From eb5a77087270dc6dcd7656dd9c1962e276012411 Mon Sep 17 00:00:00 2001 From: Magno Urbano Date: Wed, 9 Jan 2019 21:57:05 +0000 Subject: [PATCH] Update plugin.bit This change sorts pages by title in the left menu. --- plugins/pages/plugin.bit | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/pages/plugin.bit b/plugins/pages/plugin.bit index d9d267ef..cea93b24 100644 --- a/plugins/pages/plugin.bit +++ b/plugins/pages/plugin.bit @@ -13,6 +13,11 @@ $_PLUGIN_CONFIG['DATA'] = array( // ===================================================================== class PLUGIN_PAGES extends Plugin { + public function mySort($a, $b) + { + return strcmp ($a['title'], $b['title']); + } + public function blog_body() { global $pages; @@ -24,6 +29,9 @@ class PLUGIN_PAGES extends Plugin // Home $html .= '
  • '.$Language->get('home').'
  • '; + // sort pages by names + usort ($pages, array("PLUGIN_PAGES", "mySort")); + foreach($pages as $page) { if($settings['default_homepage']!=$page['id']) @@ -36,4 +44,4 @@ class PLUGIN_PAGES extends Plugin } } -?> \ No newline at end of file +?>