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


PHP StringUtils::delimiterReplaceCallback方法代碼示例

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


在下文中一共展示了StringUtils::delimiterReplaceCallback方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: explodeMarkup

 /**
  * More or less "markup-safe" explode()
  * Ignores any instances of the separator inside <...>
  * @param string $separator
  * @param string $text
  * @return array
  */
 static function explodeMarkup($separator, $text)
 {
     $placeholder = "";
     // Remove placeholder instances
     $text = str_replace($placeholder, '', $text);
     // Replace instances of the separator inside HTML-like tags with the placeholder
     $replacer = new DoubleReplacer($separator, $placeholder);
     $cleaned = StringUtils::delimiterReplaceCallback('<', '>', $replacer->cb(), $text);
     // Explode, then put the replaced separators back in
     $items = explode($separator, $cleaned);
     foreach ($items as $i => $str) {
         $items[$i] = str_replace($placeholder, $separator, $str);
     }
     return $items;
 }
開發者ID:amjadtbssm,項目名稱:website,代碼行數:22,代碼來源:StringUtils.php

示例2: expand

 function expand($string)
 {
     return StringUtils::delimiterReplaceCallback("<!-- LINKMARKER ", " -->", array(&$this, 'callback'), $string);
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:4,代碼來源:Parser_LinkHooks.php

示例3: braceSubstitution


//.........這裏部分代碼省略.........
                 if ($isHTML) {
                     // A special page; don't store it in the template cache.
                 } else {
                     $this->mTemplates[$piece['title']] = $text;
                 }
                 $text = $linestart . $text;
             }
         }
         wfProfileOut(__METHOD__ . '-loadtpl');
     }
     if ($found && !$this->incrementIncludeSize('pre-expand', strlen($text))) {
         # Error, oversize inclusion
         $text = $linestart . "[[{$titleText}]]<!-- WARNING: template omitted, pre-expand include size too large -->";
         $noparse = true;
         $noargs = true;
     }
     # Recursive parsing, escaping and link table handling
     # Only for HTML output
     if ($nowiki && $found && ($this->ot['html'] || $this->ot['pre'])) {
         $text = wfEscapeWikiText($text);
     } elseif (!$this->ot['msg'] && $found) {
         if ($noargs) {
             $assocArgs = array();
         } else {
             # Clean up argument array
             $assocArgs = self::createAssocArgs($args);
             # Add a new element to the templace recursion path
             $this->mTemplatePath[$part1] = 1;
         }
         if (!$noparse) {
             # If there are any <onlyinclude> tags, only include them
             if (in_string('<onlyinclude>', $text) && in_string('</onlyinclude>', $text)) {
                 $replacer = new OnlyIncludeReplacer();
                 StringUtils::delimiterReplaceCallback('<onlyinclude>', '</onlyinclude>', array(&$replacer, 'replace'), $text);
                 $text = $replacer->output;
             }
             # Remove <noinclude> sections and <includeonly> tags
             $text = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $text);
             $text = strtr($text, array('<includeonly>' => '', '</includeonly>' => ''));
             if ($this->ot['html'] || $this->ot['pre']) {
                 # Strip <nowiki>, <pre>, etc.
                 $text = $this->strip($text, $this->mStripState);
                 if ($this->ot['html']) {
                     $text = Sanitizer::removeHTMLtags($text, array(&$this, 'replaceVariables'), $assocArgs);
                 } elseif ($this->ot['pre'] && $this->mOptions->getRemoveComments()) {
                     $text = Sanitizer::removeHTMLcomments($text);
                 }
             }
             $text = $this->replaceVariables($text, $assocArgs);
             # If the template begins with a table or block-level
             # element, it should be treated as beginning a new line.
             if (!$piece['lineStart'] && preg_match('/^(?:{\\||:|;|#|\\*)/', $text)) {
                 $text = "\n" . $text;
             }
         } elseif (!$noargs) {
             # $noparse and !$noargs
             # Just replace the arguments, not any double-brace items
             # This is used for rendered interwiki transclusion
             $text = $this->replaceVariables($text, $assocArgs, true);
         }
     }
     # Prune lower levels off the recursion check path
     $this->mTemplatePath = $lastPathLevel;
     if ($found && !$this->incrementIncludeSize('post-expand', strlen($text))) {
         # Error, oversize inclusion
         $text = $linestart . "[[{$titleText}]]<!-- WARNING: template omitted, post-expand include size too large -->";
開發者ID:Jobava,項目名稱:diacritice-meta-repo,代碼行數:67,代碼來源:Parser_OldPP.php

示例4: internalParse

 function internalParse($text, $isMain = true, $frame = false)
 {
     $this->fck_internal_parse_text =& $text;
     /*
     		// these three tags should remain unchanged
     		$text = StringUtils::delimiterReplaceCallback( '<includeonly>', '</includeonly>', array( $this, 'fck_includeonly' ), $text );
     		$text = StringUtils::delimiterReplaceCallback( '<noinclude>', '</noinclude>', array( $this, 'fck_noinclude' ), $text );
     		$text = StringUtils::delimiterReplaceCallback( '<onlyinclude>', '</onlyinclude>', array( $this, 'fck_onlyinclude' ), $text );
     */
     // also replace all custom tags
     foreach ($this->FCKeditorWikiTags as $tag) {
         $tag = $this->guessCaseSensitiveTag($tag, $text);
         $this->fck_allTagsCurrentTagReplaced = $tag;
         $text = StringUtils::delimiterReplaceCallback("<{$tag}", "</{$tag}>", array($this, 'fck_allTags'), $text);
     }
     // Rule tags (the tag is not registered as a official wiki tag, therefore
     // not treated by the parser before
     if (defined('SEMANTIC_RULES_VERSION')) {
         $text = $this->replaceRules($text);
     }
     // __TOC__ etc. must be replaced
     $text = $this->stripToc($text);
     // HTML comments shouldn't be stripped
     $text = $this->fck_replaceHTMLcomments($text);
     // as well as templates
     $text = $this->fck_replaceTemplates($text);
     // as well as properties
     $text = $this->fck_replaceSpecialLinks($text);
     // preserve linebreaks
     //$text = strtr($text, array("\n" => "\nFCKLR_fcklr_FCKLR", "\r" => ''));
     // this doesn't work when inside tables. So leave this for later.
     $text = $this->parseExternalLinksWithTmpl($text);
     $finalString = parent::internalParse($text, $isMain);
     return $finalString;
 }
開發者ID:AbedSHP,項目名稱:WYSIWYG-CKeditor,代碼行數:35,代碼來源:CKeditorParser.body.php

示例5: internalParse

 function internalParse($text, $isMain = true, $frame = false)
 {
     $this->fck_internal_parse_text =& $text;
     // these three tags should remain unchanged
     $text = StringUtils::delimiterReplaceCallback('<includeonly>', '</includeonly>', array($this, 'fck_includeonly'), $text);
     $text = StringUtils::delimiterReplaceCallback('<noinclude>', '</noinclude>', array($this, 'fck_noinclude'), $text);
     $text = StringUtils::delimiterReplaceCallback('<onlyinclude>', '</onlyinclude>', array($this, 'fck_onlyinclude'), $text);
     // HTML comments shouldn't be stripped
     $text = $this->fck_replaceHTMLcomments($text);
     // as well as templates
     $text = $this->fck_replaceTemplates($text);
     $finalString = parent::internalParse($text, $isMain);
     return $finalString;
 }
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:14,代碼來源:FCKeditorParser.body.php


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