// The parser needs $wgTitle to be set, apparently the
// $title parameter in Parser::parse isn't enough *sigh*
- global $wgParser, $wgUser, $wgTitle, $wgLang;
+ // TODO: Does this still need $wgTitle?
+ global $wgParser, $wgTitle, $wgLang;
// Currently unnecessary, code to act as a safeguard against any change in current behaviour of uselang breaks
$oldLang = null;
if ( $titleObj->getLatestRevID() === intval( $oldid ) ) {
$articleObj = new Article( $titleObj, 0 );
+ // May get from/save to parser cache
$p_result = $this->getParsedSectionOrText( $articleObj, $titleObj, $popts, $pageid,
isset( $prop['wikitext'] ) ) ;
} else { // This is an old revision, so get the text differently
$this->text = $this->getSectionText( $this->text, 'r' . $rev->getId() );
}
- // Do we want to save old revision parses to the parser cache?
+ // Should we save old revision parses to the parser cache?
$p_result = $wgParser->parse( $this->text, $titleObj, $popts );
}
} else { // Not $oldid, but $pageid or $page
}
if ( $params['pst'] || $params['onlypst'] ) {
- $this->pstText = $wgParser->preSaveTransform( $this->text, $titleObj, $wgUser, $popts );
+ $this->pstText = $wgParser->preSaveTransform( $this->text, $titleObj, $this->getUser(), $popts );
}
if ( $params['onlypst'] ) {
// Build a result and bail out
+ $result_array = array();
$result_array['text'] = array();
$result->setContent( $result_array['text'], $this->pstText );
if ( isset( $prop['wikitext'] ) ) {
if ( !is_null( $params['summary'] ) ) {
$result_array['parsedsummary'] = array();
- $result->setContent( $result_array['parsedsummary'], $wgUser->getSkin()->formatComment( $params['summary'], $titleObj ) );
+ $result->setContent( $result_array['parsedsummary'], Linker::formatComment( $params['summary'], $titleObj ) );
}
if ( isset( $prop['langlinks'] ) ) {
}
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
- $context = $this->createContext();
+ $context = $this->getContext();
$context->setTitle( $titleObj );
$context->getOutput()->addParserOutputNoText( $p_result );
if ( $this->section !== false ) {
global $wgParser;
- $this->text = $this->getSectionText( $articleObj->getRawText(), !is_null ( $pageId )
+ $this->text = $this->getSectionText( $articleObj->getRawText(), !is_null( $pageId )
? 'page id ' . $pageId : $titleObj->getText() );
// Not cached (save or load)
$entry['lang'] = $bits[0];
if ( $title ) {
- $entry['url'] = wfExpandUrl( $title->getFullURL() );
+ $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
}
$this->getResult()->setContent( $entry, $bits[1] );
$result[] = $entry;
}
private function categoriesHtml( $categories ) {
- $context = $this->createContext();
+ $context = $this->getContext();
$context->getOutput()->addCategoryLinks( $categories );
return $context->getSkin()->getCategories();
}
/**
* @deprecated since 1.18 No modern skin generates language links this way, please use language links
* data to generate your own HTML.
+ * @param $languages array
+ * @return string
*/
private function languagesHtml( $languages ) {
global $wgContLang, $wgHideInterlanguageLinks;
$title = Title::newFromText( "{$prefix}:{$title}" );
if ( $title ) {
- $entry['url'] = wfExpandUrl( $title->getFullURL() );
+ $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
}
$this->getResult()->setContent( $entry, $title->getFullText() );
) );
}
- protected function getExamples() {
+ public function getExamples() {
return array(
'api.php?action=parse&text={{Project:Sandbox}}'
);