moe to Franck style

master
Jean-Christian Paul Denis 2021-08-17 23:46:17 +02:00
parent 5f5fdfcb01
commit 836f6eaf88
11 changed files with 679 additions and 700 deletions

View File

@ -1,33 +1,29 @@
licenseBootstrap 2021.08.17
* Move to Franck style
licenseBootstrap 2013.12.01 licenseBootstrap 2013.12.01
===========================================================
* Fix install * Fix install
* Fix user info * Fix user info
licenseBootstrap 2013.10.29 licenseBootstrap 2013.10.29
===========================================================
* Fix full license bug * Fix full license bug
* Fix french help and support links * Fix french help and support links
licenseBootstrap 2013.10.28 licenseBootstrap 2013.10.28
===========================================================
* Switched to DC 2.6 * Switched to DC 2.6
* New icon * New icon
* Add dashboard icon * Add dashboard icon
* Clean up code and (again) lighter admin interface * Clean up code and (again) lighter admin interface
licenseBootstrap 2013.05.11 licenseBootstrap 2013.05.11
===========================================================
* Fixed page title and messages and contents * Fixed page title and messages and contents
licenseBootstrap 0.3 - 2010-06-05 licenseBootstrap 0.3 - 2010-06-05
===========================================================
* Switched to DC 2.2 * Switched to DC 2.2
* Changed admin interface (easy, light, fast) * Changed admin interface (easy, light, fast)
licenseBootstrap 0.2 - 2009-11-09 licenseBootstrap 0.2 - 2009-11-09
===========================================================
* Changed lots of things * Changed lots of things
licenseBootstrap 0.1 - 2009-10-09 licenseBootstrap 0.1 - 2009-10-09
===========================================================
* First lab release * First lab release

View File

@ -25,3 +25,9 @@ go to ''configure plugin'', fill in form.
Once it's done you can manage your modules license from menu Once it's done you can manage your modules license from menu
''License bootstrap'' on sidebar or you can add dashboard icon. ''License bootstrap'' on sidebar or you can add dashboard icon.
## MORE
* License : GNU GPL v2
* Source & contribution : [GitHub Page](https://github.com/licenseBootstrap)
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)

View File

@ -13,21 +13,18 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
$core->blog->settings->addNamespace('licenseBootstrap'); $core->blog->settings->addNamespace('licenseBootstrap');
$core->addBehavior( $core->addBehavior('adminDashboardFavorites', [
'adminDashboardFavorites', 'licenseBootstrapBehaviors', 'adminDashboardFavorites'
array('licenseBootstrapBehaviors', 'adminDashboardFavorites') ]);
);
$core->addBehavior( $core->addBehavior('packmanBeforeCreatePackage', [
'packmanBeforeCreatePackage', 'licenseBootstrapBehaviors', 'packmanBeforeCreatePackage'
array('licenseBootstrapBehaviors', 'packmanBeforeCreatePackage') ]);
);
$_menu['Plugins']->addItem( $_menu['Plugins']->addItem(
__('License bootstrap'), __('License bootstrap'),

View File

@ -13,12 +13,11 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_MODULE')) { if (!defined('DC_CONTEXT_MODULE')) {
return null; return null;
} }
$redir = empty($_REQUEST['redir']) ? $redir = empty($_REQUEST['redir']) ?
$list->getURL().'#plugins' : $_REQUEST['redir']; $list->getURL() . '#plugins' : $_REQUEST['redir'];
# -- Get settings -- # -- Get settings --
$core->blog->settings->addNamespace('licenseBootstrap'); $core->blog->settings->addNamespace('licenseBootstrap');
@ -42,7 +41,7 @@ if (!empty($_POST['save'])) {
$lb_write_js = !empty($_POST['lb_write_js']); $lb_write_js = !empty($_POST['lb_write_js']);
$lb_exclude_locales = !empty($_POST['lb_exclude_locales']); $lb_exclude_locales = !empty($_POST['lb_exclude_locales']);
$lb_license_name = $_POST['lb_license_name']; $lb_license_name = $_POST['lb_license_name'];
$lb_license_head = licenseBootstrap::gethead($lb_license_name, !empty($_POST['lb_license_head_'.$lb_license_name]) ? $_POST['lb_license_head_'.$lb_license_name] : ''); $lb_license_head = licenseBootstrap::gethead($lb_license_name, !empty($_POST['lb_license_head_' . $lb_license_name]) ? $_POST['lb_license_head_' . $lb_license_name] : '');
$s->put('overwrite', $lb_overwrite); $s->put('overwrite', $lb_overwrite);
$s->put('write_full', $lb_write_full); $s->put('write_full', $lb_write_full);
@ -68,37 +67,37 @@ if (!empty($_POST['save'])) {
# -- Display form -- # -- Display form --
echo ' echo '
<div class="fieldset"> <div class="fieldset">
<h4>'.__('Files').'</h4> <h4>' . __('Files') . '</h4>
<p><label class="classic" for="lb_overwrite">'. <p><label class="classic" for="lb_overwrite">' .
form::checkbox('lb_overwrite', 1, $lb_overwrite).' '. form::checkbox('lb_overwrite', 1, $lb_overwrite) . ' ' .
__('Overwrite existing licenses'). __('Overwrite existing licenses') .
'</label></p> '</label></p>
<p><label class="classic" for="lb_write_full">'. <p><label class="classic" for="lb_write_full">' .
form::checkbox('lb_write_full', 1, $lb_write_full).' '. form::checkbox('lb_write_full', 1, $lb_write_full) .' ' .
__('Add full LICENSE file to module root'). __('Add full LICENSE file to module root') .
'</label></p> '</label></p>
<p><label class="classic" for="lb_write_php">'. <p><label class="classic" for="lb_write_php">' .
form::checkbox('lb_write_php', 1, $lb_write_php).' '. form::checkbox('lb_write_php', 1, $lb_write_php) . ' ' .
__('Add license block to PHP files'). __('Add license block to PHP files') .
'</label></p> '</label></p>
<p><label class="classic" for="lb_write_js">'. <p><label class="classic" for="lb_write_js">' .
form::checkbox('lb_write_js', 1, $lb_write_js).' '. form::checkbox('lb_write_js', 1, $lb_write_js) . ' ' .
__('Add license block to JS files'). __('Add license block to JS files') .
'</label></p> '</label></p>
<p><label class="classic" for="lb_exclude_locales">'. <p><label class="classic" for="lb_exclude_locales">' .
form::checkbox('lb_exclude_locales', 1, $lb_exclude_locales).' '. form::checkbox('lb_exclude_locales', 1, $lb_exclude_locales) . ' ' .
__('Do not add license block to files from locales folder'). __('Do not add license block to files from locales folder') .
'</label></p> '</label></p>
</div> </div>
<div class="fieldset"> <div class="fieldset">
<h4>'.__('Licenses').'</h4>'; <h4>' . __('Licenses') . '</h4>';
foreach(licenseBootstrap::getLicenses() as $name) { foreach(licenseBootstrap::getLicenses() as $name) {
@ -109,11 +108,11 @@ foreach(licenseBootstrap::getLicenses() as $name) {
$head = licenseBootstrap::getHead($name, $lb_license_head); $head = licenseBootstrap::getHead($name, $lb_license_head);
} }
echo ' echo '
<p><label class="classic" for="license_'.$name.'">'. <p><label class="classic" for="license_' . $name . '">' .
form::radio(array('lb_license_name', 'license_'.$name), $name, $check).' '. form::radio(array('lb_license_name', 'license_' . $name), $name, $check) . ' ' .
sprintf(__('License %s:'),$name).'</label></p> sprintf(__('License %s:'), $name) . '</label></p>
<p class="area">'. <p class="area">' .
form::textarea('lb_license_head_'.$name, 50, 10, html::escapeHTML($head)).' form::textarea('lb_license_head_' . $name, 50, 10, html::escapeHTML($head)) . '
</p>'; </p>';
} }
@ -121,6 +120,6 @@ echo '
</div> </div>
<div class="fieldset"> <div class="fieldset">
<h4>'.__('Files').'</h4> <h4>' . __('Files') . '</h4>
</div>'; </div>';

View File

@ -13,25 +13,19 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }
$this->registerModule( $this->registerModule(
/* Name */ 'License bootstrap', // Name
"License bootstrap", 'Add license to your plugins and themes', // Description
/* Description*/ 'Jean-Christian Denis', // Author
"Add license to your plugins and themes", '2021.08.17', // Version
/* Author */ [
"Jean-Christian Denis",
/* Version */
'2013.12.01',
/* Properties */
array(
'permissions' => null, 'permissions' => null,
'type' => 'plugin', 'type' => 'plugin',
'dc_min' => '2.6', 'dc_min' => '2.19',
'support' => 'http://jcd.lv/q=licenseBootstrap', 'support' => 'https://github.com/JcDenis/licenseBootstrap',
'details' => 'http://plugins.dotaddict.org/dc2/details/licenseBootstrap' 'details' => 'https://plugins.dotaddict.org/dc2/details/licenseBootstrap'
) ]
); );

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
@ -77,7 +76,7 @@ class licenseBootstrap
if (empty(licenseBootstrap::$licenses)) { if (empty(licenseBootstrap::$licenses)) {
$file_reg = '/^([a-z0-9]+)\.head\.txt$/'; $file_reg = '/^([a-z0-9]+)\.head\.txt$/';
$res = array(); $res = array();
foreach (files::scandir(dirname(__FILE__).'/licenses/') as $file) { foreach (files::scandir(dirname(__FILE__) . '/licenses/') as $file) {
if (preg_match($file_reg, $file, $matches)) { if (preg_match($file_reg, $file, $matches)) {
$res[] = $matches[1]; $res[] = $matches[1];
} }
@ -147,7 +146,7 @@ class licenseBootstrap
} }
return file_get_contents( return file_get_contents(
dirname(__FILE__).'/licenses/'.$name.'.'.$part.'.txt' dirname(__FILE__) . '/licenses/' . $name . '.' . $part . '.txt'
); );
} }
@ -181,7 +180,7 @@ class licenseBootstrap
continue; continue;
} }
$path = $module['root'].'/'.$file; $path = $module['root'] . '/' . $file;
$extension = files::getExtension($file); $extension = files::getExtension($file);
if ($php && $extension == 'php') { if ($php && $extension == 'php') {
@ -219,13 +218,13 @@ class licenseBootstrap
if (!isset($module['root']) || !is_writable($module['root'])) { if (!isset($module['root']) || !is_writable($module['root'])) {
throw new Exception(); throw new Exception();
} }
if (file_exists($module['root'].'/LICENSE') && !$overwrite) { if (file_exists($module['root'] . '/LICENSE') && !$overwrite) {
return null; return null;
} }
file_put_contents( file_put_contents(
$module['root'].'/LICENSE', $module['root'] . '/LICENSE',
self::getFull($name) self::getFull($name)
); );
} }
@ -241,7 +240,7 @@ class licenseBootstrap
protected static function replacePhpContent($content, $license, $overwrite) protected static function replacePhpContent($content, $license, $overwrite)
{ {
$clean = preg_replace( $clean = preg_replace(
'/((# -- BEGIN LICENSE BLOCK ([-]+))(.*?)'. '/((# -- BEGIN LICENSE BLOCK ([-]+))(.*?)' .
'(# -- END LICENSE BLOCK ([-]+))([\n|\r\n]+))/msi', '(# -- END LICENSE BLOCK ([-]+))([\n|\r\n]+))/msi',
'', '',
$content $content
@ -254,11 +253,11 @@ class licenseBootstrap
return preg_replace( return preg_replace(
'/(\<\?php)/', '/(\<\?php)/',
'<?php'. '<?php' .
"\r\n# -- BEGIN LICENSE BLOCK ----------------------------------\r\n". "\r\n# -- BEGIN LICENSE BLOCK ----------------------------------\r\n" .
"#\r\n". "#\r\n" .
'# '.str_replace("\n", "\n# ", trim($license)). '# ' . str_replace("\n", "\n# ", trim($license)).
"\r\n#". "\r\n#" .
"\r\n# -- END LICENSE BLOCK ------------------------------------\r\n", "\r\n# -- END LICENSE BLOCK ------------------------------------\r\n",
$clean, $clean,
1 1
@ -276,7 +275,7 @@ class licenseBootstrap
protected static function replaceJsContent($content, $license, $overwrite) protected static function replaceJsContent($content, $license, $overwrite)
{ {
$clean = preg_replace( $clean = preg_replace(
'/((\/\* -- BEGIN LICENSE BLOCK ([-]+))(.*?)'. '/((\/\* -- BEGIN LICENSE BLOCK ([-]+))(.*?)' .
'(\* -- END LICENSE BLOCK ([-]+)\*\/)([\n|\r\n]+))/msi', '(\* -- END LICENSE BLOCK ([-]+)\*\/)([\n|\r\n]+))/msi',
'', '',
$content $content
@ -288,11 +287,11 @@ class licenseBootstrap
} }
return return
"/* -- BEGIN LICENSE BLOCK ----------------------------------\r\n". "/* -- BEGIN LICENSE BLOCK ----------------------------------\r\n" .
" *\r\n". " *\r\n" .
' * '.str_replace("\n", "\n * ", trim($license)). ' * ' . str_replace("\n", "\n * ", trim($license)).
"\r\n *". "\r\n *" .
"\r\n * -- END LICENSE BLOCK ------------------------------------*/\r\n\r\n". "\r\n * -- END LICENSE BLOCK ------------------------------------*/\r\n\r\n" .
$clean; $clean;
} }
@ -360,14 +359,14 @@ class licenseBootstrap
continue; continue;
} }
if (is_dir($path.'/'.$file)) { if (is_dir($path . '/' . $file)) {
$res = self::getModuleFiles( $res = self::getModuleFiles(
$path.'/'.$file, $dir.'/'.$file, $path . '/' . $file, $dir . '/' . $file,
$res $res
); );
} }
else { else {
$res[] = empty($dir) ? $file : $dir.'/'.$file; $res[] = empty($dir) ? $file : $dir . '/' . $file;
} }
} }

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
@ -25,63 +24,63 @@ class libLicenseBootstrap
$type = $type == 'themes' ? 'themes' : 'plugins'; $type = $type == 'themes' ? 'themes' : 'plugins';
echo echo
'<div class="multi-part" '. '<div class="multi-part" ' .
'id="packman-'.$type.'" title="'.$title.'">'. 'id="packman-' . $type . '" title="' . $title . '">' .
'<h3>'.$title.'</h3>'; '<h3>' . $title . '</h3>';
if (empty($modules) && !is_array($modules)) { if (empty($modules) && !is_array($modules)) {
echo echo
'<p><strong>'.__('There are no modules.').'</strong></p>'. '<p><strong>' . __('There are no modules.') . '</strong></p>' .
'<div>'; '<div>';
return null; return null;
} }
echo echo
'<form action="plugin.php" method="post">'. '<form action="plugin.php" method="post">' .
'<table class="clear"><tr>'. '<table class="clear"><tr>' .
'<th class="nowrap">'.__('Id').'</th>'. '<th class="nowrap">' . __('Id') .'</th>' .
'<th class="nowrap">'.__('Version').'</th>'. '<th class="nowrap">' . __('Version') . '</th>' .
'<th class="nowrap maximal">'.__('Name').'</th>'. '<th class="nowrap maximal">' . __('Name') . '</th>' .
'<th class="nowrap">'.__('Root').'</th>'. '<th class="nowrap">' . __('Root') . '</th>' .
'</tr>'; '</tr>';
foreach (self::sort($modules) as $id => $module) { foreach (self::sort($modules) as $id => $module) {
echo echo
'<tr class="line">'. '<tr class="line">' .
'<td class="nowrap"><label class="classic">'. '<td class="nowrap"><label class="classic">' .
form::checkbox(array('modules['.html::escapeHTML($id).']'), 1). form::checkbox(array('modules[' . html::escapeHTML($id) . ']'), 1) .
html::escapeHTML($id). html::escapeHTML($id) .
'</label></td>'. '</label></td>'.
'<td class="nowrap count">'. '<td class="nowrap count">' .
html::escapeHTML($module['version']). html::escapeHTML($module['version']) .
'</td>'. '</td>' .
'<td class="nowrap maximal">'. '<td class="nowrap maximal">' .
__(html::escapeHTML($module['name'])). __(html::escapeHTML($module['name'])) .
'</td>'. '</td>' .
'<td class="nowrap">'. '<td class="nowrap">' .
dirname(path::real($module['root'], false)). dirname(path::real($module['root'], false)) .
'</td>'. '</td>' .
'</tr>'; '</tr>';
} }
echo echo
'</table>'. '</table>' .
'<p class="checkboxes-helpers"></p>'. '<p class="checkboxes-helpers"></p>' .
'<p>'. '<p>' .
(!empty($_REQUEST['redir']) ? (!empty($_REQUEST['redir']) ?
form::hidden( form::hidden(
array('redir'), array('redir'),
html::escapeHTML($_REQUEST['redir']) html::escapeHTML($_REQUEST['redir'])
) : '' ) : ''
). ).
form::hidden(array('p'),'licenseBootstrap'). form::hidden(array('p'), 'licenseBootstrap') .
form::hidden(array('type'),$type). form::hidden(array('type'), $type) .
form::hidden(array('action'),'addlicense'). form::hidden(array('action'),'addlicense') .
'<input type="submit" name="addlicense" value="'. '<input type="submit" name="addlicense" value="' .
__('Add license to selected modules').'" />'. __('Add license to selected modules') . '" />' .
$core->formNonce().'</p>'. $core->formNonce() . '</p>' .
'</form>'. '</form>' .
'</div>'; '</div>';
} }

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
@ -22,7 +21,7 @@ dcPage::checkSuper();
# Queries # Queries
$p_url = 'plugin.php?p=licenseBootstrap'; $p_url = 'plugin.php?p=licenseBootstrap';
$action = isset($_POST['action']) ? $_POST['action'] : ''; $action = isset($_POST['action']) ? $_POST['action'] : '';
$type = isset($_POST['type']) && in_array($_POST['type'], array('plugins','themes')) ? $_POST['type'] : ''; $type = isset($_POST['type']) && in_array($_POST['type'], array('plugins', 'themes')) ? $_POST['type'] : '';
# Settings # Settings
$core->blog->settings->addNamespace('licenseBootstrap'); $core->blog->settings->addNamespace('licenseBootstrap');
@ -31,7 +30,7 @@ $s = $core->blog->settings->licenseBootstrap;
# Modules # Modules
if (!isset($core->themes)) { if (!isset($core->themes)) {
$core->themes = new dcThemes($core); $core->themes = new dcThemes($core);
$core->themes->loadModules($core->blog->themes_path,null); $core->themes->loadModules($core->blog->themes_path, null);
} }
$themes = $core->themes; $themes = $core->themes;
$plugins = $core->plugins; $plugins = $core->plugins;
@ -77,21 +76,21 @@ catch(Exception $e) {
# Display # Display
echo echo
'<html><head><title>'.__('License bootstrap').'</title>'. '<html><head><title>' . __('License bootstrap') . '</title>' .
dcPage::jsPageTabs(). dcPage::jsPageTabs() .
dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js'). dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js') .
# --BEHAVIOR-- licenseBootstrapAdminHeader # --BEHAVIOR-- licenseBootstrapAdminHeader
$core->callBehavior('licenseBootstrapAdminHeader', $core). $core->callBehavior('licenseBootstrapAdminHeader', $core) .
'</head><body>'. '</head><body>' .
dcPage::breadcrumb( dcPage::breadcrumb(
array( array(
__('Plugins') => '', __('Plugins') => '',
__('License bootstrap') => '' __('License bootstrap') => ''
) )
). ) .
dcPage::notices(); dcPage::notices();
libLicenseBootstrap::modules( libLicenseBootstrap::modules(
@ -111,11 +110,4 @@ libLicenseBootstrap::modules(
dcPage::helpBlock('licenseBootstrap'); dcPage::helpBlock('licenseBootstrap');
echo echo
'<hr class="clear"/><p class="right modules"> '</body></html>';
<a class="module-config" '.
'href="plugins.php?module=licenseBootstrap&amp;conf=1&amp;redir='.
urlencode('plugin.php?p=licenseBootstrap').'">'.__('Configuration').'</a> -
licenseBootstrap - '.$core->plugins->moduleInfo('licenseBootstrap', 'version').'&nbsp;
<img alt="'.__('licenseBootstrap').'" src="index.php?pf=licenseBootstrap/icon.png" />
</p>
</body></html>';