Skip to content
Code-Schnipsel Gruppen Projekte
Commit 3a8558da erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'dev' into 'next'

feat!: quiqqer v2

See merge request !15
Übergeordnete 8897889c 51a1ae8c
Branches next-3.x
No related tags found
2 Merge Requests!16feat!: quiqqer v2,!15feat!: quiqqer v2
Pipeline #7238 bestanden mit Phase
in 8 Sekunden
checklist.md5 tools/
\ No newline at end of file phpstan.neon
.phpunit.result.cache
phpunit.xml
<?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>
...@@ -2,18 +2,17 @@ ...@@ -2,18 +2,17 @@
/** /**
* Activates the plugin * Activates the plugin
*
* @param pluginName
*
*/ */
use QUI\Ckeditor\Plugins\Manager;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_activatePlugin', 'package_quiqqer_ckeditor4_ajax_activatePlugin',
function ($pluginName) { function ($pluginName) {
$PluginManager = new \QUI\Ckeditor\Plugins\Manager(); $PluginManager = new Manager();
$PluginManager->activate($pluginName); $PluginManager->activate($pluginName);
}, },
array('pluginName'), ['pluginName'],
"quiqqer.editors.ckeditor.plugins.toggle" "quiqqer.editors.ckeditor.plugins.toggle"
); );
...@@ -2,18 +2,17 @@ ...@@ -2,18 +2,17 @@
/** /**
* Deactivates the plugin * Deactivates the plugin
*
* @param pluginName
*
*/ */
use QUI\Ckeditor\Plugins\Manager;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_deactivatePlugin', 'package_quiqqer_ckeditor4_ajax_deactivatePlugin',
function ($pluginName) { function ($pluginName) {
$PluginManager = new \QUI\Ckeditor\Plugins\Manager(); $PluginManager = new Manager();
$PluginManager->deactivate($pluginName); $PluginManager->deactivate($pluginName);
}, },
array('pluginName'), ['pluginName'],
"quiqqer.editors.ckeditor.plugins.toggle" "quiqqer.editors.ckeditor.plugins.toggle"
); );
...@@ -9,11 +9,11 @@ QUI::$Ajax->registerFunction( ...@@ -9,11 +9,11 @@ QUI::$Ajax->registerFunction(
function ($brickId) { function ($brickId) {
try { try {
$Brick = QUI\Bricks\Manager::init()->getBrickById($brickId); $Brick = QUI\Bricks\Manager::init()->getBrickById($brickId);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
return ''; return '';
} }
return '#'.$Brick->getAttribute('id').' - '.$Brick->getAttribute('title'); return '#' . $Brick->getAttribute('id') . ' - ' . $Brick->getAttribute('title');
}, },
['brickId'] ['brickId']
); );
<?php <?php
use QUI\Ckeditor\Plugins\Manager;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_getEditorConfig', 'package_quiqqer_ckeditor4_ajax_getEditorConfig',
function () { function () {
$config = array(); $config = [];
$Pluginmanager = new \QUI\Ckeditor\Plugins\Manager();
$PluginManager = new Manager();
$PackageConfig = QUI::getPackage("quiqqer/ckeditor4")->getConfig(); $PackageConfig = QUI::getPackage("quiqqer/ckeditor4")->getConfig();
$config['plugins'] = $Pluginmanager->getActivePlugins(); $config['plugins'] = $PluginManager->getActivePlugins();
$config['pluginPath'] = $Pluginmanager->getPluginUrlPath(); $config['pluginPath'] = $PluginManager->getPluginUrlPath();
$config['disableNativeSpellChecker'] = $PackageConfig->get("general", "disablenativeSpellcheck"); $config['disableNativeSpellChecker'] = $PackageConfig->get("general", "disablenativeSpellcheck");
return $config; return $config;
}, }
array()
); );
...@@ -8,11 +8,10 @@ ...@@ -8,11 +8,10 @@
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_getPermissions', 'package_quiqqer_ckeditor4_ajax_getPermissions',
function () { function () {
$result = [
$result = array(
'toggle' => false, 'toggle' => false,
'upload' => false 'upload' => false
); ];
if (QUI::getUserBySession()->getId() === 0) { if (QUI::getUserBySession()->getId() === 0) {
return $result; return $result;
...@@ -36,6 +35,5 @@ QUI::$Ajax->registerFunction( ...@@ -36,6 +35,5 @@ QUI::$Ajax->registerFunction(
} }
return $result; return $result;
}, }
array()
); );
...@@ -8,23 +8,21 @@ ...@@ -8,23 +8,21 @@
* 'plugins' => array('plugin1','plugin2','plugin3'...), * 'plugins' => array('plugin1','plugin2','plugin3'...),
* 'pluginpath' => 'path/to/plugins' * 'pluginpath' => 'path/to/plugins'
* ) * )
*
* @param pluginName
*
*/ */
use QUI\Cache\Manager;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_getPluginData', 'package_quiqqer_ckeditor4_ajax_getPluginData',
function () { function () {
if (QUI::getUserBySession()->getId() === 0) { if (QUI::getUserBySession()->getId() === 0) {
throw new \QUI\Exception("Invalid external function call. Caller must be logged in!"); throw new \QUI\Exception("Invalid external function call. Caller must be logged in!");
} }
try { try {
return \QUI\Cache\Manager::get("quiqqer/ckeditor/plugins/data"); return Manager::get("quiqqer/ckeditor/plugins/data");
} catch (\Exception $Exception) { } catch (Exception) {
} }
...@@ -32,22 +30,19 @@ QUI::$Ajax->registerFunction( ...@@ -32,22 +30,19 @@ QUI::$Ajax->registerFunction(
// Build the web reachable path for the plugin directory // Build the web reachable path for the plugin directory
$pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins"; $pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins";
$varParent = dirname(VAR_DIR); $varParent = dirname(VAR_DIR);
# Parse the URL directory # Parse the URL directory
$pluginUrlPath = str_replace($varParent, "", $pluginPath); $pluginUrlPath = str_replace($varParent, "", $pluginPath);
$data = array( $data = [
'plugins' => $Manager->getActivePlugins(), 'plugins' => $Manager->getActivePlugins(),
'pluginPath' => $pluginUrlPath 'pluginPath' => $pluginUrlPath
); ];
\QUI\Cache\Manager::set("quiqqer/ckeditor/plugins/data", $data);
Manager::set("quiqqer/ckeditor/plugins/data", $data);
return $data; return $data;
}, }
array()
); );
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
* Gets all plugins and their state * Gets all plugins and their state
*/ */
use QUI\Ckeditor\Plugins\Manager;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_getPlugins', 'package_quiqqer_ckeditor4_ajax_getPlugins',
function () { function () {
if (QUI::getUserBySession()->getId() === 0) { if (QUI::getUserBySession()->getId() === 0) {
throw new \QUI\Exception("Invalid external function call. Caller must be logged in!"); 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(); return $PluginManager->getAllPlugins();
}, }
array()
); );
<?php <?php
use QUI\Ckeditor\Plugins\Manager;
use QUI\System\Log;
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_uploadComplete', 'package_quiqqer_ckeditor4_ajax_uploadComplete',
function ($File) { function ($File) {
$filePath = $File->getAttribute('filepath'); $filePath = $File->getAttribute('filepath');
$Manager = new Manager();
$Manager = new \QUI\Ckeditor\Plugins\Manager();
try { try {
$Manager->installPlugin($filePath); $Manager->installPlugin($filePath);
} catch (\Exception $Exception) { } catch (\Exception $Exception) {
QUI::getMessagesHandler()->addError($Exception->getMessage()); QUI::getMessagesHandler()->addError($Exception->getMessage());
\QUI\System\Log::addError($Exception->getMessage()); Log::addError($Exception->getMessage());
} }
}, },
array('File'), ['File'],
"quiqqer.editors.ckeditor.plugins.upload" "quiqqer.editors.ckeditor.plugins.upload"
); );
{ {
"name": "quiqqer\/ckeditor4", "name": "quiqqer/ckeditor4",
"type": "quiqqer-module", "type": "quiqqer-module",
"description": "CKEditor for the QUIQQER CMS - enable the ckeditor for quiqqer", "description": "CKEditor for the QUIQQER CMS - enable the ckeditor for quiqqer",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{ {
"name": "Henning Leutz", "name": "Henning Leutz",
"email": "leutz@pcsg.de", "email": "leutz@pcsg.de",
"homepage": "http:\/\/www.pcsg.de", "homepage": "https://www.pcsg.de",
"role": "Developer" "role": "Developer"
} }
], ],
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
"email": "support@pcsg.de" "email": "support@pcsg.de"
}, },
"require": { "require": {
"quiqqer\/quiqqer": "*", "quiqqer/core": "^2",
"quiqqer\/qui": ">=1|*@dev", "quiqqer/qui": "^1",
"ckeditor\/ckeditor": ">=4.16.0 <4.22.0" "ckeditor/ckeditor": ">=4.16.0 <4.22.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"QUI\\Ckeditor\\": "src\/QUI\/Ckeditor\/", "QUI\\Ckeditor\\": "src/QUI/Ckeditor/",
"QUI\\Ckeditor\\Plugins\\": "src\/QUI\/Ckeditor\/Plugins\/" "QUI\\Ckeditor\\Plugins\\": "src/QUI/Ckeditor/Plugins/"
} }
} }
} }
<?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>
includes:
- phpstan-baseline.neon
parameters:
level: 1
paths:
- src
- ajax
bootstrapFiles:
- tests/phpstan-bootstrap.php
...@@ -39,7 +39,7 @@ class Manager ...@@ -39,7 +39,7 @@ class Manager
* *
* @var array * @var array
*/ */
protected $blacklist = array( protected $blacklist = [
"ckawesome", "ckawesome",
"copyformatting", "copyformatting",
"crossreference", "crossreference",
...@@ -48,7 +48,7 @@ class Manager ...@@ -48,7 +48,7 @@ class Manager
"enhancedcolorbutton", "enhancedcolorbutton",
"footnotes", "footnotes",
"textselection" "textselection"
); ];
/** /**
* Manager constructor. * Manager constructor.
...@@ -57,8 +57,8 @@ class Manager ...@@ -57,8 +57,8 @@ class Manager
{ {
$Package = QUI::getPackage("quiqqer/ckeditor4"); $Package = QUI::getPackage("quiqqer/ckeditor4");
$this->activePluginDir = $Package->getVarDir()."/plugins/bin"; $this->activePluginDir = $Package->getVarDir() . "/plugins/bin";
$this->installedPluginDir = $Package->getVarDir()."/plugins/installed"; $this->installedPluginDir = $Package->getVarDir() . "/plugins/installed";
if (!is_dir($this->activePluginDir)) { if (!is_dir($this->activePluginDir)) {
mkdir($this->activePluginDir, 0755, true); mkdir($this->activePluginDir, 0755, true);
...@@ -78,11 +78,11 @@ class Manager ...@@ -78,11 +78,11 @@ class Manager
*/ */
public function updatePlugins() public function updatePlugins()
{ {
$srcDirs = array( $srcDirs = [
OPT_DIR."ckeditor/ckeditor/plugins", OPT_DIR . "ckeditor/ckeditor/plugins",
OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer", OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4" OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4"
); ];
foreach ($srcDirs as $srcDir) { foreach ($srcDirs as $srcDir) {
if (!is_dir($srcDir)) { if (!is_dir($srcDir)) {
...@@ -94,7 +94,7 @@ class Manager ...@@ -94,7 +94,7 @@ class Manager
continue; continue;
} }
if (!is_dir($srcDir."/".$entry)) { if (!is_dir($srcDir . "/" . $entry)) {
continue; continue;
} }
...@@ -105,10 +105,10 @@ class Manager ...@@ -105,10 +105,10 @@ class Manager
} }
# Check if/where the plugin is installed # Check if/where the plugin is installed
$targetDir = $this->installedPluginDir."/".$pluginName; $targetDir = $this->installedPluginDir . "/" . $pluginName;
if (is_dir($this->activePluginDir."/".$pluginName)) { if (is_dir($this->activePluginDir . "/" . $pluginName)) {
$targetDir = $this->activePluginDir."/".$pluginName; $targetDir = $this->activePluginDir . "/" . $pluginName;
} }
if (is_dir($targetDir)) { if (is_dir($targetDir)) {
...@@ -116,7 +116,7 @@ class Manager ...@@ -116,7 +116,7 @@ class Manager
} }
File::dircopy( File::dircopy(
$srcDir."/".$entry, $srcDir . "/" . $entry,
$targetDir $targetDir
); );
} }
...@@ -129,17 +129,17 @@ class Manager ...@@ -129,17 +129,17 @@ class Manager
*/ */
public function installPluginsFromSource() public function installPluginsFromSource()
{ {
$srcDirs = array( $srcDirs = [
OPT_DIR."ckeditor/ckeditor/plugins", OPT_DIR . "ckeditor/ckeditor/plugins",
OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer", OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4" OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4"
); ];
$activePlugins = array(); $activePlugins = [];
$defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__)))))."/plugins/activePlugins.json"; $defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/plugins/activePlugins.json";
if (file_exists($defaultStateFile)) { if (file_exists($defaultStateFile)) {
$json = file_get_contents($defaultStateFile); $json = file_get_contents($defaultStateFile);
$activePlugins = json_decode($json, true); $activePlugins = json_decode($json, true);
} }
...@@ -165,15 +165,15 @@ class Manager ...@@ -165,15 +165,15 @@ class Manager
$targetDir = $this->activePluginDir; $targetDir = $this->activePluginDir;
} }
if (!is_dir($srcDir."/".$entry)) { if (!is_dir($srcDir . "/" . $entry)) {
continue; continue;
} }
if (is_dir($this->installedPluginDir."/".$pluginName)) { if (is_dir($this->installedPluginDir . "/" . $pluginName)) {
continue; continue;
} }
if (is_dir($this->activePluginDir."/".$pluginName)) { if (is_dir($this->activePluginDir . "/" . $pluginName)) {
continue; continue;
} }
...@@ -181,21 +181,20 @@ class Manager ...@@ -181,21 +181,20 @@ class Manager
continue; continue;
} }
$this->copyDir( $this->copyDir(
$srcDir."/".$entry, $srcDir . "/" . $entry,
$targetDir."/".$pluginName $targetDir . "/" . $pluginName
); );
} }
} }
if (file_exists(OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json")) { if (file_exists(OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json")) {
copy( copy(
OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json", OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json",
$this->getPluginDir()."/dependencies.json" $this->getPluginDir() . "/dependencies.json"
); );
} }
#File::deleteDir(OPT_DIR . "ckeditor/ckeditor/plugins"); #File::deleteDir(OPT_DIR . "ckeditor/ckeditor/plugins");
} }
...@@ -206,12 +205,12 @@ class Manager ...@@ -206,12 +205,12 @@ class Manager
*/ */
public function getInstalledPlugins() public function getInstalledPlugins()
{ {
$result = array(); $result = [];
$content = scandir($this->installedPluginDir); $content = scandir($this->installedPluginDir);
if ($content === false) { if ($content === false) {
return array(); return [];
} }
foreach ($content as $entry) { foreach ($content as $entry) {
...@@ -219,7 +218,7 @@ class Manager ...@@ -219,7 +218,7 @@ class Manager
continue; continue;
} }
$fullpath = $this->installedPluginDir."/".$entry; $fullpath = $this->installedPluginDir . "/" . $entry;
if (!is_dir($fullpath)) { if (!is_dir($fullpath)) {
continue; continue;
...@@ -242,29 +241,29 @@ class Manager ...@@ -242,29 +241,29 @@ class Manager
{ {
# Check if file exists # Check if file exists
if (!file_exists($pluginpath)) { 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(); $tmpDir = QUI::getTemp()->createFolder();
copy( copy(
$pluginpath, $pluginpath,
$tmpDir."/archive.zip" $tmpDir . "/archive.zip"
); );
$Zip = new \ZipArchive(); $Zip = new \ZipArchive();
if ($Zip->open($tmpDir."/archive.zip") === false) { if ($Zip->open($tmpDir . "/archive.zip") === false) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.invalid.format")); throw new Exception(["quiqqer/ckeditor4", "exception.install.file.invalid.format"]);
} }
if ($Zip->extractTo($tmpDir."/content") === false) { if ($Zip->extractTo($tmpDir . "/content") === false) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.extract.failed")); throw new Exception(["quiqqer/ckeditor4", "exception.install.file.extract.failed"]);
} }
// Scan dir and remove '.' and '..' // Scan dir and remove '.' and '..'
$contents = scandir($tmpDir."/content"); $contents = scandir($tmpDir . "/content");
foreach (array_keys($contents, ".", true) as $key) { foreach (array_keys($contents, ".", true) as $key) {
unset($contents[$key]); unset($contents[$key]);
} }
...@@ -276,10 +275,10 @@ class Manager ...@@ -276,10 +275,10 @@ class Manager
// Check if the zip contains only one folder // Check if the zip contains only one folder
if (count($contents) !== 1) { if (count($contents) !== 1) {
throw new Exception(array( throw new Exception([
"quiqqer/ckeditor4", "quiqqer/ckeditor4",
"exception.plugin.install.wrong.format" "exception.plugin.install.wrong.format"
)); ]);
} }
...@@ -289,17 +288,17 @@ class Manager ...@@ -289,17 +288,17 @@ class Manager
continue; continue;
} }
if (is_dir($this->installedPluginDir."/".$entry)) { if (is_dir($this->installedPluginDir . "/" . $entry)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists")); throw new Exception(["quiqqer/ckeditor4", "exception.install.file.exists"]);
} }
if (is_dir($this->activePluginDir."/".$entry)) { if (is_dir($this->activePluginDir . "/" . $entry)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists")); throw new Exception(["quiqqer/ckeditor4", "exception.install.file.exists"]);
} }
rename( rename(
$tmpDir."/content/".$entry, $tmpDir . "/content/" . $entry,
$this->installedPluginDir."/".$entry $this->installedPluginDir . "/" . $entry
); );
} }
...@@ -330,24 +329,24 @@ class Manager ...@@ -330,24 +329,24 @@ class Manager
$pluginName = str_replace("/", "", $pluginName); $pluginName = str_replace("/", "", $pluginName);
if (in_array($pluginName, $this->blacklist)) { if (in_array($pluginName, $this->blacklist)) {
throw new Exception(array( throw new Exception([
"quiqqer/ckeditor4", "quiqqer/ckeditor4",
"exception.plugin.activate.blacklisted" "exception.plugin.activate.blacklisted"
)); ]);
} }
if (!is_dir($this->installedPluginDir."/".$pluginName)) { if (!is_dir($this->installedPluginDir . "/" . $pluginName)) {
throw new Exception(array( throw new Exception([
"quiqqer/ckeditor4", "quiqqer/ckeditor4",
"exception.plugin.activate.plugin.not.found" "exception.plugin.activate.plugin.not.found"
)); ]);
} }
if (is_dir($this->activePluginDir."/".$pluginName)) { if (is_dir($this->activePluginDir . "/" . $pluginName)) {
throw new Exception(array( throw new Exception([
"quiqqer/ckeditor4", "quiqqer/ckeditor4",
"exception.plugin.already.active" "exception.plugin.already.active"
)); ]);
} }
$deps = $this->getDependencies($pluginName); $deps = $this->getDependencies($pluginName);
...@@ -360,8 +359,8 @@ class Manager ...@@ -360,8 +359,8 @@ class Manager
} }
rename( rename(
$this->installedPluginDir."/".$pluginName, $this->installedPluginDir . "/" . $pluginName,
$this->activePluginDir."/".$pluginName $this->activePluginDir . "/" . $pluginName
); );
QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data"); QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
...@@ -379,15 +378,15 @@ class Manager ...@@ -379,15 +378,15 @@ class Manager
$pluginName = Orthos::clearPath($pluginName); $pluginName = Orthos::clearPath($pluginName);
$pluginName = str_replace("/", "", $pluginName); $pluginName = str_replace("/", "", $pluginName);
if (!is_dir($this->activePluginDir."/".$pluginName)) { if (!is_dir($this->activePluginDir . "/" . $pluginName)) {
throw new Exception(array( throw new Exception([
"quiqqer/ckeditor4", "quiqqer/ckeditor4",
"exception.plugin.activate.plugin.not.active" "exception.plugin.activate.plugin.not.active"
)); ]);
} }
if (is_dir($this->installedPluginDir."/".$pluginName)) { if (is_dir($this->installedPluginDir . "/" . $pluginName)) {
File::deleteDir($this->activePluginDir."/".$pluginName); File::deleteDir($this->activePluginDir . "/" . $pluginName);
return; return;
} }
...@@ -400,8 +399,8 @@ class Manager ...@@ -400,8 +399,8 @@ class Manager
} }
rename( rename(
$this->activePluginDir."/".$pluginName, $this->activePluginDir . "/" . $pluginName,
$this->installedPluginDir."/".$pluginName $this->installedPluginDir . "/" . $pluginName
); );
QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data"); QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
...@@ -414,11 +413,11 @@ class Manager ...@@ -414,11 +413,11 @@ class Manager
*/ */
public function getActivePlugins() public function getActivePlugins()
{ {
$result = array(); $result = [];
$content = scandir($this->activePluginDir); $content = scandir($this->activePluginDir);
if ($content === false) { if ($content === false) {
return array(); return [];
} }
foreach ($content as $entry) { foreach ($content as $entry) {
...@@ -426,7 +425,7 @@ class Manager ...@@ -426,7 +425,7 @@ class Manager
continue; continue;
} }
$fullpath = $this->activePluginDir."/".$entry; $fullpath = $this->activePluginDir . "/" . $entry;
if (!is_dir($fullpath)) { if (!is_dir($fullpath)) {
continue; continue;
...@@ -459,10 +458,10 @@ class Manager ...@@ -459,10 +458,10 @@ class Manager
return false; return false;
} }
$result = array(); $result = [];
if (!isset($this->dependencies[$pluginName])) { if (!isset($this->dependencies[$pluginName])) {
return array(); return [];
} }
$deps = $this->dependencies[$pluginName]; $deps = $this->dependencies[$pluginName];
...@@ -471,7 +470,7 @@ class Manager ...@@ -471,7 +470,7 @@ class Manager
$result[] = $dep; $result[] = $dep;
$subDeps = $this->getDependencies($dep); $subDeps = $this->getDependencies($dep);
$result = array_merge($result, $subDeps); $result = array_merge($result, $subDeps);
} }
$result = array_unique($result); $result = array_unique($result);
...@@ -489,7 +488,7 @@ class Manager ...@@ -489,7 +488,7 @@ class Manager
*/ */
public function getDependentPlugins($pluginName) public function getDependentPlugins($pluginName)
{ {
$result = array(); $result = [];
try { try {
$this->loadDependencies(); $this->loadDependencies();
...@@ -519,13 +518,13 @@ class Manager ...@@ -519,13 +518,13 @@ class Manager
return; return;
} }
if (!file_exists($this->getPluginDir()."/dependencies.json")) { if (!file_exists($this->getPluginDir() . "/dependencies.json")) {
Log::addWarning("Missing dependency file: ".$this->getPluginDir()."/dependencies.json"); Log::addWarning("Missing dependency file: " . $this->getPluginDir() . "/dependencies.json");
throw new Exception("missing.dependency.file"); 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); $deps = json_decode($json, true);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
...@@ -553,20 +552,20 @@ class Manager ...@@ -553,20 +552,20 @@ class Manager
*/ */
public function getAllPlugins() public function getAllPlugins()
{ {
$result = array(); $result = [];
foreach ($this->getActivePlugins() as $plugin) { foreach ($this->getActivePlugins() as $plugin) {
$result[] = array( $result[] = [
'name' => $plugin, 'name' => $plugin,
'state' => 1 'state' => 1
); ];
} }
foreach ($this->getInstalledPlugins() as $plugin) { foreach ($this->getInstalledPlugins() as $plugin) {
$result[] = array( $result[] = [
'name' => $plugin, 'name' => $plugin,
'state' => 0 'state' => 0
); ];
} }
return $result; return $result;
...@@ -579,7 +578,7 @@ class Manager ...@@ -579,7 +578,7 @@ class Manager
*/ */
public function getPluginDir() public function getPluginDir()
{ {
return QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."/plugins"; return QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "/plugins";
} }
/** /**
...@@ -601,14 +600,14 @@ class Manager ...@@ -601,14 +600,14 @@ class Manager
continue; continue;
} }
$fullpath = $src."/".$entry; $fullpath = $src . "/" . $entry;
if (is_dir($fullpath)) { if (is_dir($fullpath)) {
$this->copyDir($fullpath, $target."/".$entry); $this->copyDir($fullpath, $target . "/" . $entry);
continue; continue;
} }
copy($fullpath, $target."/".$entry); copy($fullpath, $target . "/" . $entry);
} }
} }
...@@ -620,8 +619,8 @@ class Manager ...@@ -620,8 +619,8 @@ class Manager
public function getPluginUrlPath() public function getPluginUrlPath()
{ {
// Build the web reachable path for the plugin directory // Build the web reachable path for the plugin directory
$pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."plugins"; $pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins";
$varParent = dirname(VAR_DIR); $varParent = dirname(VAR_DIR);
# Parse the URL directory # Parse the URL directory
$pluginUrlPath = str_replace($varParent, "", $pluginPath); $pluginUrlPath = str_replace($varParent, "", $pluginPath);
......
<?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';
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren