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


PHP Parser::Title方法代码示例

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


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

示例1: referencesFormat

 /**
  * Make output to be returned from the references() function
  *
  * @param $group
  *
  * @return string XHTML ready for output
  */
 function referencesFormat($group)
 {
     if (count($this->mRefs) == 0 || empty($this->mRefs[$group])) {
         return '';
     }
     wfProfileIn(__METHOD__);
     wfProfileIn(__METHOD__ . '-entries');
     $ent = array();
     foreach ($this->mRefs[$group] as $k => $v) {
         $ent[] = $this->referencesFormatEntry($k, $v);
     }
     $prefix = wfMessage('cite_references_prefix')->inContentLanguage()->plain();
     $suffix = wfMessage('cite_references_suffix')->inContentLanguage()->plain();
     $content = implode("\n", $ent);
     // Prepare the parser input. We add new lines between the pieces to avoid a confused tidy (bug 13073)
     $parserInput = $prefix . "\n" . $content . "\n" . $suffix;
     // Let's try to cache it.
     global $wgMemc;
     $cacheKey = wfMemcKey('citeref', md5($parserInput), $this->mParser->Title()->getArticleID());
     wfProfileOut(__METHOD__ . '-entries');
     global $wgCiteCacheReferences;
     $data = false;
     if ($wgCiteCacheReferences) {
         wfProfileIn(__METHOD__ . '-cache-get');
         $data = $wgMemc->get($cacheKey);
         wfProfileOut(__METHOD__ . '-cache-get');
     }
     if (!$data || !$this->mParser->isValidHalfParsedText($data)) {
         wfProfileIn(__METHOD__ . '-parse');
         // Live hack: parse() adds two newlines on WM, can't reproduce it locally -ævar
         $ret = rtrim($this->parse($parserInput), "\n");
         if ($wgCiteCacheReferences) {
             $serData = $this->mParser->serializeHalfParsedText($ret);
             $wgMemc->set($cacheKey, $serData, 86400);
         }
         wfProfileOut(__METHOD__ . '-parse');
     } else {
         $ret = $this->mParser->unserializeHalfParsedText($data);
     }
     wfProfileOut(__METHOD__);
     // done, clean up so we can reuse the group
     unset($this->mRefs[$group]);
     unset($this->mGroupCnt[$group]);
     return $ret;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:52,代码来源:Cite_body.php

示例2: execute

 public function execute()
 {
     global $wgUser, $egMapsDefaultGeoService, $egMapsDistanceDecimals, $egMapsDistanceUnit;
     $params = $this->extractRequestParams();
     $geoCoordinateParser = new DataValues\Geo\Parsers\GeoCoordinateParser();
     $results = array();
     if (Maps\Geocoders::canGeocode()) {
         $location = Maps\Geocoders::attemptToGeocode($params['location'], $egMapsDefaultGeoService);
     } else {
         $location = $geoCoordinateParser->parse($params['location']);
     }
     $query = "{{#ask:[[Bundesland::+]][[aktiv::wahr]][[Lage::+]]|?Lage|?=Name|mainlabel=-|format=array|link=none|headers=plain|headersep==|sep=<BV>}}";
     $mainpage = Title::newMainPage();
     $options = new ParserOptions();
     $localparser = new Parser();
     $localparser->Title($mainpage);
     $localparser->Options($options);
     $localparser->clearState();
     $bedarfsverkehre = $localparser->RecursiveTagParse($query);
     $bedarfsverkehre = explode('&lt;BV&gt;', $bedarfsverkehre);
     foreach ($bedarfsverkehre as $key => $props) {
         $props = explode('&lt;PROP&gt;', $props);
         $bedarfsverkehre[$key] = array();
         foreach ($props as $prop) {
             $prop = explode('=', $prop);
             $bedarfsverkehre[$key][$prop[0]] = $prop[1];
         }
         $bvlocation = $geoCoordinateParser->parse($bedarfsverkehre[$key]['Lage']);
         if ($location && $bvlocation) {
             $bedarfsverkehre[$key]['Distanz'] = MapsGeoFunctions::calculateDistance($location, $bvlocation);
         } else {
             // The locations should be valid when this method gets called.
             throw new MWException('Attempt to find the distance between locations of at least one is invalid' . $bedarfsverkehre[$key]['Name']);
         }
     }
     usort($bedarfsverkehre, array("ApiBVdistances", "distanceSort"));
     $results = array_slice($bedarfsverkehre, 0, 10);
     $this->getResult()->addValue(null, 'results', $results);
 }
开发者ID:thaider,项目名称:UbiGo,代码行数:39,代码来源:ApiBVdistances.php

示例3: parseArticleText

 function parseArticleText($text)
 {
     if ($text === '') {
         return '';
     } else {
         if ($this->mExpandTemplates) {
             global $wgTitle;
             $parser = new Parser();
             $parser->Options(new ParserOptions());
             // We don't want this to be user-specific
             $parser->Title($wgTitle);
             $parser->OutputType(OT_HTML);
             return $parser->replaceVariables($text);
         } else {
             return $text;
         }
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:18,代码来源:RawPage.php

示例4: renderCustomNavigation

 /**
  * Render navigations elements that renderNavigation hasn't dealt with
  *
  * @param $buttons array
  * @param $customItems array
  */
 private function renderCustomNavigation(&$buttons, &$customItems)
 {
     /* TODO: check for unintended consequences, there are probably more elegant ways to do this... */
     $options = new ParserOptions();
     $localParser = new Parser();
     $localParser->Title($this->getSkin()->getTitle());
     $localParser->Options($options);
     $localParser->clearState();
     if (count($customItems) !== 0) {
         $newButtons = TweekiHooks::parseButtons(implode(chr(10), $customItems), $localParser, false);
         $buttons = array_merge($buttons, $newButtons);
         $customItems = array();
     }
 }
开发者ID:bashtage,项目名称:Tweeki,代码行数:20,代码来源:Tweeki.skin.php


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