X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fcontent%2FContentHandler.php;h=8603360ee06302aec715ce8d498367b70fc74560;hp=bccb147e5ba4bf314eb4c2d1ccf93bdc3ceed3fb;hb=d5a7166771613dfe4ed9fb75fa5efeced6134bd1;hpb=944b93ee740d491ec6353f3fa5a439db41de97b8 diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index bccb147e5b..8603360ee0 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -136,7 +136,7 @@ abstract class ContentHandler { $modelId = $title->getContentModel(); } - $handler = ContentHandler::getForModelID( $modelId ); + $handler = self::getForModelID( $modelId ); return $handler->unserializeContent( $text, $format ); } @@ -240,7 +240,7 @@ abstract class ContentHandler { public static function getForTitle( Title $title ) { $modelId = $title->getContentModel(); - return ContentHandler::getForModelID( $modelId ); + return self::getForModelID( $modelId ); } /** @@ -256,7 +256,7 @@ abstract class ContentHandler { public static function getForContent( Content $content ) { $modelId = $content->getModel(); - return ContentHandler::getForModelID( $modelId ); + return self::getForModelID( $modelId ); } /** @@ -293,8 +293,8 @@ abstract class ContentHandler { public static function getForModelID( $modelId ) { global $wgContentHandlers; - if ( isset( ContentHandler::$handlers[$modelId] ) ) { - return ContentHandler::$handlers[$modelId]; + if ( isset( self::$handlers[$modelId] ) ) { + return self::$handlers[$modelId]; } if ( empty( $wgContentHandlers[$modelId] ) ) { @@ -327,9 +327,9 @@ abstract class ContentHandler { wfDebugLog( 'ContentHandler', 'Created handler for ' . $modelId . ': ' . get_class( $handler ) ); - ContentHandler::$handlers[$modelId] = $handler; + self::$handlers[$modelId] = $handler; - return ContentHandler::$handlers[$modelId]; + return self::$handlers[$modelId]; } /** @@ -372,7 +372,7 @@ abstract class ContentHandler { $formats = []; foreach ( $wgContentHandlers as $model => $class ) { - $handler = ContentHandler::getForModelID( $model ); + $handler = self::getForModelID( $model ); $formats = array_merge( $formats, $handler->getSupportedFormats() ); } @@ -619,8 +619,8 @@ abstract class ContentHandler { */ public function createDifferenceEngine( IContextSource $context, $old = 0, $new = 0, $rcid = 0, // FIXME: Deprecated, no longer used - $refreshCache = false, $unhide = false ) { - + $refreshCache = false, $unhide = false + ) { // hook: get difference engine $differenceEngine = null; if ( !Hooks::run( 'GetDifferenceEngine', @@ -1007,22 +1007,22 @@ abstract class ContentHandler { * @return ParserOptions */ public function makeParserOptions( $context ) { - global $wgContLang, $wgEnableParserLimitReporting; + global $wgContLang; if ( $context instanceof IContextSource ) { - $options = ParserOptions::newFromContext( $context ); + $user = $context->getUser(); + $lang = $context->getLanguage(); } elseif ( $context instanceof User ) { // settings per user (even anons) - $options = ParserOptions::newFromUser( $context ); + $user = $context; + $lang = null; } elseif ( $context === 'canonical' ) { // canonical settings - $options = ParserOptions::newFromUserAndLang( new User, $wgContLang ); + $user = new User; + $lang = $wgContLang; } else { throw new MWException( "Bad context for parser options: $context" ); } - $options->enableLimitReport( $wgEnableParserLimitReporting ); // show inclusion/loop reports - $options->setTidy( true ); // fix bad HTML - - return $options; + return ParserOptions::newCanonical( $user, $lang ); } /**