X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiParse.php;h=fcba5b5f74d32c597336dbb10f44239ebd90d0fe;hb=0e054bbf1a955b02afd4feaa04063c841e19a569;hp=ce52565d26a055edbe8d940458c116761f635df7;hpb=be055037bfc3ed290b9e3ab9771bc4ef46398d46;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index ce52565d26..fcba5b5f74 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -27,7 +27,7 @@ */ class ApiParse extends ApiBase { - /** @var String $section */ + /** @var string $section */ private $section = null; /** @var Content $content */ @@ -346,6 +346,13 @@ class ApiParse extends ApiBase { } } + if ( isset( $prop['modules'] ) ) { + $result_array['modules'] = array_values( array_unique( $p_result->getModules() ) ); + $result_array['modulescripts'] = array_values( array_unique( $p_result->getModuleScripts() ) ); + $result_array['modulestyles'] = array_values( array_unique( $p_result->getModuleStyles() ) ); + $result_array['modulemessages'] = array_values( array_unique( $p_result->getModuleMessages() ) ); + } + if ( isset( $prop['iwlinks'] ) ) { $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() ); } @@ -363,7 +370,8 @@ class ApiParse extends ApiBase { } if ( isset( $prop['limitreportdata'] ) ) { - $result_array['limitreportdata'] = $this->formatLimitReportData( $p_result->getLimitReportData() ); + $result_array['limitreportdata'] = + $this->formatLimitReportData( $p_result->getLimitReportData() ); } if ( isset( $prop['limitreporthtml'] ) ) { $limitreportHtml = EditPage::getPreviewLimitReport( $p_result ); @@ -398,6 +406,10 @@ class ApiParse extends ApiBase { 'iwlinks' => 'iw', 'sections' => 's', 'headitems' => 'hi', + 'modules' => 'm', + 'modulescripts' => 'm', + 'modulestyles' => 'm', + 'modulemessages' => 'm', 'properties' => 'pp', 'limitreportdata' => 'lr', ); @@ -431,10 +443,10 @@ class ApiParse extends ApiBase { } /** - * @param $page WikiPage - * @param $popts ParserOptions - * @param $pageId Int - * @param $getWikitext Bool + * @param WikiPage $page + * @param ParserOptions $popts + * @param int $pageId + * @param bool $getWikitext * @return ParserOutput */ private function getParsedContent( WikiPage $page, $popts, $pageId = null, $getWikitext = false ) { @@ -488,7 +500,11 @@ class ApiParse extends ApiBase { if ( $title ) { $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); // localised language name in user language (maybe set by uselang=) - $entry['langname'] = Language::fetchLanguageName( $title->getInterwiki(), $this->getLanguage()->getCode() ); + $entry['langname'] = Language::fetchLanguageName( + $title->getInterwiki(), + $this->getLanguage()->getCode() + ); + // native language name $entry['autonym'] = Language::fetchLanguageName( $title->getInterwiki() ); } @@ -549,7 +565,7 @@ class ApiParse extends ApiBase { /** * @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 + * @param array $languages * @return string */ private function languagesHtml( $languages ) { @@ -718,6 +734,7 @@ class ApiParse extends ApiBase { 'displaytitle', 'headitems', 'headhtml', + 'modules', 'iwlinks', 'wikitext', 'properties', @@ -774,6 +791,7 @@ class ApiParse extends ApiBase { ' displaytitle - Adds the title of the parsed wikitext', ' headitems - Gives items to put in the of the page', ' headhtml - Gives parsed of the page', + ' modules - Gives the ResourceLoader modules used on the page', ' iwlinks - Gives interwiki links in the parsed wikitext', ' wikitext - Gives the original wikitext that was parsed', ' properties - Gives various properties defined in the parsed wikitext',