r106107 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106106‎ | r106107 | r106108 >
Date:21:49, 13 December 2011
Author:foxtrott
Status:ok (Comments)
Tags:
Comment:
bugfixes (title of Special page does not contain "subpages"; anon functions not available in php pre5.3; width attrib of html elements must not contain unit (px); width of wikitext image link must contain unit (px))
Modified paths:
  • /trunk/extensions/SemanticImageInput/SemanticImageInput.php (modified) (history)
  • /trunk/extensions/SemanticImageInput/includes/InstantImageInput.php (modified) (history)
  • /trunk/extensions/SemanticImageInput/resources/jquery.instantImage.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticImageInput/includes/InstantImageInput.php
@@ -104,12 +104,7 @@
105105 }
106106 else {
107107 global $wgParser;
108 -
109 - $html .= $wgParser->parse(
110 - '[[' . $cur_value . '|' . $width . ']]',
111 - Title::newFromText( self::getPage() ),
112 - ( new ParserOptions() )
113 - )->getText();
 108+ $html .= $wgParser->recursiveTagParse( '[[' . $cur_value . '|' . $width . 'px ]]' );
114109 }
115110 }
116111
@@ -139,15 +134,8 @@
140135 }
141136
142137 protected static function getPage() {
143 - $parts = explode( '/', $GLOBALS['wgTitle']->getFullText() );
144 -
145 - // TODO: this will not work for non-en.
146 - if ( $parts[0] == 'Special:FormEdit' ) {
147 - array_shift( $parts );
148 - array_shift( $parts );
149 - }
150 -
151 - return implode( '/', $parts );
 138+ global $wgParser;
 139+ return $wgParser->getTitle()->getFullText();
152140 }
153141
154142 }
Index: trunk/extensions/SemanticImageInput/resources/jquery.instantImage.js
@@ -154,7 +154,7 @@
155155
156156 $this.html( $( '<img />' ).attr( {
157157 'src': info[i].thumburl,
158 - 'width': settings.imagewidth + 'px'
 158+ 'width': settings.imagewidth
159159 } ) );
160160
161161 return;
Index: trunk/extensions/SemanticImageInput/SemanticImageInput.php
@@ -55,10 +55,7 @@
5656
5757 $wgAutoloadClasses['InstantImageInput'] = dirname( __FILE__ ) . '/includes/InstantImageInput.php';
5858
59 -$wgExtensionFunctions[] = function() {
60 - global $sfgFormPrinter;
61 - $sfgFormPrinter->registerInputType( 'InstantImageInput' );
62 -};
 59+$wgExtensionFunctions[] = 'efSIISetup';
6360
6461 // Resource loader modules
6562 $moduleTemplate = array(
@@ -76,3 +73,9 @@
7774 unset( $moduleTemplate );
7875
7976 $egSIISettings = array();
 77+
 78+function efSIISetup() {
 79+
 80+ global $sfgFormPrinter;
 81+ $sfgFormPrinter->registerInputType( 'InstantImageInput' );
 82+}
\ No newline at end of file

Comments

#Comment by Jeroen De Dauw (talk | contribs)   22:32, 13 December 2011

Awesome, thnx :)

But you killed the nice anon function :(

#Comment by F.trott (talk | contribs)   23:06, 13 December 2011

see bug 25917 and r78976  ;)

#Comment by Jeroen De Dauw (talk | contribs)   23:50, 13 December 2011
D

That's a year ago though. At this point I've given up on PHP 5.2 and have several extensions that have an architecture that extensively makes use of features introduced in PHP 5.3.

Status & tagging log