diff --git a/bl-kernel/dblanguage.class.php b/bl-kernel/dblanguage.class.php index bc56f866..6c43ac33 100644 --- a/bl-kernel/dblanguage.class.php +++ b/bl-kernel/dblanguage.class.php @@ -71,7 +71,7 @@ class dbLanguage extends dbJSON public function add($array) { - $this->db = array_merge($this->db, $array); + $this->db = array_merge($array, $this->db); } // Returns the item from plugin-data. diff --git a/bl-plugins/api/plugin.php b/bl-plugins/api/plugin.php index 496c3824..d6501d6a 100644 --- a/bl-plugins/api/plugin.php +++ b/bl-plugins/api/plugin.php @@ -117,6 +117,21 @@ class pluginAPI extends Plugin { return $Page->json(); } + private function getAllPages() + { + $pages = buildAllPages(); + + $tmp = array(); + + foreach($pages as $Page) { + if($Page->published()) { + array_push($tmp, $Page->json( $returnsArray=true )); + } + } + + return json_encode($tmp); + } + public function beforeRulesLoad() { global $Url; @@ -171,8 +186,8 @@ class pluginAPI extends Plugin { if($parameters[2] === 'posts') { $json = $this->getAllPosts(); } - elseif($parameters[1] === 'pages') { - $json = $this->getAllPosts(); + elseif($parameters[2] === 'pages') { + $json = $this->getAllPages(); } } }