diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-12-09 12:10:16 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-12-09 12:10:16 +0100 |
commit | ae0693d074a63412e7ab9587520096cb60a48e64 (patch) | |
tree | 269cbfb204858f8a6b47f061abdc0101878de2d8 /app/class | |
parent | 0cdf3e007ee05880ed290865ecd911bbf508d565 (diff) | |
download | wcms-ae0693d074a63412e7ab9587520096cb60a48e64.tar.gz wcms-ae0693d074a63412e7ab9587520096cb60a48e64.zip |
media parser
Diffstat (limited to 'app/class')
-rw-r--r-- | app/class/art2.php | 2 | ||||
-rw-r--r-- | app/class/modelhome.php | 2 | ||||
-rw-r--r-- | app/class/modelrender.php | 11 |
3 files changed, 12 insertions, 3 deletions
diff --git a/app/class/art2.php b/app/class/art2.php index 6a61687..2029895 100644 --- a/app/class/art2.php +++ b/app/class/art2.php @@ -169,6 +169,8 @@ class Art2 return $this->date->format('Y-m-d'); } elseif ($option == 'ptime') { return $this->date->format('H:i'); + } elseif ($option = 'dmy') { + return $this->date->format('d/m/Y'); } diff --git a/app/class/modelhome.php b/app/class/modelhome.php index 5d16062..bb271d6 100644 --- a/app/class/modelhome.php +++ b/app/class/modelhome.php @@ -11,7 +11,7 @@ class Modelhome extends Modeldb { $opt = new Opt(Art2::classvarlist()); - $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'secure']); + $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure']); $opt->settaglist($table); $opt->submit(); diff --git a/app/class/modelrender.php b/app/class/modelrender.php index d2cdbb4..c36417d 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -177,8 +177,8 @@ class Modelrender extends Modelart public function parser(string $text) { - $text = str_replace('<a href="~', '<a class="media" target="_blank" href="' . Model::mediapath(), $text); - $text = str_replace('<img src="~', '<img class="local" src="' . Model::mediapath(), $text); + + $text = $this->media($text); $text = $this->headerid($text); @@ -197,6 +197,13 @@ class Modelrender extends Modelart return $text; } + public function media(string $text): string + { + $rend = $this; + $text = preg_replace('%(src|target)="((\/?[\w-_]+)+\.[a-z0-9]{1,5})"%', '$1="'.Model::mediapath() . '$2"', $text); + return $text; + } + public function autourl($text) { |