diff options
Diffstat (limited to 'inc/Menu/Item/Edit.php')
-rw-r--r-- | inc/Menu/Item/Edit.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/inc/Menu/Item/Edit.php b/inc/Menu/Item/Edit.php index 579b6885d..c063ca28a 100644 --- a/inc/Menu/Item/Edit.php +++ b/inc/Menu/Item/Edit.php @@ -8,38 +8,39 @@ namespace dokuwiki\Menu\Item; * Most complex item. Shows the edit button but mutates to show, draft and create based on * current state. */ -class Edit extends AbstractItem { - +class Edit extends AbstractItem +{ /** @inheritdoc */ - public function __construct() { + public function __construct() + { global $ACT; global $INFO; global $REV; parent::__construct(); - if($ACT === 'show') { + if ($ACT === 'show') { $this->method = 'post'; - if($INFO['writable']) { + if ($INFO['writable']) { $this->accesskey = 'e'; - if(!empty($INFO['draft'])) { + if (!empty($INFO['draft'])) { $this->type = 'draft'; $this->params['do'] = 'draft'; } else { $this->params['rev'] = $REV; - if(!$INFO['exists']) { + if (!$INFO['exists']) { $this->type = 'create'; } } } else { - if(!actionOK("source")) throw new \RuntimeException("action disabled: source"); + if (!actionOK("source")) throw new \RuntimeException("action disabled: source"); $params['rev'] = $REV; $this->type = 'source'; $this->accesskey = 'v'; } } else { if (auth_quickaclcheck($INFO['id']) < AUTH_READ) throw new \RuntimeException("no permission to read"); - $this->params = array('do' => ''); + $this->params = ['do' => '']; $this->type = 'show'; $this->accesskey = 'v'; } @@ -50,17 +51,17 @@ class Edit extends AbstractItem { /** * change the icon according to what type the edit button has */ - protected function setIcon() { - $icons = array( + protected function setIcon() + { + $icons = [ 'edit' => '01-edit_pencil.svg', 'create' => '02-create_pencil.svg', 'draft' => '03-draft_android-studio.svg', 'show' => '04-show_file-document.svg', - 'source' => '05-source_file-xml.svg', - ); - if(isset($icons[$this->type])) { + 'source' => '05-source_file-xml.svg' + ]; + if (isset($icons[$this->type])) { $this->svg = DOKU_INC . 'lib/images/menu/' . $icons[$this->type]; } } - } |