X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fcontent%2FContentHandler.php;h=85894ed539f1bc214afc98a6768cfb6215ca7e3f;hb=bb866e75d0c6e7e47f59371fd5b9e37fc6e66fc8;hp=119144a550f7cf8e59e477c2e4ef9cf606cadd2c;hpb=0eae584888d0e4f0a40896c56c4ec92bd3200176;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 119144a550..85894ed539 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -361,7 +361,9 @@ abstract class ContentHandler { public static function getContentModels() { global $wgContentHandlers; - return array_keys( $wgContentHandlers ); + $models = array_keys( $wgContentHandlers ); + Hooks::run( 'GetContentModels', [ &$models ] ); + return $models; } public static function getAllContentFormats() { @@ -897,7 +899,7 @@ abstract class ContentHandler { $onlyAuthor = $row->rev_user_text; // Try to find a second contributor foreach ( $res as $row ) { - if ( $row->rev_user_text != $onlyAuthor ) { // Bug 22999 + if ( $row->rev_user_text != $onlyAuthor ) { // T24999 $onlyAuthor = false; break; } @@ -1005,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 ); } /** @@ -1155,8 +1157,11 @@ abstract class ContentHandler { * @return array Map of name=>value for fields * @since 1.28 */ - public function getDataForSearchIndex( WikiPage $page, ParserOutput $output, - SearchEngine $engine ) { + public function getDataForSearchIndex( + WikiPage $page, + ParserOutput $output, + SearchEngine $engine + ) { $fieldData = []; $content = $page->getContent();