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/Modelanalyse.php | |
parent | 0937c851313b5098dc15e5d411b6c3638cbd5116 (diff) | |
download | wcms-e32f2f1749c691f6c778261a8f8d300573895345.tar.gz wcms-e32f2f1749c691f6c778261a8f8d300573895345.zip |
Link to refactoring close #48
Diffstat (limited to 'app/class/Modelanalyse.php')
-rw-r--r-- | app/class/Modelanalyse.php | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/app/class/Modelanalyse.php b/app/class/Modelanalyse.php deleted file mode 100644 index 9f656f5..0000000 --- a/app/class/Modelanalyse.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Wcms; - -class Modelanalyse extends Modelpage -{ - - - public function __construct() { - parent::__construct(); - } - - public function analyseall() - { - $pagelist = $this->getlister(); - - $pagelist2 = []; - foreach ($pagelist as $page) { - $page->setlinkfrom($this->analyselinkfrom($page)); - $pagelist2[] = $page; - } - foreach ($pagelist2 as $page) { - $page->setlinkto($this->analyselinkto($page->id(), $pagelist)); - $this->update($page); - } - } - - - public function analyse(Page $page) - { - $page->setlinkfrom($this->analyselinkfrom($page)); - - $pagelist = $this->getlister(); - $page->setlinkto($this->analyselinkto($page->id(), $pagelist)); - - return $page; - } - - - - - public function analyselinkto($id, $pagelist) - { - //analyse les liens vers cet pageicle en fouillant tout les linkfrom de la bdd, génere un tableau à stocker dans l'pageicle - $linkto = []; - foreach ($pagelist as $link) { - if (in_array($id, $link->linkfrom('array')) && $id != $link->id()) { - $linkto[] = $link->id(); - } - } - return $linkto; - } - - public function analyselinkfrom(Page $page) - { - $linkfrom = []; - foreach (self::TEXT_ELEMENTS as $element) { - preg_match_all('#\]\((\?id=|=)(\w+)\)#', $page->$element(), $out); - $linkfrom = array_merge($linkfrom, $out[2]); - } - return array_unique($linkfrom); - - } - -} - - - - - - - -?>
\ No newline at end of file |