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


PHP XenForo_Template_Compiler::escapeSingleQuotedString方法代码示例

本文整理汇总了PHP中XenForo_Template_Compiler::escapeSingleQuotedString方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Compiler::escapeSingleQuotedString方法的具体用法?PHP XenForo_Template_Compiler::escapeSingleQuotedString怎么用?PHP XenForo_Template_Compiler::escapeSingleQuotedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XenForo_Template_Compiler的用法示例。


在下文中一共展示了XenForo_Template_Compiler::escapeSingleQuotedString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 /**
  * Compile the specified tag and return PHP code to handle it.
  *
  * @param XenForo_Template_Compiler The invoking compiler
  * @param string                 Name of the tag called
  * @param array                  Attributes for the tag (may be empty)
  * @param array                  Nodes (tags/curlies/text) within this tag (may be empty)
  * @param array                  Compilation options
  *
  * @return string
  */
 public function compile(XenForo_Template_Compiler $compiler, $tag, array $attributes, array $children, array $options)
 {
     if (empty($options['allowRawStatements'])) {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('x_tags_only_used_where_full_statements_allowed', array('tag' => 'require')));
     }
     $requirements = $compiler->getNamedAttributes($attributes, array('css', 'js'));
     if (!$requirements) {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('require_tag_does_not_specify_any_known_types_css_or_js'));
     }
     if (isset($requirements['css'])) {
         $css = $requirements['css'];
         if (empty($css) || count($css) != 1 || !is_string($css[0])) {
             throw $compiler->getNewCompilerException(new XenForo_Phrase('only_literal_css_templates_may_be_included_by_require_tag'));
         }
         if (substr($css[0], -4) != '.css') {
             throw $compiler->getNewCompilerException(new XenForo_Phrase('all_required_css_templates_must_end_in_'));
         }
         $requirements['css'][0] = substr($css[0], 0, -4);
     }
     $statement = $compiler->getNewRawStatement();
     foreach ($requirements as $attribute => $value) {
         $statement->addStatement('$this->addRequiredExternal(\'' . $compiler->escapeSingleQuotedString($attribute) . '\', ' . $compiler->compileAndCombineSegments($value) . ");\n");
     }
     return $statement;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:36,代码来源:Require.php

示例2: compile

 /**
  * Compile the specified tag and return PHP code to handle it.
  *
  * @param XenForo_Template_Compiler The invoking compiler
  * @param string                 Name of the tag called
  * @param array                  Attributes for the tag (may be empty)
  * @param array                  Nodes (tags/curlies/text) within this tag (may be empty)
  * @param array                  Compilation options
  *
  * @return string
  */
 public function compile(XenForo_Template_Compiler $compiler, $tag, array $attributes, array $children, array $options)
 {
     if ($tag == 'breadcrumb') {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('breadcrumb_tag_must_be_within_navigation_tag'));
     }
     if (empty($options['allowRawStatements'])) {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('x_tags_only_used_where_full_statements_allowed', array('tag' => 'navigation')));
     }
     $rawStatement = $compiler->getNewRawStatement();
     $rawStatement->addStatement("\$__extraData['navigation'] = array();\n");
     foreach ($children as $child) {
         if ($compiler->isSegmentNamedTag($child, 'breadcrumb')) {
             if (isset($child['attributes']['source'])) {
                 $sourceVar = $compiler->compileVarRef($child['attributes']['source'], $options);
                 $rawStatement->addStatement('$__extraData[\'navigation\'] = XenForo_Template_Helper_Core::appendBreadCrumbs($__extraData[\'navigation\'], ' . $sourceVar . ");\n");
             } else {
                 $parts = array();
                 foreach ($child['attributes'] as $name => $value) {
                     $parts[] = "'" . $compiler->escapeSingleQuotedString($name) . "' => " . $compiler->compileAndCombineSegments($value, $options);
                 }
                 $parts[] = "'value' => " . $compiler->compileAndCombineSegments($child['children'], $options);
                 $rawStatement->addStatement('$__extraData[\'navigation\'][] = array(' . implode(', ', $parts) . ");\n");
             }
         } else {
             if (is_string($child) && trim($child) === '') {
                 // whitespace -- ignore it
             } else {
                 throw $compiler->getNewCompilerException(new XenForo_Phrase('invalid_data_found_in_navigation_tag'), $child);
             }
         }
     }
     return $rawStatement;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:44,代码来源:Navigation.php

示例3: compile

 /**
  * Compiles the phrase call.
  *
  * @param XenForo_Template_Compiler The invoking compiler
  * @param string                 Name of the function called
  * @param array                  Arguments to the function (should have at least 1)
  * @param array                  Compilation options
  *
  * @return string
  */
 public function compile(XenForo_Template_Compiler $compiler, $function, array $arguments, array $options)
 {
     $argc = count($arguments);
     if ($argc < 1) {
         throw $compiler->getNewCompilerArgumentException();
     }
     $phraseName = $compiler->getArgumentLiteralValue(array_shift($arguments));
     if ($phraseName === false) {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('phrase_name_must_be_literal'));
     }
     $phraseValue = $compiler->getPhraseValue($phraseName);
     if ($phraseValue === false) {
         return "'" . $compiler->escapeSingleQuotedString($phraseName) . "'";
     }
     $this->_params = $compiler->compileNamedParams($compiler->parseNamedArguments($arguments), $options);
     $phraseValueEscaped = $compiler->escapeSingleQuotedString($phraseValue);
     $phraseValueEscaped = preg_replace_callback('/\\{([a-z0-9_-]+)\\}/i', array($this, '_replaceParam'), $phraseValueEscaped);
     if ($phraseValueEscaped === '') {
         return '';
     }
     $this->_params = array();
     return "'" . $phraseValueEscaped . "'";
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:33,代码来源:Phrase.php


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