diff --git a/CHANGELOG.md b/CHANGELOG.md index f5dcf80..a3ee0d2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +3.0.0 (2018-10-19) +-- +* Upgrade to Fork CMS v5 (minor tweaks so it works, no complete rewrite of the code) + 2.0.0 (2016-06-19) -- * Upgrade to Fork CMS v4 with Twig template support diff --git a/VERSION.md b/VERSION.md index 227cea2..4a36342 100755 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -2.0.0 +3.0.0 diff --git a/src/Backend/Modules/Compression/Actions/Settings.php b/src/Backend/Modules/Compression/Actions/Settings.php old mode 100644 new mode 100755 index e700419..fd83057 --- a/src/Backend/Modules/Compression/Actions/Settings.php +++ b/src/Backend/Modules/Compression/Actions/Settings.php @@ -3,10 +3,9 @@ namespace Backend\Modules\Compression\Actions; use Backend\Core\Engine\Base\ActionEdit as BackendBaseActionEdit; -use Backend\Core\Engine\Language; +use Backend\Core\Language\Language as BL; use Backend\Core\Engine\Model as BackendModel; use Backend\Core\Engine\Form as BackendForm; -use Backend\Core\Engine\Language as BL; use Backend\Modules\Compression\Engine\Helper; use Backend\Modules\Compression\Engine\Model as BackendCompressionModel; use Symfony\Component\HttpKernel\KernelInterface; @@ -71,7 +70,7 @@ public function __construct(KernelInterface $kernel) /** * Execute the action */ - public function execute() + public function execute(): void { parent::execute(); $this->getCompressionParameters(); @@ -82,9 +81,9 @@ public function execute() /** * Get the api key */ - private function getCompressionParameters() + private function getCompressionParameters(): void { - $removeAction = $this->getParameter('remove'); + $removeAction = $this->getRequest()->query->get('remove'); // We need to remove the api key if (!empty($removeAction)) { @@ -103,7 +102,7 @@ private function getCompressionParameters() /** * Load the compression settings form */ - private function loadCompressionSettingsForm() + private function loadCompressionSettingsForm(): void { // Create compression folder form $this->frmCompressionSettings = new BackendForm('compression'); @@ -121,7 +120,7 @@ private function loadCompressionSettingsForm() if (isset($_POST['folders']) && is_array($_POST['folders'])) { foreach ($_POST['folders'] as $folder) { $this->folders[] = array( - 'path' => (string) $folder, + 'path' => (string)$folder, 'created_on' => BackendModel::getUTCDate() ); } @@ -132,7 +131,7 @@ private function loadCompressionSettingsForm() /** * Validates the compression settings form. */ - private function validateCompressionSettingsForm() + private function validateCompressionSettingsForm(): void { if ($this->frmCompressionSettings->isSubmitted()) { if ($this->frmCompressionSettings->isCorrect()) { @@ -145,8 +144,6 @@ private function validateCompressionSettingsForm() BackendCompressionModel::insertFolders($this->folders); } } - - BackendModel::triggerEvent($this->getModule(), 'after_saved_settings'); $this->redirect(BackendModel::createURLForAction('Settings') . '&report=saved'); } } @@ -155,7 +152,7 @@ private function validateCompressionSettingsForm() /** * Parse the form */ - protected function parse() + protected function parse(): void { parent::parse(); @@ -166,7 +163,7 @@ protected function parse() // Create api key form if (!isset($this->apiKey)) { $this->frmApiKey = new BackendForm('settings'); - $this->frmApiKey->addText('key', $this->apiKey)->setAttribute('placeholder', Language::lbl('YourApiKey')); + $this->frmApiKey->addText('key', $this->apiKey)->setAttribute('placeholder', BL::lbl('YourApiKey')); if ($this->frmApiKey->isSubmitted()) { $this->frmApiKey->getField('key')->isFilled(BL::err('FieldIsRequired')); @@ -179,21 +176,21 @@ protected function parse() } // Parse the form into the template - $this->frmApiKey->parse($this->tpl); + $this->frmApiKey->parse($this->template); } // Show the actual settings form if (isset($this->apiKey)) { $this->loadCompressionSettingsForm(); - $this->tpl->assign('directoryTree', $this->directoryTreeHtml); + $this->template->assign('directoryTree', $this->directoryTreeHtml); $this->validateCompressionSettingsForm(); // Parse the form into the template - $this->frmCompressionSettings->parse($this->tpl); + $this->frmCompressionSettings->parse($this->template); } // Show the API key form if we don't have one set - $this->tpl->assign('apiKey', $this->apiKey); - $this->tpl->assign('folders', array_merge($this->savedDirectories, $this->folders)); + $this->template->assign('apiKey', $this->apiKey); + $this->template->assign('folders', array_merge($this->savedDirectories, $this->folders)); } } diff --git a/src/Backend/Modules/Compression/Ajax/ConsoleErase.php b/src/Backend/Modules/Compression/Ajax/ConsoleErase.php old mode 100644 new mode 100755 index 4d805e7..d28987f --- a/src/Backend/Modules/Compression/Ajax/ConsoleErase.php +++ b/src/Backend/Modules/Compression/Ajax/ConsoleErase.php @@ -4,7 +4,7 @@ use Backend\Core\Engine\Base\AjaxAction as BackendBaseAJAXAction; use Backend\Modules\Compression\Engine\Model as BackendCompressionModel; -use SpoonFilter; +use Symfony\Component\HttpFoundation\Response; /** * This is the console ajax action that will erase the cache file @@ -16,15 +16,16 @@ class ConsoleErase extends BackendBaseAJAXAction /** * Execute the action */ - public function execute() + public function execute(): void { parent::execute(); - $overwrite = (bool) SpoonFilter::getPostValue('overwrite', null, ''); + $overwrite = $this->getRequest()->request->get('overwrite', ''); if ($overwrite) { BackendCompressionModel::writeToCacheFile(''); } - $this->output(self::OK); + // output + $this->output(Response::HTTP_OK); } } diff --git a/src/Backend/Modules/Compression/Ajax/StartCompression.php b/src/Backend/Modules/Compression/Ajax/StartCompression.php old mode 100644 new mode 100755 index eac8cce..a27965d --- a/src/Backend/Modules/Compression/Ajax/StartCompression.php +++ b/src/Backend/Modules/Compression/Ajax/StartCompression.php @@ -6,7 +6,7 @@ use Backend\Core\Engine\Model as BackendModel; use Backend\Modules\Compression\Engine\Model as BackendCompressionModel; use Backend\Modules\Compression\Engine\TinyPNGApi; -use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpFoundation\Response; /** * This is the console ajax action @@ -32,7 +32,7 @@ class StartCompression extends BackendBaseAJAXAction /** * Execute the action */ - public function execute() + public function execute(): void { parent::execute(); @@ -79,6 +79,7 @@ public function execute() BackendCompressionModel::writeToCacheFile("There are no images that can be compressed.", true); } - $this->output(self::OK); + // output + $this->output(Response::HTTP_OK); } } diff --git a/src/Backend/Modules/Compression/Config.php b/src/Backend/Modules/Compression/Config.php old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Cronjobs/CompressImages.php b/src/Backend/Modules/Compression/Cronjobs/CompressImages.php old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Engine/Helper.php b/src/Backend/Modules/Compression/Engine/Helper.php old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Engine/Model.php b/src/Backend/Modules/Compression/Engine/Model.php old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Engine/TinyPNGApi.php b/src/Backend/Modules/Compression/Engine/TinyPNGApi.php old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Engine/cacert.pem b/src/Backend/Modules/Compression/Engine/cacert.pem old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Installer/Data/install.sql b/src/Backend/Modules/Compression/Installer/Data/install.sql old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Installer/Data/locale.xml b/src/Backend/Modules/Compression/Installer/Data/locale.xml old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Installer/Installer.php b/src/Backend/Modules/Compression/Installer/Installer.php old mode 100644 new mode 100755 index 5cc8347..5ecbda9 --- a/src/Backend/Modules/Compression/Installer/Installer.php +++ b/src/Backend/Modules/Compression/Installer/Installer.php @@ -14,7 +14,7 @@ class Installer extends ModuleInstaller /** * Insert an empty admin dashboard sequence */ - private function addDashboardWidget() + private function addDashboardWidget(): void { $compressionWidget = array( 'column' => 'middle', @@ -29,7 +29,7 @@ private function addDashboardWidget() /** * Install the module */ - public function install() + public function install(): void { $this->addModule('Compression'); diff --git a/src/Backend/Modules/Compression/Js/Compression.js b/src/Backend/Modules/Compression/Js/Compression.js old mode 100644 new mode 100755 index 872853e..db80882 --- a/src/Backend/Modules/Compression/Js/Compression.js +++ b/src/Backend/Modules/Compression/Js/Compression.js @@ -126,7 +126,10 @@ jsBackend.compression = // Erase logfile and console first $.ajax({ data: { - fork: { module: 'Compression', action: 'ConsoleErase' } + fork: { + module: 'Compression', + action: 'ConsoleErase' + } }, success: function (result) { if (result.code === 200) { diff --git a/src/Backend/Modules/Compression/Layout/Css/Compression.css b/src/Backend/Modules/Compression/Layout/Css/Compression.css old mode 100644 new mode 100755 diff --git a/src/Backend/Modules/Compression/Layout/Templates/Settings.html.twig b/src/Backend/Modules/Compression/Layout/Templates/Settings.html.twig old mode 100644 new mode 100755 index 9f628e1..d7113f6 --- a/src/Backend/Modules/Compression/Layout/Templates/Settings.html.twig +++ b/src/Backend/Modules/Compression/Layout/Templates/Settings.html.twig @@ -1,159 +1,127 @@ {% extends '/Layout/Templates/base.html.twig' %} {% block content %} + {% if apiKey is empty or folders is empty %}