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/Modelrender.php | |
parent | 0937c851313b5098dc15e5d411b6c3638cbd5116 (diff) | |
download | wcms-e32f2f1749c691f6c778261a8f8d300573895345.tar.gz wcms-e32f2f1749c691f6c778261a8f8d300573895345.zip |
Link to refactoring close #48
Diffstat (limited to 'app/class/Modelrender.php')
-rw-r--r-- | app/class/Modelrender.php | 28 |
1 files changed, 14 insertions, 14 deletions
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 '<a href="' . $rend->upage($matches[1]) . '"" title="' . Config::existnot() . '" class="internal existnot" '. $this->internallinkblank .' >' . $matches[1] . '</a>'; } else { - $linkfrom[] = $matchpage->id(); + $linkto[] = $matchpage->id(); return '<a href="' . $rend->upage($matches[1]) . $matches[2] . '" title="' . $matchpage->description() . '" class="internal exist '. $matchpage->secure('string') .'" '. $this->internallinkblank .' >' . $matchpage->title() . '</a>'; } }, $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; } |