Изменен механизм расширения ссылок. Избавление от глобальных переменных

This commit is contained in:
CORP\phedor 2018-04-18 18:20:56 +03:00
parent 524b27936a
commit 40fad0e75b
11 changed files with 77 additions and 61 deletions

View file

@ -10,9 +10,11 @@ class Page extends View
{
private $counter;
public $text;
public $site;
function __construct($data)
function __construct($data, $site)
{
$this->site = $site;
// Вставка компонентов на странице
$pattern = '/<(\w+)(\s+[a-zA-Z\-]+=\"[^\"]*\")*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u';
$matches = array();
@ -53,15 +55,8 @@ class Page extends View
function replaceContent($match, $offset)
{
//$result = phptal_component($match, $offset);
/*.Component.*/$component = null;
if (class_exists("App\\Controller\\Site")) { //Если мы в CMS2
$component = Site::loadComponent($match);
} else {
global $db, $registry; //
$component = Component::loadComponent($match, $db, $registry);
}
$component = $this->site->loadComponent($match);
$req = new HttpRequest();
unset($req['active_page']);