r32564 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32563‎ | r32564 | r32565 >
Date:11:33, 29 March 2008
Author:minuteelectron
Status:old
Tags:
Comment:
Click parser function can now be used inline. Removing redundant README files from MultiBoilerplate and
CategoryStepper.
Modified paths:
  • /trunk/extensions/CategoryStepper/README (deleted) (history)
  • /trunk/extensions/Click/Click.php (modified) (history)
  • /trunk/extensions/MultiBoilerplate/README (deleted) (history)

Diff [purge]

Index: trunk/extensions/Click/Click.php
@@ -10,7 +10,7 @@
1111 * @link http://www.mediawiki.org/wiki/Extension:Click
1212 *
1313 * @author MinuteElectron <minuteelectron@googlemail.com>
14 - * @copyright Copyright © 2008 MinuteElectron.
 14+ * @copyright Copyright � 2008 MinuteElectron.
1515 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1616 */
1717
@@ -23,7 +23,7 @@
2424 'description' => 'Adds a parser function to display an image with a link that leads to a page other than the image description page.',
2525 'author' => 'MinuteElectron',
2626 'url' => 'http://www.mediawiki.org/wiki/Extension:Click',
27 - 'version' => '1.2',
 27+ 'version' => '1.3',
2828 );
2929
3030 // Setup function.
@@ -50,6 +50,7 @@
5151 function efClickParserFunction_Render( &$parser, $target = '', $image = '', $widthalt = '', $altwidth = '' ) {
5252
5353 // Width and alt-text are interchangable.
 54+ // No need to escape here, automatically done by Xml class functions.
5455 if( preg_match( '#^[0|1|2|3|4|5|6|7|8|9]*px$#', $widthalt ) ) {
5556 // First value width, second alt.
5657 $width = $widthalt;
@@ -64,11 +65,6 @@
6566 $width = false;
6667 }
6768
68 - // Escape quotation marks of alt attribute so that any character can be
69 - // used (and it looks alright), but we are safe from including arbitrary
70 - // HTML.
71 - $alt = str_replace( '"', '&quot;', $alt );
72 -
7369 // Open hyperlink, default to a on-wiki page, but if it doesn't exist and
7470 // is a valid external URL then use it.
7571 $targettitle = Title::newFromText( $target );
@@ -104,7 +100,7 @@
105101 // Display image.
106102 if( !$width ) $width = $imageimage->getWidth();
107103 $thumbnail = $imageimage->transform( array( 'width' => $width ) );
108 - $r .= $thumbnail->toHtml( array( 'alt' => $alt, 'file-link' => false ) );
 104+ $r .= $thumbnail->toHtml( array( 'alt' => $alt, 'file-link' => false, 'valign' => 'bottom' ) );
109105 } else {
110106 // Display alt text.
111107 $r .= $alt;
@@ -117,8 +113,7 @@
118114 // Close hyperlink.
119115 if( is_object( $targettitle ) ) $r .= Xml::closeElement( 'a' );
120116
121 - // Yes, this is HTML.
122 - // TODO: Find some way to make this inline (not start a new paragraph).
123 - return array( $r, 'noparse' => true, 'isHTML' => true );
 117+ // Can't just output as HTML, need to do this to make a new paragraph.
 118+ return $parser->insertStripItem( $r, $parser->mStripState );
124119
125120 }
Index: trunk/extensions/MultiBoilerplate/README
@@ -1,97 +0,0 @@
2 -MultiBoilerplate
3 -
4 - Version 1.6
5 - Copyright © 2007-2008 MinuteElectron.
6 - Licensed under the GNU General Public License 2.0 or later.
7 -
8 -The MultiBoilerplate extension allows a boilerplate to be selected from a drop
9 -down box located above the edit form when editing non-exstant pages or
10 -optionally (based upon configuration variable $wgMultiBoilerplateOverwrite),
11 -load the template over the current contents.
12 -
13 -== Requirements ==
14 -
15 -The MultiBoilerplate extension requires MediaWiki 1.11.0 or later.
16 -
17 -== Installation ==
18 -
19 -1. Place the MultiBoilerplater.php source code into
20 - extensions/MultiBoilerplate/MultiBoilerplate.php.
21 -2. Place the MultiBoilerplater.i18n.php source code into
22 - extensions/MultiBoilerplate/MultiBoilerplate.i18n.php.
23 -3. Add require_once( "$IP/extensions/MultiBoilerplate/MultiBoilerplate.php" );
24 - to LocalSettings.php.
25 -4. Enjoy!
26 -
27 -Installation can be verified through the [[Special:Version]] page on the wiki.
28 -
29 -== Using the extension ==
30 -
31 -MultiBoilerplate adds a box to the edit page above the edit form
32 -allowing users to load a boilerplate into the edit window.
33 -
34 -Fill the $wgMultiBoilerplateOptions variable with a list of boilerplate names
35 -to templates; e.g.
36 -$wgMultiBoilerplateOptions[ "My Boilerplate" ] = "Template:My Boilerplate";
37 -
38 -Alternatively set the variable to false and use the MediaWiki:Multiboilerplate
39 -page to set options
40 -
41 -LocalSettings.php:
42 - $wgMultiBoilerplateOptions = false;
43 -MediaWiki:Multiboilerplate:
44 - * My Boilerplate|Template:My Boilerplate
45 -
46 -Optionally set whether or not the selection box is displayed on pages that
47 -already exist (defaults to false) using $wgMultiBoilerplateOverwrite.
48 -$wgMultiBoilerplateOverwrite = true;
49 -
50 -== Change log ==
51 -
52 -Version 1.1
53 -2007-12-18
54 - Original version.
55 -
56 -Version 1.2
57 -2008-01-07
58 - Refactor code, fix major bug that made the extension useless and add
59 - comments.
60 -
61 -Version 1.3
62 -2008-01-19
63 - Use Xml:: instead of manually created HTML, converted all double-quotes to
64 - single-quotes.
65 - Added an optional message multiboilerplate-label to display a label before
66 - the drop-down box, and rename multiboilerplate-select to
67 - multiboilerplate-legend and multiboilerplate-load to
68 - multiboilerplate-submit to be less ambiguous.
69 -
70 -Version 1.4
71 -2008-02-06
72 - It is now (optionally) possible to specify boilerplates in a MediaWiki
73 - namespace message instead of a LocalSettings.php configuration variable.
74 - The extension now uses descriptionmsg (allowing description
75 - internationalisation).
76 - Part of the code that used direct database interfacing to check for article
77 - existence has been replaced with a call to the $wgTitle global.
78 - The $wgMultiBoilerplateThings global has been renamed to
79 - $wgMultiBoilerplateOptions for a greater level of self-explanation.
80 - The boilerplate selection box is no longer displayed if there are no
81 - options.
82 -
83 -Version 1.5
84 -2008-02-06
85 - Now handles <noinclude> and<includeonly> tags.
86 -
87 -Version 1.6
88 -2008-02-26
89 - Added README.
90 - ltrim() now used instead of preg_replace().
91 -
92 -== Feedback ==
93 -
94 -Bugs and feature requests should be reported via MediaZilla
95 -<http://bugzilla.wikimedia.org/> and placed in the 'MediaWiki extensions'
96 -product under the 'MultiBoilerplate' component. Alternatively send an e-mail to
97 -<minuteelectron@googlemail.com> with any comments or suggestions, all are
98 -welcome.
\ No newline at end of file
Index: trunk/extensions/CategoryStepper/README
@@ -1,85 +0,0 @@
2 -CategoryStepper
3 -
4 - Version 1.5
5 - Copyright © 2007-2008 MinuteElectron.
6 - Licensed under the GNU General Public License 2.0 or later.
7 -
8 -The CategoryStepper extension displays a category stepper box allowing one to
9 -navigate forward and backwards alphabetically through one or more categories a
10 -page is in, as specified via a MediaWiki: namespace page or the
11 -$wgCategoryStepper configuration variable.
12 -
13 -== Requirements ==
14 -
15 -The CategoryStepper extension requires MediaWiki 1.11.0 or later.
16 -
17 -== Installation ==
18 -
19 -1. Place the CategoryStepper.php source code into
20 - extensions/CategoryStepper/CategoryStepper.php.
21 -2. Place the CategoryStepper.i18n.php source code into
22 - extensions/CategoryStepper/CategoryStepper.i18n.php.
23 -3. If desired place the CategoryStepper.css source code into
24 - skins/CategoryStepper.css.
25 -4. Add require_once( "$IP/extensions/CategoryStepper/CategoryStepper.php" ); to
26 - LocalSettings.php.
27 -5. Enjoy!
28 -
29 -Installation can be verified through the [[Special:Version]] page on the wiki.
30 -
31 -== Using the extension ==
32 -
33 -CategoryStepper adds a box to the bottom of the content area on pages which are
34 -in a specified category. Categories can be configured either via using the
35 -$wgCategoryStepper configuration variable or by mofifying the page
36 -MediaWiki:categorystepper.
37 -
38 -Fill the $wgCategoryStepper variable with a list of category names to stepper
39 -box titles; e.g.
40 -$wgCategoryStepper[ "Astronauts" ] = "Astronauts Box Title";
41 -
42 -Alternatively set the $wgCategoryStepper variable to false and use the
43 -MediaWiki:Categorystepper page to set options; e.g.
44 -
45 -LocalSettings.php:
46 - $wgCategoryStepper = false;
47 -MediaWiki:Categorystepper:
48 - * Astronauts|Astronauts Box Title
49 -
50 -== Change log ==
51 -
52 -Version 1.1
53 -2008-01-19
54 - Original version.
55 -
56 -Version 1.2
57 -2008-01-20
58 - Added missing space in i18n file.
59 -
60 -Version 1.3
61 -2008-02-16
62 - No longer render on edit, protect or delete pages.
63 - Allow modification of categories and title via the
64 - MediaWiki:categorystepper page.
65 -
66 -Version 1.4
67 -2008-02-17
68 - The second parameter of each row on the MediaWiki:categorystepper page is
69 - now optional and defaults to the first parameter.
70 -
71 -Version 1.5
72 -2008-02-26
73 - Default wikitable-like styling is now included and can optionally be used,
74 - or overridden via MediaWiki:Common.css or the individual skins CSS
75 - MediaWiki namespace pages.
76 - README added.
77 - Function wfCategoryStepper renamed to efCategoryStepper.
78 - ltrim() now used instead of preg_replace().
79 -
80 -== Feedback ==
81 -
82 -Bugs and feature requests should be reported via MediaZilla
83 -<http://bugzilla.wikimedia.org/> and placed in the 'MediaWiki extensions'
84 -product under the CategoryStepper component. Alternatively send an e-mail to
85 -<minuteelectron@googlemail.com> with any comments or suggestions, all are
86 -welcome.

Status & tagging log