';
static $html = '';
static $charset = 'UTF-8';
static $favicon = 'favicon.ico';
static $scripts = array();
static $styles = array();
static $title = '';
static $image_url = '';
static $titles = array();
static $meta = array();
static $links = array();
static $titles_delimetr = ' ';
static $description;
static $keywords;
static $google;
static $yandex;
static $vk_comments;
static $redirect;
static $data = [];
static $html_class = array();
static $lang = "ru";
static $stylesCode = array();
static $scriptCode = array();
static $metaCode = array();
static $stylesEnd = array();
static $body = array();
static $foot;
// СВОЙСТВА СТРАНИЦЫ
static $text_id;
static $head_crumbs = array();
static $body_class = array();
static $is_404 = false;
static $canonical;
/** @var \core\site\structure\SchemaOrg $schemaOrg */
protected static $schemaOrg;
static function schemaOrg(): SchemaOrg{
if(isset(self::$schemaOrg)) return self::$schemaOrg;
return self::$schemaOrg = new SchemaOrg();
}
/* КОНСТАНТЫ */
const BODY_VALUE='BODY_VALUE';
const BODY_TYPE='BODY_TYPE';
const BODY_TYPE_TEXT = 'BODY_TYPE_TEXT';
const BODY_TYPE_LOAD_LIBRARY = 'BODY_TYPE_LOAD_LIBRARY';
const SUBS_PAGES_LINK = "SUBS_PAGES_LINK";
const SUBS_PAGES_NAME = "SUBS_PAGES_NAME";
public function __construct() {
self::init();
}
static function init()
{
$a = ['utm_campaign', 'utm_content', 'utm_medium', 'utm_source', 'utm_term',];
self::$schemaOrg = new SchemaOrg();
foreach ($a as $v){
if($_GET[$v]){ \Core::setCookie($v,trim($_GET[$v])); }
}
$url = parse_url($_SERVER['REQUEST_URI']);
self::$canonical = \Site::sectionUrl(substr($url['path'],1),true);
}
static function addBodyClass($x){
array_push(self::$body_class,$x);
}
static function getBodyContent() {
$res = implode(self::$body);
return $res;
}
static function addData($key,$value){
self::$data[$key] = $value;
}
static function getBody() {
$res = '
'.self::getBodyContent();
return $res;
}
static function addBodyText($x) {
array_push(self::$body,$x);
}
static function getFoot() {
return self::getStylesEnd().self::$foot;
}
static function getPage() {
return self::getHead().self::getBody().self::getFoot()."";
}
static function addCrumb($name,$link) {
array_push(self::$head_crumbs,array($name,$link));
}
// Функция, которая возвращает хлебные крошки к странице
function getHeadCrumbs() {
$res = '";
return $res;
}
static function addLink($href,$rel,$type=''){
$s = array('href'=>$href,'rel'=>$rel,'type'=>$type);
array_push(self::$links,$s);
}
static function getLinks(){
$res = '';
foreach(self::$links as $k) {
$type = trim($k['type']);
$res .= '';
}
return $res;
}
static function addHtmlClass($x){ array_push(self::$html_class,$x); }
static function htmlStyleCSS($href) { return ""; }
static function htmlScriptJS($href) { return ""; }
//static function htmlScriptJS($href) { return ""; }
static function addScript($s){array_push(self::$scripts,$s);}
static function getScripts(){
$res = '';
foreach(self::$scripts as $k) {$res .= self::htmlScriptJS($k);}
return $res;
}
static function addStyle($s){array_push(self::$styles,$s);}
static function addStyleEnd($s){array_push(self::$stylesEnd,$s);}
static function getStyles(){
$res = '';
foreach(self::$styles as $k) {$res .= self::htmlStyleCSS($k);}
return $res;
}
static function getStylesEnd(){
$res = '';
foreach(self::$stylesEnd as $k) {$res .= self::htmlStyleCSS($k);}
return $res;
}
static function addStyleCode($s){array_push(self::$stylesCode,$s);}
static function getStylesCode(){
$res = '';
foreach(self::$stylesCode as $k) {$res .= trim($k);}
return $res;
}
static function addScriptCode($s){array_push(self::$scriptCode,$s);}
static function getScriptsCode(){
$res = '';
foreach(self::$scriptCode as $k) {$res .= trim($k);}
return $res;
}
static function addMetaCode($s){array_push(self::$metaCode,$s);}
static function getMetaCode(){
$res = '';
foreach(self::$metaCode as $k) {$res .= trim($k);}
return $res;
}
static function getHead() {
$res = self::$doctype.
str_replace(
array("%CLASS%","%LANG%"),array(count(self::$html_class)?'class="'.implode(' ',self::$html_class).'"':'',self::$lang),self::$html).
"";
$res .= self::getCharset();
$res .= self::getTitle();
$res .= self::getKeywords();
$res .= self::getDescription();
$res .= self::getMeta();
$res .= self::getMetaCode();
$res .= self::getFavicon();
$res .= self::getStyles();
$res .= self::getStylesCode();
$res .= self::getScriptsCode();
$res .= self::getScripts();
$res .= self::getLinks();
$res .= self::getOpenGraph();
$res .= self::getSchemaOrg();
$res .= "";
return $res;
}
static function getOpenGraph(){
$res = '';
$res .= '';
$res .= '';
$res .= '';
$res .= '';
if(self::$image_url) {
$res .= '';
}
return $res;
}
static function getSchemaOrg()
{
$data = self::schemaOrg()->toJson();
if(!$data['@graph']) return '';
return '';
}
static function getCharset() {
return '';
}
static function getFavicon() {
$res = '';
$res.= '';
return $res;
}
static function addTitle($x) {
array_push(self::$titles,htmlspecialchars($x));
}
static function addMeta($key,$value) {
self::$meta[$key] = $value;
}
static function getTitleText(){
$res = self::$title;
//if (count(self::$titles)>0) for($i = count(self::$titles)-1;$i>=0;$i--) {$res = self::$titles[$i].self::$titles_delimetr.$res;}
return implode(self::$titles_delimetr,self::$titles);
//if (count(self::$titles)>0) for($i = 0;$i".self::getTitleText()."";
}
static function getMeta() {
$res = "";
foreach(self::$meta as $k=>$v) $res .= "";
return $res;
}
static function getKeywords(){ /*if (self::$keywords) /**/ return '';}
static function getDescription(){ /*if (self::$description)/**/ return '';}
}