r22430 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22429‎ | r22430 | r22431 >
Date:16:32, 25 May 2007
Author:raymond
Status:old
Tags:
Comment:
Introducing 'frameless' keyword to [[Image:]] syntax which respects the user preferences for image width like 'thumb' but without a frame.
Now we can use frameless images without the need to nailing its size by a constant pixel parameter. Scaling by different user preference/anon view will always keep the proportions.

Usage: [[Image:name.jpg|frameless|right]]
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -414,7 +414,7 @@
415415
416416 /** @todo document */
417417 function makeImageLinkObj( $nt, $label, $alt, $align = '', $params = array(), $framed = false,
418 - $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0, $border = false )
 418+ $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0, $border = false, $frameless = false )
419419 {
420420 global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright;
421421
@@ -436,7 +436,7 @@
437437
438438 if ( !isset( $params['width'] ) ) {
439439 $params['width'] = $img->getWidth( $page );
440 - if( $thumb || $framed ) {
 440+ if( $thumb || $framed || $frameless ) {
441441 $wopt = $wgUser->getOption( 'thumbsize' );
442442
443443 if( !isset( $wgThumbLimits[$wopt] ) ) {
Index: trunk/phase3/includes/Parser.php
@@ -4412,6 +4412,7 @@
44134413 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
44144414 # * center center the image
44154415 # * framed Keep original image size, no magnify-button.
 4416+ # * frameless like 'thumbnail' but without frame, enlarge-icon and caption. User preference thumb width is used
44164417 # * upright reduce width for upright images, rounded to full __0 px
44174418 # * border draw a 1px border around the image
44184419 # vertical-align values (no % or length right now):
@@ -4436,6 +4437,7 @@
44374438 $mwManualThumb =& MagicWord::get( 'img_manualthumb' );
44384439 $mwWidth =& MagicWord::get( 'img_width' );
44394440 $mwFramed =& MagicWord::get( 'img_framed' );
 4441+ $mwFrameless =& MagicWord::get( 'img_frameless' );
44404442 $mwUpright =& MagicWord::get( 'img_upright' );
44414443 $mwBorder =& MagicWord::get( 'img_border' );
44424444 $mwPage =& MagicWord::get( 'img_page' );
@@ -4443,6 +4445,7 @@
44444446
44454447 $params = array();
44464448 $framed = $thumb = false;
 4449+ $frameless = false;
44474450 $upright = false;
44484451 $upright_factor = 0;
44494452 $border = false;
@@ -4458,6 +4461,8 @@
44594462 $upright_factor = floatval( $match );
44604463 } elseif ( !is_null( $mwBorder->matchVariableStartToEnd( $val ) ) ) {
44614464 $border = true;
 4465+ } elseif ( !is_null( $mwFrameless->matchVariableStartToEnd( $val ) ) ) {
 4466+ $frameless = true;
44624467 } elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) {
44634468 # use manually specified thumbnail
44644469 $thumb=true;
@@ -4504,7 +4509,7 @@
45054510 $alt = Sanitizer::stripAllTags( $alt );
45064511
45074512 # Linker does the rest
4508 - return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor, $border );
 4513+ return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor, $border, $frameless );
45094514 }
45104515
45114516 /**
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -281,6 +281,7 @@
282282 'img_width' => array( 1, '$1px' ),
283283 'img_center' => array( 1, 'center', 'centre' ),
284284 'img_framed' => array( 1, 'framed', 'enframed', 'frame' ),
 285+ 'img_frameless' => array( 1, 'frameless' ),
285286 'img_page' => array( 1, 'page=$1', 'page $1' ),
286287 'img_upright' => array( 1, 'upright', 'upright=$1', 'upright $1' ),
287288 'img_border' => array( 1, 'border' ),
Index: trunk/phase3/RELEASE-NOTES
@@ -34,13 +34,15 @@
3535 * (bug 9628) Show warnings about slave lag on Special:Contributions,
3636 Special:Watchlist
3737 * (bug 8818) Expose "wpDestFile" as parameter $1 to "uploaddisabledtext"
38 -* Introducing new image parameter 'upright' and corresponding variable
 38+* Introducing new image keyword 'upright' and corresponding variable
3939 $wgThumbUpright. This allows better proportional view of upright images
4040 related to landscape images on a page without nailing the width of upright
4141 images to a fix value which makes views for anon unproportional and user
4242 preferences useless
43 -* (bug 6072) Add a 'border' keyword to the image syntax
44 -
 43+* (bug 6072) Introducing 'border' keyword to the [[Image:]] syntax
 44+* Introducing 'frameless' keyword to [[Image:]] syntax which respects the
 45+ user preferences for image width like 'thumb' but without a frame.
 46+
4547 == Bugfixes since 1.10 ==
4648
4749 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi

Follow-up revisions

RevisionCommit summaryAuthorDate
r22435Reverting r22430 for now; I don't really like this keyword creep, and even if...brion18:02, 25 May 2007
r22444Merged revisions 22413-22443 via svnmerge from...david00:06, 26 May 2007