當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。