r34852 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34851‎ | r34852 | r34853 >
Date:12:15, 15 May 2008
Author:ashley
Status:old
Tags:
Comment:
ImageTagging:
*proper i18n
*change url & add version number in extension credits
*standard coding style
*standardize message names as per http://www.mediawiki.org/wiki/Manual:Coding_conventions#Messages
*remove php ending tag

this has been tested on 1.13alpha (r34643) and works relatively well, even though that the logging is still a bit bugged and Special:TaggedImages appears as <taggedimages> on Special:Specialpages
Modified paths:
  • /trunk/extensions/ImageTagging/ImageTagPage.php (modified) (history)
  • /trunk/extensions/ImageTagging/ImageTagging.i18n.php (added) (history)
  • /trunk/extensions/ImageTagging/SpecialTaggedImages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageTagging/ImageTagPage.php
@@ -1,5 +1,12 @@
22 <?php
3 -
 3+/**
 4+ * ImageTagging extension by Wikia, Inc.
 5+ * Lets a user select regions of an embedded image and associate an article with that region
 6+ *
 7+ * @author Tristan Harris
 8+ * @author Tomasz Klim
 9+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 10+ */
411 $wgHooks['UnknownAction'][] = 'addTag';
512 $wgHooks['UnknownAction'][] = 'removeTag';
613 $wgHooks['UnknownAction'][] = 'tagSearch';
@@ -8,32 +15,28 @@
916 $wgExtensionCredits['other'][] = array(
1017 'name' => 'Image Tagging',
1118 'author' => 'Wikia, Inc. (Tristan Harris, Tomasz Klim)',
12 - //'version' => 1.0,
13 - 'url' => 'http://www.wikia.com/wiki/Help:Image_tagging',
14 - 'description' => 'Wikia Image Tagging',
 19+ 'version' => 1.0,
 20+ 'url' => 'http://www.mediawiki.org/wiki/Extension:ImageTagging',
 21+ 'description' => 'Lets a user select regions of an embedded image and associate an article with that region',
1522 );
1623
1724 // other hooks to try: 'ParserAfterTidy', ...
1825 #$wgHooks['OutputPageBeforeHTML'][] = 'wfCheckArticleImageTags';
1926 $wgHooks['ArticleFromTitle'][] = 'wfArticleFromTitle';
2027
21 -
2228 $dir = dirname(__FILE__) . '/';
2329 $wgAutoloadClasses['TaggedImages'] = $dir . 'SpecialTaggedImages.php';
 30+$wgExtensionMessagesFiles['ImageTagging'] = $dir . 'ImageTagging.i18n.php';
2431 $wgSpecialPages['TaggedImages'] = 'TaggedImages';
2532
26 -
27 -
2833 /********************
2934 * End Trie Handlers
3035 ********************/
3136
32 -function wfCheckArticleImageTags($outputPage, $text)
33 -{
 37+function wfCheckArticleImageTags($outputPage, $text) {
3438 global $wgOut, $wgDBname, $wgTitle;
3539
36 - if ( $outputPage->isArticle() )
37 - {
 40+ if ( $outputPage->isArticle() ) {
3841 $db =& wfGetDB(DB_SLAVE);
3942 $res = $db->query("SELECT article_tag, tag_rect, unique_id, COUNT(article_tag) AS count FROM ".
4043 $db->tableName('imagetags').
@@ -60,19 +63,17 @@
6164 font-size:100%;
6265 text-transform:none;
6366 white-space:nowrap;" id="coordinates" class="plainlinksneverexpand">
64 - ' . wfMsg('imagetag_seemoreimages', $titleText, $o->count) .
 67+ ' . wfMsg('imagetagging-imagetag-seemoreimages', $titleText, $o->count) .
6568 '</span></a>');
6669 }
6770 }
6871 return true;
6972 }
7073
71 -
7274 // TKL 2006-03-07: it doesn't work in new MediaWiki, modification required in includes/Wiki.php (class name change only)
7375 // $wgNamespaceTemplates[NS_IMAGE] = 'ImageTagPage';
7476
75 -function addTag($action, $article)
76 -{
 77+function addTag($action, $article) {
7778 if($action != 'addTag') return true;
7879
7980 global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
@@ -91,8 +92,7 @@
9293 $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
9394
9495 $img = Image::newFromName($imgName);
95 - if ($img)
96 - {
 96+ if ($img) {
9797 $imgTitle = $img->getTitle();
9898
9999 wfPurgeTitle($imgTitle);
@@ -113,13 +113,12 @@
114114
115115 $logPage = new LogPage( 'tag' );
116116 $link = basename( $img->title->getLocalURL() );
117 - $logComment = "Image [[$link|$imgName]] was tagged to article [[$tagName]] by $userText";
 117+ $logComment = wfMsg('imagetagging-log-tagged', $link, $imgName, $tagName, $userText);
118118 $logPage->addEntry( 'tag', $imgTitle, $logComment);
119119
120120 $enotif = new EmailNotification;
121121 $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
122 - }
123 - else {
 122+ } else {
124123 $wgOut->clearHTML();
125124 $wgOut->addHTML("<!-- ERROR: img named $imgName -->
126125 <script type='text/javascript'>
@@ -131,9 +130,7 @@
132131 return false;
133132 }
134133
135 -
136 -function removeTag($action, $article)
137 -{
 134+function removeTag($action, $article) {
138135 if ($action != 'removeTag') return true;
139136
140137 global $wgRequest, $wgTitle, $wgOut, $wgDBname, $wgUser;
@@ -152,8 +149,7 @@
153150 $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
154151
155152 $img = Image::newFromName($imgName);
156 - if ($img)
157 - {
 153+ if ($img) {
158154 $imgTitle = $img->getTitle();
159155
160156 wfPurgeTitle($imgTitle);
@@ -166,13 +162,12 @@
167163 $wgOut->addHTML( wfGetImageTags($img, $imgName) );
168164
169165 $logPage = new LogPage( 'tag' );
170 - $logComment = "Removed tag to article [[$tagName]] by $userText";
 166+ $logComment = wfMsg('imagetagging-logentry', $tagName, $userText);
171167 $logPage->addEntry( 'tag', $imgTitle, $logComment);
172168
173169 $enotif = new EmailNotification;
174170 $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
175 - }
176 - else {
 171+ } else {
177172 $wgOut->clearHTML();
178173 $wgOut->addHTML("<!-- ERROR: img named $imgName -->
179174 <script type='text/javascript'>
@@ -184,8 +179,7 @@
185180 return false;
186181 }
187182
188 -function tagSearch($action, $article)
189 -{
 183+function tagSearch($action, $article) {
190184 if($action != 'tagSearch') return true;
191185
192186 global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
@@ -256,8 +250,8 @@
257251 }
258252 $sk =& $wgUser->getSkin();
259253
260 - $contextlines=5;
261 - $contextchars=50;
 254+ $contextlines = 5;
 255+ $contextchars = 50;
262256
263257 $link = $sk->makeKnownLinkObj( $t );
264258 $revision = Revision::newFromTitle( $t );
@@ -301,8 +295,7 @@
302296 return "<result>\n<link>{$link}</link>\n<context>{$extract}</context>\n</result>\n";
303297 }
304298
305 -function wfPurgeTitle($title)
306 -{
 299+function wfPurgeTitle($title) {
307300 global $wgUseSquid;
308301
309302 wfProfileIn( __METHOD__ );
@@ -322,7 +315,6 @@
323316 wfProfileOut( __METHOD__ );
324317 }
325318
326 -
327319 function wfGetImageTags($img, $imgName) {
328320 global $wgDBname;
329321 global $wgUser;
@@ -357,16 +349,16 @@
358350
359351 $specialImagesTitle = Title::newFromText("Special:TaggedImages");
360352
361 - $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('images') . '</a>';
 353+ $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('imagetagging-images') . '</a>';
362354
363 - $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('removetag') . '</a>';
 355+ $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('imagetagging-removetag') . '</a>';
364356
365357 $html .= $span . $articleLink . ' (' . $imagesLink . ' | ' . $removeLink . ')</span>';
366358 }
367359 $db->freeResult($res);
368360
369361 if ( $html )
370 - $html = 'In this image: ' . $html;
 362+ $html = wfMsg('imagetagging-inthisimage', $html);
371363
372364 wfProfileOut( __METHOD__ );
373365 return $html;
@@ -387,41 +379,24 @@
388380 }
389381
390382 function wfImageTagPageSetup() {
391 - global $wgMessageCache,$wgLogTypes;
392 - $wgMessageCache->addMessage('addimagetag',"Tag this Image");
393 - $wgMessageCache->addMessage('images',"images");
394 - $wgMessageCache->addMessage('removetag', "remove tag");
395 - $wgMessageCache->addMessage('done_button', "Done Tagging");
396 - $wgMessageCache->addMessage('tag_button', "Tag");
397 - $wgMessageCache->addMessage('tagcancel_button', "Cancel");
398 - $wgMessageCache->addMessage('tagging_instructions', 'Click on people or things in the image to tag them. ');
399 - $wgMessageCache->addMessage('addingtag', "Adding tag...");
400 - $wgMessageCache->addMessage('removingtag', "removing tag...");
401 - $wgMessageCache->addMessage('addtagsuccess', "Added tag.");
402 - $wgMessageCache->addMessage('removetagsuccess', "Removed tag.");
403 - $wgMessageCache->addMessage('oneactionatatimemessage', "Removed tag.");
404 - $wgMessageCache->addMessage('canteditneedloginmessage', "You can't edit this page. It may be because you need to login to tag images. Do you want to login now?");
405 - $wgMessageCache->addMessage('oneactionatatimemessage', "Sorry, only one tagging action at a time. Please wait for the existing action to complete.");
406 - $wgMessageCache->addMessage('oneuniquetagmessage', "Sorry, this image already has a tag with this name.");
407 - $wgMessageCache->addMessage('imagetag_seemoreimages', 'See more images of &#8220;$1&#8221; ($2)');
408 -
409 - $wgLogTypes[] = 'tag';
 383+ global $wgLogTypes;
410384
411 -class ImageTagPage extends ImagePage
412 -{
 385+ $wgLogTypes[] = 'tag';
 386+ wfLoadExtensionMessages('ImageTagging');
 387+
 388+class ImageTagPage extends ImagePage {
413389 function openShowImage() {
414 - global $wgOut, $wgUser, $wgServer, $wgImageTaggingPath, $wgStyleVersion, $wgJsMimeType, $wgScriptPath;
 390+ global $wgOut, $wgUser, $wgServer, $wgStyleVersion, $wgJsMimeType, $wgScriptPath;
415391
416392 wfProfileIn( __METHOD__ );
417393
418 -
419 - global $wgJsMimeType, $wgScriptPath ;
 394+ global $wgJsMimeType, $wgScriptPath;
420395 $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/img_tagging.js?$wgStyleVersion\"></script>\n" );
421396 $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/json.js?$wgStyleVersion\"></script>\n" );
422397
423398 $imgName = $this->getTitle()->getText();
424399 $wgOut->addHTML("<input type='hidden' value='$imgName' id='imgName' />");
425 - $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/magTagging' id='imgPath' />");
 400+ $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/ImageTagging' id='imgPath' />");
426401
427402 if ( $wgUser->isLoggedIn() )
428403 $wgOut->addHTML("<input type='hidden' value='1' id='userLoggedIn'/>");
@@ -584,7 +559,7 @@
585560
586561
587562
588 - /**
 563+/**
589564 * Create the TOC
590565 *
591566 * @access private
@@ -597,17 +572,17 @@
598573
599574 $r = '<ul id="filetoc">
600575 <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
601 -<li><a href="#filehistory">' . wfMsgHtml( 'imghistory' ) . '</a></li>
 576+<li><a href="#filehistory">' . wfMsgHtml( 'imagetagging-imghistory' ) . '</a></li>
602577 <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
603578 ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
604 -<li><a href="javascript:addImageTags()">' . wfMsgHtml( 'addimagetag' ) . '</a><sup><font color=red>New!</font></sup></li>'
 579+<li><a href="javascript:addImageTags()">' . wfMsgHtml( 'imagetagging-addimagetag' ) . '</a>'. wfMsg('imagetagging-new') .'</li>'
605580 . '</ul>';
606581
607 - $r .= '<div id="tagStatusDiv" style="margin: 5px 5px 10px 5px; padding: 10px; border: solid 1px #ffe222; background: #fffbe2; display: none;"><table style="background-color: #fffbe2;"><tr><td width="450" height="30" align="center" style="padding-left: 20px;"><img src="/skins/common/progress-wheel.gif" id="progress_wheel" style="display:none;"><div id="tagging_message" style="background: #fffbe2;">' . wfMsgHtml('tagging_instructions') . '</td><td valign="middle"><input type="button" onclick="doneAddingTags();" id="done_tagging" name="done_tagging" value="' . wfMsgHtml('done_button') . '" /></div></td></tr></table></div>';
 582+ $r .= '<div id="tagStatusDiv" style="margin: 5px 5px 10px 5px; padding: 10px; border: solid 1px #ffe222; background: #fffbe2; display: none;"><table style="background-color: #fffbe2;"><tr><td width="450" height="30" align="center" style="padding-left: 20px;"><img src="/skins/common/progress-wheel.gif" id="progress_wheel" style="display:none;"><div id="tagging_message" style="background: #fffbe2;">' . wfMsgHtml('imagetagging-tagging-instructions') . '</td><td valign="middle"><input type="button" onclick="doneAddingTags();" id="done_tagging" name="done_tagging" value="' . wfMsgHtml('imagetagging-done-button') . '" /></div></td></tr></table></div>';
608583
609584 $r .= "<div style='position: absolute; font: verdana, sans-serif; top: 10px; left: 10px; display: none; width:284px; height:24px; padding: 4px 6px; background-color: #eeeeee; color: #444444; border: 2px solid #555555; z-index:2;' id='tagEditField'>
610585
611 -<span style='position: absolute; left: 4px; top: 6px;'>Article:</span>
 586+<span style='position: absolute; left: 4px; top: 6px;'>". wfMsg('imagetagging-article') ."</span>
612587
613588 <!-- TAH: don't use the popup just yet
614589 <select name='tagType'>
@@ -616,10 +591,10 @@
617592 </select>
618593 -->";
619594
620 - $r .= "<input style='position: absolute; left: 189px; top: 6px; width: 39px; height: 20px;' type='submit' name='Tag' value='" . wfMsgHtml('tag_button') . "' onclick='submitTag()'/>";
621 - $r .= "<input style='position: absolute; left: 232px; top: 6px; width: 60px; height: 20px;' type='button' name='Cancel' value='" . wfMsgHtml('tagcancel_button') . "' onclick='hideTagBox()'/>";
 595+ $r .= "<input style='position: absolute; left: 189px; top: 6px; width: 39px; height: 20px;' type='submit' name='". wfMsgHtml('imagetagging-tag-button') ."' value='" . wfMsgHtml('imagetagging-tag-button') . "' onclick='submitTag()'/>";
 596+ $r .= "<input style='position: absolute; left: 232px; top: 6px; width: 60px; height: 20px;' type='button' name='" . wfMsgHtml('imagetagging-tagcancel-button') . "' value='" . wfMsgHtml('imagetagging-tagcancel-button') . "' onclick='hideTagBox()'/>";
622597
623 - $r .= "<input type='text' style='position: absolute; left: 46px; top: 6px; background-color:white; width: 140px; height:18px;' name='articleTag' id='articleTag' value='' title='Article to tag' onkeyup='typeTag(event);' />";
 598+ $r .= "<input type='text' style='position: absolute; left: 46px; top: 6px; background-color:white; width: 140px; height:18px;' name='articleTag' id='articleTag' value='' title='". wfMsgHtml('imagetagging-articletotag') ."' onkeyup='typeTag(event);' />";
624599
625600 $r .= '</div>';
626601
@@ -630,19 +605,18 @@
631606 // TAH: adding this to grab edit tokens from javascript
632607 $token = $wgUser->editToken();
633608 $r .= "<input type=\"hidden\" value=\"$token\" name=\"wpEditToken\" id=\"wpEditToken\" />\n";
634 - $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('addingtag') . "\">\n";
635 - $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('removingtag') . "\">\n";
636 - $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('addtagsuccess') . "\">\n";
637 - $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('removetagsuccess') . "\">\n";
 609+ $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('imagetagging-addingtag') . "\">\n";
 610+ $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('imagetagging-removingtag') . "\">\n";
 611+ $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('imagetagging-addtagsuccess') . "\">\n";
 612+ $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('imagetagging-removetagsuccess') . "\">\n";
638613
639 - $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('oneactionatatimemessage') . "\">\n";
640 - $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('canteditneedloginmessage') . "\">\n";
641 - $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('canteditothermessage') . "\">\n";
642 - $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('oneuniquetagmessage') . "\">\n";
 614+ $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('imagetagging-oneactionatatimemessage') . "\">\n";
 615+ $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('imagetagging-canteditneedloginmessage') . "\">\n";
 616+ $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('imagetagging-canteditothermessage') . "\">\n";
 617+ $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('imagetagging-oneuniquetagmessage') . "\">\n";
643618
644619 return $r;
645620 }
646621 }
647622
648623 }
649 -?>
Index: trunk/extensions/ImageTagging/ImageTagging.i18n.php
@@ -0,0 +1,37 @@
 2+<?php
 3+
 4+$messages = array();
 5+
 6+/** English
 7+ * @author Tomasz Klim
 8+ * @author Tristan Harris
 9+ */
 10+$messages['en'] = array(
 11+ 'imagetagging-addimagetag' => 'Tag this Image',
 12+ 'imagetagging-article' => 'Article:',
 13+ 'imagetagging-articletotag' => 'Article to tag',
 14+ 'imagetagging-imghistory' => 'History',
 15+ 'imagetagging-images' => 'images',
 16+ 'imagetagging-inthisimage' => 'In this image: $1',
 17+ 'imagetagging-logentry' => 'Removed tag to article [[$1]] by $2',
 18+ 'imagetagging-log-tagged' => 'Image [[$1|$2]] was tagged to article [[$3]] by $4',
 19+ 'imagetagging-new' => '<sup><span style="color:red">New!</span></sup>',
 20+ 'imagetagging-removetag' => 'remove tag',
 21+ 'imagetagging-done-button' => 'Done Tagging',
 22+ 'imagetagging-tag-button' => 'Tag',
 23+ 'imagetagging-tagcancel-button' => 'Cancel',
 24+ 'imagetagging-tagging-instructions' => 'Click on people or things in the image to tag them.',
 25+ 'imagetagging-addingtag' => 'Adding tag...',
 26+ 'imagetagging-removingtag' => 'removing tag...',
 27+ 'imagetagging-addtagsuccess' => 'Added tag.',
 28+ 'imagetagging-removetagsuccess' => 'Removed tag.',
 29+ 'imagetagging-oneactionatatimemessage' => 'Removed tag.',
 30+ 'imagetagging-canteditneedloginmessage' => 'You can\'t edit this page. It may be because you need to login to tag images. Do you want to login now?',
 31+ 'imagetagging-oneactionatatimemessage' => 'Sorry, only one tagging action at a time. Please wait for the existing action to complete.',
 32+ 'imagetagging-oneuniquetagmessage' => 'Sorry, this image already has a tag with this name.',
 33+ 'imagetagging-imagetag-seemoreimages' => 'See more images of &#8220;$1&#8221; ($2)',
 34+ 'imagetagging-taggedimages-title' => 'Images of \'$1\'',
 35+ 'imagetagging-taggedimages-displaying' => 'Displaying $1 - $2 of $3 images of &#8220;$4&#8221;',
 36+ 'imagetagging-taggedimages-total' => '&#8220;$1&#8221; image(s) total',
 37+ 'imagetagging-taggedimages' => 'Tagged Images',
 38+);
Property changes on: trunk/extensions/ImageTagging/ImageTagging.i18n.php
___________________________________________________________________
Added: svn:eol-style
139 + native
Index: trunk/extensions/ImageTagging/SpecialTaggedImages.php
@@ -7,38 +7,22 @@
88
99 define('TAGGEDIMGS_PER_PAGE', 12);
1010
 11+$wgSpecialPages['TaggedImages'] = 'TaggedImages';
1112
12 -$wgExtensionFunctions[] = 'wfSpecialTaggedImages';
13 -
14 -function wfSpecialTaggedImages() {
15 - global $wgMessageCache;
16 -
17 - $wgMessageCache->addMessage('taggedimages_title', 'Images of \'$1\'');
18 - $wgMessageCache->addMessage('taggedimages_total', '&#8220;$1&#8221; image(s) total');
19 - $wgMessageCache->addMessage('taggedimages_displaying', 'Displaying $1 - $2 of $3 images of &#8220;$4&#8221;');
20 - $wgMessageCache->addMessage('taggedimages', 'Tagged Images');
21 -
22 - SpecialPage::addPage( new TaggedImages );
23 -}
24 -
2513 /**
2614 * Photos tagged gallery
2715 *
2816 * Add images to the gallery using add(), then render that list to HTML using toHTML().
29 - *
30 - * @package MediaWiki
3117 */
32 -class TaggedImages extends SpecialPage
33 -{
 18+class TaggedImages extends SpecialPage {
 19+
3420 var $mQuery, $mImages;
3521
36 - /**
 22+ /**
3723 * Create a new tagged images object.
3824 */
39 - function TaggedImages() {
40 - global $wgLang, $wgAllowRealName;
41 - global $wgRequest;
42 - global $wgOut;
 25+ function TaggedImages() {
 26+ global $wgLang, $wgAllowRealName, $wgRequest, $wgOut;
4327
4428 $wgOut->addScript("<style type=\"text/css\">/*<![CDATA[*/ @import \"$GLOBALS[wgScriptPath]/extensions/ImageTagging/img_tagging.css?$GLOBALS[wgStyleVersion]\"; /*]]>*/</style>\n");
4529
@@ -49,16 +33,15 @@
5034 $this->mStartPage = 0;
5135 $this->mImages = array();
5236
53 - SpecialPage::SpecialPage("TaggedImages");
 37+ SpecialPage::SpecialPage('TaggedImages');
5438 }
5539
56 - /**
 40+ /**
5741 * Start doing stuff
5842 * @access public
5943 */
60 - function execute() {
61 - global $wgDBname;
62 - global $wgOut;
 44+ function execute() {
 45+ global $wgDBname, $wgOut;
6346
6447 wfProfileIn( __METHOD__ );
6548
@@ -72,12 +55,7 @@
7356 $imagetable = $db->tableName( 'image' );
7457 $imagetagstable = $db->tableName( 'imagetags' );
7558
76 - $SQL = "
77 -SELECT img_name, img_timestamp
78 -FROM $imagetable
79 -WHERE img_name IN
80 - (SELECT img_name FROM $imagetagstable $WHERECLAUSE)
81 -ORDER BY img_timestamp DESC";
 59+ $SQL = "SELECT img_name, img_timestamp FROM $imagetable WHERE img_name IN (SELECT img_name FROM $imagetagstable $WHERECLAUSE) ORDER BY img_timestamp DESC";
8260
8361 $SQL = $db->LimitResult($SQL, TAGGEDIMGS_PER_PAGE, $this->mStartPage * TAGGEDIMGS_PER_PAGE);
8462
@@ -96,14 +74,14 @@
9775 }
9876 $db->freeResult($res);
9977
100 - $wgOut->setPageTitle( wfMsg('taggedimages_title', $this->mQuery ? $this->mQuery : "all" ) );
 78+ $wgOut->setPageTitle( wfMsg('imagetagging-taggedimages-title', $this->mQuery ? $this->mQuery : "all" ) );
10179 $wgOut->setRobotpolicy('noindex,nofollow');
10280 $wgOut->addHTML($this->toHTML());
10381
10482 wfProfileOut( __METHOD__ );
10583 }
10684
107 - /**
 85+ /**
10886 * Add an image to the gallery.
10987 *
11088 * @param Image $image Image object that is added to the gallery
@@ -113,7 +91,7 @@
11492 $this->mImages[] = array( &$image, $html );
11593 }
11694
117 - /**
 95+ /**
11896 * Add an image at the beginning of the gallery.
11997 *
12098 * @param Image $image Image object that is added to the gallery
@@ -124,7 +102,7 @@
125103 }
126104
127105
128 - /**
 106+ /**
129107 * isEmpty() returns true if the gallery contains no images
130108 */
131109 function isEmpty() {
@@ -140,7 +118,7 @@
141119
142120 $queryTitle = Title::newFromText($this->mQuery, NS_MAIN);
143121
144 - $html = wfMsg('taggedimages_displaying', $this->mStartPage*TAGGEDIMGS_PER_PAGE + 1, min(($this->mStartPage+1)*TAGGEDIMGS_PER_PAGE,$this->mCount), $this->mCount, '<a href="' . $queryTitle->getLocalURL() . '">' . $this->mQuery . '</a>');
 122+ $html = wfMsg('imagetagging-taggedimages-displaying', $this->mStartPage*TAGGEDIMGS_PER_PAGE + 1, min(($this->mStartPage+1)*TAGGEDIMGS_PER_PAGE,$this->mCount), $this->mCount, '<a href="' . $queryTitle->getLocalURL() . '">' . $this->mQuery . '</a>');
145123
146124 wfProfileOut( __METHOD__ );
147125 return $html;
@@ -193,7 +171,7 @@
194172 return $html;
195173 }
196174
197 - /**
 175+ /**
198176 * Return a HTML representation of the image gallery
199177 *
200178 * For each image in the gallery, display
@@ -263,6 +241,3 @@
264242 }
265243
266244 } //class
267 -
268 -
269 -?>

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r34643Only for 'flaggedrevs' tableaaron05:31, 12 May 2008

Status & tagging log