r74153 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74152‎ | r74153 | r74154 >
Date:21:17, 2 October 2010
Author:platonides
Status:ok
Tags:
Comment:
Stylize
Modified paths:
  • /trunk/extensions/ArticleComments/ArticleComments.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleComments/ArticleComments.php
@@ -5,7 +5,7 @@
66 * @author Platonides
77 * @version 0.5
88 * @copyright Copyright (C) 2007 Jim R. Wilson
9 - * @license The MIT License - http://www.opensource.org/licenses/mit-license.php
 9+ * @license The MIT License - http://www.opensource.org/licenses/mit-license.php
1010 * -----------------------------------------------------------------------
1111 * Description:
1212 * This is a MediaWiki (http://www.mediawiki.org/) extension which adds support
@@ -49,38 +49,38 @@
5050 * Initial release.
5151 * -----------------------------------------------------------------------
5252 * Copyright (c) 2007 Jim R. Wilson
53 - *
54 - * Permission is hereby granted, free of charge, to any person obtaining a copy
55 - * of this software and associated documentation files (the "Software"), to deal
56 - * in the Software without restriction, including without limitation the rights to
57 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
58 - * the Software, and to permit persons to whom the Software is furnished to do
 53+ *
 54+ * Permission is hereby granted, free of charge, to any person obtaining a copy
 55+ * of this software and associated documentation files (the "Software"), to deal
 56+ * in the Software without restriction, including without limitation the rights to
 57+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 58+ * the Software, and to permit persons to whom the Software is furnished to do
5959 * so, subject to the following conditions:
60 - *
61 - * The above copyright notice and this permission notice shall be included in all
 60+ *
 61+ * The above copyright notice and this permission notice shall be included in all
6262 * copies or substantial portions of the Software.
63 - *
64 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65 - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
66 - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
67 - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
68 - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
69 - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
70 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
71 - * OTHER DEALINGS IN THE SOFTWARE.
 63+ *
 64+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 65+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 66+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 67+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 68+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 69+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 70+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 71+ * OTHER DEALINGS IN THE SOFTWARE.
7272 * -----------------------------------------------------------------------
7373 */
74 -
 74+
7575 # Confirm MW environment
76 -if (!defined('MEDIAWIKI')) die();
 76+if ( !defined( 'MEDIAWIKI' ) ) die();
7777
7878 # Credits
7979 $wgExtensionCredits['other'][] = array(
80 - 'name'=>'ArticleComments',
81 - 'author'=>'Jim R. Wilson - wilson.jim.r <at> gmail.com',
82 - 'url'=>'http://jimbojw.com/wiki/index.php?title=ArticleComments',
83 - 'description'=>'Enables comment sections on article pages.',
84 - 'version'=>'0.5'
 80+ 'name' => 'ArticleComments',
 81+ 'author' => 'Jim R. Wilson - wilson.jim.r <at> gmail.com',
 82+ 'url' => 'http://jimbojw.com/wiki/index.php?title=ArticleComments',
 83+ 'description' => 'Enables comment sections on article pages.',
 84+ 'version' => '0.5'
8585 );
8686
8787 # Add Extension Functions
@@ -128,7 +128,7 @@
129129
130130 # Hide content from the Parser using base64 to avoid mangling.
131131 # Note: Content will be decoded after Tidy has finished its processing of the page.
132 - return '<pre>@ENCODED@'.base64_encode($commentForm).'@ENCODED@</pre>';
 132+ return '<pre>@ENCODED@' . base64_encode( $commentForm ) . '@ENCODED@</pre>';
133133 }
134134
135135 /**
@@ -139,15 +139,15 @@
140140 function wfArticleCommentsAfterContent( $data, $skin ) {
141141
142142 global $wgRequest, $wgArticleCommentsNSDisplayList;
143 -
 143+
144144 # Short circuit for anything other than action=view or action=purge
145 - if ($wgRequest->getVal('action') &&
146 - $wgRequest->getVal('action')!='view' &&
147 - $wgRequest->getVal('action')!='purge'
 145+ if ( $wgRequest->getVal( 'action' ) &&
 146+ $wgRequest->getVal( 'action' ) != 'view' &&
 147+ $wgRequest->getVal( 'action' ) != 'purge'
148148 ) return true;
149 -
 149+
150150 # Short-circuit if displaylist is undefined, empty or null
151 - if ($wgArticleCommentsNSDisplayList == null)
 151+ if ( $wgArticleCommentsNSDisplayList == null )
152152 return true;
153153
154154 $title = $skin->getTitle();
@@ -157,13 +157,13 @@
158158
159159 # Ensure that the namespace list is an actual list
160160 $nsList = $wgArticleCommentsNSDisplayList;
161 - if (!is_array($nsList)) $nsList = array($nsList);
162 -
 161+ if ( !is_array( $nsList ) ) $nsList = array( $nsList );
 162+
163163 # Display the form
164 - if (in_array($title->getNamespace(), $nsList)) {
 164+ if ( in_array( $title->getNamespace(), $nsList ) ) {
165165 $data .= wfArticleCommentForm( $title );
166166 }
167 -
 167+
168168 return true;
169169 }
170170
@@ -175,10 +175,10 @@
176176 function wfArticleCommentForm( $title, $params = array() ) {
177177 global $wgArticleCommentDefaults;
178178
179 - # Merge in global defaults if specified
 179+ # Merge in global defaults if specified
180180 $tmp = $wgArticleCommentDefaults;
181181 foreach ( $params as $k => $v ) {
182 - $tmp[strtolower($k)] = (bool)strcasecmp( $v, "false" );
 182+ $tmp[strtolower( $k )] = (bool)strcasecmp( $v, "false" );
183183 }
184184 $params = $tmp;
185185 $ac = 'article-comments-';
@@ -190,21 +190,21 @@
191191 $content .= '<p>';
192192 $content .= Html::hidden( 'commentArticle', $title->getPrefixedDBkey() );
193193
194 - $content .= '<label for="commenterName">' . wfMsgExt($ac.'name-field', array( 'parseinline', 'content' ) ) . Html::element('br') . '</label>';
195 - $content .= Html::input( 'commenterName', '', 'text', array( 'id'=>'commenterName' ) );
 194+ $content .= '<label for="commenterName">' . wfMsgExt( $ac . 'name-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 195+ $content .= Html::input( 'commenterName', '', 'text', array( 'id' => 'commenterName' ) );
196196 $content .= '</p>';
197197
198198 if ( $params['showurlfield'] ) {
199 - $content .= '<p><label for="commenterURL">' . wfMsgExt($ac.'url-field', array( 'parseinline', 'content' ) ) . Html::element('br') . '</label>';
200 - $content .= Html::input( 'commenterURL', 'http://', 'text', array( 'id'=>'commenterURL' ) );
 199+ $content .= '<p><label for="commenterURL">' . wfMsgExt( $ac . 'url-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 200+ $content .= Html::input( 'commenterURL', 'http://', 'text', array( 'id' => 'commenterURL' ) );
201201 $content .= '</p>';
202202 }
203 -
204 - $content .= '<p><label for="comment">'.wfMsgExt($ac.'comment-field', array( 'parseinline', 'content' ) ) . Html::element('br') . '</label>';
205 -
 203+
 204+ $content .= '<p><label for="comment">' . wfMsgExt( $ac . 'comment-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 205+
206206 $content .= '<textarea id="comment" name="comment" style="width:30em" rows="5">' . '</textarea></p>';
207207
208 - $content .= '<p>' . Html::input( 'comment-submit', wfMsgForContent( $ac.'submit-button' ), 'submit' ) . '</p>';
 208+ $content .= '<p>' . Html::input( 'comment-submit', wfMsgForContent( $ac . 'submit-button' ), 'submit' ) . '</p>';
209209 $content .= '</form></div>';
210210
211211 # Short-circuit if noScript has been set to anything other than false
@@ -216,51 +216,51 @@
217217 $content .= "<script type='text/javascript'>//<![CDATA[\n(function(){\n";
218218
219219 # Prefill the name field if the user is logged in.
220 - $content .=
221 - 'var prefillUserName = function(){'."\n".
222 - 'var ptu=document.getElementById("pt-userpage");'."\n".
223 - 'if (ptu) document.getElementById("commenterName").value='.
224 - 'ptu.getElementsByTagName("a")[0].innerHTML;};'."\n".
225 - 'if (window.addEventListener) window.addEventListener'.
226 - '("load",prefillUserName,false);'."\n".
227 - 'else if (window.attachEvent) window.attachEvent'.
228 - '("onload",prefillUserName);'."\n";
 220+ $content .=
 221+ 'var prefillUserName = function(){' . "\n" .
 222+ 'var ptu=document.getElementById("pt-userpage");' . "\n" .
 223+ 'if (ptu) document.getElementById("commenterName").value=' .
 224+ 'ptu.getElementsByTagName("a")[0].innerHTML;};' . "\n" .
 225+ 'if (window.addEventListener) window.addEventListener' .
 226+ '("load",prefillUserName,false);' . "\n" .
 227+ 'else if (window.attachEvent) window.attachEvent' .
 228+ '("onload",prefillUserName);' . "\n";
229229
230230 # Prefill comment text if it has been specified by a system message
231231 # Note: This is done dynamically with JavaScript since it would be annoying
232232 # for JS-disabled browsers to have the prefilled text (since they'd have
233233 # to manually delete it) and would break parser output caching
234 - $pretext = wfMsgForContent($ac.'prefilled-comment-text');
235 - if ($pretext) {
 234+ $pretext = wfMsgForContent( $ac . 'prefilled-comment-text' );
 235+ if ( $pretext ) {
236236 $content .=
237 - 'var comment = document.getElementById("comment");'."\n".
238 - 'comment._everFocused=false;'."\n".
239 - 'comment.innerHTML="'.htmlspecialchars($pretext).'";'."\n".
240 - 'var clearCommentOnFirstFocus = function() {'."\n".
241 - 'var c=document.getElementById("comment");'."\n".
242 - 'if (!c._everFocused) {'."\n".
243 - 'c._everFocused=true;'."\n".
244 - 'c.value="";}}'."\n".
245 - 'if (comment.addEventListener) comment.addEventListener'.
246 - '("focus",clearCommentOnFirstFocus,false);'."\n".
247 - 'else if (comment.attachEvent) comment.attachEvent'.
248 - '("onfocus",clearCommentOnFirstFocus);'."\n";
 237+ 'var comment = document.getElementById("comment");' . "\n" .
 238+ 'comment._everFocused=false;' . "\n" .
 239+ 'comment.innerHTML="' . htmlspecialchars( $pretext ) . '";' . "\n" .
 240+ 'var clearCommentOnFirstFocus = function() {' . "\n" .
 241+ 'var c=document.getElementById("comment");' . "\n" .
 242+ 'if (!c._everFocused) {' . "\n" .
 243+ 'c._everFocused=true;' . "\n" .
 244+ 'c.value="";}}' . "\n" .
 245+ 'if (comment.addEventListener) comment.addEventListener' .
 246+ '("focus",clearCommentOnFirstFocus,false);' . "\n" .
 247+ 'else if (comment.attachEvent) comment.attachEvent' .
 248+ '("onfocus",clearCommentOnFirstFocus);' . "\n";
249249 }
250250
251251 # Hides the commentForm until the "Make a comment" link is clicked
252252 # Note: To disable, set $wgArticleCommentDefaults['hideForm']=false in LocalSettings.php
253 - if (!isset($params['hideform']) ||
254 - ($params['hideform']!='false' &&
255 - !$params['hideform']===false)) {
256 - $content .=
257 - 'var cf=document.getElementById("commentForm");'."\n".
258 - 'cf.style.display="none";'."\n".
259 - 'var p=document.createElement("p");'."\n".
260 - 'p.innerHTML="<a href=\'javascript:void(0)\' onclick=\''.
261 - 'document.getElementById(\\"commentForm\\").style.display=\\"block\\";'.
262 - 'this.style.display=\\"none\\";false'.
263 - '\'>'.wfMsgForContent($ac.'leave-comment-link').'</a>";'."\n".
264 - 'cf.parentNode.insertBefore(p,cf);'."\n";
 253+ if ( !isset( $params['hideform'] ) ||
 254+ ( $params['hideform'] != 'false' &&
 255+ !$params['hideform'] === false ) ) {
 256+ $content .=
 257+ 'var cf=document.getElementById("commentForm");' . "\n" .
 258+ 'cf.style.display="none";' . "\n" .
 259+ 'var p=document.createElement("p");' . "\n" .
 260+ 'p.innerHTML="<a href=\'javascript:void(0)\' onclick=\'' .
 261+ 'document.getElementById(\\"commentForm\\").style.display=\\"block\\";' .
 262+ 'this.style.display=\\"none\\";false' .
 263+ '\'>' . wfMsgForContent( $ac . 'leave-comment-link' ) . '</a>";' . "\n" .
 264+ 'cf.parentNode.insertBefore(p,cf);' . "\n";
265265 }
266266
267267 $content .= "})();\n//]]></script>";
@@ -274,7 +274,7 @@
275275 * @param String $text Article/Output text (passed by reference)
276276 * @return Boolean Always tru to give other hooking methods a chance to run.
277277 */
278 -function wfProcessEncodedContent($out, $text) {
 278+function wfProcessEncodedContent( $out, $text ) {
279279 $text = preg_replace(
280280 '/<pre>\n@ENCODED@([0-9a-zA-Z\\+\\/]+=*)@ENCODED@\n<\\/pre>/e',
281281 'base64_decode("$1")',
@@ -295,7 +295,7 @@
296296 $commenterName = $wgRequest->getVal( 'commenterName' );
297297 $commenterURL = trim( $wgRequest->getVal( 'commenterURL' ) );
298298 $comment = $wgRequest->getVal( 'comment' );
299 -
 299+
300300 // The default value is the same as not providing a URL
301301 if ( $commenterURL == 'http://' ) {
302302 $commenterURL = '';
@@ -308,30 +308,30 @@
309309 $messages = array();
310310
311311 if ( !$wgRequest->wasPosted() )
312 - $messages[] = wfMsgForContent( $ac.'not-posted' );
 312+ $messages[] = wfMsgForContent( $ac . 'not-posted' );
313313
314 - if ( $titleText === '' || !$title) {
 314+ if ( $titleText === '' || !$title ) {
315315 $messages[] = wfMsgForContent(
316 - $ac.'invalid-field', wfMsgForContent($ac.'title-string'), $titleText );
 316+ $ac . 'invalid-field', wfMsgForContent( $ac . 'title-string' ), $titleText );
317317 }
318 -
319 - if (!$commenterName) $messages[] = wfMsgForContent(
320 - $ac.'required-field', wfMsgForContent($ac.'name-string'));
321318
 319+ if ( !$commenterName ) $messages[] = wfMsgForContent(
 320+ $ac . 'required-field', wfMsgForContent( $ac . 'name-string' ) );
 321+
322322 if ( !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) )
323323 $messages[] = wfMsgForContent(
324 - $ac.'invalid-field', wfMsgForContent($ac.'url-string'), $commenterURL );
 324+ $ac . 'invalid-field', wfMsgForContent( $ac . 'url-string' ), $commenterURL );
325325
326 - if (!$comment) $messages[] = wfMsgForContent(
327 - $ac.'required-field', wfMsgForContent($ac.'comment-string'));
328 - if (!empty($messages)) {
329 - $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed'));
 326+ if ( !$comment ) $messages[] = wfMsgForContent(
 327+ $ac . 'required-field', wfMsgForContent( $ac . 'comment-string' ) );
 328+ if ( !empty( $messages ) ) {
 329+ $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
330330 $wikiText = "<div class='errorbox'>";
331 - $wikiText .= wfMsgForContent($ac.'failure-reasons')."\n\n";
332 - foreach ($messages as $message) {
 331+ $wikiText .= wfMsgForContent( $ac . 'failure-reasons' ) . "\n\n";
 332+ foreach ( $messages as $message ) {
333333 $wikiText .= "* $message\n";
334334 }
335 - $wgOut->addWikiText($wikiText . "</div>");
 335+ $wgOut->addWikiText( $wikiText . "</div>" );
336336 return;
337337 }
338338
@@ -342,12 +342,12 @@
343343 $talkArticle = new Article( $talkTitle );
344344
345345 # Check whether user is blocked from editing the talk page
346 - if ($wgUser->isBlockedFrom($talkTitle)) {
347 - $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed'));
 346+ if ( $wgUser->isBlockedFrom( $talkTitle ) ) {
 347+ $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
348348 $wikiText = "<div class='errorbox'>";
349 - $wikiText .= wfMsgForContent($ac.'failure-reasons')."\n\n";
350 - $wikiText .= '* '.wfMsgForContent($ac.'user-is-blocked', $talkTitle->getPrefixedText())."\n";
351 - $wgOut->addWikiText($wikiText . "</div>");
 349+ $wikiText .= wfMsgForContent( $ac . 'failure-reasons' ) . "\n\n";
 350+ $wikiText .= '* ' . wfMsgForContent( $ac . 'user-is-blocked', $talkTitle->getPrefixedText() ) . "\n";
 351+ $wgOut->addWikiText( $wikiText . "</div>" );
352352 return;
353353 }
354354
@@ -362,26 +362,26 @@
363363 if ( $talkTitle->exists() ) {
364364 $talkContent = $talkArticle->getContent();
365365 }
366 -
367 -
 366+
 367+
368368 # Check if talk NS is in the Namespace display list
369369 # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page.
370370 global $wgArticleCommentsNSDisplayList;
371371 $skipCheck = (
372 - is_array($wgArticleCommentsNSDisplayList) ?
373 - in_array($talkTitle->getNamespace(),$wgArticleCommentsNSDisplayList):
 372+ is_array( $wgArticleCommentsNSDisplayList ) ?
 373+ in_array( $talkTitle->getNamespace(), $wgArticleCommentsNSDisplayList ):
374374 false
375375 );
376376
377377 # Check whether the article or its talk page contains a <comments /> flag
378 - if (!$skipCheck &&
379 - preg_match('/<comments( +[^>]*)?\\/>/', $articleContent)===0 &&
380 - preg_match('/<comments( +[^>]*)?\\/>/', $talkContent)===0
 378+ if ( !$skipCheck &&
 379+ preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 &&
 380+ preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0
381381 ) {
382 - $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed'));
 382+ $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
383383 $wgOut->addWikiText(
384 - "<div class='errorbox'>".
385 - wfMsgForContent($ac.'no-comments', $title->getPrefixedText()).
 384+ "<div class='errorbox'>" .
 385+ wfMsgForContent( $ac . 'no-comments', $title->getPrefixedText() ) .
386386 "</div>"
387387 );
388388 return;
@@ -392,55 +392,55 @@
393393 wfRunHooks( 'ArticleCommentsSpamCheck', array( $comment , $commenterName, $commenterURL, &$isspam ) );
394394
395395 # If it's spam - it's gone!
396 - if ($isspam) {
397 - $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed'));
 396+ if ( $isspam ) {
 397+ $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
398398 $wgOut->addWikiText(
399 - "<div class='errorbox'>".
400 - wfMsgForContent($ac.'no-spam').
 399+ "<div class='errorbox'>" .
 400+ wfMsgForContent( $ac . 'no-spam' ) .
401401 "</div>"
402402 );
403403 return;
404404 }
405 -
 405+
406406 # Initialize the talk page's content.
407407 if ( $talkContent == '' ) {
408 - $talkContent = wfMsgForContent($ac.'talk-page-starter', $title->getPrefixedText() );
 408+ $talkContent = wfMsgForContent( $ac . 'talk-page-starter', $title->getPrefixedText() );
409409 }
410 -
 410+
411411 # Determine signature components
412 - if ($commenterURL != '') $sigText = "[$commenterURL $commenterName]";
413 - else if ($wgUser->isLoggedIn()) $sigText = $wgParser->getUserSig( $wgUser );
 412+ if ( $commenterURL != '' ) $sigText = "[$commenterURL $commenterName]";
 413+ else if ( $wgUser->isLoggedIn() ) $sigText = $wgParser->getUserSig( $wgUser );
414414 else $sigText = $commenterName;
415 -
 415+
416416 # Search for insertion point, or append most recent comment.
417417 $commentText = wfMsgForContent(
418 - $ac.'new-comment',
419 - wfMsgForContent($ac.'commenter-said', $commenterName),
 418+ $ac . 'new-comment',
 419+ wfMsgForContent( $ac . 'commenter-said', $commenterName ),
420420 $comment,
421421 $sigText,
422422 '~~~~~'
423423 );
424 -
 424+
425425 $posAbove = stripos( $talkContent, '<!--COMMENTS_ABOVE-->' );
426 - if ($posAbove===false) $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' );
427 - if ($posAbove!==false) {
 426+ if ( $posAbove === false ) $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' );
 427+ if ( $posAbove !== false ) {
428428 # Insert comments above HTML marker
429429 $talkContent = substr( $talkContent, 0, $posAbove ) . $commentText . substr( $talkContent, $posAbove );
430 - } else if ($posBelow!==false) {
 430+ } else if ( $posBelow !== false ) {
431431 # Insert comments below HTML marker
432432 $talkContent = substr( $talkContent, 0, $posBelow + 21 ) . $commentText . substr( $talkContent, $posBelow + 21 );
433433 } else {
434434 # No marker found, append to bottom (default)
435435 $talkContent .= $commentText;
436436 }
437 -
 437+
438438 # Update the talkArticle with the new comment
439 - $summary = wfMsgForContent($ac.'summary', $commenterName);
440 - $talkArticle->doEdit($talkContent, $summary);
 439+ $summary = wfMsgForContent( $ac . 'summary', $commenterName );
 440+ $talkArticle->doEdit( $talkContent, $summary );
441441
442 - $wgOut->setPageTitle(wfMsgForContent($ac.'submission-succeeded'));
443 - $wgOut->addWikiText(wfMsgForContent($ac.'submission-success', $title->getPrefixedText()));
444 - $wgOut->addWikiText(wfMsgForContent($ac.'submission-view-all', $talkTitle->getPrefixedText()));
 442+ $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-succeeded' ) );
 443+ $wgOut->addWikiText( wfMsgForContent( $ac . 'submission-success', $title->getPrefixedText() ) );
 444+ $wgOut->addWikiText( wfMsgForContent( $ac . 'submission-view-all', $talkTitle->getPrefixedText() ) );
445445 }
446446
447447 /**
@@ -452,16 +452,16 @@
453453 * @param Boolean $isspam Whether the comment is spam (passed by reference)
454454 * @return Boolean Always true to indicate other hooking methods may continue to check for spam.
455455 */
456 -function defaultArticleCommentSpamCheck($comment, $commenterName, $commenterURL, $isspam) {
 456+function defaultArticleCommentSpamCheck( $comment, $commenterName, $commenterURL, $isspam ) {
457457
458458 # Short-circuit if spam has already been determined
459 - if ($isspam) return true;
460 - $fields = array($comment, $commenterName, $commenterURL);
461 -
 459+ if ( $isspam ) return true;
 460+ $fields = array( $comment, $commenterName, $commenterURL );
 461+
462462 # Run everything through $wgSpamRegex if it has been specified
463463 global $wgSpamRegex;
464 - if ($wgSpamRegex) {
465 - foreach ($fields as $field) {
 464+ if ( $wgSpamRegex ) {
 465+ foreach ( $fields as $field ) {
466466 if ( preg_match( $wgSpamRegex, $field ) ) return $isspam = true;
467467 }
468468 }
@@ -471,23 +471,23 @@
472472 '%\\[url=(https?|ftp)://%smi',
473473 '%<a\\s+[^>]*href\\s*=\\s*[\'"]?\\s*(https?|ftp)://%smi'
474474 );
475 - foreach ($spampatterns as $sp) {
476 - foreach (array($comment, $commenterName, $commenterURL) as $field) {
477 - if ( preg_match($sp, $field) ) return $isspam = true;
 475+ foreach ( $spampatterns as $sp ) {
 476+ foreach ( array( $comment, $commenterName, $commenterURL ) as $field ) {
 477+ if ( preg_match( $sp, $field ) ) return $isspam = true;
478478 }
479479 }
480 -
 480+
481481 # Check for bad input for commenterName (seems to be a popular spam location)
482482 $spampatterns = array(
483483 '%<a\\s+%smi',
484484 '%(https?|ftp)://%smi',
485485 '%(\\n|\\r)%smi'
486486 );
487 - foreach ($spampatterns as $sp) if ( preg_match($sp, $commenterName) ) return $isspam = true;
488 -
 487+ foreach ( $spampatterns as $sp ) if ( preg_match( $sp, $commenterName ) ) return $isspam = true;
 488+
489489 # Fail for length violations
490 - if ( strlen($commenterName)>255 || strlen($commenterURL)>300 ) return $isspam = true;
491 -
 490+ if ( strlen( $commenterName ) > 255 || strlen( $commenterURL ) > 300 ) return $isspam = true;
 491+
492492 # We made it this far, leave $isspam alone and give other implementors a chance.
493493 return true;
494494 }

Status & tagging log