aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-07-09 11:46:21 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-07-09 11:46:21 +0200
commit476198849024d9dd0601b29cd34ddab38ff755a2 (patch)
treed72e64dcd5ec4213af41fff9c11671d35f84a4b4 /app/class
parent05ea1fe723534ee29ef757dead0c94d0f6321a0b (diff)
downloadwcms-476198849024d9dd0601b29cd34ddab38ff755a2.tar.gz
wcms-476198849024d9dd0601b29cd34ddab38ff755a2.zip
fix open media tag error
Diffstat (limited to 'app/class')
-rw-r--r--app/class/config.php9
-rw-r--r--app/class/modelrender.php4
2 files changed, 11 insertions, 2 deletions
diff --git a/app/class/config.php b/app/class/config.php
index 75081f4..b3ef40c 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -93,6 +93,15 @@ abstract class Config
return (self::$domain === $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']);
}
+ /**
+ * Generate full url adress where W is installed
+ * @return string url adress finished by a slash "/"
+ */
+ public static function url() : string
+ {
+ return self::$domain . (!empty(self::$basepath) ? '/' . self::$basepath : "") . '/';
+ }
+
// ________________________________________ G E T _______________________________________
public static function arttable()
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index 8957559..914ca93 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -203,7 +203,7 @@ class Modelrender extends Modelart
$head .= '<meta property="og:title" content="' . $this->art->title() . '">' . PHP_EOL;
$head .= '<meta property="og:description" content="' . $this->art->description() . '">' . PHP_EOL;
$head .= '<meta property="og:image" content="' . Config::domain() . self::thumbnailpath() . $this->art->id() . '.jpg">' . PHP_EOL;
- $head .= '<meta property="og:url" content="' . Config::domain() . '">' . PHP_EOL;
+ $head .= '<meta property="og:url" content="' . Config::url() . $this->art->id() . '/">' . PHP_EOL;
foreach ($this->art->externalcss() as $externalcss) {
@@ -562,7 +562,7 @@ class Modelrender extends Modelart
*/
public function everylink(string $text, int $limit) : string
{
- $regex = '~([\w-_éêèùïüîçà]{' . $limit . ',})~';
+ $regex = '~([\w-_éêèùïüîçà]{' . $limit . ',})(?![^<]*>|[^<>]*<\/)~';
$text = preg_replace_callback($regex , function ($matches) {
return '<a href="' . idclean($matches[1]) . '">' . $matches[1] . '</a>';
}, $text);