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/Modelrender.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'app/class/Modelrender.php') diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index c8aa13d..2338eb4 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -12,7 +12,7 @@ class Modelrender extends Modelpage protected $page; /** @var array list of ID as strings */ protected $pagelist; - protected $linkfrom = []; + protected $linkto = []; protected $sum = []; protected $internallinkblank = ''; protected $externallinkblank = ''; @@ -374,44 +374,44 @@ class Modelrender extends Modelpage public function wurl(string $text) { - $linkfrom = []; + $linkto = []; $rend = $this; $text = preg_replace_callback( '%href="([\w-]+)\/?(#?[a-z-_]*)"%', - function ($matches) use ($rend, &$linkfrom) { + function ($matches) use ($rend, &$linkto) { $matchpage = $rend->get($matches[1]); if (!$matchpage) { $link = 'href="' . $rend->upage($matches[1]) . '"" title="' . Config::existnot() . '" class="internal existnot"' . $this->internallinkblank; } else { - $linkfrom[] = $matchpage->id(); + $linkto[] = $matchpage->id(); $link = 'href="' . $rend->upage($matches[1]) . $matches[2] . '" title="' . $matchpage->description() . '" class="internal exist '. $matchpage->secure('string') .'"' . $this->internallinkblank; } return $link; }, $text ); - $this->linkfrom = array_unique(array_merge($this->linkfrom, $linkfrom)); + $this->linkto = array_unique(array_merge($this->linkto, $linkto)); return $text; } public function wikiurl(string $text) { - $linkfrom = []; + $linkto = []; $rend = $this; $text = preg_replace_callback( '%\[([\w-]+)\/?#?([a-z-_]*)\]%', - function ($matches) use ($rend, &$linkfrom) { + function ($matches) use ($rend, &$linkto) { $matchpage = $rend->get($matches[1]); if (!$matchpage) { return 'internallinkblank .' >' . $matches[1] . ''; } else { - $linkfrom[] = $matchpage->id(); + $linkto[] = $matchpage->id(); return 'internallinkblank .' >' . $matchpage->title() . ''; } }, $text ); - $this->linkfrom = array_unique(array_merge($this->linkfrom, $linkfrom)); + $this->linkto = array_unique(array_merge($this->linkto, $linkto)); return $text; } @@ -675,12 +675,12 @@ class Modelrender extends Modelpage - public function linkfrom() + public function linkto() { - sort($this->linkfrom); - $linkfrom = $this->linkfrom; - $this->linkfrom = []; - return $linkfrom; + sort($this->linkto); + $linkto = $this->linkto; + $this->linkto = []; + return $linkto; } -- cgit v1.2.3