* @return Array of module names
*/
public function getModules() {
- return $this->mModules;
+ return array_values( array_unique( $this->mModules ) );
}
/**
* @return array of module names
*/
public function getModuleScripts() {
- return $this->mModuleScripts;
+ return array_values( array_unique( $this->mModuleScripts ) );
}
/**
* @return Array of module names
*/
public function getModuleStyles() {
- return $this->mModuleStyles;
+ return array_values( array_unique( $this->mModuleStyles ) );
}
/**
* @return Array of module names
*/
public function getModuleMessages() {
- return $this->mModuleMessages;
+ return array_values( array_unique( $this->mModuleMessages ) );
}
/**
$this->mDebugtext .= $text;
}
- /**
- * @deprecated use parserOptions() instead
- */
- public function setParserOptions( $options ) {
- wfDeprecated( __METHOD__ );
- return $this->parserOptions( $options );
- }
-
/**
* Get/set the ParserOptions object to use for wikitext parsing
*
wfProfileOut( __METHOD__ );
}
- /**
- * Add wikitext to the buffer, assuming that this is the primary text for a page view
- * Saves the text into the parser cache if possible.
- *
- * @param $text String: wikitext
- * @param $article Article object
- * @param $cache Boolean
- * @deprecated Use Article::outputWikitext
- */
- public function addPrimaryWikiText( $text, $article, $cache = true ) {
- global $wgParser;
-
- wfDeprecated( __METHOD__ );
-
- $popts = $this->parserOptions();
- $popts->setTidy( true );
- $parserOutput = $wgParser->parse(
- $text, $article->mTitle,
- $popts, true, true, $this->mRevisionId
- );
- $popts->setTidy( false );
- if ( $cache && $article && $parserOutput->isCacheable() ) {
- $parserCache = ParserCache::singleton();
- $parserCache->save( $parserOutput, $article, $popts );
- }
-
- $this->addParserOutput( $parserOutput );
- }
-
- /**
- * @deprecated use addWikiTextTidy()
- */
- public function addSecondaryWikiText( $text, $linestart = true ) {
- wfDeprecated( __METHOD__ );
- $this->addWikiTextTitleTidy( $text, $this->getTitle(), $linestart );
- }
-
/**
* Add a ParserOutput object, but without Html
*
* @return String: HTML
*/
public function parse( $text, $linestart = true, $interface = false, $language = null ) {
+ // Check one for one common cause for parser state resetting
+ $callers = wfGetAllCallers( 10 );
+ if ( strpos( $callers, 'Parser::extensionSubstitution' ) !== false ) {
+ throw new MWException( "wfMsg* function with parsing cannot be used " .
+ "inside a tag hook. Should use parser->recursiveTagParse() instead" );
+ }
+
global $wgParser;
if( is_null( $this->getTitle() ) ) {
return $parsed;
}
- /**
- * @deprecated
- *
- * @param $article Article
- * @return Boolean: true if successful, else false.
- */
- public function tryParserCache( &$article ) {
- wfDeprecated( __METHOD__ );
- $parserOutput = ParserCache::singleton()->get( $article, $article->getParserOptions() );
-
- if ( $parserOutput !== false ) {
- $this->addParserOutput( $parserOutput );
- return true;
- } else {
- return false;
- }
- }
-
/**
* Set the value of the "s-maxage" part of the "Cache-control" HTTP header
*
print $outs;
}
- /**
- * @deprecated use wfReportTime() instead.
- *
- * @return String
- */
- public function reportTime() {
- wfDeprecated( __METHOD__ );
- $time = wfReportTime();
- return $time;
- }
-
/**
* Produce a "user is blocked" page.
*
$this->addModules( 'mediawiki.legacy.password' );
}
- /** @deprecated */
- public function errorpage( $title, $msg ) {
- wfDeprecated( __METHOD__ );
- throw new ErrorPageError( $title, $msg );
- }
-
- /** @deprecated */
- public function databaseError( $fname, $sql, $error, $errno ) {
- throw new MWException( "OutputPage::databaseError is obsolete\n" );
- }
-
- /** @deprecated */
- public function fatalError( $message ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( $message );
- }
-
- /** @deprecated */
- public function unexpectedValueError( $name, $val ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( wfMsg( 'unexpected', $name, $val ) );
- }
-
- /** @deprecated */
- public function fileCopyError( $old, $new ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( wfMsg( 'filecopyerror', $old, $new ) );
- }
-
- /** @deprecated */
- public function fileRenameError( $old, $new ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( wfMsg( 'filerenameerror', $old, $new ) );
- }
-
- /** @deprecated */
- public function fileDeleteError( $name ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( wfMsg( 'filedeleteerror', $name ) );
- }
-
- /** @deprecated */
- public function fileNotFoundError( $name ) {
- wfDeprecated( __METHOD__ );
- throw new FatalError( wfMsg( 'filenotfound', $name ) );
- }
-
public function showFatalError( $message ) {
$this->setPageTitle( wfMsg( 'internalerror' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
*/
protected function makeResourceLoaderLink( Skin $skin, $modules, $only, $useESI = false ) {
global $wgUser, $wgLang, $wgLoadScript, $wgResourceLoaderUseESI,
- $wgResourceLoaderInlinePrivateModules;
+ $wgResourceLoaderInlinePrivateModules, $wgRequest;
// Lazy-load ResourceLoader
// TODO: Should this be a static function of ResourceLoader instead?
// TODO: Divide off modules starting with "user", and add the user parameter to them
'skin' => $skin->getSkinName(),
'only' => $only,
);
+ // Propagate printable and handheld parameters if present
+ if ( $wgRequest->getBool( 'printable' ) ) {
+ $query['printable'] = 1;
+ }
+ if ( $wgRequest->getBool( 'handheld' ) ) {
+ $query['handheld'] = 1;
+ }
if ( !count( $modules ) ) {
return '';
}
if( isset( $options['media'] ) ) {
- $media = $this->transformCssMedia( $options['media'] );
+ $media = self::transformCssMedia( $options['media'] );
if( is_null( $media ) ) {
return '';
}
* @param $media String: current value of the "media" attribute
* @return String: modified value of the "media" attribute
*/
- function transformCssMedia( $media ) {
+ public static function transformCssMedia( $media ) {
global $wgRequest, $wgHandheldForIPhone;
// Switch in on-screen display for media testing
* @param $modules Array: list of jQuery modules which should be loaded
* @return Array: the list of modules which were not loaded.
* @since 1.16
- * @deprecated No longer needed as of 1.17
+ * @deprecated @since 1.17
*/
public function includeJQuery( $modules = array() ) {
return array();