mikuli.cz

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

commit 62435029439d815fd7b0e8fc648cc428aadb409e
parent 9fc4358ae02df86a13f5560c40b5a5c5d5ee8020
Author: markseu <mark2011@mayberg.se>
Date:   Wed, 20 Dec 2023 23:47:24 +0100

Updated edit extension for Robert

Diffstat:
Msystem/extensions/edit.php | 32++++++++++++++++++++------------
Msystem/extensions/update-current.ini | 4++--
Msystem/extensions/update-latest.ini | 4++--
3 files changed, 24 insertions(+), 16 deletions(-)

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.76"; + const VERSION = "0.8.77"; public $yellow; // access to API public $response; // web response public $merge; // text merge @@ -1411,13 +1411,13 @@ class YellowEditResponse { public function getPageNewLocation($rawData, $pageLocation, $editNewLocation, $pageMatchLocation = false) { $location = is_string_empty($editNewLocation) ? "@title" : $editNewLocation; $location = preg_replace("/@title/i", $this->getPageNewTitle($rawData), $location); - $location = preg_replace("/@timestamp/i", $this->getPageNewData($rawData, "published", true, "U"), $location); - $location = preg_replace("/@date/i", $this->getPageNewData($rawData, "published", true, "Y-m-d"), $location); - $location = preg_replace("/@year/i", $this->getPageNewData($rawData, "published", true, "Y"), $location); - $location = preg_replace("/@month/i", $this->getPageNewData($rawData, "published", true, "m"), $location); - $location = preg_replace("/@day/i", $this->getPageNewData($rawData, "published", true, "d"), $location); - $location = preg_replace("/@tag/i", $this->getPageNewData($rawData, "tag", true), $location); - $location = preg_replace("/@author/i", $this->getPageNewData($rawData, "author", true), $location); + $location = preg_replace("/@timestamp/i", $this->getPageNewData($rawData, "published", "U"), $location); + $location = preg_replace("/@date/i", $this->getPageNewData($rawData, "published", "Y-m-d"), $location); + $location = preg_replace("/@year/i", $this->getPageNewData($rawData, "published", "Y"), $location); + $location = preg_replace("/@month/i", $this->getPageNewData($rawData, "published", "m"), $location); + $location = preg_replace("/@day/i", $this->getPageNewData($rawData, "published", "d"), $location); + $location = preg_replace("/@tag/i", $this->getPageNewData($rawData, "tag"), $location); + $location = preg_replace("/@author/i", $this->getPageNewData($rawData, "author"), $location); if (!preg_match("/^\//", $location)) { if ($this->yellow->lookup->isFileLocation($pageLocation) || !$pageMatchLocation) { $location = $this->yellow->lookup->getDirectoryLocation($pageLocation).$location; @@ -1425,6 +1425,14 @@ class YellowEditResponse { $location = $this->yellow->lookup->getDirectoryLocation(rtrim($pageLocation, "/")).$location; } } + if (preg_match("/\d/", $location)) { + $locationNew = ""; + $tokens = explode("/", $location); + for ($i=1; $i<count($tokens); ++$i) { + $locationNew .= "/".$this->yellow->lookup->normaliseToken($tokens[$i]); + } + $location = $locationNew; + } if ($pageMatchLocation) { $location = rtrim($location, "/").($this->yellow->lookup->isFileLocation($pageLocation) ? "" : "/"); } @@ -1436,17 +1444,17 @@ class YellowEditResponse { $title = $this->yellow->toolbox->getMetaData($rawData, "title"); $titleSlug = $this->yellow->toolbox->getMetaData($rawData, "titleSlug"); $value = is_string_empty($titleSlug) ? $title : $titleSlug; - $value = $this->yellow->lookup->normaliseName($value, true, false, true); + $value = $this->yellow->lookup->normaliseName($value, false, false, true); return trim(preg_replace("/-+/", "-", $value), "-"); } // Return data for new/modified page - public function getPageNewData($rawData, $key, $filterFirst = false, $dateFormat = "") { + public function getPageNewData($rawData, $key, $dateFormat = "") { $value = $this->yellow->toolbox->getMetaData($rawData, $key); - if ($filterFirst && preg_match("/^(.*?)\,(.*)$/", $value, $matches)) $value = $matches[1]; + if (preg_match("/^(.*?)\,(.*)$/", $value, $matches)) $value = $matches[1]; if (!is_string_empty($dateFormat)) $value = date($dateFormat, strtotime($value)); if (is_string_empty($value)) $value = "none"; - $value = $this->yellow->lookup->normaliseName($value, true, false, true); + $value = $this->yellow->lookup->normaliseName($value, false, false, true); return trim(preg_replace("/-+/", "-", $value), "-"); } diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini @@ -18,12 +18,12 @@ system/layouts/navigation.html: navigation.html, create, update, careful system/layouts/pagination.html: pagination.html, create, update, careful Extension: Edit -Version: 0.8.76 +Version: 0.8.77 Description: Edit your website in a web browser. 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-09-18 20:10:06 +Published: 2023-12-20 23:19:46 Developer: Anna Svensson Tag: feature system/extensions/edit.php: edit.php, create, update diff --git a/system/extensions/update-latest.ini b/system/extensions/update-latest.ini @@ -172,12 +172,12 @@ Tag: language system/extensions/dutch.php: dutch.php, create, update Extension: Edit -Version: 0.8.76 +Version: 0.8.77 Description: Edit your website in a web browser. 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-09-18 20:10:06 +Published: 2023-12-20 23:19:46 Developer: Anna Svensson Tag: feature system/extensions/edit.php: edit.php, create, update