From: Rowan Collins Date: Sat, 20 Aug 2005 13:27:21 +0000 (+0000) Subject: Fix manual thumbnail syntax to use a proper "MagicWord" (MAG_IMG_MANUALTHUMB) rather... X-Git-Tag: 1.6.0~1868 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=f19c94aa72b43d712b965cd967a80f2d8ce71c21;p=lhc%2Fweb%2Fwiklou.git Fix manual thumbnail syntax to use a proper "MagicWord" (MAG_IMG_MANUALTHUMB) rather than a weird hack. --- diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 0fbe370b95..a0825ee6e3 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -55,6 +55,7 @@ define('MAG_REVISIONID', 40); define('MAG_SCRIPTPATH', 41); define('MAG_SERVERNAME', 42); define('MAG_NUMBEROFFILES', 43); +define('MAG_IMG_MANUALTHUMB', 44); $wgVariableIDs = array( MAG_CURRENTMONTH, diff --git a/includes/Parser.php b/includes/Parser.php index 2c3b48bb1f..40afaed44d 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3250,6 +3250,7 @@ class Parser $part = explode( '|', $options); $mwThumb =& MagicWord::get( MAG_IMG_THUMBNAIL ); + $mwManualThumb =& MagicWord::get( MAG_IMG_MANUALTHUMB ); $mwLeft =& MagicWord::get( MAG_IMG_LEFT ); $mwRight =& MagicWord::get( MAG_IMG_RIGHT ); $mwNone =& MagicWord::get( MAG_IMG_NONE ); @@ -3262,14 +3263,12 @@ class Parser $manual_thumb = '' ; foreach( $part as $key => $val ) { - $val_parts = explode ( '=' , $val , 2 ) ; - $left_part = array_shift ( $val_parts ) ; if ( $wgUseImageResize && ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) { $thumb=true; - } elseif ( $wgUseImageResize && count ( $val_parts ) == 1 && ! is_null( $mwThumb->matchVariableStartToEnd($left_part) ) ) { + } elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) { # use manually specified thumbnail $thumb=true; - $manual_thumb = array_shift ( $val_parts ) ; + $manual_thumb = $match; } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) { # remember to set an alignment, don't render immediately $align = 'right'; diff --git a/languages/Language.php b/languages/Language.php index 408d05534a..816b8fd749 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -212,6 +212,7 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_MSGNW => array( 0, 'MSGNW:' ), MAG_END => array( 0, '__END__' ), MAG_IMG_THUMBNAIL => array( 1, 'thumbnail', 'thumb' ), + MAG_IMG_MANUALTHUMB => array( 1, 'thumbnail=$1', 'thumb=$1'), MAG_IMG_RIGHT => array( 1, 'right' ), MAG_IMG_LEFT => array( 1, 'left' ), MAG_IMG_NONE => array( 1, 'none' ),