* @since 1.21
*/
protected function getContentObject( $def_content = null ) {
- global $wgContLang;
-
$content = false;
$user = $this->context->getUser();
if ( $undoMsg === null ) {
$oldContent = $this->page->getContent( Revision::RAW );
- $popts = ParserOptions::newFromUserAndLang( $user, $wgContLang );
+ $popts = ParserOptions::newFromUserAndLang(
+ $user, MediaWikiServices::getInstance()->getContentLanguage() );
$newContent = $content->preSaveTransform( $this->mTitle, $user, $popts );
if ( $newContent->getModel() !== $oldContent->getModel() ) {
// The undo may change content
}
/**
- * Helper function for summary input functions, which returns the neccessary
+ * Helper function for summary input functions, which returns the necessary
* attributes for the input.
*
* @param array|null $inputAttrs Array of attrs to use on the input
* save and then make a comparison.
*/
public function showDiff() {
- global $wgContLang;
-
$oldtitlemsg = 'currentrev';
# if message does not exist, show diff against the preloaded default
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) {
Hooks::run( 'EditPageGetDiffContent', [ $this, &$newContent ] );
$user = $this->context->getUser();
- $popts = ParserOptions::newFromUserAndLang( $user, $wgContLang );
+ $popts = ParserOptions::newFromUserAndLang( $user,
+ MediaWikiServices::getInstance()->getContentLanguage() );
$newContent = $newContent->preSaveTransform( $this->mTitle, $user, $popts );
}
* Get the Limit report for page previews
*
* @since 1.22
- * @param ParserOutput $output ParserOutput object from the parse
+ * @param ParserOutput|null $output ParserOutput object from the parse
* @return string HTML
*/
- public static function getPreviewLimitReport( $output ) {
+ public static function getPreviewLimitReport( ParserOutput $output = null ) {
global $wgLang;
if ( !$output || !$output->getLimitReportData() ) {
* @return string
*/
public static function getEditToolbar( $title = null ) {
- global $wgContLang, $wgOut;
- global $wgEnableUploads, $wgForeignFileRepos;
+ global $wgOut, $wgEnableUploads, $wgForeignFileRepos;
$imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
$showSignature = true;
$showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
}
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+
/**
* $toolarray is an array of arrays each of which includes the
* opening tag, the closing tag, optionally a sample text that is
],
$imagesAvailable ? [
'id' => 'mw-editbutton-image',
- 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
+ 'open' => '[[' . $contLang->getNsText( NS_FILE ) . ':',
'close' => ']]',
'sample' => wfMessage( 'image_sample' )->text(),
'tip' => wfMessage( 'image_tip' )->text(),
] : false,
$imagesAvailable ? [
'id' => 'mw-editbutton-media',
- 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
+ 'open' => '[[' . $contLang->getNsText( NS_MEDIA ) . ':',
'close' => ']]',
'sample' => wfMessage( 'media_sample' )->text(),
'tip' => wfMessage( 'media_tip' )->text(),