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


PHP Parser::getOutput方法代码示例

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


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

示例1: render

 /**
  * Renrder the survey div.
  * 
  * @since 0.1
  * 
  * @param Parser $parser
  * 
  * @return string
  */
 public function render(Parser $parser)
 {
     static $loadedJs = false;
     if (!$loadedJs) {
         $parser->getOutput()->addModules('ext.survey.tag');
         $parser->getOutput()->addHeadItem(Skin::makeVariablesScript(array('wgSurveyDebug' => SurveySettings::get('JSDebug'))));
     }
     return Html::element('span', $this->parameters, $this->contents);
 }
开发者ID:yusufchang,项目名称:app,代码行数:18,代码来源:SurveyTag.php

示例2: fmRender

 public static function fmRender($input, array $args, Parser $parser, PPFrame $frame)
 {
     global $wgResourceModules;
     global $wgOut;
     $wgOut->addModules('ext.FinancialMathematics');
     $parser->getOutput()->addModules('ext.FinancialMathematics');
     $xml = simplexml_load_string($input);
     if (!$xml) {
         $_out = "<span class='fin-math-warning'>" . wfMessage('fm-error-xml')->text() . print_r($input, 1) . "</span>";
     }
     if ($xml) {
         //http://stackoverflow.com/questions/834875/recursive-cast-from-simplexmlobject-to-array
         $x = json_decode(json_encode((array) simplexml_load_string($input)), 1);
         $m = new CT1_Concept_All();
         $result = $m->get_controller($x);
         if (isset($result['warning'])) {
             $_out = "<span class='fin-math-warning'>" . $result['warning'] . "</span>";
         } else {
             if (isset($result['formulae'])) {
                 $_out = $result['formulae'];
             }
         }
     }
     if (!isset($_out)) {
         $_out = "<span class='fin-math-warning'>" . wfMessage('fm-error-no-output')->text() . "</span>";
     }
     //From https://www.mediawiki.org/wiki/QINU_fix
     $localParser = new Parser();
     $output = FinancialMathematicsHooks::renderRawHTML($localParser, $_out);
     return $output;
 }
开发者ID:WillSwales,项目名称:financial-maths-mediawiki,代码行数:31,代码来源:FinancialMathematics.hooks.php

示例3: renderGallery

 /**
  * Parser hook handler for {{#articletype}}
  *
  * @param Parser $parser : Parser instance available to render
  *  wikitext into html, or parser methods.
  *
  * @return string: HTML to insert in the page.
  */
 public static function renderGallery($input, array $args, Parser $parser, PPFrame $frame)
 {
     $parser->getOutput()->addModules('ext.promoter.gallery');
     $pageName = $parser->getTitle()->getText();
     try {
         $renderedAds = array();
         $adChooser = new AdChooser($pageName, !$parser->getUser()->isLoggedIn());
         $ads = $adChooser->getAds();
         foreach ($ads as $ad) {
             $renderedAds[] = Ad::fromName($ad['name'])->renderHtml();
         }
     } catch (AdCampaignExistenceException $e) {
         wfDebugLog('Promoter', $e->getMessage());
         //@todo i18n
         return '<span class="error">No campaign for this page</span>';
     } catch (MWException $e) {
         wfDebugLog('Promoter', $e->getMessage());
         return '<span class="error text-danger">An error occurred [' . $e->getMessage() . ']</span>';
     }
     $html = '<div class="promotion-gallery hidden hidden-print">' . '<h5 class="sr-only">זוהי גלריה המקדמת ערכים שונים באתר.</h5>' . '<div class="gallery-controls">' . '<span class="sr-only">בכל רגע מוצגות 3 ידיעות בגלריה. ניתן להציג ידיעה נוספת או לחזור לאחור באמצעות הכפתורים הבאים, או באמצעות מקשי החיצים כאשר הפוקוס הוא על הגלריה</span>' . '<a href="#" class="owl-prev"><span class="fa fa-chevron-right fa-lg" title="הקודם"></span><span class="sr-only">הצגת הידיעה הקודמת</span></a>' . '<a href="#" class="owl-next"><span class="fa fa-chevron-left fa-lg" title="הבא"></span><span class="sr-only">הצגת הידיעה הבאה</span></a>' . '</div>';
     if ($args['title']) {
         $html .= '<div class="header">' . $args['title'] . '</div>';
     }
     $html .= '<div class="owl-carousel clearfix" tabindex="0">' . implode('', $renderedAds) . '</div>' . '</div>';
     return $html;
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:34,代码来源:PromoterGallery.php

示例4: onSparkRender

 /**
  * @since 0.1
  *
  * @param mixed $input
  * @param array $args
  * @param Parser $parser
  * @param PPFrame $frame
  */
 public static function onSparkRender($input, array $args, Parser $parser, $frame = null)
 {
     global $wgVersion;
     global $wgOut;
     global $egSparkScriptJquery;
     global $egSparkScriptJquerySpark;
     static $loadedJs = false;
     if (version_compare($wgVersion, '1.17', '<')) {
         // We do not have resource loader
         if (!$loadedJs) {
             $wgOut->addScript('<script src="' . $egSparkScriptJquery . '" type="text/javascript"></script>');
             wfDebugLog('spark', "AddScript:" . ' <script src="' . $egSparkScriptJquery . '" type="text/javascript"></script>');
             //echo "AddScript:".' <script src="'.$egSparkScriptJquery.'" type="text/javascript"></script>';
             $wgOut->addScript('<script src="' . $egSparkScriptJquerySpark . '" type="text/javascript"></script>');
             wfDebugLog('spark', "AddScript:" . ' <script src="' . $egSparkScriptJquerySpark . '" type="text/javascript"></script>');
             //echo "AddScript:".' <script src="'.$egSparkScriptJquerySpark.'" type="text/javascript"></script>';
             $loadedJs = true;
         }
     } else {
         // We have resource loader
         // If we have resource loader
         if (!$loadedJs) {
             $parser->getOutput()->addModules('ext.spark');
             $loadedJs = true;
         }
     }
     $tag = new SparkTag($args, $input);
     // PPFrame maybe not existing
     return $tag->render($parser, $frame);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:38,代码来源:Spark.hooks.php

示例5: render

 /**
  * @param Parser $parser
  * @return array
  */
 public static function render($parser)
 {
     $html = '';
     $html .= $parser->insertStripItem('<a href="#" class="custom-watchlist-wrapper" id="add-to-watchlist"></a>');
     $parser->getOutput()->addModules('ext.customwatchlist.foo');
     return array($html, 'markerType' => 'nowiki');
 }
开发者ID:vedmaka,项目名称:SettleIn_customWatchlist,代码行数:11,代码来源:customWatchlist.class.php

示例6: 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

示例7: clearStorage

 /**
  * Clear all stored data for a given parser.
  *
  * @param Parser $parser
  */
 public static function clearStorage(Parser $parser)
 {
     $output = $parser->getOutput();
     $title = $parser->getTitle();
     if (!isset($output) || !isset($title)) {
         return;
     }
     $output->mSMWData = new SMWSemanticData(new SMWDIWikiPage($title->getDBkey(), $title->getNamespace(), $title->getInterwiki()));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:SMW_ParseData.php

示例8: renderFentt

 static function renderFentt($input, array $args, Parser $parser, PPFrame $frame)
 {
     if (!self::$css_module_added) {
         // Tell ResourceLoader that we need our css module
         $parser->getOutput()->addModuleStyles('ext.FenTT');
         self::$css_module_added = true;
     }
     return FenTT::renderFentt($input, $args);
 }
开发者ID:xeyownt,项目名称:mwfentt,代码行数:9,代码来源:FenTT.php

示例9: 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

示例10: sprintbtn

 /**
  * @param Parser $parser
  * @return string
  */
 public static function sprintbtn($parser)
 {
     $html = '';
     $title = $parser->getTitle();
     $link = $title->getFullURL('printable=yes');
     $link = '#';
     $parser->getOutput()->addModules('ext.stools.foo');
     $html .= $parser->insertStripItem('<a id="print-button" href="' . $link . '" type="button" class="btn btn-primary"><i class="fa fa-print"></i> ' . wfMessage('stools-button-print')->plain() . '</a>');
     return $html;
 }
开发者ID:vedmaka,项目名称:SettleInSkin,代码行数:14,代码来源:stools.class.php

示例11: renderPlaceholder

 /**
  * @desc Based on parser tag arguments validation parsers an error or placeholder
  *
  * @param String $input
  * @param Array $args
  * @param Parser $parser
  * @param PPFrame $frame
  *
  * @return String
  */
 public function renderPlaceholder($input, array $args, Parser $parser, PPFrame $frame)
 {
     // register resource loader module dependencies for map parser tag
     // done separately for CSS and JS, so CSS will go to top of the page
     $parser->getOutput()->addModuleStyles('ext.wikia.WikiaMaps.ParserTag');
     $parser->getOutput()->addModuleScripts('ext.wikia.WikiaMaps.ParserTag');
     $errorMessage = '';
     $params = $this->sanitizeParserTagArguments($args);
     $isValid = $this->validateParseTagParams($params, $errorMessage);
     if ($isValid) {
         $params['map'] = $this->getMapObj($params['id']);
         if (!empty($params['map']->id)) {
             return $this->sendRequest('WikiaMapsParserTagController', 'mapThumbnail', $params);
         } else {
             $errorMessage = wfMessage('wikia-interactive-maps-parser-tag-error-no-map-found')->plain();
         }
     }
     return $this->sendRequest('WikiaMapsParserTagController', 'parserTagError', ['errorMessage' => $errorMessage]);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:WikiaMapsParserTagController.class.php

示例12: renderVote

 /**
  * Callback function for registerParserHook.
  *
  * @param string $input User-supplied input, unused
  * @param array $args User-supplied arguments
  * @param Parser $parser Instance of Parser, unused
  * @return string HTML
  */
 public static function renderVote($input, $args, $parser)
 {
     global $wgOut, $wgUser;
     wfProfileIn(__METHOD__);
     // Disable parser cache (sadly we have to do this, because the caching is
     // messing stuff up; we want to show an up-to-date rating instead of old
     // or totally wrong rating, i.e. another page's rating...)
     $parser->disableCache();
     // Add CSS & JS
     // In order for us to do this *here* instead of having to do this in
     // registerParserHook(), we must've disabled parser cache
     $parser->getOutput()->addModuleStyles('ext.voteNY.styles');
     if ($wgUser->isAllowed('voteny')) {
         $parser->getOutput()->addModules('ext.voteNY.scripts');
     }
     // Define variable - 0 means that we'll get that green voting box by default
     $type = 0;
     // Determine what kind of a voting gadget the user wants: a box or pretty stars?
     if (preg_match("/^\\s*type\\s*=\\s*(.*)/mi", $input, $matches)) {
         $type = htmlspecialchars($matches[1]);
     } elseif (!empty($args['type'])) {
         $type = intval($args['type']);
     }
     $output = null;
     $title = $wgOut->getTitle();
     if ($title) {
         $articleID = $title->getArticleID();
         switch ($type) {
             case 0:
                 $vote = new Vote($articleID);
                 break;
             case 1:
                 $vote = new VoteStars($articleID);
                 break;
             default:
                 $vote = new Vote($articleID);
         }
         $output = $vote->display();
     }
     wfProfileOut(__METHOD__);
     return $output;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:50,代码来源:VoteHooks.php

示例13: renderTabber

 /**
  * Renders the necessary HTML for a <tabber> tag.
  *
  * @access	public
  * @param	string	The input URL between the beginning and ending tags.
  * @param	array	Array of attribute arguments on that beginning tag.
  * @param	object	Mediawiki Parser Object
  * @param	object	Mediawiki PPFrame Object
  * @return	string	HTML
  */
 public static function renderTabber($input, array $args, Parser $parser, PPFrame $frame)
 {
     $parser->getOutput()->addModules('ext.Tabber');
     $key = md5($input);
     $arr = explode("|-|", $input);
     $htmlTabs = '';
     foreach ($arr as $tab) {
         $htmlTabs .= self::buildTab($tab, $parser);
     }
     $HTML = '<div id="tabber-' . $key . '" class="tabber">' . $htmlTabs . "</div>";
     return $HTML;
 }
开发者ID:kcwikizh,项目名称:Tabber,代码行数:22,代码来源:Tabber.hooks.php

示例14: addSpecificMapHTML

    /**
     * @see MapsBaseMap::addSpecificMapHTML()
     *
     */
    public function addSpecificMapHTML(Parser $parser)
    {
        global $egValidatorErrorLevel;
        MapsGoogleMaps::addOverlayOutput($this->output, $this->mapName, $this->overlays, $this->controls);
        if ($egValidatorErrorLevel >= Validator_ERRORS_WARN) {
            $couldNotGeocodeMsg = Xml::escapeJsString(wfMsg('ukgeocoding_couldNotGeocode'));
            $showErrorJs = "document.getElementById( '{$this->mapName}_errors' ).innerHTML = '{$couldNotGeocodeMsg}';";
        } else {
            $showErrorJs = '';
        }
        $this->output .= Html::element('div', array('id' => $this->mapName, 'style' => "width: {$this->width}; height: {$this->height}; background-color: #cccccc;"), wfMsg('maps-loading-map')) . "<div id='{$this->mapName}_errors'></div>";
        $parser->getOutput()->addHeadItem(Html::inlineScript(<<<EOT
\$(function() {
\tvar map = initializeGoogleMap('{$this->mapName}', 
\t\t{
\t\tlat: 0,
\t\tlon: 0,
\t\tzoom: {$this->zoom},
\t\ttype: {$this->type},
\t\ttypes: [{$this->types}],
\t\tcontrols: [{$this->controls}],
\t\tscrollWheelZoom: {$this->autozoom}
\t\t},
\t\t[]
\t);
\tvar localSearch = new GlocalSearch();
\tfunction usePointFromPostcode( marker, callbackFunction ) {
\t\tlocalSearch.setSearchCompleteCallback( null,
\t\t\tfunction() {
\t\t\t\tif ( localSearch.results[0] ) {    
\t\t\t\t\tcallbackFunction(new GLatLng(localSearch.results[0].lat, localSearch.results[0].lng), marker);
\t\t\t\t} else {
\t\t\t\t\t{$showErrorJs}
\t\t\t\t}
\t\t\t}
\t\t);
\t\tlocalSearch.execute(marker.location + ", UK");
\t}
\tfunction updateGoogleMap(point, marker) {
\t\tmap.addOverlay(createGMarker(point, marker.title, marker.label, marker.icon));
\t\tbounds.extend(point);
\t\tmap.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
\t\tif({$this->zoom}!=null) map.setZoom({$this->zoom});
\t}
\tvar markers = [{$this->markerString}];
\tvar bounds = new GLatLngBounds();
\tfor(i in markers) {
\t\tusePointFromPostcode(markers[i], updateGoogleMap);
\t}
});\t\t\t\t
EOT
));
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:57,代码来源:UKG_GoogleMapsDispUkPoint.php

示例15: render

 /**
  * Call controller view to render <lyricfind> parser hook
  *
  * Add an article to appriopriate category
  *
  * Example:
  *
  * <lyricfind
  * 	artist="Paradise Lost"
  * 	album="Draconian Times"
  * 	additionalAlbums="Draconian Times MMXI"
  * 	song="Forever Failure"
  * 	songwriter="Nick Holmes"
  * 	publisher="Music for Nations"
  * 	amgid=28750800>
  * Understand procedure, understand war
  * ...
  * </lyricfind>
  *
  * @param $content string tag content
  * @param array $arguments tag atribbutes
  * @param Parser $parser parser instance
  * @return string rendered content
  */
 public static function render($content, array $arguments, Parser $parser)
 {
     wfProfileIn(__METHOD__);
     $data = array_merge($arguments, ['lyric' => self::encodeLyric($content)]);
     // RingTone URL
     $data['ringtoneUrl'] = 'http://www.ringtonematcher.com/co/ringtonematcher/02/noc.asp' . http_build_query(['sid' => 'WILWros', 'artist' => $data['artist'], 'song' => $data['song']]);
     // merge albums data
     $data['albums'] = array($data['album']);
     if (isset($data['additionalalbums']) && $data['additionalalbums'] != '') {
         $data['albums'] = array_merge($data['albums'], explode(',', $data['additionalalbums']));
     }
     $html = F::app()->renderPartial('LyricFindParser', 'content', $data);
     // add a category + CSS and JavaScript
     $parser->getOutput()->addCategory(self::CATEGORY, self::CATEGORY);
     $parser->getOutput()->addModules('ext.lyrics.lyricbox');
     // generate a marker
     $marker = $parser->uniqPrefix() . '-lyricfind-' . count(self::$markers) . "-";
     self::$markers[$marker] = $html;
     wfProfileOut(__METHOD__);
     return $marker;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:45,代码来源:LyricFindParserController.class.php


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