Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/112405
Change subject: Use context instead of global variables, add typehinting ...................................................................... Use context instead of global variables, add typehinting Change-Id: I316fc36b97ee648af303d2cafde0eb69f8c83b83 --- M CodeEditor.hooks.php 1 file changed, 7 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeEditor refs/changes/05/112405/1 diff --git a/CodeEditor.hooks.php b/CodeEditor.hooks.php index 470f82e..b8c3a35 100644 --- a/CodeEditor.hooks.php +++ b/CodeEditor.hooks.php @@ -1,7 +1,7 @@ <?php class CodeEditorHooks { - static function getPageLanguage( $title ) { + static function getPageLanguage( Title $title ) { global $wgCodeEditorEnableCore; if ( $wgCodeEditorEnableCore && method_exists( $title, "getContentModel" ) ) { @@ -25,26 +25,23 @@ return $lang; } - public static function editPageShowEditFormInitial( &$toolbar ) { - global $wgOut, $wgTitle; - $lang = self::getPageLanguage( $wgTitle ); + public static function editPageShowEditFormInitial( EditPage $editPage, OutputPage $out ) { + $lang = self::getPageLanguage( $out->getTitle() ); if ( $lang ) { - $wgOut->addModules( 'ext.codeEditor' ); + $out->addModules( 'ext.codeEditor' ); } return true; } - public static function onMakeGlobalVariablesScript( &$vars, $output ) { - global $wgTitle; - - $lang = self::getPageLanguage( $wgTitle ); + public static function onMakeGlobalVariablesScript( &$vars, OutputPage $output ) { + $lang = self::getPageLanguage( $output->getTitle() ); if( $lang ) { $vars['wgCodeEditorCurrentLanguage'] = $lang; } return true; } - public static function onBeforePageDisplay( $out, $skin ) { + public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { global $wgCodeEditorGeshiIntegration; if ( $wgCodeEditorGeshiIntegration ) { $out->addModules( 'ext.codeEditor.geshi' ); -- To view, visit https://gerrit.wikimedia.org/r/112405 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I316fc36b97ee648af303d2cafde0eb69f8c83b83 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CodeEditor Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits