当前位置: 首页>>代码示例>>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;未经允许,请勿转载。