From e32f2f1749c691f6c778261a8f8d300573895345 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 12 Feb 2020 19:44:00 +0100 Subject: Link to refactoring close #48 --- app/class/Opt.php | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'app/class/Opt.php') 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 '' . $secure . '' . PHP_EOL; } - public function linktolink(array $linkfromlist) + public function linktolink(array $linktolist) { - $linkfromstring = ""; - foreach ($linkfromlist as $linkfrom ) { - $linkfromstring .= '' . $linkfrom . '' . PHP_EOL; + $linktostring = ""; + foreach ($linktolist as $linkto ) { + $linktostring .= '' . $linkto . '' . 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)) { -- cgit v1.2.3