From 675906d6009770f08b2db30e2379e373b8b14e0d Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 6 Apr 2023 22:11:28 +0200 Subject: [PATCH] use latest Helper fo dotclear 2.26-dev --- src/Action.php | 11 ++--- src/Backend.php | 7 +-- src/Config.php | 5 -- src/Core.php | 21 +++----- src/Install.php | 3 -- src/Manage.php | 99 ++++++++++++++++++++----------------- src/Module.php | 5 +- src/module/cssheader.php | 13 ++--- src/module/dcdeprecated.php | 11 ++--- src/module/dcstore.php | 33 ++++++------- src/module/endoffile.php | 5 -- src/module/gitshields.php | 5 -- src/module/licensefile.php | 13 ++--- src/module/newline.php | 5 -- src/module/phpcsfixer.php | 19 +++---- src/module/phpheader.php | 13 ++--- src/module/phpstan.php | 25 ++++------ src/module/po2php.php | 3 -- src/module/tab.php | 1 - src/module/zip.php | 15 ++---- 20 files changed, 116 insertions(+), 196 deletions(-) diff --git a/src/Action.php b/src/Action.php index 181b390..8dae9d2 100644 --- a/src/Action.php +++ b/src/Action.php @@ -14,16 +14,11 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ +use ArrayObject; use dcCore; use dcModuleDefine; use dcPage; - -/* clearbricks */ -use http; - -/* php */ -use ArrayObject; +use Dotclear\Helper\Network\Http; /** * Improve action class helper @@ -247,7 +242,7 @@ abstract class Action ); dcCore::app()->blog->triggerBlog(); dcPage::addSuccessNotice(__('Configuration successfully updated')); - http::redirect($url); + Http::redirect($url); return true; } diff --git a/src/Backend.php b/src/Backend.php index 5abe967..68075d8 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -14,16 +14,13 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ use dcAdmin; use dcCore; use dcPage; use dcFavorites; use dcNsProcess; - -/* clearbricks */ +use Dotclear\Helper\File\Files; use Dotclear\Helper\Clearbricks; -use files; /** * Improve admin class @@ -68,7 +65,7 @@ class Backend extends dcNsProcess 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)) { 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 */ diff --git a/src/Config.php b/src/Config.php index addab25..966f937 100644 --- a/src/Config.php +++ b/src/Config.php @@ -14,12 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ use dcCore; use dcPage; use dcNsProcess; - -/* clearbricks */ use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -29,8 +26,6 @@ use Dotclear\Helper\Html\Form\{ Para, Text }; - -/* php */ use Exception; /** diff --git a/src/Core.php b/src/Core.php index beb4e6d..8f22201 100644 --- a/src/Core.php +++ b/src/Core.php @@ -14,17 +14,12 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ +use ArrayObject; use dcCore; use dcLog; use dcModuleDefine; - -/* clearbricks */ -use path; -use files; - -/* php */ -use ArrayObject; +use Dotclear\Helper\File\Files; +use Dotclear\Helper\File\Path; use Exception; /** @@ -248,7 +243,7 @@ class Core )); } } - files::putContent($file[0], $content); + Files::putContent($file[0], $content); } foreach ($workers as $action) { // 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 { - $path = path::real($path); + $path = Path::real($path); if (!$path) { return []; } @@ -291,7 +286,7 @@ class Core $dir = $path; } $res[] = [$dir, '', false]; - $files = files::scandir($path); + $files = Files::scandir($path); foreach ($files as $file) { if (substr($file, 0, 1) == '.') { @@ -304,7 +299,7 @@ class Core $res ); } else { - $res[] = [$dir . '/' . $file, files::getExtension($file), true]; + $res[] = [$dir . '/' . $file, Files::getExtension($file), true]; } } @@ -330,7 +325,7 @@ class Core } if (!empty($in)) { foreach ($in as $v) { - $v = trim(files::getExtension('a.' . $v)); + $v = trim(Files::getExtension('a.' . $v)); if (!empty($v)) { $out[] = $v; } diff --git a/src/Install.php b/src/Install.php index b76414b..cdf542d 100644 --- a/src/Install.php +++ b/src/Install.php @@ -14,12 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ use dcCore; use dcNamespace; use dcNsProcess; - -/* php */ use Exception; /** diff --git a/src/Manage.php b/src/Manage.php index 3fbda61..da869b6 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -14,19 +14,24 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* dotclear */ use dcCore; use dcPage; use dcAdminNotices; use dcThemes; use dcUtils; use dcNsProcess; - -/* clearbricks */ -use html; -use form; - -/* php */ +use Dotclear\Helper\Html\Html; +use Dotclear\Helper\Html\Form\{ + Checkbox, + Div, + Form, + Hidden, + Label, + Para, + Select, + Submit, + Text +}; use Exception; /** @@ -233,27 +238,32 @@ class Manage extends dcNsProcess echo '

' . sprintf(__('Configure module "%s"'), self::$action->name()) . '

' . __('Back') . '

-

' . html::escapeHTML(self::$action->description()) . '

-
' . - (empty($res) ? '

' . __('Nothing to configure') . '

' : $res) . ' -

' . - form::hidden('type', self::$type) . - form::hidden('config', self::$action->id()) . - form::hidden('redir', $redir) . - dcCore::app()->formNonce() . '

' . - '
'; +

' . Html::escapeHTML(self::$action->description()) . '

' . + + (new Form('form-actions'))->method('post')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([ + empty($res) ? (new Text('p', __('Nothing to configure')))->class('message') : (new Text('', $res)), + (new Para())->class('clear')->items([ + (new Submit(['save']))->value(__('Save')), + (new Hidden('type', self::$type)), + (new Hidden('config', self::$action->id())), + (new Hidden('redir', $redir)), + dcCore::app()->formNonce(false), + ]), + ])->render(); } } private static function displayActions(): void { echo - '
' . - '

' . - form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], self::$type) . ' ' . - '' . - form::hidden('p', My::id()) . '

' . - '
'; + (new Form('improve_menu'))->method('get')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([ + (new Para())->class('anchor-nav')->items([ + (new Label(__('Goto:')))->for('type')->class('classic'), + (new Select('type'))->default(self::$type)->items([__('Plugins') => 'plugin', __('Themes') => 'theme']), + (new Submit('simenu'))->value(__('Save')), + (new Hidden('p', My::id())), + ]), + ])->render(); $combo_modules = self::comboModules(); if (count($combo_modules) == 1) { @@ -272,17 +282,14 @@ class Manage extends dcNsProcess } echo '' . - '' . form::checkbox( - ['actions[]', - 'action_' . $action->id(), ], - $action->id(), - in_array($action->id(), self::getPreference()) && $action->isConfigured(), - '', - '', - !$action->isConfigured() - ) . '' . + '' . + (new Checkbox( + ['actions[]', 'action_' . $action->id()], + in_array($action->id(), self::getPreference()) && $action->isConfigured() + ))->value($action->id())->disabled(!$action->isConfigured())->render() . + '' . '' . - '' . + (new Label(Html::escapeHTML($action->name())))->for('action_' . $action->id())->class('classic')->render() . '' . '' . $action->description() . '' . '' . ( @@ -294,19 +301,21 @@ class Manage extends dcNsProcess ''; } - echo ' -
-

-

' . - form::combo('module', $combo_modules, self::$module) . - ' ' . - form::hidden(['type'], self::$type) . - dcCore::app()->formNonce() . ' -

-
-
+ echo '' . + (new Div())->class('two-cols')->items([ + (new Para())->class('col left')->items([ + (new Checkbox('save_preferences', !empty($_POST['save_preferences'])))->value(1), + (new Label(__('Save fields selection as preference'), Label::OUTSIDE_LABEL_AFTER))->for('save_preferences')->class('classic'), + ]), + (new Para())->class('col right')->items([ + (new Label(__('Select a module:')))->for('module')->class('classic'), + (new Select('module'))->default(self::$module)->items($combo_modules), + (new Submit('fix'))->value(__('Fix it')), + (new Hidden(['type'], self::$type)), + dcCore::app()->formNonce(false), + ]), + ])->render() . + '
'; if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->get(My::id())->get('nodetails')) { diff --git a/src/Module.php b/src/Module.php index 18ee735..680cc9d 100644 --- a/src/Module.php +++ b/src/Module.php @@ -14,8 +14,7 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve; -/* clearbricks */ -use path; +use Dotclear\Helper\File\Path; /** * Improve module helper @@ -179,7 +178,7 @@ class Module 'name' => $name, 'oname' => $oname, 'sname' => self::sanitizeString($name), - 'sroot' => path::real($properties['root']), + 'sroot' => Path::real($properties['root']), ] ); } diff --git a/src/module/cssheader.php b/src/module/cssheader.php index fdd7dd1..1fb9cad 100644 --- a/src/module/cssheader.php +++ b/src/module/cssheader.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use dcCore; use Dotclear\Helper\Html\Form\{ Checkbox, @@ -27,14 +26,8 @@ use Dotclear\Helper\Html\Form\{ Select, Textarea }; - -/* improve */ +use Dotclear\Helper\Html\Html; use Dotclear\Plugin\improve\Action; - -/* clearbricks */ -use html; - -/* php */ use Exception; /** @@ -145,7 +138,7 @@ class cssheader extends Action // bloc_content (new Para())->items([ (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( __('You can use wildcards %s'), @@ -155,7 +148,7 @@ class cssheader extends Action // exemple (new Para())->items([ (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(); diff --git a/src/module/dcdeprecated.php b/src/module/dcdeprecated.php index ecdde4f..5f94310 100644 --- a/src/module/dcdeprecated.php +++ b/src/module/dcdeprecated.php @@ -14,13 +14,10 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ +use Dotclear\Helper\File\Files; +use Dotclear\Helper\File\Path; use Dotclear\Plugin\improve\Action; -/* clearbricks */ -use files; -use path; - /** * Improve action module Dotclear depreciated */ @@ -45,11 +42,11 @@ class dcdeprecated extends Action private function loadDeprecatedDefinition(): void { - $path = path::real(__DIR__ . '/dcdeprecated'); + $path = Path::real(__DIR__ . '/dcdeprecated'); if (!$path || !is_dir($path) || !is_readable($path)) { return; } - $files = files::scandir($path); + $files = Files::scandir($path); foreach ($files as $file) { if (substr($file, 0, 1) == '.') { diff --git a/src/module/dcstore.php b/src/module/dcstore.php index 8bbc477..aac71d8 100644 --- a/src/module/dcstore.php +++ b/src/module/dcstore.php @@ -14,8 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ +use DOMDocument; use Dotclear\Plugin\improve\Action; +use Dotclear\Helper\File\Files; use Dotclear\Helper\Html\Form\{ Div, Fieldset, @@ -25,14 +26,8 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; - -/* clearbricks */ -use files; -use text; -use xmlTag; -use DOMDocument; - -/* php */ +use Dotclear\Helper\Html\XmlTag; +use Dotclear\Helper\Text; use Exception; /** @@ -97,7 +92,7 @@ class dcstore extends Action $content = $this->prettyXML($content); 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.')); } catch (Exception $e) { $this->setError(__('Failed to write dcstore.xml file')); @@ -111,7 +106,7 @@ class dcstore extends Action public function generateXML(): string { $xml = ['']; - $rsp = new xmlTag('module'); + $rsp = new XmlTag('module'); # id $rsp->id = $this->module->getId(); @@ -168,35 +163,35 @@ class dcstore extends Action if (empty($this->module->get('dc_min'))) { $this->setWarning(__('no minimum dotclear version')); } 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 if (empty($this->module->get('details'))) { $this->setWarning(__('no details URL')); } else { - $rsp->insertNode(new xmlTag('da:details', $this->module->get('details'))); + $rsp->insertNode(new XmlTag('da:details', $this->module->get('details'))); } # da sshot - //$rsp->insertNode(new xmlTag('da:sshot', $this->module['sshot'])); + //$rsp->insertNode(new XmlTag('da:sshot', $this->module['sshot'])); # da 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 if (empty($this->module->get('support'))) { $this->setWarning(__('no support URL')); } else { - $rsp->insertNode(new xmlTag('da:support', $this->module->get('support'))); + $rsp->insertNode(new XmlTag('da:support', $this->module->get('support'))); } # 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/'); return self::prettyXML($res->toXML()); @@ -218,7 +213,7 @@ class dcstore extends Action private function parseFilePattern(): string { - return text::tidyURL(str_replace( + return Text::tidyURL(str_replace( [ '%type%', '%id%', diff --git a/src/module/endoffile.php b/src/module/endoffile.php index 2abccd5..b856dd9 100644 --- a/src/module/endoffile.php +++ b/src/module/endoffile.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -24,12 +23,8 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; - -/* improve */ use Dotclear\Plugin\improve\Action; -/* clearbricks */ - /** * Improve action module end of file */ diff --git a/src/module/gitshields.php b/src/module/gitshields.php index 5d69688..375459c 100644 --- a/src/module/gitshields.php +++ b/src/module/gitshields.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use dcCore; use Dotclear\Helper\Html\Form\{ Checkbox, @@ -26,12 +25,8 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; - -/* improve */ use Dotclear\Plugin\improve\Action; -/* clearbricks */ - /** * Improve action module Github shields.io */ diff --git a/src/module/licensefile.php b/src/module/licensefile.php index e2a5fee..1669098 100644 --- a/src/module/licensefile.php +++ b/src/module/licensefile.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ +use Dotclear\Helper\File\Files; use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -24,14 +24,7 @@ use Dotclear\Helper\Html\Form\{ Para, Select }; - -/* improve */ use Dotclear\Plugin\improve\Action; - -/* clearbricks */ -use files; - -/* php */ use Exception; /** @@ -137,7 +130,7 @@ class licensefile extends Action 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"')); } catch (Exception $e) { $this->setError(__('Failed to write new license file')); @@ -154,7 +147,7 @@ class licensefile extends Action if ($only_one && $file != 'LICENSE') { 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)); } elseif (!@unlink($this->module->get('root') . DIRECTORY_SEPARATOR . $file)) { $this->setError(sprintf(__('Failed to delete old license file (%s)'), $file)); diff --git a/src/module/newline.php b/src/module/newline.php index a60fb8e..0d243e1 100644 --- a/src/module/newline.php +++ b/src/module/newline.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use Dotclear\Helper\Html\Form\{ Div, Fieldset, @@ -24,13 +23,9 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; - -/* improve */ use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Core; -/* clearbricks */ - /** * Improve action module new line */ diff --git a/src/module/phpcsfixer.php b/src/module/phpcsfixer.php index 3cb6779..ed4e761 100644 --- a/src/module/phpcsfixer.php +++ b/src/module/phpcsfixer.php @@ -14,13 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ -use Dotclear\Plugin\improve\Action; -use Dotclear\Plugin\improve\My; - -/* dotclear */ use dcCore; use dcPage; +use Dotclear\Helper\File\Path; use Dotclear\Helper\Html\Form\{ Div, Fieldset, @@ -31,12 +27,9 @@ use Dotclear\Helper\Html\Form\{ Para, Textarea }; - -/* clearbricks */ -use html; -use path; - -/* php */ +use Dotclear\Helper\Html\Html; +use Dotclear\Plugin\improve\Action; +use Dotclear\Plugin\improve\My; use Exception; /** @@ -121,7 +114,7 @@ class phpcsfixer extends Action // file_content (new Para())->items([ (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() . ( @@ -174,7 +167,7 @@ class phpcsfixer extends Action if (empty($phpexe_path) && !empty(PHP_BINDIR)) { $phpexe_path = PHP_BINDIR; } - $phpexe_path = (string) path::real($phpexe_path); + $phpexe_path = (string) Path::real($phpexe_path); if (!empty($phpexe_path)) { $phpexe_path .= '/'; } diff --git a/src/module/phpheader.php b/src/module/phpheader.php index dda4fca..9deaf33 100644 --- a/src/module/phpheader.php +++ b/src/module/phpheader.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use dcCore; use Dotclear\Helper\Html\Form\{ Checkbox, @@ -27,14 +26,8 @@ use Dotclear\Helper\Html\Form\{ Select, Textarea }; - -/* improve */ +use Dotclear\Helper\Html\Html; use Dotclear\Plugin\improve\Action; - -/* clearbricks */ -use html; - -/* php */ use Exception; /** @@ -144,7 +137,7 @@ class phpheader extends Action // bloc_content (new Para())->items([ (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( __('You can use wildcards %s'), @@ -154,7 +147,7 @@ class phpheader extends Action // exemple (new Para())->items([ (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(); diff --git a/src/module/phpstan.php b/src/module/phpstan.php index 8c72e87..5a70b5c 100644 --- a/src/module/phpstan.php +++ b/src/module/phpstan.php @@ -14,13 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ -use Dotclear\Plugin\improve\Action; -use Dotclear\Plugin\improve\My; - -/* dotclear */ use dcCore; use dcPage; +use Dotclear\Helper\File\Path; use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -33,12 +29,9 @@ use Dotclear\Helper\Html\Form\{ Para, Textarea }; - -/* clearbricks */ -use html; -use path; - -/* php */ +use Dotclear\Helper\Html\Html; +use Dotclear\Plugin\improve\Action; +use Dotclear\Plugin\improve\My; use Exception; /** @@ -164,7 +157,7 @@ class phpstan extends Action // file_content (new Para())->items([ (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() . ( @@ -273,7 +266,7 @@ class phpstan extends Action if (empty($phpexe_path) && !empty(PHP_BINDIR)) { $phpexe_path = PHP_BINDIR; } - $phpexe_path = (string) path::real($phpexe_path); + $phpexe_path = (string) Path::real($phpexe_path); if (!empty($phpexe_path)) { $phpexe_path .= '/'; } @@ -292,9 +285,9 @@ class phpstan extends Action ], [ $this->run_level, - (string) path::real($this->module->get('root'), false), - (string) path::real(DC_ROOT, false), - (string) path::real(__DIR__ . '/phpstan', false), + (string) Path::real($this->module->get('root'), false), + (string) Path::real(DC_ROOT, false), + (string) Path::real(__DIR__ . '/phpstan', false), ], (string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.' . $full . 'conf') ); diff --git a/src/module/po2php.php b/src/module/po2php.php index 27c3b4d..fae50b7 100644 --- a/src/module/po2php.php +++ b/src/module/po2php.php @@ -14,14 +14,11 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ use Dotclear\Plugin\improve\Action; /* clearbricks */ use l10n; -/* php */ - /** * Improve action module dcstore.xml */ diff --git a/src/module/tab.php b/src/module/tab.php index 73bc3f4..02c5454 100644 --- a/src/module/tab.php +++ b/src/module/tab.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* improve */ use Dotclear\Plugin\improve\Action; /** diff --git a/src/module/zip.php b/src/module/zip.php index e0b1d67..8288c55 100644 --- a/src/module/zip.php +++ b/src/module/zip.php @@ -14,8 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\improve\Module; -/* dotclear */ use dcCore; +use Dotclear\Helper\File\Files; +use Dotclear\Helper\File\Path; use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -26,14 +27,8 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; - -/* improve */ use Dotclear\Plugin\improve\Action; -/* clearbricks */ -use path; -use files; - /** * Improve action module zip */ @@ -125,7 +120,7 @@ class zip extends Action (new Note())->text(sprintf( __('Preconization: %s'), 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'), ]), (new Fieldset())->class('fieldset')->legend((new Legend(__('Files'))))->fields([ @@ -199,7 +194,7 @@ class zip extends Action ); $parts = explode('/', $file); foreach ($parts as $i => $part) { - $parts[$i] = files::tidyFileName($part); + $parts[$i] = Files::tidyFileName($part); } $path = $this->getSetting('pack_repository') . '/' . implode('/', $parts) . '.zip'; if (file_exists($path) && empty($this->getSetting('pack_overwrite'))) { @@ -223,7 +218,7 @@ class zip extends Action $zip->addExclusion($e); } $zip->addDirectory( - path::real($this->module->get('root')), + Path::real($this->module->get('root')), $this->module->getId(), true );