aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Menu/MobileMenu.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/Menu/MobileMenu.php')
-rw-r--r--inc/Menu/MobileMenu.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/inc/Menu/MobileMenu.php b/inc/Menu/MobileMenu.php
index 209805646..c9d13932f 100644
--- a/inc/Menu/MobileMenu.php
+++ b/inc/Menu/MobileMenu.php
@@ -11,23 +11,24 @@ use dokuwiki\Menu\Item\AbstractItem;
* menus. This is a meta menu, aggregating the items from the other menus and offering a combined
* view. The idea is to use this on mobile devices, thus the context is fixed to CTX_MOBILE
*/
-class MobileMenu implements MenuInterface {
-
+class MobileMenu implements MenuInterface
+{
/**
* Returns all items grouped by view
*
* @return AbstractItem[][]
*/
- public function getGroupedItems() {
+ public function getGroupedItems()
+ {
$pagemenu = new PageMenu(AbstractItem::CTX_MOBILE);
$sitemenu = new SiteMenu(AbstractItem::CTX_MOBILE);
$usermenu = new UserMenu(AbstractItem::CTX_MOBILE);
- return array(
+ return [
'page' => $pagemenu->getItems(),
'site' => $sitemenu->getItems(),
'user' => $usermenu->getItems()
- );
+ ];
}
/**
@@ -37,9 +38,10 @@ class MobileMenu implements MenuInterface {
*
* @return AbstractItem[]
*/
- public function getItems() {
+ public function getItems()
+ {
$menu = $this->getGroupedItems();
- return call_user_func_array('array_merge', array_values($menu));
+ return array_merge(...array_values($menu));
}
/**
@@ -51,7 +53,8 @@ class MobileMenu implements MenuInterface {
* @param string $button submit button label
* @return string
*/
- public function getDropdown($empty = '', $button = '>') {
+ public function getDropdown($empty = '', $button = '>')
+ {
global $ID;
global $REV;
/** @var string[] $lang */
@@ -61,18 +64,18 @@ class MobileMenu implements MenuInterface {
$html = '<form action="' . script() . '" method="get" accept-charset="utf-8">';
$html .= '<div class="no">';
$html .= '<input type="hidden" name="id" value="' . $ID . '" />';
- if($REV) $html .= '<input type="hidden" name="rev" value="' . $REV . '" />';
- if($INPUT->server->str('REMOTE_USER')) {
+ if ($REV) $html .= '<input type="hidden" name="rev" value="' . $REV . '" />';
+ if ($INPUT->server->str('REMOTE_USER')) {
$html .= '<input type="hidden" name="sectok" value="' . getSecurityToken() . '" />';
}
$html .= '<select name="do" class="edit quickselect" title="' . $lang['tools'] . '">';
$html .= '<option value="">' . $empty . '</option>';
- foreach($this->getGroupedItems() as $tools => $items) {
- if (count($items)) {
+ foreach ($this->getGroupedItems() as $tools => $items) {
+ if ($items !== []) {
$html .= '<optgroup label="' . $lang[$tools . '_tools'] . '">';
- foreach($items as $item) {
+ foreach ($items as $item) {
$params = $item->getParams();
$html .= '<option value="' . $params['do'] . '">';
$html .= hsc($item->getLabel());
@@ -89,5 +92,4 @@ class MobileMenu implements MenuInterface {
return $html;
}
-
}