aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-03-31 15:38:42 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-03-31 15:38:42 +0200
commit2e27596acb55e15495492fee916304d647bb3eab (patch)
treeaa7a06d0323d1c7c0bbeef7c665b61fcdcc9bb5f
parent20c44426207b8f58fd8ef1145b509913371b2901 (diff)
downloadwcms-2e27596acb55e15495492fee916304d647bb3eab.tar.gz
wcms-2e27596acb55e15495492fee916304d647bb3eab.zip
domain analyser OG meta rendering
-rw-r--r--app/class/application.php7
-rw-r--r--app/class/config.php27
-rw-r--r--app/class/modelrender.php13
-rw-r--r--composer.json2
4 files changed, 41 insertions, 8 deletions
diff --git a/app/class/application.php b/app/class/application.php
index 07db776..b749d9b 100644
--- a/app/class/application.php
+++ b/app/class/application.php
@@ -19,6 +19,7 @@ class Application
} else {
Config::hydrate($_POST['configinit']);
}
+ Config::getdomain();
if(!is_dir(Model::RENDER_DIR)) {
mkdir(Model::RENDER_DIR);
}
@@ -39,7 +40,7 @@ class Application
} else {
if(Config::readconfig()) {
- if(!Config::checkbasepath() || empty(Config::arttable()) || !is_dir(Model::RENDER_DIR)) {
+ if(!Config::checkbasepath() || empty(Config::arttable()) || !is_dir(Model::RENDER_DIR) || !Config::checkdomain()) {
echo '<ul>';
if(!Config::checkbasepath()) {
echo '<li>Wrong path</li>';
@@ -47,6 +48,9 @@ class Application
if(empty(Config::arttable())) {
echo '<li>Unset table name</li>';
}
+ if(!Config::checkdomain()) {
+ echo '<li>Need to recheck the domain</li>';
+ }
if(!is_dir(Model::RENDER_DIR)) {
echo '<li>Render path not existing</li>';
}
@@ -122,6 +126,7 @@ class Application
<?php
}
+
}
diff --git a/app/class/config.php b/app/class/config.php
index 00c03ae..75081f4 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -5,6 +5,7 @@
abstract class Config
{
protected static $arttable = 'mystore';
+ protected static $domain = '';
protected static $color4;
protected static $fontsize = 15;
protected static $basepath = '';
@@ -76,6 +77,22 @@ abstract class Config
return (file_exists($path));
}
+ /**
+ * Calculate Domain name
+ */
+ public static function getdomain()
+ {
+ self::$domain = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
+ }
+
+ /**
+ * Verify Domain name
+ */
+ public static function checkdomain()
+ {
+ return (self::$domain === $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']);
+ }
+
// ________________________________________ G E T _______________________________________
public static function arttable()
@@ -83,6 +100,11 @@ abstract class Config
return self::$arttable;
}
+ public static function domain()
+ {
+ return self::$domain;
+ }
+
public static function color4()
{
return self::$color4;
@@ -177,6 +199,11 @@ abstract class Config
self::$arttable = strip_tags($arttable);
}
+ public static function setdomain($domain)
+ {
+ self::$domain = strip_tags(strtolower($domain));
+ }
+
public static function setcolor4($color4)
{
if (strlen($color4) <= 8) {
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index 046499f..540e7b9 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -198,6 +198,13 @@ class Modelrender extends Modelart
$head .= '<meta name="description" content="' . $this->art->description() . '" />' . PHP_EOL;
$head .= '<meta name="viewport" content="width=device-width" />' . PHP_EOL;
+
+ $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() . '/' . Config::basepath() . '/' . self::thumbnailpath() . $this->art->id() . '.jpg">' . PHP_EOL;
+ $head .= '<meta property="og:url" content="' . Config::domain() . '">' . PHP_EOL;
+
+
foreach ($this->art->externalcss() as $externalcss) {
$head .= '<link href="' . $externalcss . '" rel="stylesheet" />' . PHP_EOL;
}
@@ -216,12 +223,6 @@ class Modelrender extends Modelart
$head .= '<link href="' . Model::globalpath() . 'fonts.css" rel="stylesheet" />' . PHP_EOL;
$head .= '<link href="' . Model::globalpath() . 'global.css" rel="stylesheet" />' . PHP_EOL;
- // if (!empty($this->art->templatecss())) {
- // $tempaltequickcssart = $this->art->templatecss();
- // $head .= '<link href="' . Model::renderpath() . $tempaltequickcssart . '.quick.css" rel="stylesheet" />' . PHP_EOL;
- // }
- // $head .= '<link href="' . Model::renderpath() . $this->art->id() . '.quick.css" rel="stylesheet" />' . PHP_EOL;
-
if (!empty($this->art->templatecss())) {
$tempaltecssart = $this->art->templatecss();
$head .= '<link href="' . Model::renderpath() . $tempaltecssart . '.css" rel="stylesheet" />' . PHP_EOL;
diff --git a/composer.json b/composer.json
index 64ba744..f7961e8 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "w-cms",
"description": "point'n think",
- "version": "1.2.0",
+ "version": "1.2.1",
"require": {
"michelf/php-markdown": "^1.8",
"league/plates": "3.*",