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
===========================================================
* Fix install
* Fix user info
licenseBootstrap 2013.10.29
===========================================================
* Fix full license bug
* Fix french help and support links
licenseBootstrap 2013.10.28
===========================================================
* Switched to DC 2.6
* New icon
* Add dashboard icon
* Clean up code and (again) lighter admin interface
licenseBootstrap 2013.05.11
===========================================================
* Fixed page title and messages and contents
licenseBootstrap 0.3 - 2010-06-05
===========================================================
* Switched to DC 2.2
* Changed admin interface (easy, light, fast)
licenseBootstrap 0.2 - 2009-11-09
===========================================================
* Changed lots of things
licenseBootstrap 0.1 - 2009-10-09
===========================================================
* 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
''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 ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
$core->blog->settings->addNamespace('licenseBootstrap');
$core->addBehavior(
'adminDashboardFavorites',
array('licenseBootstrapBehaviors', 'adminDashboardFavorites')
);
$core->addBehavior('adminDashboardFavorites', [
'licenseBootstrapBehaviors', 'adminDashboardFavorites'
]);
$core->addBehavior(
'packmanBeforeCreatePackage',
array('licenseBootstrapBehaviors', 'packmanBeforeCreatePackage')
);
$core->addBehavior('packmanBeforeCreatePackage', [
'licenseBootstrapBehaviors', 'packmanBeforeCreatePackage'
]);
$_menu['Plugins']->addItem(
__('License bootstrap'),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,6 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
@ -22,7 +21,7 @@ dcPage::checkSuper();
# Queries
$p_url = 'plugin.php?p=licenseBootstrap';
$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
$core->blog->settings->addNamespace('licenseBootstrap');
@ -31,7 +30,7 @@ $s = $core->blog->settings->licenseBootstrap;
# Modules
if (!isset($core->themes)) {
$core->themes = new dcThemes($core);
$core->themes->loadModules($core->blog->themes_path,null);
$core->themes->loadModules($core->blog->themes_path, null);
}
$themes = $core->themes;
$plugins = $core->plugins;
@ -77,21 +76,21 @@ catch(Exception $e) {
# Display
echo
'<html><head><title>'.__('License bootstrap').'</title>'.
dcPage::jsPageTabs().
dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js').
'<html><head><title>' . __('License bootstrap') . '</title>' .
dcPage::jsPageTabs() .
dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js') .
# --BEHAVIOR-- licenseBootstrapAdminHeader
$core->callBehavior('licenseBootstrapAdminHeader', $core).
$core->callBehavior('licenseBootstrapAdminHeader', $core) .
'</head><body>'.
'</head><body>' .
dcPage::breadcrumb(
array(
__('Plugins') => '',
__('License bootstrap') => ''
)
).
) .
dcPage::notices();
libLicenseBootstrap::modules(
@ -111,11 +110,4 @@ libLicenseBootstrap::modules(
dcPage::helpBlock('licenseBootstrap');
echo
'<hr class="clear"/><p class="right modules">
<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>';
'</body></html>';