r73896 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73895‎ | r73896 | r73897 >
Date:15:21, 28 September 2010
Author:jimbojw
Status:deferred
Tags:
Comment:
Import of ArticleComments v0.2.1 by Jim R. Wilson from http://jimbojw.com/wiki/index.php?title=ArticleComments&oldid=1600
Modified paths:
  • /trunk/extensions/ArticleComments/ArticleComments.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleComments/ArticleComments.php
@@ -93,9 +93,9 @@
9494 * @param Title $title The title of the article on which the form will appear.
9595 * @param Array $params A hash of parameters containing rendering options.
9696 */
97 -function displayArticleCommentForm( $nsList = null, $title = null, $params = array() ) {
 97+function displayArticleCommentForm( $title = null, $params = array() ) {
9898
99 - global $wgRequest;
 99+ global $wgRequest, $wgArticleCommentsNSDisplayList;
100100
101101 # Short circuit for anything other than action=view or action=purge
102102 if ($wgRequest->getVal('action') &&
@@ -103,20 +103,17 @@
104104 $wgRequest->getVal('action')!='purge'
105105 ) return;
106106
 107+ # Short-circuit if displayl ist is undefined or null
 108+ if ($wgArticleCommentsNSDisplayList==null) return;
 109+
107110 # Use wgTitle if title is not specified
108111 if ($title==null) {
109112 global $wgTitle;
110113 $title = $wgTitle;
111114 }
112115
113 - # Use wgArticleCommentsNSDisplayList if nsList is not specified
114 - if ($nsList==null) {
115 - global $wgArticleCommentsNSDisplayList;
116 - $nsList = $wgArticleCommentsNSDisplayList;
117 - $nsList = ($nsList==null?array(NS_MAIN):$nsList);
118 - }
119 -
120116 # Ensure that the namespace list is an actual list
 117+ $nsList = $wgArticleCommentsNSDisplayList;
121118 if (!is_array($nsList)) $nsList = array($nsList);
122119
123120 # Display the form
@@ -355,11 +352,12 @@
356353 }
357354
358355
359 - # Check if talk NS is in the Namespace whitelist
360 - global $wgArticleCommentsNSWhitelist;
 356+ # Check if talk NS is in the Namespace display list
 357+ # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page.
 358+ global $wgArticleCommentsNSDisplayList;
361359 $skipCheck = (
362 - is_array($wgArticleCommentsNSWhitelist) ?
363 - in_array($talkTitle->getNamespace(),$wgArticleCommentsNSWhitelist):
 360+ is_array($wgArticleCommentsNSDisplayList) ?
 361+ in_array($talkTitle->getNamespace(),$wgArticleCommentsNSDisplayList):
364362 false
365363 );
366364

Status & tagging log