aboutsummaryrefslogtreecommitdiff
path: root/app/class/modelrender.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-12 13:55:40 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-12 13:55:40 +0100
commite4768cd0647d934eff424f73bfd9f5c8f6223c94 (patch)
treeb36029a8152d79108e0dd57aacd73f80b7232b33 /app/class/modelrender.php
parent0f44c6d918a2932b68019c02de5bc55e7057600a (diff)
downloadwcms-e4768cd0647d934eff424f73bfd9f5c8f6223c94.tar.gz
wcms-e4768cd0647d934eff424f73bfd9f5c8f6223c94.zip
link+log
Diffstat (limited to 'app/class/modelrender.php')
-rw-r--r--app/class/modelrender.php31
1 files changed, 26 insertions, 5 deletions
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index 0951537..2d56f6b 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -43,7 +43,11 @@ class Modelrender extends Modelart
if (isset($art->template('array')[$element])) {
$templateid = $art->template('array')[$element];
$tempalteart = $this->get($templateid);
- $text = $tempalteart->$element() . PHP_EOL . $art->$element();
+ if($tempalteart) {
+ $text = $tempalteart->$element() . PHP_EOL . $art->$element();
+ } else {
+ $text = $art->$element();
+ }
} else {
$text = $art->$element();
}
@@ -151,6 +155,7 @@ class Modelrender extends Modelart
$text = str_replace(self::SUMMARY, $this->sumparser($text), $text);
+ $text = $this->wurl($text);
$text = $this->wikiurl($text);
$text = $this->tooltip($art->linkfrom('array'), $text);
@@ -170,18 +175,35 @@ class Modelrender extends Modelart
return $text;
}
+ public function wurl(string $text)
+ {
+ $rend = $this;
+ $text = preg_replace_callback(
+ '%href="([\w-]+)"%',
+ function ($matches) use ($rend) {
+ $matchart = $rend->get($matches[1]);
+ if (!$matchart) {
+ return 'href="' . $rend->uart($matches[1]) . '"" title="' . Config::existnot() . '" class="internal"';
+ } else {
+ return 'href="' . $rend->uart($matches[1]) . '" title="' . $matchart->description() . '" class="internal"';
+ }
+ },
+ $text
+ );
+ return $text;
+ }
+
public function wikiurl(string $text)
{
$rend = $this;
- $artlist = [];
$text = preg_replace_callback(
'%\[([\w-]+)\]%',
function ($matches) use ($rend) {
$matchart = $rend->get($matches[1]);
if (!$matchart) {
- return '<a href="' . $rend->uart($matches[1]) . '">' . $matches[1] . '</a>';
+ return '<a href="' . $rend->uart($matches[1]) . '"" title="' . Config::existnot() . '" class="internal">' . $matches[1] . '</a>';
} else {
- return '<a href="' . $rend->uart($matches[1]) . '" title="' . $matchart->description() . '">' . $matchart->title() . '</a>';
+ return '<a href="' . $rend->uart($matches[1]) . '" title="' . $matchart->description() . '" class="internal">' . $matchart->title() . '</a>';
}
},
$text
@@ -189,7 +211,6 @@ class Modelrender extends Modelart
return $text;
}
-
public function markdown($text)
{
//use Michelf\MarkdownExtra;