fix Validator
This commit is contained in:
parent
28429039a4
commit
526262c80b
9 changed files with 38 additions and 39 deletions
|
|
@ -26,6 +26,7 @@ class Action
|
|||
|
||||
// Параметры устанавливаются при создании контроллера
|
||||
public $name = ''; // Имя модуля
|
||||
public $front;
|
||||
|
||||
public $modulePath = null; // Путь к модулю
|
||||
public $moduleTitle = '';
|
||||
|
|
|
|||
|
|
@ -171,8 +171,9 @@ class Component
|
|||
*/
|
||||
public function getModel($name)
|
||||
{
|
||||
$modelName = "Mapper_" . $name;
|
||||
$modelName = "App\\Mapper\\" . $name;
|
||||
$model = new $modelName();
|
||||
$model->config = $this->config;
|
||||
$model->db = $this->db;
|
||||
return $model;
|
||||
}
|
||||
|
|
@ -260,7 +261,7 @@ class Component
|
|||
} else {
|
||||
$component = new $className();
|
||||
|
||||
$template = $component->getTemplateName($registry);
|
||||
$template = $component->getTemplateName($site->config);
|
||||
|
||||
$component->viewPath = array(
|
||||
// Сначало ищем локально
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class Front extends Action
|
|||
$module->config = $this->config;
|
||||
$module->db = $this->db;
|
||||
$module->user = $this->user;
|
||||
$module->front = $this;
|
||||
// Ведение лога
|
||||
$logger = new ActionLogger($module, $logPath, $this->user);
|
||||
$logger->before = $this->loadSettings(Path::join($modPath, 'filter', 'logger.php'));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace ctiso\Controller;
|
||||
|
||||
interface SiteInterface {
|
||||
function getResource();
|
||||
function loadComponent($expression);
|
||||
function getDatabase();
|
||||
function getConfig();
|
||||
|
|
|
|||
|
|
@ -48,20 +48,4 @@ class Registry {
|
|||
function set($ns, $key, $value) {
|
||||
$this->namespace[$ns]['data'][$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Список модулей
|
||||
*/
|
||||
public function getModules()
|
||||
{
|
||||
return array_keys($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка наличия модуля
|
||||
*/
|
||||
public function hasModule($name)
|
||||
{
|
||||
return isset($this->data[$name]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,11 +156,6 @@ class Settings
|
|||
$name = array_shift($key);
|
||||
unset($data[$name]);
|
||||
}
|
||||
|
||||
public function getOwner()
|
||||
{
|
||||
return array_keys($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Запись настроек в файл (Может переименовать в store)
|
||||
|
|
@ -195,4 +190,20 @@ class Settings
|
|||
function import($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Список модулей/ключей
|
||||
*/
|
||||
public function getKeys()
|
||||
{
|
||||
return array_keys($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка наличия ключа
|
||||
*/
|
||||
public function hasKey($name)
|
||||
{
|
||||
return isset($this->data[$name]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace ctiso\Validator\Rule;
|
|||
use ctiso\Validator\Rule\AbstractRule,
|
||||
ctiso\Collection;
|
||||
|
||||
class Match extends AbstractRule
|
||||
class MatchRule extends AbstractRule
|
||||
{
|
||||
public $same;
|
||||
|
||||
|
|
@ -28,19 +28,19 @@ class Validator
|
|||
public function addRuleList(array $input)
|
||||
{
|
||||
$type = array(
|
||||
'date' => 'Validator_Rule_Date',
|
||||
'email' => 'Validator_Rule_Email',
|
||||
'emaillist'=> 'Validator_Rule_EmailList',
|
||||
'match' => 'Validator_Rule_Match',
|
||||
'time' => 'Validator_Rule_Time',
|
||||
'alpha' => 'Validator_Rule_Alpha',
|
||||
'require' => 'Validator_Rule_Notnull',
|
||||
'numeric' => 'Validator_Rule_Numeric',
|
||||
'unique' => 'Validator_Rule_Unique',
|
||||
'filename' => 'Validator_Rule_FileName',
|
||||
'count' => 'Validator_Rule_Count',
|
||||
'isfile' => 'Validator_Rule_IsFile',
|
||||
'code' => 'Validator_Rule_Code'
|
||||
'date' => 'ctiso\\Validator\\Rule\\Date',
|
||||
'email' => 'ctiso\\Validator\\Rule\\Email',
|
||||
'emaillist'=> 'ctiso\\Validator\\Rule\\EmailList',
|
||||
'match' => 'ctiso\\Validator\\Rule\\MatchRule',
|
||||
'time' => 'ctiso\\Validator\\Rule\\Time',
|
||||
'alpha' => 'ctiso\\Validator\\Rule\\Alpha',
|
||||
'require' => 'ctiso\\Validator\\Rule\\Notnull',
|
||||
'numeric' => 'ctiso\\Validator\\Rule\\Numeric',
|
||||
'unique' => 'ctiso\\Validator\\Rule\\Unique',
|
||||
'filename' => 'ctiso\\Validator\\Rule\\FileName',
|
||||
'count' => 'ctiso\\Validator\\Rule\\Count',
|
||||
'isfile' => 'ctiso\\Validator\\Rule\\IsFile',
|
||||
'code' => 'ctiso\\Validator\\Rule\\Code'
|
||||
);
|
||||
|
||||
// Разбор правила проверки
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ class View
|
|||
* Связывет переменную с вложенным шаблоном
|
||||
*
|
||||
* @param string $section переменная шаблона
|
||||
* @param CompositeView $view вложенный шаблон
|
||||
* @param View|string $view вложенный шаблон
|
||||
*/
|
||||
public function setView($section, /*View_View|string*/ $view)
|
||||
public function setView($section, $view/*: View|string*/)
|
||||
{
|
||||
$this->_section [$section] = $view;
|
||||
if (is_object($view)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue