当前位置: 首页>>代码示例>>PHP>>正文


PHP sfOutputEscaper::markClassAsSafe方法代码示例

本文整理汇总了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('&lt;strong&gt;escaped!&lt;/strong&gt;'), '<strong>escaped!</strong>', '::unescape() returns an unescaped string if the value to unescape is a string');
$t->is(sfOutputEscaper::unescape('&lt;strong&gt;&eacute;chapp&eacute;&lt;/strong&gt;'), '<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');
开发者ID:sensorsix,项目名称:app,代码行数:31,代码来源:sfOutputEscaperTest.php

示例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;
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:26,代码来源:opApplicationConfiguration.class.php

示例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;
 }
开发者ID:TadahiroKudo,项目名称:OpenPNE3,代码行数:19,代码来源:opApplicationConfiguration.class.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:openphysic-svn,代码行数:28,代码来源:config_core_compile.yml.php

示例6: initialize

 public function initialize()
 {
     // make the ioMenuItem not be escaped in the template
     sfOutputEscaper::markClassAsSafe('ioMenuItem');
 }
开发者ID:vicb,项目名称:ioMenuPlugin,代码行数:5,代码来源:ioMenuPluginConfiguration.class.php


注:本文中的sfOutputEscaper::markClassAsSafe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。