本文整理汇总了PHP中sfFilterChain::register方法的典型用法代码示例。如果您正苦于以下问题:PHP sfFilterChain::register方法的具体用法?PHP sfFilterChain::register怎么用?PHP sfFilterChain::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfFilterChain
的用法示例。
在下文中一共展示了sfFilterChain::register方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute_filter_chain
function execute_filter_chain($context, $t)
{
$filterChain = new sfFilterChain();
$filter = new lastTestFilter($context);
$filter->response = $context->response;
$filterChain->register($filter);
$filter = new sfCommonFilter($context);
$filterChain->register($filter);
$filter = new firstTestFilter($context);
$filter->response = $context->response;
$filterChain->register($filter);
$filterChain->execute();
$dom = new DomDocument('1.0', 'UTF-8');
$dom->validateOnParse = true;
$dom->loadHTML($context->response->getContent());
$selector = new sfDomCssSelector($dom);
return $selector;
}
示例2: sfContext
// sfFlashFilter has executed no code
// register some flash from previous request
$user->setAttribute('previous_request', 'foo', 'symfony/flash');
$user->setAttribute('every_request', 'foo', 'symfony/flash');
$filterChain->execute();
// sfFlashFilter has executed all its code
$t->ok(!$user->hasAttribute('previous_request', 'symfony/flash'), '->execute() removes flash variables that have been tagged before');
$t->ok(!$user->hasAttribute('previous_request', 'symfony/flash/remove'), '->execute() removes flash variables that have been tagged before');
$t->is($user->getAttribute('this_request', null, 'symfony/flash'), 'foo', '->execute() keeps current request flash variables');
$t->is($user->getAttribute('every_request', null, 'symfony/flash'), 'foo', '->execute() flash variables that have been overriden in current request');
}
}
$context = new sfContext();
$user = new myUser();
$user->initialize($context);
$context->user = $user;
$filterChain = new sfFilterChain();
$filter = new lastTestFilter();
$filter->t = $t;
$filter->user = $user;
$filter->initialize($context);
$filterChain->register($filter);
$filter = new sfFlashFilter();
$filter->initialize($context);
$filterChain->register($filter);
$filter = new firstTestFilter();
$filter->t = $t;
$filter->user = $user;
$filter->initialize($context);
$filterChain->register($filter);
$filterChain->execute();