本文整理汇总了PHP中Parser::Options方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::Options方法的具体用法?PHP Parser::Options怎么用?PHP Parser::Options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser::Options方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
global $wgContLang;
parent::setUp();
$this->testParserOptions = ParserOptions::newFromUserAndLang(new User(), $wgContLang);
$this->testParser = new Parser();
$this->testParser->Options($this->testParserOptions);
$this->testParser->clearState();
$this->title = Title::newFromText('Preload Test');
}
示例2: setUp
function setUp()
{
global $wgTitle, $wgParser;
$wgParser = new Parser();
$wgParser->Options(new ParserOptions());
$wgParser->clearState();
$wgParser->setTitle($wgTitle);
}
示例3: setUpParser
protected function setUpParser()
{
$parser = new Parser();
$options = new ParserOptions();
$title = Title::newFromText('Test');
$parser->Options($options);
$parser->startExternalParse($title, $options, 'text', true);
return $parser;
}
示例4: 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('<BV>', $bedarfsverkehre);
foreach ($bedarfsverkehre as $key => $props) {
$props = explode('<PROP>', $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);
}
示例5: setParserTS
/**
* helper to set the parser timestamp and revision timestamp
* @param string $ts
*/
private function setParserTS($ts)
{
$this->testParser->Options()->setTimestamp($ts);
$this->testParser->mRevisionTimestamp = $ts;
}
示例6: 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;
}
}
}
示例7: 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();
}
}