Правки namespace
This commit is contained in:
parent
ee06f1febb
commit
524b27936a
39 changed files with 141 additions and 120 deletions
|
|
@ -2,16 +2,19 @@
|
|||
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\HttpRequest,
|
||||
ctiso\ComponentRequest,
|
||||
ctiso\Arr,
|
||||
ctiso\Path,
|
||||
PHPTAL,
|
||||
PHPTAL_PreFilter_Normalize,
|
||||
ctiso\File,
|
||||
ctiso\Form\Form,
|
||||
ctiso\Form\OptionFactory,
|
||||
ctiso\Database,
|
||||
ctiso\Database\PDOStatement,
|
||||
ctiso\Collection,
|
||||
ctiso\Controller\Site;
|
||||
ctiso\Settings,
|
||||
App\Controller\Site,
|
||||
PHPTAL,
|
||||
PHPTAL_PreFilter_Normalize;
|
||||
|
||||
function replaceContent($match) {
|
||||
$result = Tales\Component::phptal_component(htmlspecialchars_decode($match[3]));
|
||||
|
|
@ -22,35 +25,6 @@ function applyComponents($text) {
|
|||
return preg_replace_callback('/<(\w+)(\s+[a-zA-Z\-]+=\"[^\"]*\")*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u', 'replaceContent', $text);
|
||||
}
|
||||
|
||||
class ComponentRequest {
|
||||
public $component_id;
|
||||
public $component_title;
|
||||
public $r;
|
||||
|
||||
function __construct($c, HttpRequest $r) {
|
||||
$this->component_id = $c;
|
||||
$this->r = $r;
|
||||
}
|
||||
|
||||
function get($key, $default = null) {
|
||||
if ($key == 'active_page') {
|
||||
return $this->r->get($key);
|
||||
}
|
||||
if ($arr = $this->r->get($key)) {
|
||||
if (is_array($arr)) {
|
||||
return Arr::get($arr, $this->component_id, $default);
|
||||
} else {
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
function getAction() {
|
||||
return $this->r->getAction();
|
||||
}
|
||||
}
|
||||
|
||||
class FakeTemplate {
|
||||
public $_data = [];
|
||||
public $_name = '';
|
||||
|
|
@ -183,7 +157,7 @@ class Component
|
|||
return $model;
|
||||
}
|
||||
|
||||
public function options($key, $val, /*.Database_PDOStatement.*/$res) {
|
||||
public function options($key, $val, /*.PDOStatement.*/$res) {
|
||||
$result = array();
|
||||
while($res->next()) {
|
||||
$result[] = array('value' => $res->getString($key), 'name' => $res->getString($val));
|
||||
|
|
@ -221,7 +195,7 @@ class Component
|
|||
/**
|
||||
* Генерация интерфейса для выбора галлереи фотографии
|
||||
*/
|
||||
public function setParameters(/*.View_Composite.*/$view)
|
||||
public function setParameters(/*.Composite.*/$view)
|
||||
{
|
||||
$form = new Form();
|
||||
$options = new OptionFactory($this->db, $this->registry);
|
||||
|
|
@ -234,7 +208,7 @@ class Component
|
|||
$view->component_title = $settings['title'];
|
||||
}
|
||||
|
||||
static function loadComponent($expression, Database $db, /*.Registry.*/ $registry)
|
||||
static function loadComponent($expression, Database $db, /*.Settings.*/ $registry)
|
||||
{
|
||||
|
||||
$expression = htmlspecialchars_decode($expression);
|
||||
|
|
@ -254,7 +228,7 @@ class Component
|
|||
$path = Path::join (BASE_PATH, 'components', $name, $name . '.php');
|
||||
$className = 'Component_' . $name;
|
||||
|
||||
/*.Controller_Component.*/$component = null;
|
||||
/*.Component.*/$component = null;
|
||||
|
||||
if (file_exists($path)) {
|
||||
require_once ($path);
|
||||
|
|
@ -313,7 +287,7 @@ class Component
|
|||
|
||||
$editor = $component->getEditUrl();
|
||||
if ($editor) {
|
||||
if(class_exists("Controller_Site")) { //Если мы в CMS2
|
||||
if (class_exists("Controller_Site")) { //Если мы в CMS2
|
||||
$instance = Site::getInstance();
|
||||
$instance->componentsConfig[] = $editor;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue