use latest Helper fo dotclear 2.26-dev
parent
1877d40fce
commit
675906d600
|
@ -14,16 +14,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
use ArrayObject;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcModuleDefine;
|
use dcModuleDefine;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
|
use Dotclear\Helper\Network\Http;
|
||||||
/* clearbricks */
|
|
||||||
use http;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use ArrayObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action class helper
|
* Improve action class helper
|
||||||
|
@ -247,7 +242,7 @@ abstract class Action
|
||||||
);
|
);
|
||||||
dcCore::app()->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
dcPage::addSuccessNotice(__('Configuration successfully updated'));
|
dcPage::addSuccessNotice(__('Configuration successfully updated'));
|
||||||
http::redirect($url);
|
Http::redirect($url);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,13 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcAdmin;
|
use dcAdmin;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
use dcFavorites;
|
use dcFavorites;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
|
use Dotclear\Helper\File\Files;
|
||||||
/* clearbricks */
|
|
||||||
use Dotclear\Helper\Clearbricks;
|
use Dotclear\Helper\Clearbricks;
|
||||||
use files;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve admin class
|
* Improve admin class
|
||||||
|
@ -68,7 +65,7 @@ class Backend extends dcNsProcess
|
||||||
dcCore::app()->auth->isSuperAdmin()
|
dcCore::app()->auth->isSuperAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach (files::scandir(Utils::getActionsDir()) as $file) {
|
foreach (Files::scandir(Utils::getActionsDir()) as $file) {
|
||||||
if (is_file(Utils::getActionsDir() . $file) && '.php' == substr($file, -4)) {
|
if (is_file(Utils::getActionsDir() . $file) && '.php' == substr($file, -4)) {
|
||||||
Clearbricks::lib()->autoload([Utils::getActionsNS() . substr($file, 0, -4) => Utils::getActionsDir() . $file]);
|
Clearbricks::lib()->autoload([Utils::getActionsNS() . substr($file, 0, -4) => Utils::getActionsDir() . $file]);
|
||||||
dcCore::app()->addBehavior('improveAddAction', [Utils::getActionsNS() . substr($file, 0, -4), 'create']); /* @phpstan-ignore-line */
|
dcCore::app()->addBehavior('improveAddAction', [Utils::getActionsNS() . substr($file, 0, -4), 'create']); /* @phpstan-ignore-line */
|
||||||
|
|
|
@ -14,12 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -29,8 +26,6 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Para,
|
Para,
|
||||||
Text
|
Text
|
||||||
};
|
};
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
21
src/Core.php
21
src/Core.php
|
@ -14,17 +14,12 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
use ArrayObject;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcLog;
|
use dcLog;
|
||||||
use dcModuleDefine;
|
use dcModuleDefine;
|
||||||
|
use Dotclear\Helper\File\Files;
|
||||||
/* clearbricks */
|
use Dotclear\Helper\File\Path;
|
||||||
use path;
|
|
||||||
use files;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use ArrayObject;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,7 +243,7 @@ class Core
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
files::putContent($file[0], $content);
|
Files::putContent($file[0], $content);
|
||||||
}
|
}
|
||||||
foreach ($workers as $action) {
|
foreach ($workers as $action) {
|
||||||
// action: after closing a file. full path, extension
|
// action: after closing a file. full path, extension
|
||||||
|
@ -280,7 +275,7 @@ class Core
|
||||||
|
|
||||||
private static function getModuleFiles(string $path, string $dir = '', array $res = []): array
|
private static function getModuleFiles(string $path, string $dir = '', array $res = []): array
|
||||||
{
|
{
|
||||||
$path = path::real($path);
|
$path = Path::real($path);
|
||||||
if (!$path) {
|
if (!$path) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -291,7 +286,7 @@ class Core
|
||||||
$dir = $path;
|
$dir = $path;
|
||||||
}
|
}
|
||||||
$res[] = [$dir, '', false];
|
$res[] = [$dir, '', false];
|
||||||
$files = files::scandir($path);
|
$files = Files::scandir($path);
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (substr($file, 0, 1) == '.') {
|
if (substr($file, 0, 1) == '.') {
|
||||||
|
@ -304,7 +299,7 @@ class Core
|
||||||
$res
|
$res
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$res[] = [$dir . '/' . $file, files::getExtension($file), true];
|
$res[] = [$dir . '/' . $file, Files::getExtension($file), true];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +325,7 @@ class Core
|
||||||
}
|
}
|
||||||
if (!empty($in)) {
|
if (!empty($in)) {
|
||||||
foreach ($in as $v) {
|
foreach ($in as $v) {
|
||||||
$v = trim(files::getExtension('a.' . $v));
|
$v = trim(Files::getExtension('a.' . $v));
|
||||||
if (!empty($v)) {
|
if (!empty($v)) {
|
||||||
$out[] = $v;
|
$out[] = $v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNamespace;
|
use dcNamespace;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,19 +14,24 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
use dcAdminNotices;
|
use dcAdminNotices;
|
||||||
use dcThemes;
|
use dcThemes;
|
||||||
use dcUtils;
|
use dcUtils;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
/* clearbricks */
|
use Dotclear\Helper\Html\Form\{
|
||||||
use html;
|
Checkbox,
|
||||||
use form;
|
Div,
|
||||||
|
Form,
|
||||||
/* php */
|
Hidden,
|
||||||
|
Label,
|
||||||
|
Para,
|
||||||
|
Select,
|
||||||
|
Submit,
|
||||||
|
Text
|
||||||
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,27 +238,32 @@ class Manage extends dcNsProcess
|
||||||
echo '
|
echo '
|
||||||
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
|
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
|
||||||
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
|
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
|
||||||
<h4>' . html::escapeHTML(self::$action->description()) . '</h4>
|
<h4>' . Html::escapeHTML(self::$action->description()) . '</h4>' .
|
||||||
<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id()) . '" method="post" id="form-actions">' .
|
|
||||||
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
|
(new Form('form-actions'))->method('post')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([
|
||||||
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .
|
empty($res) ? (new Text('p', __('Nothing to configure')))->class('message') : (new Text('', $res)),
|
||||||
form::hidden('type', self::$type) .
|
(new Para())->class('clear')->items([
|
||||||
form::hidden('config', self::$action->id()) .
|
(new Submit(['save']))->value(__('Save')),
|
||||||
form::hidden('redir', $redir) .
|
(new Hidden('type', self::$type)),
|
||||||
dcCore::app()->formNonce() . '</p>' .
|
(new Hidden('config', self::$action->id())),
|
||||||
'</form>';
|
(new Hidden('redir', $redir)),
|
||||||
|
dcCore::app()->formNonce(false),
|
||||||
|
]),
|
||||||
|
])->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function displayActions(): void
|
private static function displayActions(): void
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
'<form method="get" action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id()) . '" id="improve_menu">' .
|
(new Form('improve_menu'))->method('get')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([
|
||||||
'<p class="anchor-nav"><label for="type" class="classic">' . __('Goto:') . ' </label>' .
|
(new Para())->class('anchor-nav')->items([
|
||||||
form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], self::$type) . ' ' .
|
(new Label(__('Goto:')))->for('type')->class('classic'),
|
||||||
'<input type="submit" value="' . __('Ok') . '" />' .
|
(new Select('type'))->default(self::$type)->items([__('Plugins') => 'plugin', __('Themes') => 'theme']),
|
||||||
form::hidden('p', My::id()) . '</p>' .
|
(new Submit('simenu'))->value(__('Save')),
|
||||||
'</form>';
|
(new Hidden('p', My::id())),
|
||||||
|
]),
|
||||||
|
])->render();
|
||||||
|
|
||||||
$combo_modules = self::comboModules();
|
$combo_modules = self::comboModules();
|
||||||
if (count($combo_modules) == 1) {
|
if (count($combo_modules) == 1) {
|
||||||
|
@ -272,17 +282,14 @@ class Manage extends dcNsProcess
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'<tr class="line' . ($action->isConfigured() ? '' : ' offline') . '">' .
|
'<tr class="line' . ($action->isConfigured() ? '' : ' offline') . '">' .
|
||||||
'<td class="minimal">' . form::checkbox(
|
'<td class="minimal">' .
|
||||||
['actions[]',
|
(new Checkbox(
|
||||||
'action_' . $action->id(), ],
|
['actions[]', 'action_' . $action->id()],
|
||||||
$action->id(),
|
in_array($action->id(), self::getPreference()) && $action->isConfigured()
|
||||||
in_array($action->id(), self::getPreference()) && $action->isConfigured(),
|
))->value($action->id())->disabled(!$action->isConfigured())->render() .
|
||||||
'',
|
'</td>' .
|
||||||
'',
|
|
||||||
!$action->isConfigured()
|
|
||||||
) . '</td>' .
|
|
||||||
'<td class="minimal nowrap">' .
|
'<td class="minimal nowrap">' .
|
||||||
'<label for="action_' . $action->id() . '" class="classic">' . html::escapeHTML($action->name()) . '</label>' .
|
(new Label(Html::escapeHTML($action->name())))->for('action_' . $action->id())->class('classic')->render() .
|
||||||
'</td>' .
|
'</td>' .
|
||||||
'<td class="maximal">' . $action->description() . '</td>' .
|
'<td class="maximal">' . $action->description() . '</td>' .
|
||||||
'<td class="minimal nowrap modules">' . (
|
'<td class="minimal nowrap modules">' . (
|
||||||
|
@ -294,19 +301,21 @@ class Manage extends dcNsProcess
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</tbody></table>
|
echo '</tbody></table>' .
|
||||||
<div class="two-cols">
|
(new Div())->class('two-cols')->items([
|
||||||
<p class="col left"><label for="save_preferences" class="classic">' .
|
(new Para())->class('col left')->items([
|
||||||
form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) .
|
(new Checkbox('save_preferences', !empty($_POST['save_preferences'])))->value(1),
|
||||||
__('Save fields selection as preference') . '</label></p>
|
(new Label(__('Save fields selection as preference'), Label::OUTSIDE_LABEL_AFTER))->for('save_preferences')->class('classic'),
|
||||||
<p class="col right"><label for="module" class="classic">' . __('Select a module:') . ' </label>' .
|
]),
|
||||||
form::combo('module', $combo_modules, self::$module) .
|
(new Para())->class('col right')->items([
|
||||||
' <input type="submit" name="fix" value="' . __('Fix it') . '" />' .
|
(new Label(__('Select a module:')))->for('module')->class('classic'),
|
||||||
form::hidden(['type'], self::$type) .
|
(new Select('module'))->default(self::$module)->items($combo_modules),
|
||||||
dcCore::app()->formNonce() . '
|
(new Submit('fix'))->value(__('Fix it')),
|
||||||
</p>
|
(new Hidden(['type'], self::$type)),
|
||||||
</div>
|
dcCore::app()->formNonce(false),
|
||||||
<br class="clear" />
|
]),
|
||||||
|
])->render() .
|
||||||
|
'<br class="clear" />
|
||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->get(My::id())->get('nodetails')) {
|
if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->get(My::id())->get('nodetails')) {
|
||||||
|
|
|
@ -14,8 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* clearbricks */
|
use Dotclear\Helper\File\Path;
|
||||||
use path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve module helper
|
* Improve module helper
|
||||||
|
@ -179,7 +178,7 @@ class Module
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'oname' => $oname,
|
'oname' => $oname,
|
||||||
'sname' => self::sanitizeString($name),
|
'sname' => self::sanitizeString($name),
|
||||||
'sroot' => path::real($properties['root']),
|
'sroot' => Path::real($properties['root']),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -27,14 +26,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Select,
|
Select,
|
||||||
Textarea
|
Textarea
|
||||||
};
|
};
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use html;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,7 +138,7 @@ class cssheader extends Action
|
||||||
// bloc_content
|
// bloc_content
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Bloc content:')))->for('bloc_content'),
|
(new Label(__('Bloc content:')))->for('bloc_content'),
|
||||||
(new Textarea('bloc_content', html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
|
(new Textarea('bloc_content', Html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
|
||||||
]),
|
]),
|
||||||
(new Note())->text(sprintf(
|
(new Note())->text(sprintf(
|
||||||
__('You can use wildcards %s'),
|
__('You can use wildcards %s'),
|
||||||
|
@ -155,7 +148,7 @@ class cssheader extends Action
|
||||||
// exemple
|
// exemple
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Exemple:')))->for('content_exemple'),
|
(new Label(__('Exemple:')))->for('content_exemple'),
|
||||||
(new Textarea('content_exemple', html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->extra('readonly="true"'),
|
(new Textarea('content_exemple', Html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->readonly(true),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
|
|
|
@ -14,13 +14,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
use Dotclear\Helper\File\Files;
|
||||||
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use files;
|
|
||||||
use path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module Dotclear depreciated
|
* Improve action module Dotclear depreciated
|
||||||
*/
|
*/
|
||||||
|
@ -45,11 +42,11 @@ class dcdeprecated extends Action
|
||||||
|
|
||||||
private function loadDeprecatedDefinition(): void
|
private function loadDeprecatedDefinition(): void
|
||||||
{
|
{
|
||||||
$path = path::real(__DIR__ . '/dcdeprecated');
|
$path = Path::real(__DIR__ . '/dcdeprecated');
|
||||||
if (!$path || !is_dir($path) || !is_readable($path)) {
|
if (!$path || !is_dir($path) || !is_readable($path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$files = files::scandir($path);
|
$files = Files::scandir($path);
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (substr($file, 0, 1) == '.') {
|
if (substr($file, 0, 1) == '.') {
|
||||||
|
|
|
@ -14,8 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
use DOMDocument;
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Div,
|
Div,
|
||||||
Fieldset,
|
Fieldset,
|
||||||
|
@ -25,14 +26,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Note,
|
Note,
|
||||||
Para
|
Para
|
||||||
};
|
};
|
||||||
|
use Dotclear\Helper\Html\XmlTag;
|
||||||
/* clearbricks */
|
use Dotclear\Helper\Text;
|
||||||
use files;
|
|
||||||
use text;
|
|
||||||
use xmlTag;
|
|
||||||
use DOMDocument;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +92,7 @@ class dcstore extends Action
|
||||||
$content = $this->prettyXML($content);
|
$content = $this->prettyXML($content);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
files::putContent($this->module->get('root') . DIRECTORY_SEPARATOR . 'dcstore.xml', $content);
|
Files::putContent($this->module->get('root') . DIRECTORY_SEPARATOR . 'dcstore.xml', $content);
|
||||||
$this->setSuccess(__('Write dcstore.xml file.'));
|
$this->setSuccess(__('Write dcstore.xml file.'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->setError(__('Failed to write dcstore.xml file'));
|
$this->setError(__('Failed to write dcstore.xml file'));
|
||||||
|
@ -111,7 +106,7 @@ class dcstore extends Action
|
||||||
public function generateXML(): string
|
public function generateXML(): string
|
||||||
{
|
{
|
||||||
$xml = ['<modules xmlns:da="http://dotaddict.org/da/">'];
|
$xml = ['<modules xmlns:da="http://dotaddict.org/da/">'];
|
||||||
$rsp = new xmlTag('module');
|
$rsp = new XmlTag('module');
|
||||||
|
|
||||||
# id
|
# id
|
||||||
$rsp->id = $this->module->getId();
|
$rsp->id = $this->module->getId();
|
||||||
|
@ -168,35 +163,35 @@ class dcstore extends Action
|
||||||
if (empty($this->module->get('dc_min'))) {
|
if (empty($this->module->get('dc_min'))) {
|
||||||
$this->setWarning(__('no minimum dotclear version'));
|
$this->setWarning(__('no minimum dotclear version'));
|
||||||
} else {
|
} else {
|
||||||
$rsp->insertNode(new xmlTag('da:dcmin', $this->module->get('dc_min')));
|
$rsp->insertNode(new XmlTag('da:dcmin', $this->module->get('dc_min')));
|
||||||
}
|
}
|
||||||
|
|
||||||
# da details
|
# da details
|
||||||
if (empty($this->module->get('details'))) {
|
if (empty($this->module->get('details'))) {
|
||||||
$this->setWarning(__('no details URL'));
|
$this->setWarning(__('no details URL'));
|
||||||
} else {
|
} else {
|
||||||
$rsp->insertNode(new xmlTag('da:details', $this->module->get('details')));
|
$rsp->insertNode(new XmlTag('da:details', $this->module->get('details')));
|
||||||
}
|
}
|
||||||
|
|
||||||
# da sshot
|
# da sshot
|
||||||
//$rsp->insertNode(new xmlTag('da:sshot', $this->module['sshot']));
|
//$rsp->insertNode(new XmlTag('da:sshot', $this->module['sshot']));
|
||||||
|
|
||||||
# da section
|
# da section
|
||||||
if (!empty($this->module->get('section'))) {
|
if (!empty($this->module->get('section'))) {
|
||||||
$rsp->insertNode(new xmlTag('da:section', $this->module->get('section')));
|
$rsp->insertNode(new XmlTag('da:section', $this->module->get('section')));
|
||||||
}
|
}
|
||||||
|
|
||||||
# da support
|
# da support
|
||||||
if (empty($this->module->get('support'))) {
|
if (empty($this->module->get('support'))) {
|
||||||
$this->setWarning(__('no support URL'));
|
$this->setWarning(__('no support URL'));
|
||||||
} else {
|
} else {
|
||||||
$rsp->insertNode(new xmlTag('da:support', $this->module->get('support')));
|
$rsp->insertNode(new XmlTag('da:support', $this->module->get('support')));
|
||||||
}
|
}
|
||||||
|
|
||||||
# da tags
|
# da tags
|
||||||
//$rsp->insertNode(new xmlTag('da:tags', $this->module['tags']));
|
//$rsp->insertNode(new XmlTag('da:tags', $this->module['tags']));
|
||||||
|
|
||||||
$res = new xmlTag('modules', $rsp);
|
$res = new XmlTag('modules', $rsp);
|
||||||
$res->insertAttr('xmlns:da', 'http://dotaddict.org/da/');
|
$res->insertAttr('xmlns:da', 'http://dotaddict.org/da/');
|
||||||
|
|
||||||
return self::prettyXML($res->toXML());
|
return self::prettyXML($res->toXML());
|
||||||
|
@ -218,7 +213,7 @@ class dcstore extends Action
|
||||||
|
|
||||||
private function parseFilePattern(): string
|
private function parseFilePattern(): string
|
||||||
{
|
{
|
||||||
return text::tidyURL(str_replace(
|
return Text::tidyURL(str_replace(
|
||||||
[
|
[
|
||||||
'%type%',
|
'%type%',
|
||||||
'%id%',
|
'%id%',
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -24,12 +23,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Note,
|
Note,
|
||||||
Para
|
Para
|
||||||
};
|
};
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module end of file
|
* Improve action module end of file
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -26,12 +25,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Note,
|
Note,
|
||||||
Para
|
Para
|
||||||
};
|
};
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module Github shields.io
|
* Improve action module Github shields.io
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -24,14 +24,7 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Para,
|
Para,
|
||||||
Select
|
Select
|
||||||
};
|
};
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use files;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +130,7 @@ class licensefile extends Action
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
files::putContent($this->module->get('root') . DIRECTORY_SEPARATOR . 'LICENSE', str_replace("\r\n", "\n", $full));
|
Files::putContent($this->module->get('root') . DIRECTORY_SEPARATOR . 'LICENSE', str_replace("\r\n", "\n", $full));
|
||||||
$this->setSuccess(__('Write new license file "LICENSE"'));
|
$this->setSuccess(__('Write new license file "LICENSE"'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->setError(__('Failed to write new license file'));
|
$this->setError(__('Failed to write new license file'));
|
||||||
|
@ -154,7 +147,7 @@ class licensefile extends Action
|
||||||
if ($only_one && $file != 'LICENSE') {
|
if ($only_one && $file != 'LICENSE') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!files::isDeletable($this->module->get('root') . DIRECTORY_SEPARATOR . $file)) {
|
if (!Files::isDeletable($this->module->get('root') . DIRECTORY_SEPARATOR . $file)) {
|
||||||
$this->setWarning(sprintf(__('Old license file is not deletable (%s)'), $file));
|
$this->setWarning(sprintf(__('Old license file is not deletable (%s)'), $file));
|
||||||
} elseif (!@unlink($this->module->get('root') . DIRECTORY_SEPARATOR . $file)) {
|
} elseif (!@unlink($this->module->get('root') . DIRECTORY_SEPARATOR . $file)) {
|
||||||
$this->setError(sprintf(__('Failed to delete old license file (%s)'), $file));
|
$this->setError(sprintf(__('Failed to delete old license file (%s)'), $file));
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Div,
|
Div,
|
||||||
Fieldset,
|
Fieldset,
|
||||||
|
@ -24,13 +23,9 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Note,
|
Note,
|
||||||
Para
|
Para
|
||||||
};
|
};
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
use Dotclear\Plugin\improve\Core;
|
use Dotclear\Plugin\improve\Core;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module new line
|
* Improve action module new line
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,13 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
|
||||||
use Dotclear\Plugin\improve\My;
|
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Div,
|
Div,
|
||||||
Fieldset,
|
Fieldset,
|
||||||
|
@ -31,12 +27,9 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Para,
|
Para,
|
||||||
Textarea
|
Textarea
|
||||||
};
|
};
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
/* clearbricks */
|
use Dotclear\Plugin\improve\Action;
|
||||||
use html;
|
use Dotclear\Plugin\improve\My;
|
||||||
use path;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +114,7 @@ class phpcsfixer extends Action
|
||||||
// file_content
|
// file_content
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('PHP CS Fixer configuration file:')))->for('file_content'),
|
(new Label(__('PHP CS Fixer configuration file:')))->for('file_content'),
|
||||||
(new Textarea('file_content', html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->extra('readonly="true"'),
|
(new Textarea('file_content', Html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->readonly(true),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])->render() . (
|
])->render() . (
|
||||||
|
@ -174,7 +167,7 @@ class phpcsfixer extends Action
|
||||||
if (empty($phpexe_path) && !empty(PHP_BINDIR)) {
|
if (empty($phpexe_path) && !empty(PHP_BINDIR)) {
|
||||||
$phpexe_path = PHP_BINDIR;
|
$phpexe_path = PHP_BINDIR;
|
||||||
}
|
}
|
||||||
$phpexe_path = (string) path::real($phpexe_path);
|
$phpexe_path = (string) Path::real($phpexe_path);
|
||||||
if (!empty($phpexe_path)) {
|
if (!empty($phpexe_path)) {
|
||||||
$phpexe_path .= '/';
|
$phpexe_path .= '/';
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -27,14 +26,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Select,
|
Select,
|
||||||
Textarea
|
Textarea
|
||||||
};
|
};
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use html;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +137,7 @@ class phpheader extends Action
|
||||||
// bloc_content
|
// bloc_content
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Bloc content:')))->for('bloc_content'),
|
(new Label(__('Bloc content:')))->for('bloc_content'),
|
||||||
(new Textarea('bloc_content', html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
|
(new Textarea('bloc_content', Html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
|
||||||
]),
|
]),
|
||||||
(new Note())->text(sprintf(
|
(new Note())->text(sprintf(
|
||||||
__('You can use wildcards %s'),
|
__('You can use wildcards %s'),
|
||||||
|
@ -154,7 +147,7 @@ class phpheader extends Action
|
||||||
// exemple
|
// exemple
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Exemple:')))->for('content_exemple'),
|
(new Label(__('Exemple:')))->for('content_exemple'),
|
||||||
(new Textarea('content_exemple', html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->extra('readonly="true"'),
|
(new Textarea('content_exemple', Html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->readonly(true),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
|
|
|
@ -14,13 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
|
||||||
use Dotclear\Plugin\improve\My;
|
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -33,12 +29,9 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Para,
|
Para,
|
||||||
Textarea
|
Textarea
|
||||||
};
|
};
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
/* clearbricks */
|
use Dotclear\Plugin\improve\Action;
|
||||||
use html;
|
use Dotclear\Plugin\improve\My;
|
||||||
use path;
|
|
||||||
|
|
||||||
/* php */
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +157,7 @@ class phpstan extends Action
|
||||||
// file_content
|
// file_content
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('PHPStan configuration file:')))->for('file_content'),
|
(new Label(__('PHPStan configuration file:')))->for('file_content'),
|
||||||
(new Textarea('file_content', html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->extra('readonly="true"'),
|
(new Textarea('file_content', Html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->readonly(true),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])->render() . (
|
])->render() . (
|
||||||
|
@ -273,7 +266,7 @@ class phpstan extends Action
|
||||||
if (empty($phpexe_path) && !empty(PHP_BINDIR)) {
|
if (empty($phpexe_path) && !empty(PHP_BINDIR)) {
|
||||||
$phpexe_path = PHP_BINDIR;
|
$phpexe_path = PHP_BINDIR;
|
||||||
}
|
}
|
||||||
$phpexe_path = (string) path::real($phpexe_path);
|
$phpexe_path = (string) Path::real($phpexe_path);
|
||||||
if (!empty($phpexe_path)) {
|
if (!empty($phpexe_path)) {
|
||||||
$phpexe_path .= '/';
|
$phpexe_path .= '/';
|
||||||
}
|
}
|
||||||
|
@ -292,9 +285,9 @@ class phpstan extends Action
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$this->run_level,
|
$this->run_level,
|
||||||
(string) path::real($this->module->get('root'), false),
|
(string) Path::real($this->module->get('root'), false),
|
||||||
(string) path::real(DC_ROOT, false),
|
(string) Path::real(DC_ROOT, false),
|
||||||
(string) path::real(__DIR__ . '/phpstan', false),
|
(string) Path::real(__DIR__ . '/phpstan', false),
|
||||||
],
|
],
|
||||||
(string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.' . $full . 'conf')
|
(string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.' . $full . 'conf')
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,14 +14,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use l10n;
|
use l10n;
|
||||||
|
|
||||||
/* php */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module dcstore.xml
|
* Improve action module dcstore.xml
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,8 +14,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve\Module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use Dotclear\Helper\File\Files;
|
||||||
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -26,14 +27,8 @@ use Dotclear\Helper\Html\Form\{
|
||||||
Note,
|
Note,
|
||||||
Para
|
Para
|
||||||
};
|
};
|
||||||
|
|
||||||
/* improve */
|
|
||||||
use Dotclear\Plugin\improve\Action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
|
||||||
use path;
|
|
||||||
use files;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module zip
|
* Improve action module zip
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +120,7 @@ class zip extends Action
|
||||||
(new Note())->text(sprintf(
|
(new Note())->text(sprintf(
|
||||||
__('Preconization: %s'),
|
__('Preconization: %s'),
|
||||||
dcCore::app()->blog->public_path ?
|
dcCore::app()->blog->public_path ?
|
||||||
path::real(dcCore::app()->blog->public_path) : __("Blog's public directory")
|
Path::real(dcCore::app()->blog->public_path) : __("Blog's public directory")
|
||||||
))->class('form-note'),
|
))->class('form-note'),
|
||||||
]),
|
]),
|
||||||
(new Fieldset())->class('fieldset')->legend((new Legend(__('Files'))))->fields([
|
(new Fieldset())->class('fieldset')->legend((new Legend(__('Files'))))->fields([
|
||||||
|
@ -199,7 +194,7 @@ class zip extends Action
|
||||||
);
|
);
|
||||||
$parts = explode('/', $file);
|
$parts = explode('/', $file);
|
||||||
foreach ($parts as $i => $part) {
|
foreach ($parts as $i => $part) {
|
||||||
$parts[$i] = files::tidyFileName($part);
|
$parts[$i] = Files::tidyFileName($part);
|
||||||
}
|
}
|
||||||
$path = $this->getSetting('pack_repository') . '/' . implode('/', $parts) . '.zip';
|
$path = $this->getSetting('pack_repository') . '/' . implode('/', $parts) . '.zip';
|
||||||
if (file_exists($path) && empty($this->getSetting('pack_overwrite'))) {
|
if (file_exists($path) && empty($this->getSetting('pack_overwrite'))) {
|
||||||
|
@ -223,7 +218,7 @@ class zip extends Action
|
||||||
$zip->addExclusion($e);
|
$zip->addExclusion($e);
|
||||||
}
|
}
|
||||||
$zip->addDirectory(
|
$zip->addDirectory(
|
||||||
path::real($this->module->get('root')),
|
Path::real($this->module->get('root')),
|
||||||
$this->module->getId(),
|
$this->module->getId(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue