Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/Menu
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-19 07:10:29 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-19 07:10:29 +0400
commite9aae52fb3bc392663ee19aa2a5f702a3ed71fbf (patch)
tree0259bfcda90bf8cafd5e95383fff4111cf70ca96 /core/Menu
parent253b165e621953efcb692f985036e217920ba696 (diff)
make sure the ordering of reports is correct, pass an instance of a report to RenderReport
Diffstat (limited to 'core/Menu')
-rw-r--r--core/Menu/MenuAbstract.php25
1 files changed, 22 insertions, 3 deletions
diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php
index cbd5c5a798..69b48f76b1 100644
--- a/core/Menu/MenuAbstract.php
+++ b/core/Menu/MenuAbstract.php
@@ -291,15 +291,34 @@ abstract class MenuAbstract extends Singleton
*/
protected function menuCompare($itemOne, $itemTwo)
{
- if (!is_array($itemOne) || !is_array($itemTwo)
- || !isset($itemOne['_order']) || !isset($itemTwo['_order'])
- ) {
+ if (!is_array($itemOne) && !is_array($itemTwo)) {
return 0;
}
+ if (!is_array($itemOne) && is_array($itemTwo)) {
+ return -1;
+ }
+
+ if (is_array($itemOne) && !is_array($itemTwo)) {
+ return 1;
+ }
+
+ if (!isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
+ return 0;
+ }
+
+ if (!isset($itemOne['_order']) && isset($itemTwo['_order'])) {
+ return -1;
+ }
+
+ if (isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
+ return 1;
+ }
+
if ($itemOne['_order'] == $itemTwo['_order']) {
return strcmp($itemOne['_name'], $itemTwo['_name']);
}
+
return ($itemOne['_order'] < $itemTwo['_order']) ? -1 : 1;
}
}