commit 8d60be09b33f3aec6407f9505eea46251c837c9e
parent c5358c47afee51982b07c91895fd50ea667b47d5
Author: markseu <mark2011@mayberg.se>
Date: Mon, 1 Apr 2024 19:01:16 +0200
Updated API
Diffstat:
9 files changed, 54 insertions(+), 81 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.128";
+ const VERSION = "0.8.129";
const RELEASE = "0.8.23";
public $content; // content files
public $media; // media files
@@ -385,25 +385,9 @@ class YellowContent {
}
// Return page collection with top-level navigation
- public function top($showInvisible = false, $showOnePager = true) {
+ public function top($showInvisible = false) {
$rootLocation = $this->getRootLocation($this->yellow->page->location);
- $pages = $this->getChildren($rootLocation, $showInvisible);
- if (count($pages)==1 && $showOnePager) {
- $scheme = $this->yellow->page->scheme;
- $address = $this->yellow->page->address;
- $base = $this->yellow->page->base;
- $one = ($pages->offsetGet(0)->location!=$this->yellow->page->location) ? $pages->offsetGet(0) : $this->yellow->page;
- preg_match_all("/<h(\d) id=\"([^\"]+)\">(.*?)<\/h\d>/i", $one->getContentHtml(), $matches, PREG_SET_ORDER);
- foreach ($matches as $match) {
- if ($match[1]==2) {
- $page = new YellowPage($this->yellow);
- $page->setRequestInformation($scheme, $address, $base, $one->location."#".$match[2], $one->fileName, false);
- $page->parseMeta("---\nTitle: $match[3]\n---\n");
- $pages->append($page);
- }
- }
- }
- return $pages;
+ return $this->getChildren($rootLocation, $showInvisible);
}
// Return page collection with path ancestry
@@ -2013,8 +1997,13 @@ class YellowToolbox {
}
return $entries;
}
+
+ // Return directory information, modification date and file count
+ public function getDirectoryInformation($path) {
+ return $this->getDirectoryInformationRecursive($path, 1);
+ }
- // Return directory information recursively, Unix time and file count
+ // Return directory information recursively, modification date and file count
public function getDirectoryInformationRecursive($path, $levelMax = 0) {
--$levelMax;
$modified = $fileCount = 0;
@@ -2026,8 +2015,8 @@ class YellowToolbox {
$modified = max($modified, $this->getFileModified("$path/$entry"));
if (is_file("$path/$entry")) ++$fileCount;
}
- rewinddir($directoryHandle);
if ($levelMax!=0) {
+ rewinddir($directoryHandle);
while (($entry = readdir($directoryHandle))!==false) {
if (substru($entry, 0, 1)==".") continue;
if (is_dir("$path/$entry")) {
@@ -2037,6 +2026,7 @@ class YellowToolbox {
}
}
}
+ closedir($directoryHandle);
}
return array($modified, $fileCount);
}
@@ -3100,7 +3090,7 @@ class YellowPage {
$output = $value["object"]->onParseContentElement($this, $name, $text, $attrributes, $type);
if (!is_null($output)) break;
}
- if (method_exists($value["object"], "onParseContentShortcut")) {
+ if (method_exists($value["object"], "onParseContentShortcut")) { //TODO: remove later, for backwards compatibility
$output = $value["object"]->onParseContentShortcut($this, $name, $text, $type);
if (!is_null($output)) break;
}
@@ -3116,25 +3106,8 @@ class YellowPage {
return $output;
}
- // Parse page content shortcut
- public function parseContentShortcut($name, $text, $type) {
- $output = null;
- foreach ($this->yellow->extension->data as $key=>$value) {
- if (method_exists($value["object"], "onParseContentShortcut")) {
- $output = $value["object"]->onParseContentShortcut($this, $name, $text, $type);
- if (!is_null($output)) break;
- }
- }
- if (is_null($output)) {
- if ($name=="yellow" && $type=="inline" && $text=="error") {
- $output = $this->errorMessage;
- }
- }
- if ($this->yellow->system->get("coreDebugMode")>=3 && !is_string_empty($name)) {
- echo "YellowPage::parseContentShortcut name:$name type:$type<br/>\n";
- }
- return $output;
- }
+ // TODO: remove later, for backwards compatibility
+ public function parseContentShortcut($name, $text, $type) { return $this->parseContentElement($name, $text, "", $type); }
// Parse page
public function parsePage() {
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.77";
+ const VERSION = "0.8.78";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@@ -93,8 +93,8 @@ class YellowEdit {
rtrim($this->yellow->system->get("editLocation"), "/").$page->location));
}
- // Handle page content of shortcut
- public function onParseContentShortcut($page, $name, $text, $type) {
+ // Handle page content element
+ public function onParseContentElement($page, $name, $text, $attributes, $type) {
$output = null;
if ($name=="edit" && $type=="inline") {
list($target, $description) = $this->yellow->toolbox->getTextList($text, " ", 2);
diff --git a/system/extensions/image.php b/system/extensions/image.php
@@ -2,7 +2,7 @@
// Image extension, https://github.com/annaesvensson/yellow-image
class YellowImage {
- const VERSION = "0.8.19";
+ const VERSION = "0.8.20";
public $yellow; // access to API
// Handle initialisation
@@ -26,8 +26,8 @@ class YellowImage {
}
}
- // Handle page content of shortcut
- public function onParseContentShortcut($page, $name, $text, $type) {
+ // Handle page content element
+ public function onParseContentElement($page, $name, $text, $attributes, $type) {
$output = null;
if ($name=="image" && $type=="inline") {
list($name, $alt, $style, $width, $height) = $this->yellow->toolbox->getTextArguments($text);
diff --git a/system/extensions/install-blog.bin b/system/extensions/install-blog.bin
Binary files differ.
diff --git a/system/extensions/install-wiki.bin b/system/extensions/install-wiki.bin
Binary files differ.
diff --git a/system/extensions/markdown.php b/system/extensions/markdown.php
@@ -2,7 +2,7 @@
// Markdown extension, https://github.com/annaesvensson/yellow-markdown
class YellowMarkdown {
- const VERSION = "0.8.26";
+ const VERSION = "0.8.27";
public $yellow; // access to API
// Handle initialisation
@@ -3887,13 +3887,13 @@ class YellowMarkdownParser extends MarkdownExtraParser {
// Handle shortcuts, block style
public function _doAutoLinks_shortcutBlock_callback($matches) {
- $output = $this->page->parseContentShortcut($matches[1], trim($matches[2]), "block");
+ $output = $this->page->parseContentElement($matches[1], trim($matches[2]), "", "block");
return is_null($output) ? $matches[0] : $this->hashBlock($output);
}
// Handle shortcuts, inline style
public function _doAutoLinks_shortcutInline_callback($matches) {
- $output = $this->page->parseContentShortcut($matches[1], trim($matches[2]), "inline");
+ $output = $this->page->parseContentElement($matches[1], trim($matches[2]), "", "inline");
return is_null($output) ? $matches[0] : $this->hashPart($output);
}
@@ -3905,7 +3905,7 @@ class YellowMarkdownParser extends MarkdownExtraParser {
// Handle shortcuts, symbol style
public function _doAutoLinks_shortcutSymbol_callback($matches) {
- $output = $this->page->parseContentShortcut("", $matches[1], "symbol");
+ $output = $this->page->parseContentElement("", $matches[1], "", "symbol");
return is_null($output) ? $matches[0] : $this->hashPart($output);
}
@@ -3913,7 +3913,7 @@ class YellowMarkdownParser extends MarkdownExtraParser {
public function _doFencedCodeBlocks_callback($matches) {
$text = $matches[4];
$name = is_string_empty($matches[2]) ? "" : trim("$matches[2] $matches[3]");
- $output = $this->page->parseContentShortcut($name, $text, "code");
+ $output = $this->page->parseContentElement($name, $text, "", "code");
if (is_null($output)) {
$attr = $this->doExtraAttributes("pre", ".$matches[2] $matches[3]");
$output = "<pre$attr><code>".htmlspecialchars($text, ENT_NOQUOTES)."</code></pre>";
diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini
@@ -44,14 +44,14 @@ system/themes/berlin-opensans-light.woff: berlin-opensans-light.woff, create, up
system/themes/berlin-opensans-regular.woff: berlin-opensans-regular.woff, create, update, careful
Extension: Blog
-Version: 0.8.30
+Version: 0.8.31
Description: Blog for your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-blog/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-blog
DocumentationLanguage: en, de, sv
-Published: 2023-11-01 17:49:02
+Published: 2024-04-01 18:52:01
Status: available
system/extensions/blog.php: blog.php, create, update
system/layouts/blog.html: blog.html, create, update, careful
@@ -148,14 +148,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
system/themes/copenhagen.png: copenhagen.png, create
Extension: Core
-Version: 0.8.128
+Version: 0.8.129
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: 2024-03-30 17:29:58
+Published: 2024-04-01 18:44:16
Status: available
system/extensions/core.php: core.php, create, update
system/layouts/default.html: default.html, create, update, careful
@@ -211,14 +211,14 @@ Status: available
system/extensions/dutch.php: dutch.php, create, update
Extension: Edit
-Version: 0.8.77
+Version: 0.8.78
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: 2023-12-20 23:19:46
+Published: 2024-04-01 18:48:05
Status: available
system/extensions/edit.php: edit.php, create, update
system/extensions/edit.css: edit.css, create, update
@@ -431,14 +431,14 @@ system/extensions/icon.css: icon.css, create, update
system/extensions/icon.woff: icon.woff, create, update
Extension: Image
-Version: 0.8.19
+Version: 0.8.20
Description: Add images and thumbnails.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-image/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-image
DocumentationLanguage: en, de, sv
-Published: 2023-04-16 23:50:53
+Published: 2024-04-01 18:49:07
Status: available
system/extensions/image.php: image.php, create, update
media/images/photo.jpg: photo.jpg, create, optional
@@ -501,14 +501,14 @@ system/themes/karlskrona.css: karlskrona.css, create, update, careful
system/themes/karlskrona.png: karlskrona.png, create
Extension: Markdown
-Version: 0.8.26
+Version: 0.8.27
Description: Text formatting for humans.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-markdown/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-markdown
DocumentationLanguage: en, de, sv
-Published: 2023-09-18 20:49:33
+Published: 2024-04-01 18:41:04
Status: available
system/extensions/markdown.php: markdown.php, create, update
@@ -556,14 +556,14 @@ system/themes/paris-opensans-light.woff: paris-opensans-light.woff, create, upda
system/themes/paris-opensans-regular.woff: paris-opensans-regular.woff, create, update, careful
Extension: Parsedown
-Version: 0.8.26
+Version: 0.8.27
Description: Text formatting for humans.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-parsedown/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-parsedown
DocumentationLanguage: en, de, sv
-Published: 2023-09-18 20:49:49
+Published: 2024-04-01 18:41:53
Status: available
system/extensions/parsedown.php: parsedown.php, create, update
@@ -789,27 +789,27 @@ Status: available
system/extensions/turkish.php: turkish.php, create, update
Extension: Update
-Version: 0.8.100
+Version: 0.8.101
Description: Keep your website up to date.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-update
DocumentationLanguage: en, de, sv
-Published: 2024-03-29 22:29:25
+Published: 2024-04-01 18:50:26
Status: available
system/extensions/update.php: update.php, create, update
system/extensions/updatepatch.bin: updatepatch.php, create, additional
Extension: Wiki
-Version: 0.8.30
+Version: 0.8.31
Description: Wiki for your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-wiki/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-wiki
DocumentationLanguage: en, de, sv
-Published: 2023-11-01 17:49:10
+Published: 2024-04-01 18:51:50
Status: available
system/extensions/wiki.php: wiki.php, create, update
system/layouts/wiki.html: wiki.html, create, update, careful
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -1,14 +1,14 @@
# Datenstrom Yellow update settings for installed extensions
Extension: Core
-Version: 0.8.128
+Version: 0.8.129
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: 2024-03-30 17:29:58
+Published: 2024-04-01 18:44:16
Status: available
system/extensions/core.php: core.php, create, update
system/layouts/default.html: default.html, create, update, careful
@@ -19,14 +19,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
-Version: 0.8.77
+Version: 0.8.78
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: 2023-12-20 23:19:46
+Published: 2024-04-01 18:48:05
Status: available
system/extensions/edit.php: edit.php, create, update
system/extensions/edit.css: edit.css, create, update
@@ -48,14 +48,14 @@ Status: available
system/extensions/generate.php: generate.php, create, update
Extension: Image
-Version: 0.8.19
+Version: 0.8.20
Description: Add images and thumbnails.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-image/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-image
DocumentationLanguage: en, de, sv
-Published: 2023-04-16 23:50:53
+Published: 2024-04-01 18:49:07
Status: available
system/extensions/image.php: image.php, create, update
media/images/photo.jpg: photo.jpg, create, optional
@@ -85,14 +85,14 @@ media/downloads/yellow.pdf: yellow.pdf, create
./robots.txt: robots.txt, create
Extension: Markdown
-Version: 0.8.26
+Version: 0.8.27
Description: Text formatting for humans.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-markdown/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-markdown
DocumentationLanguage: en, de, sv
-Published: 2023-09-18 20:49:33
+Published: 2024-04-01 18:41:04
Status: available
system/extensions/markdown.php: markdown.php, create, update
@@ -126,14 +126,14 @@ 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.100
+Version: 0.8.101
Description: Keep your website up to date.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-update
DocumentationLanguage: en, de, sv
-Published: 2024-03-29 22:29:25
+Published: 2024-04-01 18:50:26
Status: available
system/extensions/update.php: update.php, create, update
system/extensions/updatepatch.bin: updatepatch.php, create, additional
diff --git a/system/extensions/update.php b/system/extensions/update.php
@@ -2,7 +2,7 @@
// Update extension, https://github.com/annaesvensson/yellow-update
class YellowUpdate {
- const VERSION = "0.8.100";
+ const VERSION = "0.8.101";
const PRIORITY = "2";
public $yellow; // access to API
public $extensions; // number of extensions
@@ -74,8 +74,8 @@ class YellowUpdate {
return array("about [extension]", "install [extension]", "uninstall [extension]", "update [extension]");
}
- // Parse page content shortcut
- public function onParseContentShortcut($page, $name, $text, $type) {
+ // Handle page content element
+ public function onParseContentElement($page, $name, $text, $attributes, $type) {
$output = null;
if ($name=="yellow" && $type=="inline") {
if ($text=="about") {