Частичная синхронизация с CMS

This commit is contained in:
origami11 2017-02-17 16:22:44 +03:00
parent 312f18a20a
commit b26e521657
62 changed files with 827 additions and 5992 deletions

48
src/View/Plain.php Normal file
View file

@ -0,0 +1,48 @@
<?php
// Класс отображения
// CompositeView !! Composite pattern
/**
* @package system.view
*/
class View_Plain
{
protected $document;
protected $values = array();
public function __construct ($document)
{
$this->document = $document;
}
public function set($key, $value)
{
$this->values[$key] = $value;
}
public function import($list)
{
$this->values = array_merge($this->values, $list);
}
public function __set($key, $value)
{
$this->set($key, $value);
}
public function execute()
{
$result = $this->values;
return self::getTemplateContent ($this->document, $result);
}
static function getTemplateContent($document, $result)
{
ob_start ();
include ($document);
$content = ob_get_contents ();
ob_clean ();
return $content;
}
}