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


PHP XenForo_Template_Compiler::parseConditionExpression方法代码示例

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


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

示例1: compile

 /**
  * Compiles the function 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();
     }
     $condition = $compiler->parseConditionExpression($arguments[0], $options);
     $true = $function == 'checked' ? 'checked="checked"' : 'selected="selected"';
     return '(' . $condition . ' ? \' ' . $true . '\' : \'\')';
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:20,代码来源:CheckedSelected.php

示例2: compile

 /**
  * Compile the var named in the first argument and return PHP code to access and escape it.
  *
  * @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)
 {
     if (count($arguments) < 1) {
         throw $compiler->getNewCompilerArgumentException();
     }
     $compileOptions = array_merge($options, array('varEscape' => false));
     if (!empty($arguments[1])) {
         $doubleEncode = $compiler->parseConditionExpression($arguments[1], $options);
     } else {
         $doubleEncode = 'true';
     }
     return 'htmlspecialchars(' . $compiler->compileAndCombineSegments($arguments[0], $compileOptions) . ', ENT_QUOTES, \'UTF-8\', ' . $doubleEncode . ')';
 }
开发者ID:Sywooch,项目名称:forums,代码行数:23,代码来源:Escape.php

示例3: compile

 /**
  * Compile the var named in the first argument and return PHP code to access and escape it.
  *
  * @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)
 {
     if (count($arguments) < 1) {
         throw $compiler->getNewCompilerArgumentException();
     }
     $compileOptions = array_merge($options, array('varEscape' => false));
     if (!empty($arguments[1])) {
         $doubleEncode = $compiler->parseConditionExpression($arguments[1], $options);
     } else {
         $doubleEncode = 'true';
     }
     // note: ISO-8859-1 is fine since we use UTF-8 and are only replacing basic chars
     return 'htmlspecialchars(' . $compiler->compileAndCombineSegments($arguments[0], $compileOptions) . ', ENT_COMPAT, \'ISO-8859-1\', ' . $doubleEncode . ')';
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:24,代码来源:Escape.php

示例4: compile

 /**
  * Compiles the function 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 != 2 && $argc != 3) {
         throw $compiler->getNewCompilerArgumentException();
     }
     $condition = $compiler->parseConditionExpression($arguments[0], $options);
     $true = $compiler->compileAndCombineSegments($arguments[1], $options);
     if (!isset($arguments[2])) {
         $arguments[2] = '';
     }
     $false = $compiler->compileAndCombineSegments($arguments[2], $options);
     return '(' . $condition . ' ? (' . $true . ') : (' . $false . '))';
 }
开发者ID:Sywooch,项目名称:forums,代码行数:24,代码来源:If.php

示例5: 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)
 {
     // user array
     if (!empty($attributes['user'])) {
         $user = $compiler->compileVarRef($attributes['user'], $options);
     } else {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('missing_attribute_x_for_tag_y', array('attribute' => 'user', 'tag' => 'avatar')));
     }
     // avatar image mode (span or img)
     if (isset($attributes['img'])) {
         $img = $compiler->parseConditionExpression($attributes['img'], $options);
     } else {
         $img = 'false';
     }
     return 'XenForo_Template_Helper_Core::callHelper(\'avatarhtml\', array(' . $user . ',' . $img . ',' . $compiler->getNamedParamsAsPhpCode($attributes, $options, array('code')) . ',' . $compiler->compileAndCombineSegments($children, $options) . '))';
 }
开发者ID:Sywooch,项目名称:forums,代码行数:27,代码来源:Avatar.php

示例6: 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)
 {
     // user array
     if (!empty($attributes['user'])) {
         $user = $compiler->compileVarRef($attributes['user'], $options);
         unset($attributes['user']);
     } else {
         throw $compiler->getNewCompilerException(new XenForo_Phrase('missing_x_attribute_for_y_tag', array('attribute' => 'user', 'tag' => 'username')));
     }
     if (!empty($attributes['rich'])) {
         $rich = $compiler->parseConditionExpression($attributes['rich'], $options);
     } else {
         $rich = 'false';
     }
     unset($attributes['rich']);
     return 'XenForo_Template_Helper_Core::userNameHtml(' . $user . ',' . $compiler->compileAndCombineSegments($children, $options) . ',' . $rich . ',' . $compiler->getNamedParamsAsPhpCode($attributes, $options, array('code')) . ')';
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:28,代码来源:Username.php


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