當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XenForo_Template_Compiler::getNamedAttributes方法代碼示例

本文整理匯總了PHP中XenForo_Template_Compiler::getNamedAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Template_Compiler::getNamedAttributes方法的具體用法?PHP XenForo_Template_Compiler::getNamedAttributes怎麽用?PHP XenForo_Template_Compiler::getNamedAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XenForo_Template_Compiler的用法示例。


在下文中一共展示了XenForo_Template_Compiler::getNamedAttributes方法的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)
 {
     $controlOptions = $compiler->getNamedAttributes($attributes, array('save', 'name', 'reset', 'savekey', 'saveclass', 'resetkey', 'resetclass', 'explain'));
     $controlOptions = $compiler->getNamedParamsAsPhpCode($controlOptions, $options);
     $childOutput = $compiler->compileIntoVariable($children, $submitVar, $options);
     $statement = $compiler->getNewRawStatement();
     $statement->addStatement($childOutput);
     $statement->addStatement('$' . $compiler->getOutputVar() . ' .= XenForo_Template_Helper_Admin::submitUnit($' . $submitVar . ', ' . $controlOptions . ");\n" . 'unset($' . $submitVar . ");\n");
     return $statement;
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:21,代碼來源:SubmitUnit.php

示例3: _getControlOptions

 /**
  * Gets the control options for a given tag.
  *
  * @param XenForo_Template_Compiler $compiler
  * @param array $attributes Raw key-value attribues list
  * @param array $extraExpected Extra expected attributes, on top of the standard
  * @param boolean $includeStandard If true, include the standard control tags
  * @param boolean $allowData If true, allow all data-* attributes
  *
  * @return array Key-value pairs of expected attributes; data attributes in _data key
  */
 protected function _getControlOptions(XenForo_Template_Compiler $compiler, array $attributes, array $extraExpected = array(), $includeStandard = true, $allowData = true)
 {
     if ($includeStandard) {
         $extraExpected = array_merge($extraExpected, self::$_standardControlOptions);
     }
     $controlOptions = $compiler->getNamedAttributes($attributes, $extraExpected);
     if ($allowData) {
         $data = $this->_getDataAttributes($compiler, $attributes);
         if ($data) {
             $controlOptions['_data'] = $data;
         }
     }
     return $controlOptions;
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:25,代碼來源:Abstract.php


注:本文中的XenForo_Template_Compiler::getNamedAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。