commit 6e290d1788e42c3dd5c3078ab5c455bcbb63c662
parent bf80348802fb23dee4846de37639f9951e025e24
Author: markseu <mark2011@mayberg.se>
Date: Thu, 14 Apr 2022 18:05:56 +0200
Updated command line, about command with links
Diffstat:
4 files changed, 64 insertions(+), 46 deletions(-)
diff --git a/system/extensions/command.php b/system/extensions/command.php
@@ -2,7 +2,7 @@
// Command extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/command
class YellowCommand {
- const VERSION = "0.8.34";
+ const VERSION = "0.8.35";
public $yellow; // access to API
public $files; // number of files
public $links; // number of links
@@ -46,11 +46,19 @@ class YellowCommand {
// Process command to show current version and extensions
public function processCommandAbout($command, $text) {
- echo "Datenstrom Yellow ".YellowCore::RELEASE."\n";
- $dataCurrent = $this->yellow->extension->data;
- uksort($dataCurrent, "strnatcasecmp");
- foreach ($dataCurrent as $key=>$value) {
- echo ucfirst($key)." ".$value["version"]."\n";
+ echo "Datenstrom Yellow ".YellowCore::RELEASE." - https://datenstrom.se/yellow/\n";
+ if ($this->yellow->extension->isExisting("update")) {
+ list($dummy, $settingsCurrent) = $this->yellow->extension->get("update")->getExtensionSettings(false);
+ foreach ($settingsCurrent as $key=>$value) {
+ $documentation = $value->isExisting("helpUrl") ? $value->get("helpUrl") : "No documentation available";
+ echo ucfirst($key)." ".$value->get("version")." - $documentation\n";
+ }
+ } else {
+ $dataCurrent = $this->yellow->extension->data;
+ uksort($dataCurrent, "strnatcasecmp");
+ foreach ($dataCurrent as $key=>$value) {
+ echo ucfirst($key)." ".$value["version"]."\n";
+ }
}
return 200;
}
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
- const VERSION = "0.8.66";
+ const VERSION = "0.8.67";
const RELEASE = "0.8.19";
public $page; // current page
public $content; // content files
@@ -589,31 +589,8 @@ class YellowPage {
}
}
if (is_null($output)) {
- if ($name=="yellow" && $type=="inline") {
- if ($text=="release") $output = "Datenstrom Yellow ".YellowCore::RELEASE;
- if ($text=="about") {
- $output = "Datenstrom Yellow ".YellowCore::RELEASE."<br />\n";
- $dataCurrent = $this->yellow->extension->data;
- uksort($dataCurrent, "strnatcasecmp");
- foreach ($dataCurrent as $key=>$value) {
- $output .= ucfirst($key)." ".$value["version"]."<br />\n";
- }
- }
- if ($text=="log") {
- $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreWebsiteFile");
- $fileHandle = @fopen($fileName, "r");
- if ($fileHandle) {
- $dataBufferSize = 512;
- fseek($fileHandle, max(0, filesize($fileName) - $dataBufferSize));
- $dataBuffer = fread($fileHandle, $dataBufferSize);
- if (strlenb($dataBuffer)==$dataBufferSize) {
- $dataBuffer = ($pos = strposu($dataBuffer, "\n")) ? substru($dataBuffer, $pos+1) : $dataBuffer;
- }
- fclose($fileHandle);
- }
- $output = str_replace("\n", "<br />\n", htmlspecialchars($dataBuffer));
- }
- if ($text=="error") $output = $this->get("pageError");
+ if ($name=="yellow" && $type=="inline" && $text=="error") {
+ $output = $this->get("pageError");
}
}
if ($this->yellow->system->get("coreDebugMode")>=3 && !empty($name)) {
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -11,21 +11,21 @@ Tag: feature
system/extensions/bundle.php: bundle.php, create, update
Extension: Command
-Version: 0.8.34
+Version: 0.8.35
Description: Command line of the website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/command
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/command.zip
-Published: 2022-04-12 17:26:01
+Published: 2022-04-14 16:40:15
Developer: Datenstrom
Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
-Version: 0.8.66
+Version: 0.8.67
Description: Core functionality of the website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2022-04-13 21:43:31
+Published: 2022-04-14 16:29:41
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update
@@ -131,11 +131,11 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea
system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful
Extension: Update
-Version: 0.8.67
+Version: 0.8.68
Description: Keep your website up to date.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/update
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/update.zip
-Published: 2022-04-13 18:51:09
+Published: 2022-04-14 17:32:03
Developer: Datenstrom
Tag: feature
system/extensions/update.php: update.php, create, update
diff --git a/system/extensions/update.php b/system/extensions/update.php
@@ -2,7 +2,7 @@
// Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update
class YellowUpdate {
- const VERSION = "0.8.67";
+ const VERSION = "0.8.68";
const PRIORITY = "2";
public $yellow; // access to API
public $updates; // number of updates
@@ -170,6 +170,38 @@ class YellowUpdate {
return $help;
}
+ // Parse page content shortcut
+ public function onParseContentShortcut($page, $name, $text, $type) {
+ $output = null;
+ if ($name=="yellow" && $type=="inline") {
+ if ($text=="release") $output = "Datenstrom Yellow ".YellowCore::RELEASE;
+ if ($text=="about") {
+ $url = $this->yellow->language->getText("editYellowUrl", $page->get("language"));
+ $output = "Datenstrom Yellow ".YellowCore::RELEASE." - <a href=\"".htmlspecialchars($url)."\">".htmlspecialchars($url)."</a><br />\n";
+ list($dummy, $settingsCurrent) = $this->getExtensionSettings(false);
+ foreach ($settingsCurrent as $key=>$value) {
+ $documentation = $value->isExisting("helpUrl") ? "<a href=\"".htmlspecialchars($value->get("helpUrl"))."\">".htmlspecialchars($value->get("helpUrl"))."</a>" : "No documentation available";
+ $output .= ucfirst($key)." ".$value->get("version")." - $documentation<br />\n";
+ }
+ }
+ if ($text=="log") {
+ $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreWebsiteFile");
+ $fileHandle = @fopen($fileName, "r");
+ if ($fileHandle) {
+ $dataBufferSize = 512;
+ fseek($fileHandle, max(0, filesize($fileName) - $dataBufferSize));
+ $dataBuffer = fread($fileHandle, $dataBufferSize);
+ if (strlenb($dataBuffer)==$dataBufferSize) {
+ $dataBuffer = ($pos = strposu($dataBuffer, "\n")) ? substru($dataBuffer, $pos+1) : $dataBuffer;
+ }
+ fclose($fileHandle);
+ }
+ $output = str_replace("\n", "<br />\n", htmlspecialchars($dataBuffer));
+ }
+ }
+ return $output;
+ }
+
// Process command to install extensions
public function processCommandInstall($command, $text) {
$extensions = $this->getExtensionsFromText($text);
@@ -182,7 +214,7 @@ class YellowUpdate {
echo "Yellow $command: Website ".($statusCode!=200 ? "not " : "")."updated";
echo ", $this->updates extension".($this->updates!=1 ? "s" : "")." installed\n";
} else {
- $statusCode = $this->showExtensions();
+ $statusCode = $this->showExtensions(true);
}
return $statusCode;
}
@@ -198,7 +230,7 @@ class YellowUpdate {
echo "Yellow $command: Website ".($statusCode!=200 ? "not " : "")."updated";
echo ", $this->updates extension".($this->updates!=1 ? "s" : "")." uninstalled\n";
} else {
- $statusCode = $this->showExtensions();
+ $statusCode = $this->showExtensions(false);
}
return $statusCode;
}
@@ -261,14 +293,15 @@ class YellowUpdate {
}
// Show extensions
- public function showExtensions() {
- list($statusCode, $settingsLatest) = $this->getExtensionSettings(true);
- foreach ($settingsLatest as $key=>$value) {
- $description = $text = $value->get("description");
+ public function showExtensions($latest) {
+ list($statusCode, $settings) = $this->getExtensionSettings($latest);
+ foreach ($settings as $key=>$value) {
+ $text = $value->isExisting("description") ? $value->get("description") : "No description available.";
+ $description = $text;
if ($value->isExisting("developer")) $description = "$text Developed by ".$value["developer"].".";
if ($value->isExisting("designer")) $description = "$text Designed by ".$value["designer"].".";
if ($value->isExisting("translator")) $description = "$text Translated by ".$value["translator"].".";
- echo ucfirst($key).": $description\n";
+ echo ucfirst($key)." - $description\n";
}
if ($statusCode!=200) echo "ERROR checking extensions: ".$this->yellow->page->get("pageError")."\n";
return $statusCode;