From df00756a412f597e29f29b76203f39eb54809266 Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Wed, 25 Apr 2018 14:50:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=81=D0=B0=20Site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Component.php | 6 +++--- src/Controller/SiteInterface.php | 11 +++++++++++ src/Registry.php | 5 ++++- src/Tales.php | 4 ++-- src/View/Page.php | 4 ++-- 5 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 src/Controller/SiteInterface.php diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 7210d32..2204da8 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -13,7 +13,7 @@ use ctiso\HttpRequest, ctiso\Database\PDOStatement, ctiso\Collection, ctiso\Registry, - App\Controller\Site, + ctiso\Controller\SiteInterface, PHPTAL, PHPTAL_PreFilter_Normalize; @@ -209,7 +209,7 @@ class Component $view->component_title = $settings['title']; } - static function loadComponent($expression, /*.Site.*/ $site) + static function loadComponent($expression, /*.SiteInterface.*/ $site) { $expression = htmlspecialchars_decode($expression); @@ -251,7 +251,7 @@ class Component } } - $db = $site->db; + $db = $site->getDatabase(); $component->db = $db; $component->config = $site->config; diff --git a/src/Controller/SiteInterface.php b/src/Controller/SiteInterface.php new file mode 100644 index 0000000..205e5ea --- /dev/null +++ b/src/Controller/SiteInterface.php @@ -0,0 +1,11 @@ +namespace[$ns]['data'][$key]; + if (isset($this->namespace[$ns]['data'][$key])) { + return $this->namespace[$ns]['data'][$key]; + } + throw new Exception('Unknown key ' . $ns . '::' . $key); } public function has($ns, $key) { diff --git a/src/Tales.php b/src/Tales.php index 55bffc6..b6fc45a 100644 --- a/src/Tales.php +++ b/src/Tales.php @@ -5,7 +5,7 @@ */ namespace ctiso; use PHPTAL_Php_TalesInternal, - App\Controller\Site, + ctiso\Controller\SiteInterface, ctiso\Controller\Component, ctiso\HttpRequest, PHPTAL_Tales, @@ -32,7 +32,7 @@ class Tales_Component implements PHPTAL_Tales } class Tales { - static /*.Site.*/$site; + static /*.SiteInterface.*/$site; static function phptal_date ($e) { return date("d.m.Y", $e); diff --git a/src/View/Page.php b/src/View/Page.php index d224fc2..3591abe 100644 --- a/src/View/Page.php +++ b/src/View/Page.php @@ -2,7 +2,7 @@ namespace ctiso\View; use ctiso\View\View, - App\Controller\Site, /* Нужно импортровать интерфейс */ + ctiso\Controller\SiteInterface, ctiso\Controller\Component, ctiso\HttpRequest; @@ -10,7 +10,7 @@ class Page extends View { private $counter; public $text; - public /*.Site.*/$site; + public /*.SiteInterface.*/$site; function __construct($data, $site) {