* (bug 2443) Add image name as alt-text when no caption is provided.
authorAndrew Garrett <werdna@users.mediawiki.org>
Fri, 8 Aug 2008 10:24:09 +0000 (10:24 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Fri, 8 Aug 2008 10:24:09 +0000 (10:24 +0000)
RELEASE-NOTES
includes/parser/Parser.php

index f688f43..96650b7 100644 (file)
@@ -78,6 +78,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   Patch by Max Semenik.
 * (bug 15055) Talk page notifications no longer attempt to send mail when
   user's e-mail address is invalid or unconfirmed
+* (bug 2443) Add image name as alt-text when no caption is provided.
 
 === API changes in 1.14 ===
 
index 7a2f5f7..0648040 100644 (file)
@@ -4517,7 +4517,7 @@ class Parser
                list( $paramMap, $mwArray ) = $this->getImageParams( $handler );
 
                # Process the input parameters
-               $caption = '';
+               $caption = false;
                $params = array( 'frame' => array(), 'handler' => array(),
                        'horizAlign' => array(), 'vertAlign' => array() );
                foreach( $parts as $part ) {
@@ -4584,9 +4584,15 @@ class Parser
                if ( $params['vertAlign'] ) {
                        $params['frame']['valign'] = key( $params['vertAlign'] );
                }
-
-               # Strip bad stuff out of the alt text
-               $alt = $this->replaceLinkHoldersText( $caption );
+               
+               // Process alt text
+               if ($caption === false) {
+                       // Put the image name in.
+                       $alt = $title->getPrefixedText();
+               } else {
+                       # Strip bad stuff out of the alt text
+                       $alt = $this->replaceLinkHoldersText( $caption );
+               }
 
                # make sure there are no placeholders in thumbnail attributes
                # that are later expanded to html- so expand them now and