Правки namespace
This commit is contained in:
parent
ee06f1febb
commit
524b27936a
39 changed files with 141 additions and 120 deletions
35
src/ComponentRequest.php
Normal file
35
src/ComponentRequest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso;
|
||||
|
||||
use ctiso\HttpRequest,
|
||||
ctiso\Arr;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ use ctiso\Shortcut,
|
|||
ctiso\HttpRequest,
|
||||
ctiso\Functions,
|
||||
ctiso\Settings,
|
||||
ctiso\View\Composite,
|
||||
ctiso\View\View,
|
||||
ctiso\Controller\State;
|
||||
|
||||
/**
|
||||
|
|
@ -82,18 +84,15 @@ class Action
|
|||
return Path::join($basePath, "modules", $name);
|
||||
}
|
||||
|
||||
public function addSuggest(View $view, $name)
|
||||
{
|
||||
public function addSuggest(View $view, $name) {
|
||||
$suggest = array();
|
||||
$file = Path::join($this->modulePath, 'help', $name . '.suggest');
|
||||
if (file_exists($file)) {
|
||||
include($file);
|
||||
$view->suggestions = $suggest;
|
||||
$view->suggestions = include($file);
|
||||
}
|
||||
}
|
||||
|
||||
function findIcon($icon, $size)
|
||||
{
|
||||
function findIcon($icon, $size) {
|
||||
$webPath = $this->settings['web'];
|
||||
return Path::join($webPath, 'icons', $size . 'x' . $size, $icon . '.png');
|
||||
}
|
||||
|
|
@ -122,7 +121,7 @@ class Action
|
|||
if(file_exists($template)) { break; }
|
||||
}
|
||||
|
||||
/*.View_Composite.*/$tpl = new $viewClass($template);
|
||||
/*.Composite.*/$tpl = new $viewClass($template);
|
||||
|
||||
$stylePath = Path::join($webPath, "assets", "css");
|
||||
$iconsPath = Path::join($webPath, 'icons');
|
||||
|
|
@ -170,7 +169,7 @@ class Action
|
|||
$action = "actionIndex";
|
||||
}
|
||||
$view = $this->forward($action, $request);
|
||||
if ($view instanceof View_View) {
|
||||
if ($view instanceof View) {
|
||||
$view->active_module = get_class($this);
|
||||
$view->module_action = $action;
|
||||
}
|
||||
|
|
@ -208,7 +207,7 @@ class Action
|
|||
*/
|
||||
public function nUrl($name, array $param = array())
|
||||
{
|
||||
/*.Filter_ActionAccess.*/$access = $this->access;
|
||||
/*.ActionAccess.*/$access = $this->access;
|
||||
|
||||
if ($access == null || $access->checkAction($name)) {
|
||||
$param = array_merge(array(
|
||||
|
|
@ -295,12 +294,12 @@ class Action
|
|||
/**
|
||||
* Добавление widget к отображению
|
||||
*/
|
||||
public function addChild(/*Widgets_Widget*/ $section, $node)
|
||||
public function addChild($section, $node)
|
||||
{
|
||||
$this->childNodes[$section] = $node;
|
||||
}
|
||||
|
||||
public function setValue(/*Widgets_Widget*/ $name, $value)
|
||||
public function setValue($name, $value)
|
||||
{
|
||||
$this->ctrlValues[$name] = $value;
|
||||
}
|
||||
|
|
@ -308,7 +307,7 @@ class Action
|
|||
/**
|
||||
* Добавление дочернего отображения к текущему отображению
|
||||
*/
|
||||
public function addView(/*CompositeView*/ $section, $node)
|
||||
public function addView($section, $node)
|
||||
{
|
||||
$this->childViews[$section] = $node;
|
||||
}
|
||||
|
|
@ -322,7 +321,7 @@ class Action
|
|||
if ($this->view instanceof View_View) {
|
||||
$this->view->assignValues($this->ctrlValues);
|
||||
|
||||
/*.Widgets_Widget.*/$node = null;
|
||||
/*.Composite.*/$node = null;
|
||||
foreach ($this->childNodes as $name => $node) {
|
||||
$node->make($this);
|
||||
$this->view->setView($name, $node->view);
|
||||
|
|
@ -335,8 +334,7 @@ class Action
|
|||
return $this->view;
|
||||
}
|
||||
|
||||
function getPageId(HttpRequest $request)
|
||||
{
|
||||
function getPageId(HttpRequest $request) {
|
||||
$pageId = time();
|
||||
$request->session()->set('page', $pageId);
|
||||
return $pageId;
|
||||
|
|
@ -353,19 +351,17 @@ class Action
|
|||
return $result;
|
||||
}
|
||||
|
||||
function _getActionPath()
|
||||
{
|
||||
function _getActionPath() {
|
||||
return new State('index');
|
||||
}
|
||||
|
||||
// Тоже убрать в метод Controller_Model
|
||||
function getActionPath(HttpRequest $request, $action = null)
|
||||
{
|
||||
function getActionPath(HttpRequest $request, $action = null) {
|
||||
$this->_getActionPath()->getPath($this, ($action) ? $action : $request->getAction());
|
||||
}
|
||||
|
||||
function redirect($action) {
|
||||
header('location: ' . $this->fUrl($action));
|
||||
header('location: ' . $action->toString());
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class Front extends Action
|
|||
return $this->loadModule($name[0], $request, $controller);
|
||||
} catch (UserMessageException $ex) { //Исключение с понятным пользователю сообщением
|
||||
$mode = $request->get('mode');
|
||||
if($mode == 'ajax' || $mode == 'json') {
|
||||
if ($mode == 'ajax' || $mode == 'json') {
|
||||
return json_encode(['result'=>'fail', 'message'=> $ex->userMessage]);
|
||||
} else {
|
||||
return $ex->userMessage;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\HttpRequest;
|
||||
|
||||
class Request {
|
||||
public $r;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
* Класс сервиса = Упрощенный компонент
|
||||
*/
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Path;
|
||||
use ctiso\Path,
|
||||
ctiso\Database\PDOStatement;
|
||||
|
||||
class Service
|
||||
{
|
||||
|
|
@ -49,7 +50,7 @@ class Service
|
|||
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->getInt($key), 'name' => $res->getString($val));
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace {
|
|||
namespace ctiso {
|
||||
use PDO,
|
||||
ctiso\Database\Statement,
|
||||
ctiso\Database\PDOStatement,
|
||||
ctiso\Database\IdGenerator;
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +62,7 @@ class Database extends PDO
|
|||
|
||||
public function executeQuery($query, $values=null)
|
||||
{
|
||||
/*.Database_PDOStatement.*/$stmt = $this->prepare($query);
|
||||
/*.PDOStatement.*/$stmt = $this->prepare($query);
|
||||
|
||||
$stmt->execute($values);
|
||||
$stmt->cache = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
|
@ -79,7 +80,7 @@ class Database extends PDO
|
|||
*/
|
||||
public function fetchAllArray($query, $values = null)
|
||||
{
|
||||
/*.Database_PDOStatement.*/$sth = $this->prepare($query);
|
||||
/*.PDOStatement.*/$sth = $this->prepare($query);
|
||||
$prep = $this->prepareValues($values);
|
||||
$sth->execute($prep);
|
||||
return $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
|
@ -90,7 +91,7 @@ class Database extends PDO
|
|||
*/
|
||||
public function fetchOneArray($query, $values = null)
|
||||
{
|
||||
/*.Database_PDOStatement.*/$sth = $this->prepare($query);
|
||||
/*.PDOStatement.*/$sth = $this->prepare($query);
|
||||
$prep = $this->prepareValues($values);
|
||||
$sth->execute($prep);
|
||||
return $sth->fetch(PDO::FETCH_ASSOC);
|
||||
|
|
@ -180,9 +181,12 @@ class Database extends PDO
|
|||
return $result['nextval'];
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
function prepare($query) {
|
||||
/*.PDOStatement.*/$result = $this->prepare($query);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function close() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace ctiso\Database;
|
||||
|
||||
use ctiso\Database\StatementIterator,
|
||||
ctiso\Tools\StringUtil,
|
||||
PDO;
|
||||
|
||||
class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
||||
|
|
@ -91,7 +92,7 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
|||
}
|
||||
|
||||
function getArray($name) {
|
||||
return strToArray($this->fields[$name]);
|
||||
return StringUtil::strToArray($this->fields[$name]);
|
||||
}
|
||||
|
||||
function getRecordCount() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
* Класс оболочка для PDOStatement для замены Creole
|
||||
*/
|
||||
namespace ctiso\Database;
|
||||
use PDO;
|
||||
use PDO,
|
||||
ctiso\Database;
|
||||
|
||||
class Statement
|
||||
{
|
||||
|
|
@ -50,7 +51,7 @@ class Statement
|
|||
if ($this->limit) {
|
||||
$this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}";
|
||||
}
|
||||
/*.Database_PDOStatement.*/$stmt = $this->conn->prepare($this->query);
|
||||
/*.PDOStatement.*/$stmt = $this->conn->prepare($this->query);
|
||||
foreach ($this->binds as $bind) {
|
||||
list($n, $value, $type) = $bind;
|
||||
$stmt->bindValue($n, $value, (int) $type);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace ctiso\Database;
|
||||
use PDO;
|
||||
|
||||
class StatementIterator implements Iterator
|
||||
class StatementIterator implements \Iterator
|
||||
{
|
||||
|
||||
private $result;
|
||||
|
|
@ -11,7 +11,7 @@ class StatementIterator implements Iterator
|
|||
private $fetchmode;
|
||||
private $row_count;
|
||||
|
||||
public function __construct(/*.Database_PDOStatement.*/ $rs) {
|
||||
public function __construct(/*.PDOStatement.*/ $rs) {
|
||||
$this->result = $rs;
|
||||
$this->row_count = $rs->getRecordCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Клетка таблицы
|
||||
*/
|
||||
namespace ctiso\Excel;
|
||||
use XMLWriter;
|
||||
|
||||
class TableCell
|
||||
{
|
||||
|
|
@ -310,4 +311,3 @@ class Table
|
|||
$doc->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ActionAccess
|
|||
public $access = array();
|
||||
public $processor;
|
||||
|
||||
function __construct(/*.Filter_Filter.*/$processor) {
|
||||
function __construct(/*.Filter.*/$processor) {
|
||||
$this->processor = $processor;
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ class ActionAccess
|
|||
*/
|
||||
function checkAction($action) {
|
||||
// Импликация !! http://ru.wikipedia.org/wiki/Импликация
|
||||
return (!isset($this->access[$action]) || in_array(UserAccess::$access, $this->access[$action]));
|
||||
return (!isset($this->access[$action]) || in_array($this->user->access, $this->access[$action]));
|
||||
}
|
||||
|
||||
function execute(HttpRequest $request) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ActionLogger
|
|||
public $action;
|
||||
public $processor;
|
||||
|
||||
function __construct(/*.Filter_Filter.*/$processor, $logPath, $user) {
|
||||
function __construct(/*.Filter.*/$processor, $logPath, $user) {
|
||||
$this->processor = $processor;
|
||||
$this->user = $user;
|
||||
$this->file = fopen($logPath, "a");
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@
|
|||
* Попытка реализовать фильтр для запросов
|
||||
*/
|
||||
namespace ctiso\Filter;
|
||||
use ctiso\HttpRequest;
|
||||
|
||||
use ctiso\Controller\Action,
|
||||
ctiso\HttpRequest;
|
||||
|
||||
class Filter
|
||||
{
|
||||
public $processor;
|
||||
public function __construct(/*.Controller_Action.*/$processor)
|
||||
public function __construct(/*.Action.*/$processor)
|
||||
{
|
||||
$this->processor = $processor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,11 @@ class Login extends Filter
|
|||
{
|
||||
const SESSION_BROWSER_SIGN_SECRET = '@w3dsju45Msk#';
|
||||
const SESSION_BROWSER_SIGN_KEYNAME = 'session.app.browser.sign';
|
||||
|
||||
public $mode = 'ajax';
|
||||
public $user;
|
||||
public $role;
|
||||
public $whitelist;
|
||||
|
||||
function __construct($processor, $role, $whitelist = []) {
|
||||
parent::__construct($processor);
|
||||
|
|
@ -63,7 +66,7 @@ class Login extends Filter
|
|||
if ($result) {
|
||||
$temp = md5($result->getString('password') . $result->getString('login') . $result->getString('sid'));
|
||||
if ($password == $temp) {
|
||||
$this->enter($db, $result);
|
||||
$this->enter($result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Select,
|
||||
ctiso\Model\Resources,
|
||||
App\Model\Resources,
|
||||
ctiso\Model\Factory;
|
||||
|
||||
class OptionFactory {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Model;
|
||||
use ctiso\Settings;
|
||||
use ctiso\Settings,
|
||||
ctiso\Database;
|
||||
|
||||
class Factory
|
||||
{
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class Setup
|
|||
return;
|
||||
}
|
||||
|
||||
/*.SimpleXMLElement.*/$item = $this->stack[count($this->stack) - 1];
|
||||
/*.\SimpleXMLElement.*/$item = $this->stack[count($this->stack) - 1];
|
||||
$root = $item->children();
|
||||
foreach ($root as $node)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
namespace ctiso;
|
||||
use PHPTAL_Php_TalesInternal,
|
||||
ctiso\Controller\Site,
|
||||
App\Controller\Site,
|
||||
ctiso\Controller\Component,
|
||||
ctiso\HttpRequest,
|
||||
PHPTAL_Tales,
|
||||
|
|
@ -48,7 +48,7 @@ class Tales {
|
|||
*/
|
||||
static function phptal_component ($expression) {
|
||||
$begin = floatval(microtime(true));
|
||||
/*.Controller_Component.*/$component = null;
|
||||
/*.Component.*/$component = null;
|
||||
|
||||
if (class_exists("ctiso\\Controller\\Site")) { //Если мы в CMS2
|
||||
$component = Site::loadComponent($expression);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class TemplateImage
|
|||
return "";
|
||||
}
|
||||
|
||||
function imageText($text, /*.stdClass.*/$value)
|
||||
function imageText($text, /*.\stdClass.*/$value)
|
||||
{
|
||||
assert(is_string($text));
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
namespace ctiso;
|
||||
|
||||
class Url {
|
||||
public $parts;
|
||||
|
||||
function __construct($parts = []) {
|
||||
$this->parts = $parts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
abstract namespace ctiso\Validator\Rule;
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Collection;
|
||||
|
||||
class Abstract
|
||||
abstract class AbstractRule
|
||||
{
|
||||
public $field;
|
||||
protected $errorMsg;
|
||||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка на число
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Alpha extends Abstract
|
||||
class Alpha extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата электронной почты
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Code extends Abstract
|
||||
class Code extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата даты
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Count extends Abstract
|
||||
class Count extends AbstractRule
|
||||
{
|
||||
public $size = 1;
|
||||
public $max = null;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата даты
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Date extends Abstract
|
||||
class Date extends AbstractRule
|
||||
{
|
||||
private $split = "\\/";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата электронной почты
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Email extends Abstract
|
||||
class Email extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата электронной почты
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class EmailList extends Abstract
|
||||
class EmailList extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection,
|
||||
ctiso\Path;
|
||||
|
||||
class FileName extends Abstract {
|
||||
class FileName extends AbstractRule {
|
||||
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата времени
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class IsFile extends Abstract
|
||||
class IsFile extends AbstractRule
|
||||
{
|
||||
private $type = array();
|
||||
private $maxsize = 1024;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка на равентство двух полей
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Match extends Abstract
|
||||
class Match extends AbstractRule
|
||||
{
|
||||
public $same;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Notnull extends Abstract
|
||||
class Notnull extends AbstractRule
|
||||
{
|
||||
function skipEmpty() {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка на число
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Numeric extends Abstract
|
||||
class Numeric extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
* Проверка формата времени
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Time extends Abstract
|
||||
class Time extends AbstractRule
|
||||
{
|
||||
private $split = ":";
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/**
|
||||
*/
|
||||
namespace ctiso\Validator\Rule;
|
||||
use ctiso\Validator\Rule\Abstract,
|
||||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Unique extends Abstract
|
||||
class Unique extends AbstractRule
|
||||
{
|
||||
public function getErrorMsg()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace ctiso\Validator;
|
||||
use Exception,
|
||||
ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Validator
|
||||
|
|
@ -81,7 +82,7 @@ class Validator
|
|||
}
|
||||
}
|
||||
|
||||
public function skip(/*.Validator_Rule_Abstract.*/$rule, /*.Collection.*/$container) // -> Rule_Abstract
|
||||
public function skip(/*.AbstractRule.*/$rule, /*.Collection.*/$container) // -> Rule_Abstract
|
||||
{
|
||||
if ($rule->skipEmpty()) {
|
||||
$data = $container->get($rule->field);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace ctiso\View;
|
||||
use ctiso\View\View;
|
||||
|
||||
class List extends View
|
||||
class ListView extends View
|
||||
{
|
||||
function execute()
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace ctiso\View;
|
||||
use ctiso\View\View,
|
||||
ctiso\Controller\Site,
|
||||
App\Controller\Site,
|
||||
ctiso\Controller\Component,
|
||||
ctiso\HttpRequest;
|
||||
|
||||
|
|
@ -54,10 +54,9 @@ class Page extends View
|
|||
function replaceContent($match, $offset)
|
||||
{
|
||||
//$result = phptal_component($match, $offset);
|
||||
/*.Controller_Component.*/$component = null;
|
||||
/*.Component.*/$component = null;
|
||||
|
||||
|
||||
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||
if (class_exists("App\\Controller\\Site")) { //Если мы в CMS2
|
||||
$component = Site::loadComponent($match);
|
||||
} else {
|
||||
global $db, $registry; //
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Top extends Composite {
|
|||
|
||||
$init = array();
|
||||
foreach($s->_section as $key => $item) {
|
||||
/*.View_View.*/$ss = $item;
|
||||
/*.View.*/$ss = $item;
|
||||
if ($ss->codeGenerator !== null) {
|
||||
// функцию которая вычисляет а не результат
|
||||
$part = call_user_func($ss->codeGenerator, $this, $key, $value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue