mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit 54b4f78a75ca114a26316ec0f92aa58a4b984a97
parent 8ce84205c760456e9eda2a898f64aa0757ad4ad6
Author: markseu <mark2011@mayberg.se>
Date:   Thu,  6 Sep 2018 13:23:56 +0200

Updated plugins, refactoring

Diffstat:
Msystem/plugins/bundle.php | 8++++----
Msystem/plugins/command.php | 38+++++++++++++++++++-------------------
Msystem/plugins/core.php | 10+++++-----
Msystem/plugins/edit.php | 8++++----
Msystem/plugins/image.php | 8++++----
5 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/system/plugins/bundle.php b/system/plugins/bundle.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowBundle { - const VERSION = "0.7.3"; + const VERSION = "0.7.4"; public $yellow; //access to API // Handle initialisation @@ -26,14 +26,14 @@ class YellowBundle { public function onCommand($args) { list($command) = $args; switch ($command) { - case "clean": $statusCode = $this->cleanCommand($args); break; + case "clean": $statusCode = $this->processCommandClean($args); break; default: $statusCode = 0; } return $statusCode; } - // Clean bundles - public function cleanCommand($args) { + // Process command to clean bundles + public function processCommandClean($args) { $statusCode = 0; list($command, $path) = $args; if ($path=="all") { diff --git a/system/plugins/command.php b/system/plugins/command.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowCommand { - const VERSION = "0.7.10"; + const VERSION = "0.7.11"; public $yellow; //access to API public $files; //number of files public $links; //number of links @@ -21,11 +21,11 @@ class YellowCommand { public function onCommand($args) { list($command) = $args; switch ($command) { - case "": $statusCode = $this->helpCommand(); break; - case "build": $statusCode = $this->buildCommand($args); break; - case "check": $statusCode = $this->checkCommand($args); break; - case "clean": $statusCode = $this->cleanCommand($args); break; - case "version": $statusCode = $this->versionCommand($args); break; + case "": $statusCode = $this->processCommandHelp(); break; + case "build": $statusCode = $this->processCommandBuild($args); break; + case "check": $statusCode = $this->processCommandCheck($args); break; + case "clean": $statusCode = $this->processCommandClean($args); break; + case "version": $statusCode = $this->processCommandVersion($args); break; default: $statusCode = 0; } return $statusCode; @@ -40,8 +40,8 @@ class YellowCommand { return $help; } - // Show available commands - public function helpCommand() { + // Process command to show available commands + public function processCommandHelp() { echo "Datenstrom Yellow ".YellowCore::VERSION."\n"; $lineCounter = 0; foreach ($this->getCommandHelp() as $line) { @@ -50,8 +50,8 @@ class YellowCommand { return 200; } - // Build static website - public function buildCommand($args) { + // Process command to build static website + public function processCommandBuild($args) { $statusCode = 0; list($command, $path, $location) = $args; if (empty($location) || $location[0]=="/") { @@ -221,8 +221,8 @@ class YellowCommand { } } - // Check static files for broken links - public function checkCommand($args) { + // Process command to check static files for broken links + public function processCommandCheck($args) { $statusCode = 0; list($command, $path, $location) = $args; if (empty($location) || $location[0]=="/") { @@ -243,7 +243,7 @@ class YellowCommand { return $statusCode; } - // Check static files + // Check static files for broken links public function checkStaticFiles($path, $locationFilter) { $path = rtrim(empty($path) ? $this->yellow->config->get("staticDir") : $path, "/"); $this->files = $this->links = 0; @@ -354,8 +354,8 @@ class YellowCommand { } } - // Clean static files - public function cleanCommand($args) { + // Process command to clean static files + public function processCommandClean($args) { $statusCode = 0; list($command, $path, $location) = $args; if (empty($location) || $location[0]=="/") { @@ -373,7 +373,7 @@ class YellowCommand { $statusCode = 200; $path = rtrim(empty($path) ? $this->yellow->config->get("staticDir") : $path, "/"); if (empty($location)) { - $statusCode = max($statusCode, $this->commandBroadcast("clean", "all")); + $statusCode = max($statusCode, $this->broadcastCommand("clean", "all")); $statusCode = max($statusCode, $this->cleanStaticDirectory($path)); } else { if ($this->yellow->lookup->isFileLocation($location)) { @@ -411,7 +411,7 @@ class YellowCommand { } // Broadcast command to other plugins - public function commandBroadcast($args) { + public function broadcastCommand($args) { $statusCode = 0; foreach ($this->yellow->plugins->plugins as $key=>$value) { if ($key=="command") continue; @@ -423,8 +423,8 @@ class YellowCommand { return $statusCode; } - // Show software version and updates - public function versionCommand($args) { + // Process command to show software version and updates + public function processCommandVersion($args) { $serverVersion = $this->yellow->toolbox->getServerVersion(); echo "Datenstrom Yellow ".YellowCore::VERSION.", PHP ".PHP_VERSION.", $serverVersion\n"; list($statusCode, $dataCurrent) = $this->getSoftwareVersion(); diff --git a/system/plugins/core.php b/system/plugins/core.php @@ -2977,17 +2977,17 @@ class YellowToolbox { // Detect web browser language public function detectBrowserLanguage($languages, $languageDefault) { - $language = $languageDefault; + $languageFound = $languageDefault; if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { foreach (preg_split("/\s*,\s*/", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $string) { - $tokens = explode(";", $string); - if (in_array($tokens[0], $languages)) { - $language = $tokens[0]; + list($language) = explode(";", $string); + if (in_array($language, $languages)) { + $languageFound = $language; break; } } } - return $language; + return $languageFound; } // Detect image dimensions and type for gif/jpg/png/svg diff --git a/system/plugins/edit.php b/system/plugins/edit.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowEdit { - const VERSION = "0.7.29"; + const VERSION = "0.7.30"; public $yellow; //access to API public $response; //web response public $users; //user accounts @@ -122,7 +122,7 @@ class YellowEdit { public function onCommand($args) { list($command) = $args; switch ($command) { - case "user": $statusCode = $this->userCommand($args); break; + case "user": $statusCode = $this->processCommandUser($args); break; default: $statusCode = 0; } return $statusCode; @@ -133,8 +133,8 @@ class YellowEdit { return "user [option email password name]\n"; } - // Update user account - public function userCommand($args) { + // Process command to update user account + public function processCommandUser($args) { list($command, $option) = $args; switch ($option) { case "": $statusCode = $this->userShow($args); break; diff --git a/system/plugins/image.php b/system/plugins/image.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowImage { - const VERSION = "0.7.5"; + const VERSION = "0.7.6"; public $yellow; //access to API public $graphicsLibrary; //graphics library support? (boolean) @@ -72,14 +72,14 @@ class YellowImage { public function onCommand($args) { list($command) = $args; switch ($command) { - case "clean": $statusCode = $this->cleanCommand($args); break; + case "clean": $statusCode = $this->processCommandClean($args); break; default: $statusCode = 0; } return $statusCode; } - // Clean thumbnails - public function cleanCommand($args) { + // Process command to clean thumbnails + public function processCommandClean($args) { $statusCode = 0; list($command, $path) = $args; if ($path=="all") {