mikuli.cz

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

commit f10341ccc8c00ca2e02414f16cf5b5cd322f4226
parent 07d0fcd5639eddfde5e79e54ee72e5be10792f5d
Author: markseu <mark2011@mayberg.se>
Date:   Sat, 30 Mar 2024 17:38:20 +0100

Updated API, experimental

Diffstat:
Msystem/extensions/core.php | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++--
Msystem/extensions/update-available.ini | 4++--
Msystem/extensions/update-current.ini | 4++--
3 files changed, 57 insertions(+), 6 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.127"; + const VERSION = "0.8.128"; const RELEASE = "0.8.23"; public $content; // content files public $media; // media files @@ -1066,7 +1066,7 @@ class YellowExtension { // Load extensions public function load($path) { foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.php$/", true, false) as $entry) { - $this->modified = max($this->modified, filemtime($entry)); + $this->modified = max($this->modified, $this->yellow->toolbox->getFileModified($entry)); require_once($entry); $name = $this->yellow->lookup->normaliseName(basename($entry), true, true); $this->register(lcfirst($name), "Yellow".ucfirst($name)); @@ -2014,6 +2014,33 @@ class YellowToolbox { return $entries; } + // Return directory information recursively, Unix time and file count + public function getDirectoryInformationRecursive($path, $levelMax = 0) { + --$levelMax; + $modified = $fileCount = 0; + $directoryHandle = @opendir($path); + if ($directoryHandle) { + $path = rtrim($path, "/"); + while (($entry = readdir($directoryHandle))!==false) { + if (substru($entry, 0, 1)==".") continue; + $modified = max($modified, $this->getFileModified("$path/$entry")); + if (is_file("$path/$entry")) ++$fileCount; + } + rewinddir($directoryHandle); + if ($levelMax!=0) { + while (($entry = readdir($directoryHandle))!==false) { + if (substru($entry, 0, 1)==".") continue; + if (is_dir("$path/$entry")) { + list($modifiedBelow, $fileCountBelow) = $this->getDirectoryInformationRecursive("$path/$entry", $levelMax); + $modified = max($modified, $modifiedBelow); + $fileCount += $fileCountBelow; + } + } + } + } + return array($modified, $fileCount); + } + // Read file, empty string if not found public function readFile($fileName, $sizeMax = 0) { $fileData = ""; @@ -3065,6 +3092,30 @@ class YellowPage { } } + // Parse page content element, experimental + public function parseContentElement($name, $text, $attrributes, $type) { + $output = null; + foreach ($this->yellow->extension->data as $key=>$value) { + if (method_exists($value["object"], "onParseContentElement")) { + $output = $value["object"]->onParseContentElement($this, $name, $text, $attrributes, $type); + if (!is_null($output)) break; + } + 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::parseContentElement name:$name type:$type<br/>\n"; + } + return $output; + } + // Parse page content shortcut public function parseContentShortcut($name, $text, $type) { $output = null; diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini @@ -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.127 +Version: 0.8.128 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-29 20:32:14 +Published: 2024-03-30 17:29:58 Status: available system/extensions/core.php: core.php, create, update system/layouts/default.html: default.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.127 +Version: 0.8.128 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-29 20:32:14 +Published: 2024-03-30 17:29:58 Status: available system/extensions/core.php: core.php, create, update system/layouts/default.html: default.html, create, update, careful