diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-02-12 19:44:00 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-02-12 19:44:00 +0100 |
commit | e32f2f1749c691f6c778261a8f8d300573895345 (patch) | |
tree | 84a4293c7f0781243259d21f2472273c0f52fada /app/class/Opt.php | |
parent | 0937c851313b5098dc15e5d411b6c3638cbd5116 (diff) | |
download | wcms-e32f2f1749c691f6c778261a8f8d300573895345.tar.gz wcms-e32f2f1749c691f6c778261a8f8d300573895345.zip |
Link to refactoring close #48
Diffstat (limited to 'app/class/Opt.php')
-rw-r--r-- | app/class/Opt.php | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/app/class/Opt.php b/app/class/Opt.php index e0a8492..5f00141 100644 --- a/app/class/Opt.php +++ b/app/class/Opt.php @@ -141,19 +141,19 @@ class Opt extends Item return '<a class="secure ' . $secure . '" href="?' . $this->getfilteradress(['secure' => $level]) . '">' . $secure . '</a>' . PHP_EOL; } - public function linktolink(array $linkfromlist) + public function linktolink(array $linktolist) { - $linkfromstring = ""; - foreach ($linkfromlist as $linkfrom ) { - $linkfromstring .= '<a class="linkfrom" href="?' . $this->getfilteradress(['linkto' => $linkfrom]) . '" >' . $linkfrom . '</a>' . PHP_EOL; + $linktostring = ""; + foreach ($linktolist as $linkto ) { + $linktostring .= '<a class="linkto" href="?' . $this->getfilteradress(['linkto' => $linkto]) . '" >' . $linkto . '</a>' . PHP_EOL; } - return $linkfromstring; + return $linktostring; } public function getfilteradress(array $vars = []) { - $varlist = ['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorfilter', 'authorcompare', 'invert', 'limit']; + $varlist = ['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorfilter', 'authorcompare', 'linkto', 'invert', 'limit']; // array_filter($vars, function ()) $object = $this->drylist($varlist); $object = array_merge($object, $vars); @@ -352,8 +352,10 @@ class Opt extends Item public function setlinkto($linkto) : bool { if (is_string($linkto)) { - if (in_array($linkto, $this->pageidlist)) { - + if(empty($this->pageidlist)) { + $this->linkto = idclean($linkto); + return true; + } elseif (in_array($linkto, $this->pageidlist)) { $this->linkto = idclean($linkto); return true; } else { @@ -364,26 +366,6 @@ class Opt extends Item } } - public function setlinktomin($min) - { - $this->linkto['min'] = intval($min); - } - - public function setlinktomax($max) - { - $this->linkto['max'] = intval($max); - } - - public function setlinkfrommin($min) - { - $this->linkfrom['min'] = intval($min); - } - - public function setlinkfrommax($max) - { - $this->linkfrom['max'] = intval($max); - } - public function setcol($col) { if (is_array($col)) { |