本文整理汇总了PHP中sfOutputEscaper::markClassAsSafe方法的典型用法代码示例。如果您正苦于以下问题:PHP sfOutputEscaper::markClassAsSafe方法的具体用法?PHP sfOutputEscaper::markClassAsSafe怎么用?PHP sfOutputEscaper::markClassAsSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfOutputEscaper
的用法示例。
在下文中一共展示了sfOutputEscaper::markClassAsSafe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize()
{
if ($this->configuration instanceof sfApplicationConfiguration) {
if (sfNestedCommentConfig::isRoutesRegister()) {
if (in_array('sfNestedComment', sfConfig::get('sf_enabled_modules', array()))) {
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'listenToRoutingLoadConfigurationEvent'));
}
if (in_array('sfNestedCommentAdmin', sfConfig::get('sf_enabled_modules', array()))) {
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'addRouteForNestedCommentAdmin'));
}
}
sfOutputEscaper::markClassAsSafe('sfNestedCommentsRenderer');
if (sfNestedCommentConfig::isUsePluginPurifier()) {
self::registerHTMLPurifier();
}
}
}
开发者ID:nibsirahsieu,项目名称:sfNestedCommentPlugin,代码行数:19,代码来源:sfNestedCommentPluginConfiguration.class.php
示例2: array
$t->diag('::unescape() unescapes strings');
$t->is(sfOutputEscaper::unescape('<strong>escaped!</strong>'), '<strong>escaped!</strong>', '::unescape() returns an unescaped string if the value to unescape is a string');
$t->is(sfOutputEscaper::unescape('<strong>échappé</strong>'), '<strong>échappé</strong>', '::unescape() returns an unescaped string if the value to unescape is a string');
$t->diag('::unescape() unescapes arrays');
$input = sfOutputEscaper::escape('esc_entities', array('foo' => '<strong>escaped!</strong>', 'bar' => array('foo' => '<strong>escaped!</strong>')));
$output = sfOutputEscaper::unescape($input);
$t->ok(is_array($output), '::unescape() returns an array if the input is a sfOutputEscaperArrayDecorator object');
$t->is($output['foo'], '<strong>escaped!</strong>', '::unescape() unescapes all elements of the original array');
$t->is($output['bar']['foo'], '<strong>escaped!</strong>', '::unescape() is recursive');
$t->diag('::unescape() unescapes objects');
$object = new OutputEscaperTestClass();
$input = sfOutputEscaper::escape('esc_entities', $object);
$output = sfOutputEscaper::unescape($input);
$t->isa_ok($output, 'OutputEscaperTestClass', '::unescape() returns the original object when a sfOutputEscaperObjectDecorator object is passed');
$t->is($output->getTitle(), '<strong>escaped!</strong>', '::unescape() unescapes all methods of the original object');
$t->is($output->title, '<strong>escaped!</strong>', '::unescape() unescapes all properties of the original object');
$t->is($output->getTitleTitle(), '<strong>escaped!</strong>', '::unescape() is recursive');
$t->isa_ok(sfOutputEscaperIteratorDecorator::unescape(sfOutputEscaper::escape('esc_entities', new DirectoryIterator('.'))), 'DirectoryIterator', '::unescape() unescapes sfOutputEscaperIteratorDecorator objects');
$t->diag('::unescape() does not unescape object marked as being safe');
$t->isa_ok(sfOutputEscaper::unescape(sfOutputEscaper::escape('esc_entities', new sfOutputEscaperSafe(new OutputEscaperTestClass()))), 'OutputEscaperTestClass', '::unescape() returns the original value if it is marked as being safe');
sfOutputEscaper::markClassAsSafe('OutputEscaperTestClass');
$t->isa_ok(sfOutputEscaper::unescape(sfOutputEscaper::escape('esc_entities', new OutputEscaperTestClass())), 'OutputEscaperTestClass', '::unescape() returns the original value if the object class is marked as being safe');
$t->isa_ok(sfOutputEscaper::unescape(sfOutputEscaper::escape('esc_entities', new OutputEscaperTestClassChild())), 'OutputEscaperTestClassChild', '::unescape() returns the original value if one of the object parent class is marked as being safe');
$t->diag('::unescape() do nothing to resources');
$fh = fopen(__FILE__, 'r');
$t->is(sfOutputEscaper::unescape($fh), $fh, '::unescape() do nothing to resources');
$t->diag('::unescape() unescapes mixed arrays');
$object = new OutputEscaperTestClass();
$input = array('foo' => 'bar', 'bar' => sfOutputEscaper::escape('esc_entities', '<strong>bar</strong>'), 'foobar' => sfOutputEscaper::escape('esc_entities', $object));
$output = array('foo' => 'bar', 'bar' => '<strong>bar</strong>', 'foobar' => $object);
$t->is(sfOutputEscaper::unescape($input), $output, '::unescape() unescapes values with some escaped and unescaped values');
示例3: filterTemplateParameters
/**
* Listens to the template.filter_parameters event.
*
* @param sfEvent $event An sfEvent instance
* @param array $parameters An array of template parameters to filter
*
* @return array The filtered parameters array
*/
public function filterTemplateParameters(sfEvent $event, $parameters)
{
$parameters['op_config'] = new opConfig();
sfOutputEscaper::markClassAsSafe('opConfig');
$parameters['op_color'] = new opColorConfig();
$table = Doctrine::getTable('SnsTerm');
$application = sfConfig::get('sf_app');
if ($application == 'pc_backend') {
$application = 'pc_frontend';
}
$table->configure(sfContext::getInstance()->getUser()->getCulture(), $application);
if (!$table['member']) {
$table->configure('en', $application);
}
$parameters['op_term'] = $table;
sfOutputEscaper::markClassAsSafe('SnsTermTable');
return $parameters;
}
示例4: filterTemplateParameters
/**
* Listens to the template.filter_parameters event.
*
* @param sfEvent $event An sfEvent instance
* @param array $parameters An array of template parameters to filter
*
* @return array The filtered parameters array
*/
public function filterTemplateParameters(sfEvent $event, $parameters)
{
$parameters['op_config'] = new opConfig();
sfOutputEscaper::markClassAsSafe('opConfig');
$parameters['op_color'] = new opColorConfig();
$table = Doctrine::getTable('SnsTerm');
$table->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app'));
$parameters['op_term'] = $table;
sfOutputEscaper::markClassAsSafe('SnsTermTable');
return $parameters;
}
示例5: initialize
public function initialize($context, $moduleName, $actionName, $viewName)
{
$this->moduleName = $moduleName;
$this->actionName = $actionName;
$this->viewName = $viewName;
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Initialize view for "%s/%s"', $moduleName, $actionName))));
}
sfOutputEscaper::markClassAsSafe('sfForm');
$this->attributeHolder = $this->initializeAttributeHolder();
$this->parameterHolder = new sfParameterHolder();
$this->parameterHolder->add(sfConfig::get('mod_' . strtolower($moduleName) . '_view_param', array()));
$request = $context->getRequest();
if (!is_null($format = $request->getRequestFormat())) {
if ('html' != $format) {
$this->setExtension('.' . $format . $this->getExtension());
}
if ($mimeType = $request->getMimeType($format)) {
$this->context->getResponse()->setContentType($mimeType);
$this->setDecorator(false);
}
$this->dispatcher->notify(new sfEvent($this, 'view.configure_format', array('format' => $format, 'response' => $context->getResponse(), 'request' => $context->getRequest())));
}
$this->configure();
return true;
}
示例6: initialize
public function initialize()
{
// make the ioMenuItem not be escaped in the template
sfOutputEscaper::markClassAsSafe('ioMenuItem');
}