diff --git a/.gitignore b/.gitignore index fa8f1f53f9a838341f3d92b79481d909fcf235a8..5d49cc71d98b16e2ed3cc08be94e85f83584b1e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -checklist.md5 \ No newline at end of file +tools/ +phpstan.neon +.phpunit.result.cache +phpunit.xml diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000000000000000000000000000000000000..a1315a09b4adad780a9c5e52f74835c708c5c7d5 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phive xmlns="https://phar.io/phive"> + <phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/> +</phive> diff --git a/ajax/activatePlugin.php b/ajax/activatePlugin.php index 557bb114bea9cd10bd816fa5f35ff192487c2d56..5c24fc6002dc530e2c4232f6a36d5bd1363c8cce 100644 --- a/ajax/activatePlugin.php +++ b/ajax/activatePlugin.php @@ -2,18 +2,17 @@ /** * Activates the plugin - * - * @param pluginName - * */ +use QUI\Ckeditor\Plugins\Manager; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_activatePlugin', function ($pluginName) { - $PluginManager = new \QUI\Ckeditor\Plugins\Manager(); + $PluginManager = new Manager(); $PluginManager->activate($pluginName); }, - array('pluginName'), + ['pluginName'], "quiqqer.editors.ckeditor.plugins.toggle" ); diff --git a/ajax/deactivatePlugin.php b/ajax/deactivatePlugin.php index f502bb54fc3e3cd93b0748ba6df54fa9a8a53a53..5e392e4c6cf0bb61d77770bee465b20061682a0b 100644 --- a/ajax/deactivatePlugin.php +++ b/ajax/deactivatePlugin.php @@ -2,18 +2,17 @@ /** * Deactivates the plugin - * - * @param pluginName - * */ +use QUI\Ckeditor\Plugins\Manager; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_deactivatePlugin', function ($pluginName) { - $PluginManager = new \QUI\Ckeditor\Plugins\Manager(); + $PluginManager = new Manager(); $PluginManager->deactivate($pluginName); }, - array('pluginName'), + ['pluginName'], "quiqqer.editors.ckeditor.plugins.toggle" ); diff --git a/ajax/getBrickInfo.php b/ajax/getBrickInfo.php index bb344c4e10dfe168eeac65683231b39f08329d59..1742f1be00a161bd591c3faf660dcd84a626dbd2 100644 --- a/ajax/getBrickInfo.php +++ b/ajax/getBrickInfo.php @@ -9,11 +9,11 @@ QUI::$Ajax->registerFunction( function ($brickId) { try { $Brick = QUI\Bricks\Manager::init()->getBrickById($brickId); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { return ''; } - return '#'.$Brick->getAttribute('id').' - '.$Brick->getAttribute('title'); + return '#' . $Brick->getAttribute('id') . ' - ' . $Brick->getAttribute('title'); }, ['brickId'] ); diff --git a/ajax/getEditorConfig.php b/ajax/getEditorConfig.php index b518c08579e94c8eb32f4d876916f1c24fe526d6..03ff7425bde5d9f7b122d8be297b220b00633386 100644 --- a/ajax/getEditorConfig.php +++ b/ajax/getEditorConfig.php @@ -1,20 +1,20 @@ <?php +use QUI\Ckeditor\Plugins\Manager; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_getEditorConfig', function () { - $config = array(); - - $Pluginmanager = new \QUI\Ckeditor\Plugins\Manager(); + $config = []; + $PluginManager = new Manager(); $PackageConfig = QUI::getPackage("quiqqer/ckeditor4")->getConfig(); - $config['plugins'] = $Pluginmanager->getActivePlugins(); - $config['pluginPath'] = $Pluginmanager->getPluginUrlPath(); + $config['plugins'] = $PluginManager->getActivePlugins(); + $config['pluginPath'] = $PluginManager->getPluginUrlPath(); $config['disableNativeSpellChecker'] = $PackageConfig->get("general", "disablenativeSpellcheck"); return $config; - }, - array() + } ); diff --git a/ajax/getPermissions.php b/ajax/getPermissions.php index 32dd1f80139de0e74e89c0c1db2b2ee1ba1725ce..079d5266efaab6bb2b1a56d310be4a56b8567f06 100644 --- a/ajax/getPermissions.php +++ b/ajax/getPermissions.php @@ -8,11 +8,10 @@ QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_getPermissions', function () { - - $result = array( + $result = [ 'toggle' => false, 'upload' => false - ); + ]; if (QUI::getUserBySession()->getId() === 0) { return $result; @@ -36,6 +35,5 @@ QUI::$Ajax->registerFunction( } return $result; - }, - array() + } ); diff --git a/ajax/getPluginData.php b/ajax/getPluginData.php index 097b69803065c0cf7a7e6aeba1b8a3825ee75024..c45ce92a1e1843014a6dece0467e119325f13cc7 100644 --- a/ajax/getPluginData.php +++ b/ajax/getPluginData.php @@ -8,23 +8,21 @@ * 'plugins' => array('plugin1','plugin2','plugin3'...), * 'pluginpath' => 'path/to/plugins' * ) - * - * @param pluginName - * */ +use QUI\Cache\Manager; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_getPluginData', function () { - if (QUI::getUserBySession()->getId() === 0) { throw new \QUI\Exception("Invalid external function call. Caller must be logged in!"); } try { - return \QUI\Cache\Manager::get("quiqqer/ckeditor/plugins/data"); - } catch (\Exception $Exception) { + return Manager::get("quiqqer/ckeditor/plugins/data"); + } catch (Exception) { } @@ -32,22 +30,19 @@ QUI::$Ajax->registerFunction( // Build the web reachable path for the plugin directory $pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins"; - $varParent = dirname(VAR_DIR); + $varParent = dirname(VAR_DIR); # Parse the URL directory $pluginUrlPath = str_replace($varParent, "", $pluginPath); - $data = array( - 'plugins' => $Manager->getActivePlugins(), + $data = [ + 'plugins' => $Manager->getActivePlugins(), 'pluginPath' => $pluginUrlPath - ); - - - \QUI\Cache\Manager::set("quiqqer/ckeditor/plugins/data", $data); + ]; + Manager::set("quiqqer/ckeditor/plugins/data", $data); return $data; - }, - array() + } ); diff --git a/ajax/getPlugins.php b/ajax/getPlugins.php index ed382b215e4f314b2cda4ba3cf31558dde5755bc..7dc18e8729393742402d9679368a33f150bad5ec 100644 --- a/ajax/getPlugins.php +++ b/ajax/getPlugins.php @@ -4,17 +4,17 @@ * Gets all plugins and their state */ +use QUI\Ckeditor\Plugins\Manager; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_getPlugins', function () { - if (QUI::getUserBySession()->getId() === 0) { throw new \QUI\Exception("Invalid external function call. Caller must be logged in!"); } - $Pluginmanager = new \QUI\Ckeditor\Plugins\Manager(); + $PluginManager = new Manager(); - return $Pluginmanager->getAllPlugins(); - }, - array() + return $PluginManager->getAllPlugins(); + } ); diff --git a/ajax/uploadComplete.php b/ajax/uploadComplete.php index f192cfe94b013e49c8c31ed5074aca4b6dadda7c..9cb505dbd799e8e4211f256a5f6a684f786453ca 100644 --- a/ajax/uploadComplete.php +++ b/ajax/uploadComplete.php @@ -1,19 +1,21 @@ <?php +use QUI\Ckeditor\Plugins\Manager; +use QUI\System\Log; + QUI::$Ajax->registerFunction( 'package_quiqqer_ckeditor4_ajax_uploadComplete', function ($File) { - $filePath = $File->getAttribute('filepath'); + $Manager = new Manager(); - $Manager = new \QUI\Ckeditor\Plugins\Manager(); try { $Manager->installPlugin($filePath); } catch (\Exception $Exception) { QUI::getMessagesHandler()->addError($Exception->getMessage()); - \QUI\System\Log::addError($Exception->getMessage()); + Log::addError($Exception->getMessage()); } }, - array('File'), + ['File'], "quiqqer.editors.ckeditor.plugins.upload" ); diff --git a/composer.json b/composer.json index 942dc282a0c45f946ebf5f5a042e6d526a7de912..7f5dab4ace110ee21a5c881703cf423c4a57ae78 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "quiqqer\/ckeditor4", + "name": "quiqqer/ckeditor4", "type": "quiqqer-module", "description": "CKEditor for the QUIQQER CMS - enable the ckeditor for quiqqer", "license": "GPL-2.0-or-later", @@ -7,7 +7,7 @@ { "name": "Henning Leutz", "email": "leutz@pcsg.de", - "homepage": "http:\/\/www.pcsg.de", + "homepage": "https://www.pcsg.de", "role": "Developer" } ], @@ -15,14 +15,14 @@ "email": "support@pcsg.de" }, "require": { - "quiqqer\/quiqqer": "*", - "quiqqer\/qui": ">=1|*@dev", - "ckeditor\/ckeditor": ">=4.16.0 <4.22.0" + "quiqqer/core": "^2", + "quiqqer/qui": "^1", + "ckeditor/ckeditor": ">=4.16.0 <4.22.0" }, "autoload": { "psr-4": { - "QUI\\Ckeditor\\": "src\/QUI\/Ckeditor\/", - "QUI\\Ckeditor\\Plugins\\": "src\/QUI\/Ckeditor\/Plugins\/" + "QUI\\Ckeditor\\": "src/QUI/Ckeditor/", + "QUI\\Ckeditor\\Plugins\\": "src/QUI/Ckeditor/Plugins/" } } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000000000000000000000000000000000000..300bdeee5226a2565edb7219b8c1b84cd39c5030 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<ruleset> + <!-- Use PSR-12 ruleset --> + <rule ref="PSR12"/> + + <!-- Only scan *.php files --> + <arg name="extensions" value="php"/> + + <!-- Ignore warnings --> + <arg name="warning-severity" value="0"/> + + <!-- Process 64 (or number of CPU cores) files in parallel --> + <arg name="parallel" value="64"/> + + <!-- Output relative file paths, by setting the current folder as the basepath --> + <arg name="basepath" value="."/> + + <!-- Show colored output --> + <arg name="colors"/> + + <!-- Scan everything in the current folder --> + <file>.</file> +</ruleset> + diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 0000000000000000000000000000000000000000..37e6b52ac8d173c7f1e1645fbf40eab4adeccdb2 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,11 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 1 + paths: + - src + - ajax + bootstrapFiles: + - tests/phpstan-bootstrap.php + diff --git a/src/QUI/Ckeditor/Plugins/Manager.php b/src/QUI/Ckeditor/Plugins/Manager.php index 607d6b04c31a9de4392a77cafc4f8024846c5d67..c0ddf77a979eb25967f7eb56682f8f05b4b2f8c7 100644 --- a/src/QUI/Ckeditor/Plugins/Manager.php +++ b/src/QUI/Ckeditor/Plugins/Manager.php @@ -39,7 +39,7 @@ class Manager * * @var array */ - protected $blacklist = array( + protected $blacklist = [ "ckawesome", "copyformatting", "crossreference", @@ -48,7 +48,7 @@ class Manager "enhancedcolorbutton", "footnotes", "textselection" - ); + ]; /** * Manager constructor. @@ -57,8 +57,8 @@ class Manager { $Package = QUI::getPackage("quiqqer/ckeditor4"); - $this->activePluginDir = $Package->getVarDir()."/plugins/bin"; - $this->installedPluginDir = $Package->getVarDir()."/plugins/installed"; + $this->activePluginDir = $Package->getVarDir() . "/plugins/bin"; + $this->installedPluginDir = $Package->getVarDir() . "/plugins/installed"; if (!is_dir($this->activePluginDir)) { mkdir($this->activePluginDir, 0755, true); @@ -78,11 +78,11 @@ class Manager */ public function updatePlugins() { - $srcDirs = array( - OPT_DIR."ckeditor/ckeditor/plugins", - OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer", - OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4" - ); + $srcDirs = [ + OPT_DIR . "ckeditor/ckeditor/plugins", + OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer", + OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4" + ]; foreach ($srcDirs as $srcDir) { if (!is_dir($srcDir)) { @@ -94,7 +94,7 @@ class Manager continue; } - if (!is_dir($srcDir."/".$entry)) { + if (!is_dir($srcDir . "/" . $entry)) { continue; } @@ -105,10 +105,10 @@ class Manager } # Check if/where the plugin is installed - $targetDir = $this->installedPluginDir."/".$pluginName; + $targetDir = $this->installedPluginDir . "/" . $pluginName; - if (is_dir($this->activePluginDir."/".$pluginName)) { - $targetDir = $this->activePluginDir."/".$pluginName; + if (is_dir($this->activePluginDir . "/" . $pluginName)) { + $targetDir = $this->activePluginDir . "/" . $pluginName; } if (is_dir($targetDir)) { @@ -116,7 +116,7 @@ class Manager } File::dircopy( - $srcDir."/".$entry, + $srcDir . "/" . $entry, $targetDir ); } @@ -129,17 +129,17 @@ class Manager */ public function installPluginsFromSource() { - $srcDirs = array( - OPT_DIR."ckeditor/ckeditor/plugins", - OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer", - OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4" - ); + $srcDirs = [ + OPT_DIR . "ckeditor/ckeditor/plugins", + OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer", + OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4" + ]; - $activePlugins = array(); - $defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__)))))."/plugins/activePlugins.json"; + $activePlugins = []; + $defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/plugins/activePlugins.json"; if (file_exists($defaultStateFile)) { - $json = file_get_contents($defaultStateFile); + $json = file_get_contents($defaultStateFile); $activePlugins = json_decode($json, true); } @@ -165,15 +165,15 @@ class Manager $targetDir = $this->activePluginDir; } - if (!is_dir($srcDir."/".$entry)) { + if (!is_dir($srcDir . "/" . $entry)) { continue; } - if (is_dir($this->installedPluginDir."/".$pluginName)) { + if (is_dir($this->installedPluginDir . "/" . $pluginName)) { continue; } - - if (is_dir($this->activePluginDir."/".$pluginName)) { + + if (is_dir($this->activePluginDir . "/" . $pluginName)) { continue; } @@ -181,21 +181,20 @@ class Manager continue; } - + $this->copyDir( - $srcDir."/".$entry, - $targetDir."/".$pluginName + $srcDir . "/" . $entry, + $targetDir . "/" . $pluginName ); } } - if (file_exists(OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json")) { + if (file_exists(OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json")) { copy( - OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json", - $this->getPluginDir()."/dependencies.json" + OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json", + $this->getPluginDir() . "/dependencies.json" ); } - #File::deleteDir(OPT_DIR . "ckeditor/ckeditor/plugins"); } @@ -206,12 +205,12 @@ class Manager */ public function getInstalledPlugins() { - $result = array(); + $result = []; $content = scandir($this->installedPluginDir); if ($content === false) { - return array(); + return []; } foreach ($content as $entry) { @@ -219,7 +218,7 @@ class Manager continue; } - $fullpath = $this->installedPluginDir."/".$entry; + $fullpath = $this->installedPluginDir . "/" . $entry; if (!is_dir($fullpath)) { continue; @@ -242,29 +241,29 @@ class Manager { # Check if file exists if (!file_exists($pluginpath)) { - throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.not.found")); + throw new Exception(["quiqqer/ckeditor4", "exception.install.file.not.found"]); } $tmpDir = QUI::getTemp()->createFolder(); copy( $pluginpath, - $tmpDir."/archive.zip" + $tmpDir . "/archive.zip" ); $Zip = new \ZipArchive(); - if ($Zip->open($tmpDir."/archive.zip") === false) { - throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.invalid.format")); + if ($Zip->open($tmpDir . "/archive.zip") === false) { + throw new Exception(["quiqqer/ckeditor4", "exception.install.file.invalid.format"]); } - if ($Zip->extractTo($tmpDir."/content") === false) { - throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.extract.failed")); + if ($Zip->extractTo($tmpDir . "/content") === false) { + throw new Exception(["quiqqer/ckeditor4", "exception.install.file.extract.failed"]); } // Scan dir and remove '.' and '..' - $contents = scandir($tmpDir."/content"); + $contents = scandir($tmpDir . "/content"); foreach (array_keys($contents, ".", true) as $key) { unset($contents[$key]); } @@ -276,10 +275,10 @@ class Manager // Check if the zip contains only one folder if (count($contents) !== 1) { - throw new Exception(array( + throw new Exception([ "quiqqer/ckeditor4", "exception.plugin.install.wrong.format" - )); + ]); } @@ -289,17 +288,17 @@ class Manager continue; } - if (is_dir($this->installedPluginDir."/".$entry)) { - throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists")); + if (is_dir($this->installedPluginDir . "/" . $entry)) { + throw new Exception(["quiqqer/ckeditor4", "exception.install.file.exists"]); } - if (is_dir($this->activePluginDir."/".$entry)) { - throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists")); + if (is_dir($this->activePluginDir . "/" . $entry)) { + throw new Exception(["quiqqer/ckeditor4", "exception.install.file.exists"]); } rename( - $tmpDir."/content/".$entry, - $this->installedPluginDir."/".$entry + $tmpDir . "/content/" . $entry, + $this->installedPluginDir . "/" . $entry ); } @@ -330,24 +329,24 @@ class Manager $pluginName = str_replace("/", "", $pluginName); if (in_array($pluginName, $this->blacklist)) { - throw new Exception(array( + throw new Exception([ "quiqqer/ckeditor4", "exception.plugin.activate.blacklisted" - )); + ]); } - if (!is_dir($this->installedPluginDir."/".$pluginName)) { - throw new Exception(array( + if (!is_dir($this->installedPluginDir . "/" . $pluginName)) { + throw new Exception([ "quiqqer/ckeditor4", "exception.plugin.activate.plugin.not.found" - )); + ]); } - if (is_dir($this->activePluginDir."/".$pluginName)) { - throw new Exception(array( + if (is_dir($this->activePluginDir . "/" . $pluginName)) { + throw new Exception([ "quiqqer/ckeditor4", "exception.plugin.already.active" - )); + ]); } $deps = $this->getDependencies($pluginName); @@ -360,8 +359,8 @@ class Manager } rename( - $this->installedPluginDir."/".$pluginName, - $this->activePluginDir."/".$pluginName + $this->installedPluginDir . "/" . $pluginName, + $this->activePluginDir . "/" . $pluginName ); QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data"); @@ -379,15 +378,15 @@ class Manager $pluginName = Orthos::clearPath($pluginName); $pluginName = str_replace("/", "", $pluginName); - if (!is_dir($this->activePluginDir."/".$pluginName)) { - throw new Exception(array( + if (!is_dir($this->activePluginDir . "/" . $pluginName)) { + throw new Exception([ "quiqqer/ckeditor4", "exception.plugin.activate.plugin.not.active" - )); + ]); } - if (is_dir($this->installedPluginDir."/".$pluginName)) { - File::deleteDir($this->activePluginDir."/".$pluginName); + if (is_dir($this->installedPluginDir . "/" . $pluginName)) { + File::deleteDir($this->activePluginDir . "/" . $pluginName); return; } @@ -400,8 +399,8 @@ class Manager } rename( - $this->activePluginDir."/".$pluginName, - $this->installedPluginDir."/".$pluginName + $this->activePluginDir . "/" . $pluginName, + $this->installedPluginDir . "/" . $pluginName ); QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data"); @@ -414,11 +413,11 @@ class Manager */ public function getActivePlugins() { - $result = array(); + $result = []; $content = scandir($this->activePluginDir); if ($content === false) { - return array(); + return []; } foreach ($content as $entry) { @@ -426,7 +425,7 @@ class Manager continue; } - $fullpath = $this->activePluginDir."/".$entry; + $fullpath = $this->activePluginDir . "/" . $entry; if (!is_dir($fullpath)) { continue; @@ -459,10 +458,10 @@ class Manager return false; } - $result = array(); + $result = []; if (!isset($this->dependencies[$pluginName])) { - return array(); + return []; } $deps = $this->dependencies[$pluginName]; @@ -471,7 +470,7 @@ class Manager $result[] = $dep; $subDeps = $this->getDependencies($dep); - $result = array_merge($result, $subDeps); + $result = array_merge($result, $subDeps); } $result = array_unique($result); @@ -489,7 +488,7 @@ class Manager */ public function getDependentPlugins($pluginName) { - $result = array(); + $result = []; try { $this->loadDependencies(); @@ -519,13 +518,13 @@ class Manager return; } - if (!file_exists($this->getPluginDir()."/dependencies.json")) { - Log::addWarning("Missing dependency file: ".$this->getPluginDir()."/dependencies.json"); + if (!file_exists($this->getPluginDir() . "/dependencies.json")) { + Log::addWarning("Missing dependency file: " . $this->getPluginDir() . "/dependencies.json"); throw new Exception("missing.dependency.file"); } - $json = file_get_contents($this->getPluginDir()."/dependencies.json"); + $json = file_get_contents($this->getPluginDir() . "/dependencies.json"); $deps = json_decode($json, true); if (json_last_error() !== JSON_ERROR_NONE) { @@ -553,20 +552,20 @@ class Manager */ public function getAllPlugins() { - $result = array(); + $result = []; foreach ($this->getActivePlugins() as $plugin) { - $result[] = array( - 'name' => $plugin, + $result[] = [ + 'name' => $plugin, 'state' => 1 - ); + ]; } foreach ($this->getInstalledPlugins() as $plugin) { - $result[] = array( - 'name' => $plugin, + $result[] = [ + 'name' => $plugin, 'state' => 0 - ); + ]; } return $result; @@ -579,7 +578,7 @@ class Manager */ public function getPluginDir() { - return QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."/plugins"; + return QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "/plugins"; } /** @@ -601,14 +600,14 @@ class Manager continue; } - $fullpath = $src."/".$entry; + $fullpath = $src . "/" . $entry; if (is_dir($fullpath)) { - $this->copyDir($fullpath, $target."/".$entry); + $this->copyDir($fullpath, $target . "/" . $entry); continue; } - copy($fullpath, $target."/".$entry); + copy($fullpath, $target . "/" . $entry); } } @@ -620,8 +619,8 @@ class Manager public function getPluginUrlPath() { // Build the web reachable path for the plugin directory - $pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."plugins"; - $varParent = dirname(VAR_DIR); + $pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins"; + $varParent = dirname(VAR_DIR); # Parse the URL directory $pluginUrlPath = str_replace($varParent, "", $pluginPath); diff --git a/tests/phpstan-bootstrap.php b/tests/phpstan-bootstrap.php new file mode 100644 index 0000000000000000000000000000000000000000..b61ff4b8300a965e0f46025ba64745a22b118e74 --- /dev/null +++ b/tests/phpstan-bootstrap.php @@ -0,0 +1,13 @@ +<?php + +if (!defined('QUIQQER_SYSTEM')) { + define('QUIQQER_SYSTEM', true); +} + +if (!defined('QUIQQER_AJAX')) { + define('QUIQQER_AJAX', true); +} + +putenv("QUIQQER_OTHER_AUTOLOADERS=KEEP"); + +require_once __DIR__ . '/../../../../bootstrap.php';