commit ab67f1407b1cc0c99b69bf47b43609893106bedc
parent dc7d8e402b2e9815f389e0222c8d34a83ee89872
Author: markseu <mark2011@mayberg.se>
Date: Thu, 18 May 2023 20:52:56 +0200
Updated API, spring remix
Diffstat:
4 files changed, 53 insertions(+), 57 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/annaesvensson/yellow-core
class YellowCore {
- const VERSION = "0.8.112";
+ const VERSION = "0.8.113";
const RELEASE = "0.8.22";
public $content; // content files
public $media; // media files
@@ -283,7 +283,7 @@ class YellowCore {
// Handle startup
public function startup() {
- if ($this->isLoaded()) {
+ if (isset($this->extension->data)) {
foreach ($this->extension->data as $key=>$value) {
if (method_exists($value["object"], "onStartup")) $value["object"]->onStartup();
}
@@ -292,7 +292,7 @@ class YellowCore {
// Handle shutdown
public function shutdown() {
- if ($this->isLoaded()) {
+ if (isset($this->extension->data)) {
foreach ($this->extension->data as $key=>$value) {
if (method_exists($value["object"], "onShutdown")) $value["object"]->onShutdown();
}
@@ -319,7 +319,7 @@ class YellowCore {
public function getRequestInformation($scheme = "", $address = "", $base = "") {
if (is_string_empty($scheme) && is_string_empty($address) && is_string_empty($base)) {
$url = $this->system->get("coreServerUrl");
- if ($url=="auto" || $this->isCommandLine()) $url = $this->toolbox->detectServerUrl();
+ if ($url=="auto" || $this->lookup->isCommandLine()) $url = $this->toolbox->detectServerUrl();
list($scheme, $address, $base) = $this->lookup->getUrlInformation($url);
$this->system->set("coreServerScheme", $scheme);
$this->system->set("coreServerAddress", $address);
@@ -373,18 +373,9 @@ class YellowCore {
return $this->lookup->commandHandler;
}
- // Check if running at command line
- public function isCommandLine() {
- return isset($this->lookup->commandHandler);
- }
-
- // Check if all extensions loaded
- public function isLoaded() {
- return isset($this->extension->data);
- }
-
// TODO: remove later, for backwards compatibility
public function log($action, $message) { $this->toolbox->log($action, $message); }
+ public function isCommandLine() { return $this->lookup->isCommandLine(); }
}
class YellowContent {
@@ -1875,6 +1866,11 @@ class YellowLookup {
$systemDirectoryLength = strlenu($this->yellow->system->get("coreSystemDirectory"));
return substru($fileName, 0, $systemDirectoryLength)==$this->yellow->system->get("coreSystemDirectory");
}
+
+ // Check if running at command line
+ public function isCommandLine() {
+ return isset($this->commandHandler);
+ }
}
class YellowToolbox {
@@ -3241,7 +3237,7 @@ class YellowPage {
return htmlspecialchars($this->getDateFormatted($key, $format));
}
- // Return page content, HTML encoded or raw format
+ // Return page content data, HTML encoded or raw format
public function getContent($rawFormat = false) {
if ($rawFormat) {
$this->parseMetaUpdate();
@@ -3253,6 +3249,38 @@ class YellowPage {
return $text;
}
+ // Return page extra data, HTML encoded
+ public function getExtra($name) {
+ $output = "";
+ foreach ($this->yellow->extension->data as $key=>$value) {
+ if (method_exists($value["object"], "onParsePageExtra")) {
+ $outputExtension = $value["object"]->onParsePageExtra($this, $name);
+ if (!is_null($outputExtension)) $output .= $outputExtension;
+ }
+ }
+ if ($name=="header") {
+ $fileNameTheme = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".css";
+ if (is_file($fileNameTheme)) {
+ $locationTheme = $this->yellow->system->get("coreServerBase").
+ $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".css";
+ $output .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"$locationTheme\" />\n";
+ }
+ $fileNameScript = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".js";
+ if (is_file($fileNameScript)) {
+ $locationScript = $this->yellow->system->get("coreServerBase").
+ $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".js";
+ $output .= "<script type=\"text/javascript\" src=\"$locationScript\"></script>\n";
+ }
+ $fileNameFavicon = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".png";
+ if (is_file($fileNameFavicon)) {
+ $locationFavicon = $this->yellow->system->get("coreServerBase").
+ $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".png";
+ $output .= "<link rel=\"icon\" type=\"image/png\" href=\"$locationFavicon\" />\n";
+ }
+ }
+ return $output;
+ }
+
// Return parent page, null if none
public function getParent() {
$parentLocation = $this->yellow->content->getParentLocation($this->location);
@@ -3344,38 +3372,6 @@ class YellowPage {
return $this->isHeader($key) ? $this->headerData[$key] : "";
}
- // Return page extra data
- public function getExtra($name) {
- $output = "";
- foreach ($this->yellow->extension->data as $key=>$value) {
- if (method_exists($value["object"], "onParsePageExtra")) {
- $outputExtension = $value["object"]->onParsePageExtra($this, $name);
- if (!is_null($outputExtension)) $output .= $outputExtension;
- }
- }
- if ($name=="header") {
- $fileNameTheme = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".css";
- if (is_file($fileNameTheme)) {
- $locationTheme = $this->yellow->system->get("coreServerBase").
- $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".css";
- $output .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"$locationTheme\" />\n";
- }
- $fileNameScript = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".js";
- if (is_file($fileNameScript)) {
- $locationScript = $this->yellow->system->get("coreServerBase").
- $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".js";
- $output .= "<script type=\"text/javascript\" src=\"$locationScript\"></script>\n";
- }
- $fileNameFavicon = $this->yellow->system->get("coreThemeDirectory").$this->yellow->lookup->normaliseName($this->get("theme")).".png";
- if (is_file($fileNameFavicon)) {
- $locationFavicon = $this->yellow->system->get("coreServerBase").
- $this->yellow->system->get("coreThemeLocation").$this->yellow->lookup->normaliseName($this->get("theme")).".png";
- $output .= "<link rel=\"icon\" type=\"image/png\" href=\"$locationFavicon\" />\n";
- }
- }
- return $output;
- }
-
// Set page response output
public function setOutput($output) {
$this->outputData = $output;
diff --git a/system/extensions/edit.php b/system/extensions/edit.php
@@ -2,7 +2,7 @@
// Edit extension, https://github.com/annaesvensson/yellow-edit
class YellowEdit {
- const VERSION = "0.8.73";
+ const VERSION = "0.8.74";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@@ -1599,8 +1599,8 @@ class YellowEditResponse {
$mailHeaders = array(
"To" => "$userName <$userEmail>",
"From" => "$sitename <$siteEmail>",
- "Date" => date(DATE_RFC2822),
"Subject" => $subject,
+ "Date" => date(DATE_RFC2822),
"Mime-Version" => "1.0",
"Content-Type" => "text/plain; charset=utf-8",
"X-Request-Url" => "$scheme://$address$base");
diff --git a/system/extensions/static.php b/system/extensions/static.php
@@ -2,7 +2,7 @@
// Static extension, https://github.com/annaesvensson/static-command
class YellowStatic {
- const VERSION = "0.8.48";
+ const VERSION = "0.8.49";
public $yellow; // access to API
public $files; // number of files
public $links; // number of links
@@ -462,7 +462,7 @@ class YellowStatic {
$location .= $this->yellow->toolbox->getLocationArguments();
$fileName = rtrim($this->yellow->system->get("coreCacheDirectory"), "/").$location;
if (!$this->yellow->lookup->isFileLocation($location)) $fileName .= $this->yellow->system->get("staticDefaultFile");
- if (is_file($fileName) && is_readable($fileName) && !$this->yellow->isCommandLine()) {
+ if (is_file($fileName) && is_readable($fileName) && !$this->yellow->lookup->isCommandLine()) {
$statusCode = $this->yellow->sendFile(200, $fileName, true);
}
}
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -1,11 +1,11 @@
# Datenstrom Yellow update settings
Extension: Core
-Version: 0.8.112
+Version: 0.8.113
Description: Core functionality of the website.
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/core.zip
-Published: 2023-05-12 14:32:32
+Published: 2023-05-18 17:55:38
Developer: Mark Seuffert, David Fehrmann
Tag: feature
system/extensions/core.php: core.php, create, update
@@ -17,11 +17,11 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
-Version: 0.8.73
+Version: 0.8.74
Description: Edit your website in a web browser.
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/edit.zip
-Published: 2023-05-11 17:18:21
+Published: 2023-05-18 18:03:30
Developer: Anna Svensson
Tag: feature
system/extensions/edit.php: edit.php, create, update
@@ -86,11 +86,11 @@ Tag: feature
system/extensions/meta.php: meta.php, create, update
Extension: Static
-Version: 0.8.48
+Version: 0.8.49
Description: Build a static website.
DocumentationUrl: https://github.com/annaesvensson/yellow-static
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/static.zip
-Published: 2023-04-16 23:50:49
+Published: 2023-05-18 17:56:17
Developer: Anna Svensson
Tag: feature
system/extensions/static.php: static.php, create, update