From 27b835c161bc57a515c89c4b019ff900788713ad Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sun, 21 May 2017 05:41:04 +0100 Subject: [PATCH] remove php4 constructor; hide some cNav_bar variables and rename some variables --- list-virtual.php | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/list-virtual.php b/list-virtual.php index 0e41c4d8..109d5358 100644 --- a/list-virtual.php +++ b/list-virtual.php @@ -325,12 +325,16 @@ class cNav_bar { - var $count, $title, $limit, $page_size, $pages, $search; //* arguments - var $url; //* manually - var $fInit, $arr_prev, $arr_next, $arr_top; //* internal - var $anchor; + protected $count, $title, $limit, $page_size, $pages, $search; //* arguments - function cNav_bar ($aTitle, $aLimit, $aPage_size, $aPages, $aSearch) { + /* @var string - appended to page link href */ + public $append_to_url = ''; + + protected $have_run_init = false; + protected $arr_prev, $arr_next, $arr_top; //* internal + protected $anchor; + + public function __construct ($aTitle, $aLimit, $aPage_size, $aPages, $aSearch) { $this->count = count($aPages); $this->title = $aTitle; $this->limit = $aLimit; @@ -341,20 +345,18 @@ function cNav_bar ($aTitle, $aLimit, $aPage_size, $aPages, $aSearch) { } else { $this->search = ""; } - $this->url = ''; - $this->fInit = false; } - function init () { + private function init () { $this->anchor = 'a'.substr ($this->title, 3); - $this->url .= '#'.$this->anchor; - ($this->limit >= $this->page_size) ? $this->arr_prev = ' '.$GLOBALS ['PALANG']['pOverview_left_arrow'].' ' : $this->arr_prev = ''; - ($this->limit > 0) ? $this->arr_top = ' '.$GLOBALS ['PALANG']['pOverview_up_arrow'].' ' : $this->arr_top = ''; - (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' '.$GLOBALS ['PALANG']['pOverview_right_arrow'].' ' : $this->arr_next = ''; - $this->fInit = true; + $this->append_to_url .= '#'.$this->anchor; + ($this->limit >= $this->page_size) ? $this->arr_prev = ' '.$GLOBALS ['PALANG']['pOverview_left_arrow'].' ' : $this->arr_prev = ''; + ($this->limit > 0) ? $this->arr_top = ' '.$GLOBALS ['PALANG']['pOverview_up_arrow'].' ' : $this->arr_top = ''; + (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' '.$GLOBALS ['PALANG']['pOverview_right_arrow'].' ' : $this->arr_next = ''; + $this->have_run_init = true; } - function display_pre () { + private function display_pre() { $ret_val = '