commit d135589ed37e22d56c940557e8f4cf8bc2bdf5f8
parent b4b90987c815fb6642ecd5c04259e86024185432
Author: markseu <mark2011@mayberg.se>
Date: Sun, 8 Feb 2026 19:08:36 +0100
Updated API and events
Diffstat:
4 files changed, 53 insertions(+), 42 deletions(-)
diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini
@@ -149,14 +149,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
system/themes/copenhagen.png: copenhagen.png, create
Extension: Core
-Version: 0.9.17
+Version: 0.9.18
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
-Published: 2025-11-09 21:35:25
+Published: 2026-02-08 18:41:27
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: corepatch.txt, update
@@ -213,14 +213,14 @@ Status: available
system/workers/dutch.php: dutch.php, create, update
Extension: Edit
-Version: 0.9.12
+Version: 0.9.13
Description: Edit your website in a web browser.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DocumentationLanguage: en, de, sv
-Published: 2025-09-15 13:48:39
+Published: 2026-02-07 21:24:45
Status: available
system/workers/edit.php: edit.php, create, update
system/workers/edit.css: edit.css, create, update
@@ -693,7 +693,7 @@ Extension: Stockholm
Version: 0.9.5
Description: Stockholm is a clean theme.
Designer: Anna Svensson
-Tag: default, theme
+Tag: example, theme
DownloadUrl: https://github.com/annaesvensson/yellow-stockholm/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-stockholm
DocumentationLanguage: en, de, sv
diff --git a/system/extensions/update-installed.ini b/system/extensions/update-installed.ini
@@ -1,14 +1,14 @@
# Datenstrom Yellow update settings for installed extensions
Extension: Core
-Version: 0.9.17
+Version: 0.9.18
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
-Published: 2025-11-09 21:35:25
+Published: 2026-02-08 18:41:27
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: corepatch.txt, update
@@ -20,14 +20,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
-Version: 0.9.12
+Version: 0.9.13
Description: Edit your website in a web browser.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DocumentationLanguage: en, de, sv
-Published: 2025-09-15 13:48:39
+Published: 2026-02-07 21:24:45
Status: available
system/workers/edit.php: edit.php, create, update
system/workers/edit.css: edit.css, create, update
@@ -114,7 +114,7 @@ Extension: Stockholm
Version: 0.9.5
Description: Stockholm is a clean theme.
Designer: Anna Svensson
-Tag: default, theme
+Tag: example, theme
DownloadUrl: https://github.com/annaesvensson/yellow-stockholm/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-stockholm
DocumentationLanguage: en, de, sv
diff --git a/system/workers/core.php b/system/workers/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/annaesvensson/yellow-core
class YellowCore {
- const VERSION = "0.9.17";
+ const VERSION = "0.9.18";
const RELEASE = "0.9";
public $content; // content files
public $media; // media files
@@ -267,7 +267,9 @@ class YellowCore {
if (method_exists($value["object"], "onCommandHelp")) {
$this->lookup->commandHandler = $key;
$output = $value["object"]->onCommandHelp();
- $lines = array_merge($lines, is_array($output) ? $output : array($output));
+ if (!is_null($output)) {
+ $lines = array_merge($lines, is_array($output) ? $output : array($output));
+ }
}
}
usort($lines, "strnatcasecmp");
@@ -701,35 +703,12 @@ class YellowSystem {
// Return different value for system setting
public function getDifferent($key) {
- $array = array_diff($this->getAvailable($key), array($this->get($key)));
+ $array = array_diff($this->yellow->toolbox->enumerate("system", $key), array($this->get($key)));
return reset($array);
}
- // Return available values for system setting
- public function getAvailable($key) {
- $values = array();
- $valueDefault = isset($this->settingsDefaults[$key]) ? $this->settingsDefaults[$key] : "";
- if ($key=="email") {
- foreach ($this->yellow->user->settings as $userKey=>$userValue) {
- array_push($values, $userKey);
- }
- } elseif ($key=="language") {
- foreach ($this->yellow->language->settings as $languageKey=>$languageValue) {
- array_push($values, $languageKey);
- }
- } elseif ($key=="layout") {
- $path = $this->yellow->system->get("coreLayoutDirectory");
- foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.html$/", true, false, false) as $entry) {
- array_push($values, lcfirst(substru($entry, 0, -5)));
- }
- } elseif ($key=="theme") {
- $path = $this->yellow->system->get("coreThemeDirectory");
- foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.css$/", true, false, false) as $entry) {
- array_push($values, lcfirst(substru($entry, 0, -4)));
- }
- }
- return !is_array_empty($values) ? $values : array($valueDefault);
- }
+ // TODO: Remove later, this is only for backwards compatibility
+ public function getAvailable($key) { return $this->yellow->toolbox->enumerate("system", $key); }
// Return system settings
public function getSettings($filterStart = "", $filterEnd = "") {
@@ -2927,6 +2906,37 @@ class YellowToolbox {
}
return $value;
}
+
+ // Return possible values
+ public function enumerate($action, $text) {
+ $values = array();
+ foreach ($this->yellow->extension->data as $key=>$value) {
+ if (method_exists($value["object"], "onEnumerate")) {
+ $output = $value["object"]->onEnumerate($action, $text);
+ if (!is_null($output)) {
+ $lines = array_merge($values, is_array($output) ? $output : array($output));
+ }
+ }
+ }
+ if ($action=="system") {
+ if ($text=="email") {
+ foreach ($this->yellow->user->settings as $userKey=>$userValue) {
+ array_push($values, $userKey);
+ }
+ } elseif ($text=="language") {
+ foreach ($this->yellow->language->settings as $languageKey=>$languageValue) {
+ array_push($values, $languageKey);
+ }
+ } elseif ($text=="theme") {
+ $path = $this->yellow->system->get("coreThemeDirectory");
+ foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.css$/", true, false, false) as $entry) {
+ array_push($values, substru($entry, 0, -4));
+ }
+ }
+ usort($values, "strnatcasecmp");
+ }
+ return $values;
+ }
// Send email message
public function mail($action, $headers, $message) {
@@ -3190,8 +3200,9 @@ class YellowPage {
if (!$this->isHeader("Content-Type")) $this->setHeader("Content-Type", "text/html; charset=utf-8");
if (!$this->isHeader("Content-Modified")) $this->setHeader("Content-Modified", $this->getModified(true));
if (!$this->isHeader("Last-Modified")) $this->setHeader("Last-Modified", $this->getLastModified(true));
- $fileNameTheme = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".css";
- if (!is_file($fileNameTheme)) {
+ $name = $this->yellow->lookup->normaliseName($this->get("theme"));
+ if (!is_file($this->yellow->system->get("coreThemeDirectory").$name.".css") &&
+ !in_array($name, $this->yellow->toolbox->enumerate("system", "theme"))) {
$this->error(500, "Theme '".$this->get("theme")."' does not exist!");
}
if (!$this->yellow->language->isExisting($this->get("language"))) {
diff --git a/system/workers/edit.php b/system/workers/edit.php
@@ -2,7 +2,7 @@
// Edit extension, https://github.com/annaesvensson/yellow-edit
class YellowEdit {
- const VERSION = "0.9.12";
+ const VERSION = "0.9.13";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@@ -1253,7 +1253,7 @@ class YellowEditResponse {
$data["coreExtensions"][$key] = $value["class"];
}
$data["coreLanguages"] = array();
- foreach ($this->yellow->system->getAvailable("language") as $language) {
+ foreach ($this->yellow->toolbox->enumerate("system", "language") as $language) {
$data["coreLanguages"][$language] = $this->yellow->language->getTextHtml("languageDescription", $language);
}
$data["editSettingsActions"] = $this->getSettingsActions();