r10663 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10662‎ | r10663 | r10664 >
Date:13:27, 20 August 2005
Author:imsop
Status:old
Tags:
Comment:
Fix manual thumbnail syntax to use a proper "MagicWord" (MAG_IMG_MANUALTHUMB) rather than a weird hack.
Modified paths:
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3250,6 +3250,7 @@
32513251 $part = explode( '|', $options);
32523252
32533253 $mwThumb =& MagicWord::get( MAG_IMG_THUMBNAIL );
 3254+ $mwManualThumb =& MagicWord::get( MAG_IMG_MANUALTHUMB );
32543255 $mwLeft =& MagicWord::get( MAG_IMG_LEFT );
32553256 $mwRight =& MagicWord::get( MAG_IMG_RIGHT );
32563257 $mwNone =& MagicWord::get( MAG_IMG_NONE );
@@ -3262,14 +3263,12 @@
32633264 $manual_thumb = '' ;
32643265
32653266 foreach( $part as $key => $val ) {
3266 - $val_parts = explode ( '=' , $val , 2 ) ;
3267 - $left_part = array_shift ( $val_parts ) ;
32683267 if ( $wgUseImageResize && ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
32693268 $thumb=true;
3270 - } elseif ( $wgUseImageResize && count ( $val_parts ) == 1 && ! is_null( $mwThumb->matchVariableStartToEnd($left_part) ) ) {
 3269+ } elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) {
32713270 # use manually specified thumbnail
32723271 $thumb=true;
3273 - $manual_thumb = array_shift ( $val_parts ) ;
 3272+ $manual_thumb = $match;
32743273 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
32753274 # remember to set an alignment, don't render immediately
32763275 $align = 'right';
Index: trunk/phase3/includes/MagicWord.php
@@ -55,6 +55,7 @@
5656 define('MAG_SCRIPTPATH', 41);
5757 define('MAG_SERVERNAME', 42);
5858 define('MAG_NUMBEROFFILES', 43);
 59+define('MAG_IMG_MANUALTHUMB', 44);
5960
6061 $wgVariableIDs = array(
6162 MAG_CURRENTMONTH,
Index: trunk/phase3/languages/Language.php
@@ -212,6 +212,7 @@
213213 MAG_MSGNW => array( 0, 'MSGNW:' ),
214214 MAG_END => array( 0, '__END__' ),
215215 MAG_IMG_THUMBNAIL => array( 1, 'thumbnail', 'thumb' ),
 216+ MAG_IMG_MANUALTHUMB => array( 1, 'thumbnail=$1', 'thumb=$1'),
216217 MAG_IMG_RIGHT => array( 1, 'right' ),
217218 MAG_IMG_LEFT => array( 1, 'left' ),
218219 MAG_IMG_NONE => array( 1, 'none' ),

Status & tagging log