id = $id; $this->setChangeLog(); } /** * set class property changelog */ abstract protected function setChangeLog(); /** * Get revisions, and set correct pagination 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 */ protected function getRevisions(&$first, &$hasNext) { global $conf; $changelog =& $this->changelog; $revisions = []; $currentRevInfo = $changelog->getCurrentRevisionInfo(); if (!$currentRevInfo) return $revisions; $num = $conf['recent']; if ($first == 0) { $revisions[] = $currentRevInfo; $num = $num - 1; } /* we need to get one additional log entry to be able to * decide if this is the last page or is there another one. * see also Ui\Recent::getRecents() */ $revlist = $changelog->getRevisions($first, $num + 1); if (count($revlist) == 0 && $first > 0) { // resets to zero if $first requested a too high number $first = 0; return $this->getRevisions($first, $hasNext); } // decide if this is the last page or is there another one $hasNext = false; if (count($revlist) > $num) { $hasNext = true; array_pop($revlist); // remove one additional log entry } // append each revison info array to the revisions foreach ($revlist as $rev) { $revisions[] = $changelog->getRevisionInfo($rev); } return $revisions; } /** * 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 string html */ protected function navigation($first, $hasNext, $callback) { global $conf; $html = '
 ';
                        } else {
                            $href = media_managerURL(['image'=> $id, 'rev'=> $rev, 'mediado'=>'diff'], '&');
                            $html = ''
                                  . '
';
                        } else {
                            $href = media_managerURL(['image'=> $id, 'rev'=> $rev, 'mediado'=>'diff'], '&');
                            $html = ''
                                  . '!['. $lang['diff'] .' '.$lang['diff'] .']('.DOKU_BASE.'lib/images/diff.png) '
                                  . ' ';
                        }
                        return $html;
                    case 'page': // page revision
                        if ($this->info['current'] || !page_exists($id, $rev)) {
                            $html = '
'
                                  . ' ';
                        }
                        return $html;
                    case 'page': // page revision
                        if ($this->info['current'] || !page_exists($id, $rev)) {
                            $html = ' ';
                        } else {
                            $href = wl($id, "rev=$rev,do=diff", false, '&');
                            $html = ''
                                  . '
';
                        } else {
                            $href = wl($id, "rev=$rev,do=diff", false, '&');
                            $html = ''
                                  . '!['.$lang['diff'].' '.$lang['diff'].']('.DOKU_BASE.'lib/images/diff.png) '
                                  . '';
                        }
                        return $html;
                }
                return '';
            }
            // 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)
    }
}
'
                                  . '';
                        }
                        return $html;
                }
                return '';
            }
            // 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)
    }
}