From 5167ae7213f3576644ab6273ed55db947004cd91 Mon Sep 17 00:00:00 2001 From: Platonides Date: Wed, 29 Sep 2010 23:27:26 +0000 Subject: [PATCH] Do not show math toolbar button if TeX is disabled. Do not show image and media toolbar buttons if the wiki can't show images (either by local upload or via a foreign repo) --- includes/EditPage.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 773f969b16..07fd9ad465 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2111,6 +2111,9 @@ HTML */ static function getEditToolbar() { global $wgStylePath, $wgContLang, $wgLang, $wgOut; + global $wgUseTeX, $wgEnableUploads, $wgForeignFileRepos; + + $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos ); /** @@ -2170,7 +2173,7 @@ HTML 'tip' => wfMsg( 'headline_tip' ), 'key' => 'H' ), - array( + $imagesAvailable ? array( 'image' => $wgLang->getImageFile( 'button-image' ), 'id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':', @@ -2178,8 +2181,8 @@ HTML 'sample' => wfMsg( 'image_sample' ), 'tip' => wfMsg( 'image_tip' ), 'key' => 'D' - ), - array( + ) : false, + $imagesAvailable ? array( 'image' => $wgLang->getImageFile( 'button-media' ), 'id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':', @@ -2187,8 +2190,8 @@ HTML 'sample' => wfMsg( 'media_sample' ), 'tip' => wfMsg( 'media_tip' ), 'key' => 'M' - ), - array( + ) : false, + $wgUseTeX ? array( 'image' => $wgLang->getImageFile( 'button-math' ), 'id' => 'mw-editbutton-math', 'open' => "", @@ -2196,7 +2199,7 @@ HTML 'sample' => wfMsg( 'math_sample' ), 'tip' => wfMsg( 'math_tip' ), 'key' => 'C' - ), + ) : false, array( 'image' => $wgLang->getImageFile( 'button-nowiki' ), 'id' => 'mw-editbutton-nowiki', @@ -2229,6 +2232,8 @@ HTML $script = ''; foreach ( $toolarray as $tool ) { + if ( !$tool ) continue; + $params = array( $image = $wgStylePath . '/common/images/' . $tool['image'], // Note that we use the tip both for the ALT tag and the TITLE tag of the image. -- 2.20.1