diff --git a/inc/class.improve.action.php b/inc/class.improve.action.php index 523e358..e3c3262 100644 --- a/inc/class.improve.action.php +++ b/inc/class.improve.action.php @@ -10,7 +10,6 @@ * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ - /** * @brief Plugin improve action class * diff --git a/inc/class.improve.php b/inc/class.improve.php index bcab46b..c608ce5 100644 --- a/inc/class.improve.php +++ b/inc/class.improve.php @@ -10,7 +10,6 @@ * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ - /** * This class manage all actions sub-class */ diff --git a/inc/lib.improve.action.phpcsfixer.php b/inc/lib.improve.action.phpcsfixer.php index 51f640e..cee6062 100644 --- a/inc/lib.improve.action.phpcsfixer.php +++ b/inc/lib.improve.action.phpcsfixer.php @@ -38,24 +38,19 @@ class ImproveActionPhpcsfixer extends ImproveAction public function isConfigured(): bool { - return !empty($this->getSetting('phpcsf_path')); + return true; } public function configure($url): ?string { if (!empty($_POST['save'])) { $this->setSettings([ - 'phpexe_path' => !empty($_POST['phpexe_path']) ? $_POST['phpexe_path'] : '', - 'phpcsf_path' => !empty($_POST['phpcsf_path']) ? $_POST['phpcsf_path'] : '' + 'phpexe_path' => !empty($_POST['phpexe_path']) ? $_POST['phpexe_path'] : '' ]); $this->redirect($url); } return - '

' . sprintf( - __('You must have installed %s to use this tool'), - 'php-cs-fixer' - ) . '

' . '

' . @@ -63,12 +58,7 @@ class ImproveActionPhpcsfixer extends ImproveAction '

' . __('If this server is under unix, leave it empty.') . ' ' . __('If this server is under Windows, put here directory to php executable (without executable file name).') . - ' C:\path_to\php

' . - '

' . - '

' . - '

' . __('Do not add file name to the end of path.') . ' \path_to\tools\php-cs-fixer\vendor\friendsofphp\php-cs-fixer

'; + ' C:\path_to\php

'; } public function closeModule(): ?bool @@ -77,12 +67,11 @@ class ImproveActionPhpcsfixer extends ImproveAction if (!empty($phpexe_path)) { $phpexe_path .= '/'; } - $phpcsf_path = path::real($this->getSetting('phpcsf_path')); $command = sprintf( - '%sphp %s/php-cs-fixer fix %s --config=%s/dc.phpcsfixer.rules.php --using-cache=no', + '%sphp %s/libs/php-cs-fixer.phar fix %s --config=%s/libs/dc.phpcsfixer.rules.php --using-cache=no', $phpexe_path, - $phpcsf_path, + dirname(__FILE__), $this->module['sroot'], dirname(__FILE__) ); diff --git a/inc/dc.phpcsfixer.rules.php b/inc/libs/dc.phpcsfixer.rules.php similarity index 100% rename from inc/dc.phpcsfixer.rules.php rename to inc/libs/dc.phpcsfixer.rules.php diff --git a/inc/libs/php-cs-fixer.phar b/inc/libs/php-cs-fixer.phar new file mode 100644 index 0000000..78798f0 Binary files /dev/null and b/inc/libs/php-cs-fixer.phar differ