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


PHP String::indent方法代码示例

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


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

示例1: indent

 /**
  * Indents the HTML content from the left.
  * @param  string UTF-8 encoding or 8-bit
  * @param  int
  * @param  string
  * @return string
  */
 public static function indent($s, $level = 1, $chars = "\t")
 {
     if ($level >= 1) {
         $s = String::replace($s, '#<(textarea|pre).*?</\\1#si', callback(create_function('$m', 'return strtr($m[0], " \\t\\r\\n", "\\x1F\\x1E\\x1D\\x1A");')));
         $s = String::indent($s, $level, $chars);
         $s = strtr($s, "", " \t\r\n");
     }
     return $s;
 }
开发者ID:vrana,项目名称:ORM-benchmark,代码行数:16,代码来源:TemplateHelpers.php

示例2: indent

 /**
  * Indents the HTML content from the left.
  * @param  string UTF-8 encoding or 8-bit
  * @param  int
  * @param  string
  * @return string
  */
 public static function indent($s, $level = 1, $chars = "\t")
 {
     if ($level >= 1) {
         $s = String::replace($s, '#<(textarea|pre).*?</\\1#si', function ($m) {
             return strtr($m[0], " \t\r\n", "");
         });
         $s = String::indent($s, $level, $chars);
         $s = strtr($s, "", " \t\r\n");
     }
     return $s;
 }
开发者ID:jff15,项目名称:travelbot,代码行数:18,代码来源:TemplateHelpers.php

示例3: getValidateScript

 private function getValidateScript(Rules $rules)
 {
     $res = '';
     foreach ($rules as $rule) {
         if (!is_string($rule->operation)) {
             continue;
         }
         if (strcasecmp($rule->operation, 'Nette\\Forms\\InstantClientScript::javascript') === 0) {
             $res .= "{$rule->arg}\n";
             continue;
         }
         $script = $this->getClientScript($rule->control, $rule->operation, $rule->arg);
         if (!$script) {
             continue;
         }
         if (!empty($rule->message)) {
             // this is rule
             $message = Rules::formatMessage($rule, FALSE);
             $res .= "{$script}\n" . "if (" . ($rule->isNegative ? '' : '!') . "res) " . "return " . Nette\Json::encode((string) $message) . (strpos($message, '%value') === FALSE ? '' : ".replace('%value', val);\n") . ";\n";
         }
         if ($rule->type === Rule::CONDITION) {
             // this is condition
             $innerScript = $this->getValidateScript($rule->subRules);
             if ($innerScript) {
                 $res .= "{$script}\nif (" . ($rule->isNegative ? '!' : '') . "res) {\n" . Nette\String::indent($innerScript) . "}\n";
                 if ($rule->control instanceof ISubmitterControl) {
                     $this->central = FALSE;
                 }
             }
         }
     }
     return $res;
 }
开发者ID:vrana,项目名称:ORM-benchmark,代码行数:33,代码来源:InstantClientScript.php


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