Merge branch 'noglob' of http://gitlab.edu.yar.ru/composer/PHP_Library into noglob
This commit is contained in:
commit
04662a94df
5 changed files with 22 additions and 8 deletions
|
|
@ -12,7 +12,7 @@ use ctiso\HttpRequest,
|
|||
ctiso\Database\PDOStatement,
|
||||
ctiso\Collection,
|
||||
ctiso\Registry,
|
||||
App\Controller\Site,
|
||||
ctiso\Controller\SiteInterface,
|
||||
PHPTAL,
|
||||
PHPTAL_PreFilter_Normalize;
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ class Component
|
|||
$view->component_title = $settings['title'];
|
||||
}
|
||||
|
||||
static function loadComponent($expression, /*.Site.*/ $site)
|
||||
static function loadComponent($expression, /*.SiteInterface.*/ $site)
|
||||
{
|
||||
|
||||
$expression = htmlspecialchars_decode($expression);
|
||||
|
|
@ -249,7 +249,7 @@ class Component
|
|||
}
|
||||
}
|
||||
|
||||
$db = $site->db;
|
||||
$db = $site->getDatabase();
|
||||
|
||||
$component->db = $db;
|
||||
$component->config = $site->config;
|
||||
|
|
|
|||
11
src/Controller/SiteInterface.php
Normal file
11
src/Controller/SiteInterface.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
|
||||
interface SiteInterface {
|
||||
function loadComponent($expression);
|
||||
function getDatabase();
|
||||
function getConfig();
|
||||
function setComponentConfig($config);
|
||||
function addRequireJsPath($name, $path, $schim = null);
|
||||
}
|
||||
|
|
@ -27,7 +27,10 @@ class Registry {
|
|||
}
|
||||
|
||||
public function get($ns, $key) {
|
||||
return $this->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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue