<?php
/**
* Класс документа
*/
class Document {
var $version = 0.01;
public $title = null;
public $description = null;
public $keyword = null;
public $style = null;
public $script = null;
public $header = null;
public function __construct() {
$this->keyword = new Keyword();
$this->description = new Description();
$this->title = new Title();
}
/**
* @global Engine $engine
*/
function headers() {
global $engine;
header("Content-Type: text/html; charset=" . $engine->language->get('CHARSET'));
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: " . gmdate("D, d M Y H:i:s", 0) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("X-Powered-By: XSiteCMS ");
}
/**
* @global Engine $engine
* @return <type>
*/
function meta() {
global $engine;
return '<meta charset=' . $engine->language->get('CHARSET') . ' />
<meta http-equiv="content-type" content="text/html; charset=' . $engine->language->get('CHARSET') . '" />
<meta name="title" content="' . $this->title->get() . '" />
<meta name="keywords" content="' . $this->keyword->get() . '" />
<meta name="description" content="' . $this->description->get() . '" />
<meta name="abstract" content="' . $this->description->get() . '" />
<meta name="generator" content="' . GENERATOR . '" />'
. (GOOGLE ? "\n" . ' <meta name="verify-v1" content="' . GOOGLE . '" />' : '')
. (YANDEX ? "\n" . ' <meta name="yandex-verification" content="' . YANDEX . '" />' : '')
. (WEBMONEY ? "\n" . ' <meta name="webmoney.attestation.label" content="' . WEBMONEY . '" />' : '')
. "\n" . ' <link rel="alternate" href="feed.rss" type="application/rss+xml">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">';
}
}
/**
* Класс ключевых влов
*/
class Keyword {
var $version = 0.01;
public $config = array('words' => 15, 'min' => 5, 'max' => 25);
private $keywords = array();
private $endings = array("ые", "ое", "ие", "ий", "ая", "ый", "ой", "ми", "ых", "ее", "ую", "их", "ым");
private $exceptions = array("able", "about", "даже", "дал", "далее", "далеко"
);
/**
*
* @global Engine $engine
*/
public function __construct() {
global $engine;
$this->keywords = preg_split("/[\s,]+/s", $engine->string->trim($engine->config['keywords']));
}
/**
*
* @global Engine $engine
*/
function get() {
global $engine;
return (string) implode(", ", $this->keywords);
}
/**
*
* @global Engine $engine
* @param <type> $key
*/
function set($key) {
global $engine;
if (in_array($key, $this->keywords)):
return false;
else:
$this->keywords[] = $key;
endif;
}
/**
*
* @global Engine $engine
*/
function clear() {
global $engine;
$this->keywords = array();
}
/**
*
* @global Engine $engine
* @param string $text
* @return mixed
*/
function generate($text=null) {
global $engine;
$text = $engine->string->lower($text);
// вырезаем теги, символы и лишние пробелы
$text = $engine->string->clean($text);
// создаем массив слов
$words = preg_split("/[\s]+/s", $text);
...
return $words;
}
}
/**
* Класс составления описания страницы
*/
class Description {
var $version = 0.01;
public $config = array('length' => 300);
private $description = array();
private $synonyms = array('searche' => 'replace');
/**
*
* @global Engine $engine
*/
public function __construct() {
global $engine;
$this->description = $engine->config['description'];
}
/**
*
* @global Engine $engine
* @param <type> $key
*/
function get() {
global $engine;
return $this->description;
}
/**
*
* @global Engine $engine
* @param <type> $key
*/
function set($string) {
global $engine;
$this->description .= $string;
}
/**
*
* @global Engine $engine
*/
function clear() {
global $engine;
$this->description = null;
}
/**
*
* @global Engine $engine
* @param string $text
* @return mixed
*/
function generate($text=null) {
global $engine;
}
}
/**
* Класс заголовка страницы
*/
class Title {
var $version = 0.01;
public $config = array('length' => 300, 'separator' => ' - ');
private $title = array();
private $synonyms = array('searche' => 'replace');
/**
*
* @global Engine $engine
*/
public function __construct() {
global $engine;
$this->title[] = $engine->config['title'];
}
/**
*
* @global Engine $engine
* @param <type> $key
*/
function get() {
global $engine;
return (string) implode($this->config['separator'], $this->title);
}
/**
*
* @global Engine $engine
* @param <type> $key
*/
function set($string) {
global $engine;
$this->title[] = $string;
}
/**
*
* @global Engine $engine
*/
function clear() {
global $engine;
$this->title = null;
}
/**
*
* @global Engine $engine
* @param string $text
* @return mixed
*/
function generate($text=null) {
global $engine;
}
}
//
?>