<?php
/**
- *
- *
* Created on Dec 01, 2007
*
* Copyright © 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com
* @ingroup API
*/
class ApiParse extends ApiBase {
-
private $section, $text, $pstText = null;
public function __construct( $main, $action ) {
$redirValues = null;
if ( !is_null( $oldid ) || !is_null( $pageid ) || !is_null( $page ) ) {
-
if ( !is_null( $oldid ) ) {
// Don't use the parser cache
$rev = Revision::newFromID( $oldid );
$p_result = $this->getParsedSectionOrText( $articleObj, $titleObj, $popts, $pageid,
isset( $prop['wikitext'] ) ) ;
-
} else { // This is an old revision, so get the text differently
$this->text = $rev->getText( Revision::FOR_THIS_USER );
$p_result = $wgParser->parse( $this->text, $titleObj, $popts );
}
-
} else { // Not $oldid
-
if ( !is_null ( $pageid ) ) {
$titleObj = Title::newFromID( $pageid );
$this->dieUsageMsg( array( 'nosuchpageid', $pageid ) );
}
} else { // $page
-
if ( $params['redirects'] ) {
$req = new FauxRequest( array(
'action' => 'query',
$p_result = $this->getParsedSectionOrText( $articleObj, $titleObj, $popts, $pageid,
isset( $prop['wikitext'] ) ) ;
}
-
} else { // Not $oldid, $pageid, $page. Hence based on $text
$this->text = $text;
if ( isset( $prop['iwlinks'] ) ) {
$result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() );
}
-
+
if ( isset( $prop['wikitext'] ) ) {
$result_array['wikitext'] = array();
$result->setContent( $result_array['wikitext'], $this->text );
$entry = array();
$bits = explode( ':', $link, 2 );
$title = Title::newFromText( $link );
-
+
$entry['lang'] = $bits[0];
if ( $title ) {
$entry['url'] = $title->getFullURL();