commit dedd5179b1ae71994ee520b6e8608ffb3782d316
parent 9ef0ce3fb55dd7ac43e96e614c904c9c86305abc
Author: markseu <mark2011@mayberg.se>
Date: Tue, 23 Apr 2024 22:09:57 +0200
Refactored code, wee faster sort
Co-Authored-By: wunderfeyd <7998283+wunderfeyd@users.noreply.github.com>
Diffstat:
3 files changed, 13 insertions(+), 13 deletions(-)
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.9.5
+Version: 0.9.6
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-04-23 10:16:44
+Published: 2024-04-23 21:35:24
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: coreupdate.txt, update
@@ -602,14 +602,14 @@ Status: available
system/workers/private.php: private.php, create, update
Extension: Publish
-Version: 0.9.3
+Version: 0.9.4
Description: Make and publish extensions.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-publish/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-publish
DocumentationLanguage: en, de, sv
-Published: 2024-04-10 10:20:07
+Published: 2024-04-23 22:01:41
Status: available
system/workers/publish.php: publish.php, create, update
diff --git a/system/extensions/yellow-extension.ini b/system/extensions/yellow-extension.ini
@@ -1,14 +1,14 @@
# Datenstrom Yellow extension settings
Extension: Core
-Version: 0.9.5
+Version: 0.9.6
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-04-23 10:16:44
+Published: 2024-04-23 21:35:24
Status: available
system/workers/core.php: core.php, create, update
system/extensions/core.php: coreupdate.txt, update
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.5";
+ const VERSION = "0.9.6";
const RELEASE = "0.9";
public $content; // content files
public $media; // media files
@@ -3656,14 +3656,14 @@ class YellowPageCollection extends ArrayObject {
public function sort($key, $ascendingOrder = true): YellowPageCollection {
$array = $this->getArrayCopy();
$sortIndex = 0;
+ $sortKeys = array();
foreach ($array as $page) {
- $page->set("sortIndex", ++$sortIndex);
+ $sortKeys[$page->location] = $page->get($key)." ".++$sortIndex;
}
- $callback = function ($a, $b) use ($key, $ascendingOrder) {
- $result = $ascendingOrder ?
- strnatcasecmp($a->get($key), $b->get($key)) :
- strnatcasecmp($b->get($key), $a->get($key));
- return $result==0 ? $a->get("sortIndex") - $b->get("sortIndex") : $result;
+ $callback = function ($a, $b) use ($sortKeys, $ascendingOrder) {
+ return $ascendingOrder ?
+ strnatcasecmp($sortKeys[$a->location], $sortKeys[$b->location]) :
+ strnatcasecmp($sortKeys[$b->location], $sortKeys[$a->location]);
};
usort($array, $callback);
$this->exchangeArray($array);