本文整理汇总了PHP中Filter::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::factory方法的具体用法?PHP Filter::factory怎么用?PHP Filter::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::factory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($name)
{
if (self::$factory == NULL) {
self::$factory = new Factory('filters');
}
return self::$factory->get($name);
}
示例2: _apply
/**
* Apply Filter
*
* @param Iterator $iterator
* @param mixed $filters
* @return Iterator
*/
protected function _apply($iterator, $filters)
{
foreach ($filters as $filter) {
$iterator = Filter::factory($iterator, $filter);
}
return $iterator;
}
示例3: post_save
public function post_save()
{
$settings = $this->param('setting', array(), TRUE);
$filter = Filter::factory($settings)->rule('site.allow_html_title', FALSE, Config::NO);
$validation = Validation::factory(array());
Observer::notify('validation_settings', $validation, $filter, $settings);
$filter->run();
$validation = $validation->copy($filter->data());
if (!$validation->check()) {
throw new API_Validation_Exception($validation->errors('validation'));
}
$settings = $validation->data();
Config::set_from_array($settings);
Observer::notify('save_settings', $settings);
Kohana::$log->add(Log::INFO, ':user change Settings')->write();
$this->message('Settings has been saved!');
}
示例4: post_filter
public function post_filter($field, $callback, array $args = NULL)
{
$context = $field === NULL ? $this : $this->find($field);
// Add the post filter
$context->add_validator('post_filters', Filter::factory($field, $context, $callback, $args));
return $this;
}
示例5: validate
function validate($filter, $var)
{
return Filter::factory($filter)->validate($var);
}
示例6: testFactoryRegister
public function testFactoryRegister()
{
Filter::registerFilter('gibberish', 'Filterus\\Filters\\Raw');
$expect = Filter::factory('gibberish');
$this->assertTrue($expect instanceof Filters\Raw);
}
示例7: _init
protected function _init()
{
$this->_filter = Filter::factory(array(), $this->filters());
return parent::_init();
}