diff options
Diffstat (limited to 'app/class')
-rw-r--r-- | app/class/application.php | 7 | ||||
-rw-r--r-- | app/class/config.php | 27 | ||||
-rw-r--r-- | app/class/modelrender.php | 13 |
3 files changed, 40 insertions, 7 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; |