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


PHP Parser::recursiveTagParse方法代码示例

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


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

示例1: renderCollection

 public static function renderCollection($input, array $args, Parser $parser, PPFrame $frame)
 {
     $string_array = array();
     $parsed_input = $parser->recursiveTagParse($input, $frame);
     if (Collection::startsWith($parsed_input, "Coll") === true) {
         $results = Collection::getResults($parsed_input);
         $string_array[] = '{| class="wikitable"';
         $string_array[] = "! ";
         foreach ($results['langs'] as $lang) {
             $string_array[] = "!" . $lang;
         }
         $string_array[] = "|-";
         foreach (array_keys($results['data']) as $pagename) {
             $string_array[] = "|[[" . $pagename . " |Edit]]";
             foreach ($results['langs'] as $lang) {
                 if (isset($results['data'][$pagename][$lang])) {
                     $string_array[] = "|" . implode("<br/>", $results['data'][$pagename][$lang]);
                 } else {
                     $string_array[] = "|";
                 }
             }
             $string_array[] = "|-";
         }
         $string_array[] = "|}";
         return $parser->recursiveTagParse(implode("\n\n", $string_array), $frame);
     } else {
         return $parser->recursiveTagParse("No results", $frame);
     }
 }
开发者ID:albbas,项目名称:Collection,代码行数:29,代码来源:Collection.php

示例2: parse

 /**
  * Transforms from wikitext string to HTML.
  * Require a value.
  * 
  * @param string|boolean $value A string or boolean <i>true</i>
  * @return string
  * @throws UserError When value is not a signed integer.
  */
 protected function parse($value)
 {
     if (!$this->parser instanceof \Parser) {
         throw new \MWException('Parser must be set using setParser()');
     }
     if ($value === true) {
         // parameter specified without value
         Tools::ThrowUserError(wfMessage('wfmk-value-required', $this->getName()));
     }
     return $this->parser->recursiveTagParse($value);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:19,代码来源:Wikitext.php

示例3: parseSpoilerTag

 /**
  * Parses the <spoiler> tag.
  *
  * @access	public
  * @param	string	User input between <spoiler>
  * @param	array	Array of arguments from the opening spoiler tag.
  * @param	object	Mediawiki Parser Object
  * @param	object	PPFrame object
  * @return	string	HTML
  */
 public static function parseSpoilerTag($input, array $args, Parser $parser, PPFrame $frame)
 {
     $out = $parser->getOutput();
     $out->addModules('ext.spoilers');
     $renderedInput = $parser->recursiveTagParse($input);
     $output = "<div class='spoilers'>\n\t\t\t\t\t\t<div class='spoilers-button-container'>\n\t\t\t\t\t\t\t<span class='spoilers-button'>\n\t\t\t\t\t\t\t\t<span class='spoilers-show'>" . ($args['show'] ? htmlentities($args['show'], ENT_QUOTES) : wfMessage('spoilers_show_default')->text()) . "</span>\n\t\t\t\t\t\t\t\t<span class='spoilers-hide' style='display:none;'>" . ($args['hide'] ? htmlentities($args['hide'], ENT_QUOTES) : wfMessage('spoilers_hide_default')->text()) . "</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='spoilers-body' style='display:none;'>{$renderedInput}</div>\n\t\t\t\t\t</div>";
     return $output;
 }
开发者ID:nelson6e65,项目名称:themanaworld-website,代码行数:18,代码来源:Spoilers.hooks.php

示例4: render

 /**
  * Renderer for <emblem> parser tag hook
  *
  * @param $input
  * @param $args Array
  * @param $parser Parser
  * @param $frame
  */
 public static function render($input, $args, Parser $parser, PPFrame $frame)
 {
     $output = $parser->getOutput();
     if (!isset($output->articleEmblems)) {
         $output->articleEmblems = array();
     }
     $output->articleEmblems[] = $parser->recursiveTagParse($input, $frame);
     return '';
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:ArticleEmblems.hooks.php

示例5: hideContent

 /**
  * @static
  * @param $contents
  * @param $attributes
  * @param Parser $parser
  * @return string
  */
 public static function hideContent($contents, $attributes, $parser)
 {
     $app = F::app();
     if ($app->checkSkin($app->wg->MobileSkins)) {
         return '';
     } else {
         return $parser->recursiveTagParse($contents);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:MobileContentParser.class.php

示例6: parseWikitext

 /**
  * Utility function to parse wikitext without having to care
  * about handling a tag extension or parser function. 
  * 
  * @since 0.4.4
  * 
  * @param string $text The wikitext to be parsed
  * 
  * @return string the parsed output
  */
 protected function parseWikitext($text)
 {
     // Parse the wikitext to HTML.
     if ($this->isFunction()) {
         return $this->parser->parse(text, $this->parser->mTitle, $this->parser->mOptions, true, false)->getText();
     } else {
         return $this->parser->recursiveTagParse($text, $this->frame);
     }
 }
开发者ID:JeroenDeDauw,项目名称:phpapi,代码行数:19,代码来源:ParserHook.php

示例7: renderModuleContainerTag

 public static function renderModuleContainerTag($content, array $attributes, Parser $parser, PPFrame $frame)
 {
     if (!empty($attributes['content-title'])) {
         $title = Title::newFromText($attributes['content-title']);
         if ($title->exists()) {
             $article = Article::newFromTitle($title, RequestContext::getMain());
             $attributes['content'] = $parser->recursiveTagParse($article->getContent());
         }
     }
     return F::app()->renderView('Njord', 'modula', $attributes);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:11,代码来源:NjordHooks.class.php

示例8: error

 /**
  * Return an error message based on an error ID
  *
  * @param string $key   Message name for the error
  * @param string $param Parameter to pass to the message
  * @param string $parse Whether to parse the message ('parse') or not ('noparse')
  * @return string XHTML or wikitext ready for output
  */
 function error($key, $param = null, $parse = 'parse')
 {
     # We rely on the fact that PHP is okay with passing unused argu-
     # ments to functions.  If $1 is not used in the message, wfMessage will
     # just ignore the extra parameter.
     $ret = '<strong class="error mw-ext-cite-error">' . wfMessage('cite_error', wfMessage($key, $param)->inContentLanguage()->plain())->inContentLanguage()->plain() . '</strong>';
     if ($parse == 'parse') {
         $ret = $this->mParser->recursiveTagParse($ret);
     }
     return $ret;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:Cite_body.php

示例9: parse

 /**
  * Parse a given fragment and fix up Tidy's trail of blood on
  * it...
  *
  * @param string $in The text to parse
  * @return string The parsed text
  */
 function parse($in)
 {
     if (method_exists($this->mParser, 'recursiveTagParse')) {
         // New fast method
         return $this->mParser->recursiveTagParse($in);
     } else {
         // Old method
         $ret = $this->mParser->parse($in, $this->mParser->mTitle, $this->mParser->mOptions, false, false);
         $text = $ret->getText();
         return $this->fixTidy($text);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:19,代码来源:Cite_body.php

示例10: parserFunction_ev

 /**
  * Embeds video of the chosen service
  * @param Parser $parser Instance of running Parser.
  * @param String $service Which online service has the video.
  * @param String $id Identifier of the chosen service
  * @param String $width Width of video (optional)
  * @param String $desc description to show (optional, unused)
  * @param String $align alignment of the video (optional, unused)
  * @return String Encoded representation of input params (to be processed later)
  */
 public static function parserFunction_ev($parser, $service = null, $id = null, $width = null, $align = null, $desc = null)
 {
     global $wgScriptPath;
     # Initialize things once
     if (!EmbedVideo::$initialized) {
         EmbedVideo::VerifyWidthMinAndMax();
         # Add system messages
         wfLoadExtensionMessages('embedvideo');
         $parser->disableCache();
         EmbedVideo::$initialized = true;
     }
     # Get the name of the host
     if ($service === null || $id === null) {
         return EmbedVideo::errMissingParams($service, $id);
     }
     $service = trim($service);
     $id = trim($id);
     $desc = $parser->recursiveTagParse($desc);
     $entry = EmbedVideo::getServiceEntry($service);
     if (!$entry) {
         return EmbedVideo::errBadService($service);
     }
     if (!EmbedVideo::sanitizeWidth($entry, $width)) {
         return EmbedVideo::errBadWidth($width);
     }
     $height = EmbedVideo::getHeight($entry, $width);
     $hasalign = $align !== null;
     if ($hasalign) {
         $desc = EmbedVideo::getDescriptionMarkup($desc);
     }
     # If the service has an ID pattern specified, verify the id number
     if (!EmbedVideo::verifyID($entry, $id)) {
         return EmbedVideo::errBadID($service, $id);
     }
     # if the service has it's own custom extern declaration, use that instead
     if (array_key_exists('extern', $entry) && ($clause = $entry['extern']) != null) {
         $clause = wfMsgReplaceArgs($clause, array($wgScriptPath, $id, $width, $height));
         if ($hasalign) {
             $clause = EmbedVideo::generateAlignExternClause($clause, $align, $desc, $width, $height);
         }
         return array($clause, 'noparse' => true, 'isHTML' => true);
     }
     # Build URL and output embedded flash object
     $url = wfMsgReplaceArgs($entry['url'], array($id, $width, $height));
     $clause = "";
     if ($hasalign) {
         $clause = EmbedVideo::generateAlignClause($url, $width, $height, $align, $desc);
     } else {
         $clause = EmbedVideo::generateNormalClause($url, $width, $height);
     }
     return array($clause, 'noparse' => true, 'isHTML' => true);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:62,代码来源:EmbedVideo.hooks.php

示例11: parserHook

 /**
  * This function is the callback that the ParserFirstCallInit hook assigns
  * to the parser whenever a supported FBML tag is encountered (like <fb:like-box>).
  * Function createParserHook($tag) creates an anonymous (lambda-style)
  * function that simply redirects to parserHook(), filling in the missing
  * $tag argument with the $tag provided to createParserHook.
  */
 public static function parserHook($tag, $text, $args, Parser $parser)
 {
     if ($tag == 'fb:like-box' && isset($args['profileid'])) {
         $args['profile_id'] = $args['profileid'];
         unset($args['profileid']);
     }
     // add custom attribute to look for in DOM. We use this to determine
     // if the Facebook SDK should be loaded.
     $args['data-type'] = 'xfbml-tag';
     // Allow other tags by default
     $attrs = self::implodeAttrs($args);
     return "<{$tag}{$attrs}>" . $parser->recursiveTagParse($text) . "</{$tag}>";
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:FacebookClientXFBML.php

示例12: buildTab

/**
 * @param $tab
 * @param Parser $parser
 * @return string
 */
function buildTab($tab, $parser)
{
    if (trim($tab) == '') {
        return '';
    }
    $arr = explode("=", $tab);
    $tabName = array_shift($arr);
    // Wikia Change Start @author aquilax
    $tabName = trim($tabName);
    // Wikia Change End
    $tabBody = $parser->recursiveTagParse(implode("=", $arr));
    $tab = '<div class="tabbertab" title="' . htmlspecialchars($tabName) . '">' . '<p>' . $tabBody . '</p>' . '</div>';
    return $tab;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:tabber.php

示例13: buildTab

    /**
     * Build individual tab.
     *
     * @access	private
     * @param	string	Tab information
     * @param	object	Mediawiki Parser Object
     * @return	string	HTML
     */
    private static function buildTab($tab = '', Parser $parser)
    {
        $tab = trim($tab);
        if (empty($tab)) {
            return $tab;
        }
        $args = explode('=', $tab);
        $tabName = array_shift($args);
        $tabBody = $parser->recursiveTagParse(implode('=', $args));
        $tab = '
			<div class="tabbertab" title="' . htmlspecialchars($tabName) . '">
				<p>' . $tabBody . '</p>
			</div>';
        return $tab;
    }
开发者ID:kcwikizh,项目名称:Tabber,代码行数:23,代码来源:Tabber.hooks.php

示例14: renderChosen

/**
 * @param $input
 * @param $argv
 * @param Parser $parser
 * @return mixed|string
 */
function renderChosen($input, $argv, $parser)
{
    # Prevent caching
    #$parser->disableCache();
    global $wgParserCacheExpireTime;
    $wgParserCacheExpireTime = 60;
    wfDebug("soft disable Cache (choose)\n");
    # Parse the options and calculate total weight
    $len = preg_match_all("/<option(?:(?:\\s[^>]*?)?\\sweight=[\"']?([^\\s>]+))?" . "(?:\\s[^>]*)?>([\\s\\S]*?)<\\/option>/", $input, $out);
    $r = 0;
    for ($i = 0; $i < $len; $i++) {
        if (strlen($out[1][$i]) == 0) {
            $out[1][$i] = 1;
        } else {
            $out[1][$i] = intval($out[1][$i]);
        }
        $r += $out[1][$i];
    }
    # Choose an option at random
    if ($r <= 0) {
        return "";
    }
    $r = mt_rand(1, $r);
    for ($i = 0; $i < $len; $i++) {
        $r -= $out[1][$i];
        if ($r <= 0) {
            $input = $out[2][$i];
            break;
        }
    }
    # If running new parser, take the easy way out
    if (defined('Parser::VERSION') && version_compare(Parser::VERSION, '1.6.1', '>')) {
        return $parser->recursiveTagParse($input);
    }
    # Otherwise, create new parser to handle rendering
    $localParser = new Parser();
    # Initialize defaults, then copy info from parent parser
    $localParser->clearState();
    $localParser->mTagHooks = $parser->mTagHooks;
    $localParser->mTemplates = $parser->mTemplates;
    $localParser->mTemplatePath = $parser->mTemplatePath;
    $localParser->mFunctionHooks = $parser->mFunctionHooks;
    $localParser->mFunctionSynonyms = $parser->mFunctionSynonyms;
    # Render the chosen option
    $output = $localParser->parse($input, $parser->mTitle, $parser->mOptions, false, false);
    return $output->getText();
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:53,代码来源:RandomSelection.php

示例15: renderTag

 public function renderTag($input, $params, Parser $parser, PPFrame $frame)
 {
     //$this->frame = $frame;
     global $wgRTEParserEnabled, $wgHTTPProxy, $wgFogbugzAPIConfig, $wgCaptchaDirectory, $wgCaptchaDirectoryLevels, $wgStylePath;
     if (!isset($params['id'])) {
         return '';
     }
     $output = Xml::openElement('span', array('class' => 'fogbugz_tck', 'data-id' => $parser->recursiveTagParse($params['id'], $frame)));
     //$output .= $input;
     $output .= Xml::openElement('img', array('src' => $wgStylePath . '/common/images/ajax.gif'));
     $output .= Xml::closeElement('span');
     $data = array('wikitext' => RTEData::get('wikitext', self::$mWikitextIdx), 'placeholder' => 1);
     //$dataIdx = RTEData::put('data', $data);
     //$output = RTEData::addIdxToTag($dataIdx, $output);
     $output .= F::build('JSSnippets')->addToStack(array('/extensions/wikia/FogbugzTag/js/FogbugzTag.js'));
     return $output;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:FogbugzTag.class.php


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