aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-07-09 13:33:02 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-07-09 13:33:02 +0200
commitd39bec8e089a55ebd370fbe9f4b5388aafade10d (patch)
tree445a9c7b21eae9a174ba1fa2ea7db976af2a0dcf /app
parent476198849024d9dd0601b29cd34ddab38ff755a2 (diff)
downloadwcms-d39bec8e089a55ebd370fbe9f4b5388aafade10d.tar.gz
wcms-d39bec8e089a55ebd370fbe9f4b5388aafade10d.zip
1.2.3 fix unused thumbnail open media tag
Diffstat (limited to 'app')
-rw-r--r--app/class/art2.php29
-rw-r--r--app/class/config.php4
-rw-r--r--app/class/modelrender.php7
3 files changed, 23 insertions, 17 deletions
diff --git a/app/class/art2.php b/app/class/art2.php
index 01ce218..2bd1138 100644
--- a/app/class/art2.php
+++ b/app/class/art2.php
@@ -32,7 +32,6 @@ class Art2
protected $templatejavascript;
protected $templateoptions;
protected $favicon;
- protected $thumbnail;
protected $authors;
protected $invites;
protected $readers;
@@ -104,7 +103,6 @@ class Art2
$this->settemplatejavascript('');
$this->settemplateoptions(['externalcss', 'externaljavascript', 'favicon', 'reccursivecss', 'quickcss']);
$this->setfavicon('');
- $this->setthumbnail('');
$this->setauthors([]);
$this->setinvites([]);
$this->setreaders([]);
@@ -138,6 +136,21 @@ class Art2
return $array;
}
+ /**
+ * Check if page have a thumbnail
+ * @return bool true if the page have a thumbnail otherwise return false.
+ */
+ public function thumbnailexist() : bool
+ {
+ $thumbnaillink = Model::THUMBNAIL_DIR . $this->id . '.jpg';
+
+ $test = file_exists($thumbnaillink);
+
+ $exist = file_exists(Model::THUMBNAIL_DIR . $this->id . '.jpg');
+
+ return $exist;
+ }
+
// _____________________________________________________ G E T ____________________________________________________
@@ -412,11 +425,6 @@ class Art2
return $this->favicon;
}
- public function thumbnail($type = 'string')
- {
- return $this->thumbnail;
- }
-
public function authors($type = 'array')
{
return $this->authors;
@@ -716,13 +724,6 @@ class Art2
}
}
- public function setthumbnail($thumbnail)
- {
- if (is_string($thumbnail)) {
- $this->thumbnail = $thumbnail;
- }
- }
-
public function setauthors($authors)
{
if(is_array($authors)) {
diff --git a/app/class/config.php b/app/class/config.php
index b3ef40c..dbc6d80 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -97,9 +97,9 @@ abstract class Config
* Generate full url adress where W is installed
* @return string url adress finished by a slash "/"
*/
- public static function url() : string
+ public static function url($endslash = true) : string
{
- return self::$domain . (!empty(self::$basepath) ? '/' . self::$basepath : "") . '/';
+ return self::$domain . (!empty(self::$basepath) ? '/' . self::$basepath : "") . ($endslash ? '/' : '');
}
// ________________________________________ G E T _______________________________________
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index 914ca93..553442d 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -3,6 +3,7 @@
class Modelrender extends Modelart
{
protected $router;
+ /** @var art2 */
protected $art;
protected $artlist;
protected $linkfrom = [];
@@ -202,7 +203,11 @@ 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;
+
+ if($this->art->thumbnailexist()) {
+ $head .= '<meta property="og:image" content="' . Config::domain() . self::thumbnailpath() . $this->art->id() . '.jpg">' . PHP_EOL;
+ }
+
$head .= '<meta property="og:url" content="' . Config::url() . $this->art->id() . '/">' . PHP_EOL;