本文整理匯總了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();
}