id = $id; } /** * Get revisions, and set correct pagenation parameters (first, hasNext) * * @param int $first * @param bool $hasNext * @return array revisions to be shown in a pagenated list * @see also https://www.dokuwiki.org/devel:changelog */ abstract protected function getRevisions(&$first, &$hasNext); /** * Navigation buttons for Pagenation (prev/next) * * @param int $first * @param bool $hasNext * @param callable $callback returns array of hidden fields for the form button * @return array html */ protected function navigation($first, $hasNext, $callback) { global $conf; $html = ''; return $html; } /** * Returns instance of objRevInfo * * @param array $info Revision info structure of a page or media file * @return objRevInfo object (anonymous class) */ protected function getObjRevInfo(array $info) { return new class ($info) // anonymous class (objRevInfo) { protected $info; public function __construct(array $info) { $this->info = $info; } // current indicator public function currentIndicator() { global $lang; return ($this->info['current']) ? '('.$lang['current'].')' : ''; } // edit date and time of the page or media file public function editDate() { return ''. dformat($this->info['date']) .''; } // edit summary public function editSummary() { return ''.' – '. hsc($this->info['sum']).''; } // editor of the page or media file public function editor() { // slightly different with display of Ui\Recent, i.e. external edit global $lang; $html = ''; if (!$this->info['user'] && !$this->info['ip']) { $html.= '('.$lang['external_edit'].')'; } elseif ($this->info['user']) { $html.= ''. editorinfo($this->info['user']) .''; if (auth_ismanager()) $html.= ' ('. $this->info['ip'] .')'; } else { $html.= ''. $this->info['ip'] .''; } $html.= ''; return $html; } // name of the page or media file public function itemName() { // slightly different with display of Ui\Recent, i.e. revison may not exists $id = $this->info['id']; $rev = $this->info['date']; if (isset($this->info['media'])) { // media file revision if (isset($this->info['current'])) { $href = media_managerURL(['image'=> $id, 'tab_details'=> 'view'], '&'); $html = ''.$id.''; } elseif (file_exists(mediaFN($id, $rev))) { $href = media_managerURL(['image'=> $id, 'tab_details'=> 'view', 'rev'=> $rev], '&'); $html = ''.$id.''; } else { $html = $id; } return $html; } else { // page revision $display_name = useHeading('navigation') ? hsc(p_get_first_heading($id)) : $id; if (!$display_name) $display_name = $id; if ($this->info['current'] || page_exists($id, $rev)) { $href = wl($id, "rev=$rev", false, '&'); $html = ''.$display_name.''; } else { $html = $display_name; } return $html; } } // icon difflink public function difflink() { global $lang; $id = $this->info['id']; $rev = $this->info['date']; if (isset($this->info['media'])) { // media file revision if (isset($this->info['current']) || !file_exists(mediaFN($id, $rev))) { $html = ''; } else { $href = media_managerURL(['image'=> $id, 'rev'=> $rev, 'mediado'=>'diff'], '&'); $html = '' . ''.$lang['diff'] .'' . ' '; } return $html; } else { // page revision if ($this->info['current'] || !page_exists($id, $rev)) { $html = ''; } else { $href = wl($id, "rev=$rev,do=diff", false, '&'); $html = '' . ''.$lang['diff'].'' . ''; } return $html; } } // size change public function sizeChange() { $class = 'sizechange'; $value = filesize_h(abs($this->info['sizechange'])); if ($this->info['sizechange'] > 0) { $class .= ' positive'; $value = '+' . $value; } elseif ($this->info['sizechange'] < 0) { $class .= ' negative'; $value = '-' . $value; } else { $value = '±' . $value; } return ''.$value.''; } }; // end of anonymous class (objRevInfo) } }