r93066 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93065‎ | r93066 | r93067 >
Date:16:59, 25 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Stylize Extension
Modified paths:
  • /trunk/extensions/CollabWatchlist/CollabWatchlist.i18n.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/CollabWatchlist.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CollabWatchlistEditor.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CollabWatchlist/CollabWatchlist.i18n.php
@@ -1,6 +1,6 @@
22 <?php
33 $messages = array();
4 -
 4+
55 $messages['en'] = array(
66 'collabwatchlist' => 'Collaborative watchlist',
77 'specialcollabwatchlist' => 'Collaborative watchlist special page',
Index: trunk/extensions/CollabWatchlist/CollabWatchlist.php
@@ -1,6 +1,6 @@
22 <?php
33 # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
4 -if (!defined('MEDIAWIKI')) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 echo <<<EOT
66 To install the CollabWatchlist extension, put the following line in LocalSettings.php:
77 require_once( "\$IP/extensions/CollabWatchlist/CollabWatchlist.php" );
@@ -11,16 +11,15 @@
1212
1313 $wgExtensionCredits['specialpage'][] = array(
1414 'name' => 'CollabWatchlist',
15 - 'author' =>'Florian Hackenberger',
 15+ 'author' => 'Florian Hackenberger',
1616 'url' => 'http://www.mediawiki.org/wiki/User:Flohack',
1717 'description' => 'Provides collaborative watchlists based on categories',
1818 'descriptionmsg' => 'specialcollabwatchlist-desc',
1919 'version' => '0.9.0',
2020 );
2121
22 -
2322 # Autoload our classes
24 -$wgDir = dirname(__FILE__) . '/';
 23+$wgDir = dirname( __FILE__ ) . '/';
2524 $wgCollabWatchlistIncludes = $wgDir . 'includes/';
2625 $wgExtensionMessagesFiles['CollabWatchlist'] = $wgDir . 'CollabWatchlist.i18n.php';
2726 $wgExtensionAliasesFiles['CollabWatchlist'] = $wgDir . 'CollabWatchlist.alias.php';
@@ -38,13 +37,13 @@
3938
4039 function fnCollabWatchlistDbSchema() {
4140 global $wgExtNewTables;
42 - $wgSql = dirname(__FILE__) . '/sql/';
43 - $wgExtNewTables[] = array('collabwatchlist', $wgSql . 'collabwatchlist.sql');
44 - $wgExtNewTables[] = array('collabwatchlistuser', $wgSql . 'collabwatchlistuser.sql');
45 - $wgExtNewTables[] = array('collabwatchlistcategory', $wgSql . 'collabwatchlistcategory.sql');
46 - $wgExtNewTables[] = array('collabwatchlistrevisiontag', $wgSql . 'collabwatchlistrevisiontag.sql');
47 - $wgExtNewTables[] = array('collabwatchlisttag', $wgSql . 'collabwatchlisttag.sql');
48 - $wgExtNewFields[] = array('change_tag', 'ct_id', $wgSql . 'patch-change_tag_id.sql');
 41+ $wgSql = dirname( __FILE__ ) . '/sql/';
 42+ $wgExtNewTables[] = array( 'collabwatchlist', $wgSql . 'collabwatchlist.sql' );
 43+ $wgExtNewTables[] = array( 'collabwatchlistuser', $wgSql . 'collabwatchlistuser.sql' );
 44+ $wgExtNewTables[] = array( 'collabwatchlistcategory', $wgSql . 'collabwatchlistcategory.sql' );
 45+ $wgExtNewTables[] = array( 'collabwatchlistrevisiontag', $wgSql . 'collabwatchlistrevisiontag.sql' );
 46+ $wgExtNewTables[] = array( 'collabwatchlisttag', $wgSql . 'collabwatchlisttag.sql' );
 47+ $wgExtNewFields[] = array( 'change_tag', 'ct_id', $wgSql . 'patch-change_tag_id.sql' );
4948 return true;
5049 }
5150
@@ -72,11 +71,11 @@
7372 define( 'COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT', 'TrustedEditor' ); // trusted editors are used to filter edits which don't require a review
7473
7574 function fnCollabWatchlistUserTypeToText( $userType ) {
76 - if( $userType === COLLABWATCHLISTUSER_OWNER )
 75+ if ( $userType === COLLABWATCHLISTUSER_OWNER )
7776 return COLLABWATCHLISTUSER_OWNER_TEXT;
78 - if( $userType === COLLABWATCHLISTUSER_USER )
 77+ if ( $userType === COLLABWATCHLISTUSER_USER )
7978 return COLLABWATCHLISTUSER_USER_TEXT;
80 - if( $userType === COLLABWATCHLISTUSER_TRUSTED_EDITOR )
 79+ if ( $userType === COLLABWATCHLISTUSER_TRUSTED_EDITOR )
8180 return COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT;
8281 }
8382 /**#@-*/
Index: trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php
@@ -11,7 +11,7 @@
1212
1313 // Add feed links
1414 $wlToken = $wgUser->getOption( 'watchlisttoken' );
15 - if (!$wlToken) {
 15+ if ( !$wlToken ) {
1616 $wlToken = sha1( mt_rand() . microtime( true ) );
1717 $wgUser->setOption( 'watchlisttoken', $wlToken );
1818 $wgUser->saveSettings();
@@ -20,9 +20,9 @@
2121 global $wgFeedClasses;
2222 $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
2323 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken );
24 - $feedTemplate = wfScript('api').'?';
 24+ $feedTemplate = wfScript( 'api' ) . '?';
2525
26 - foreach( $wgFeedClasses as $format => $class ) {
 26+ foreach ( $wgFeedClasses as $format => $class ) {
2727 $theseParams = $apiParams + array( 'feedformat' => $format );
2828 $url = $feedTemplate . wfArrayToCGI( $theseParams );
2929 $wgOut->addFeedLink( $format, $url );
@@ -33,7 +33,7 @@
3434 $wgOut->setRobotPolicy( 'noindex,nofollow' );
3535
3636 # Anons don't get a watchlist
37 - if( $wgUser->isAnon() ) {
 37+ if ( $wgUser->isAnon() ) {
3838 $wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
3939 $llink = $skin->linkKnown(
4040 SpecialPage::getTitleFor( 'Userlogin' ),
@@ -47,7 +47,7 @@
4848
4949 $wgOut->setPageTitle( wfMsg( 'collabwatchlist' ) );
5050
51 - $listIdsAndNames = CollabWatchlistChangesList::getCollabWatchlistIdAndName($wgUser->getId());
 51+ $listIdsAndNames = CollabWatchlistChangesList::getCollabWatchlistIdAndName( $wgUser->getId() );
5252 $sub = wfMsgExt(
5353 'watchlistfor2',
5454 array( 'parseinline', 'replaceafter' ),
@@ -62,14 +62,14 @@
6363 // The filter form has one checkbox for each tag, build an array
6464 $postValues = $wgRequest->getValues();
6565 $tagFilter = array();
66 - foreach( $postValues as $key => $value ) {
67 - if( stripos($key, 'collaborative-watchlist-filtertag-') === 0 ) {
 66+ foreach ( $postValues as $key => $value ) {
 67+ if ( stripos( $key, 'collaborative-watchlist-filtertag-' ) === 0 ) {
6868 $tagFilter[] = $postValues[$key];
6969 }
7070 }
7171 // Alternative syntax for requests from links (show / hide ...)
72 - if( empty($tagFilter) ) {
73 - $tagFilter = explode('|', $wgRequest->getVal('filterTags'));
 72+ if ( empty( $tagFilter ) ) {
 73+ $tagFilter = explode( '|', $wgRequest->getVal( 'filterTags' ) );
7474 }
7575
7676 $defaults = array(
@@ -84,11 +84,11 @@
8585 /* int */ 'collabwatchlist' => 0,
8686 /* ? */ 'globalwatch' => 'all',
8787 /* ? */ 'invert' => false,
88 - /* ? */ 'invertTags'=> false,
89 - /* ? */ 'filterTags'=> '',
 88+ /* ? */ 'invertTags' => false,
 89+ /* ? */ 'filterTags' => '',
9090 );
9191
92 - extract($defaults);
 92+ extract( $defaults );
9393
9494 # Extract variables from the request, falling back to user preferences or
9595 # other default values if these don't exist
@@ -112,23 +112,23 @@
113113 $hideOwn = $wgRequest->getBool( 'hideOwn' , $prefs['hideown'] );
114114 $hideListUser = $wgRequest->getBool( 'hideListUser', $prefs['hidelistuser'] );
115115 $hidePatrolled = $wgRequest->getBool( 'hidePatrolled' , $prefs['hidepatrolled'] );
116 - $filterTags = implode('|', $tagFilter);
 116+ $filterTags = implode( '|', $tagFilter );
117117 $invertTags = $wgRequest->getBool( 'invertTags' , $prefs['invertTags'] );
118118
119119 # Get collabwatchlist value, if supplied, and prepare a WHERE fragment
120120 $collabWatchlist = $wgRequest->getIntOrNull( 'collabwatchlist' );
121121 $invert = $wgRequest->getBool( 'invert' );
122 - if( !is_null( $collabWatchlist ) && $collabWatchlist !== 'all') {
 122+ if ( !is_null( $collabWatchlist ) && $collabWatchlist !== 'all' ) {
123123 $collabWatchlist = intval( $collabWatchlist );
124124 } else {
125125 $collabWatchlist = 0;
126126 return;
127127 }
128 - if(array_key_exists($collabWatchlist, $listIdsAndNames)) {
129 - $wgOut->addHTML( Xml::element('h2', null, $listIdsAndNames[$collabWatchlist]) );
 128+ if ( array_key_exists( $collabWatchlist, $listIdsAndNames ) ) {
 129+ $wgOut->addHTML( Xml::element( 'h2', null, $listIdsAndNames[$collabWatchlist] ) );
130130 }
131131
132 - if( ( $mode = CollabWatchlistEditor::getMode( $wgRequest, $par ) ) !== false ) {
 132+ if ( ( $mode = CollabWatchlistEditor::getMode( $wgRequest, $par ) ) !== false ) {
133133 $editor = new CollabWatchlistEditor();
134134 $editor->execute( $collabWatchlist, $listIdsAndNames, $wgOut, $wgRequest, $mode );
135135 return;
@@ -138,9 +138,9 @@
139139 $recentchanges = $dbr->tableName( 'recentchanges' );
140140
141141 $nitems = $dbr->selectField( 'collabwatchlistcategory', 'COUNT(*)',
142 - $collabWatchlist == 0 ? array() : array('rl_id' => $collabWatchlist
 142+ $collabWatchlist == 0 ? array() : array( 'rl_id' => $collabWatchlist
143143 ), __METHOD__ );
144 - if( $nitems == 0 ) {
 144+ if ( $nitems == 0 ) {
145145 $wgOut->addWikiMsg( 'nowatchlist' );
146146 return;
147147 }
@@ -148,23 +148,23 @@
149149 // Dump everything here
150150 $nondefaults = array();
151151
152 - wfAppendToArrayIfNotDefault( 'days' , $days , $defaults, $nondefaults);
 152+ wfAppendToArrayIfNotDefault( 'days' , $days , $defaults, $nondefaults );
153153 wfAppendToArrayIfNotDefault( 'hideMinor', (int)$hideMinor, $defaults, $nondefaults );
154 - wfAppendToArrayIfNotDefault( 'hideBots' , (int)$hideBots , $defaults, $nondefaults);
 154+ wfAppendToArrayIfNotDefault( 'hideBots' , (int)$hideBots , $defaults, $nondefaults );
155155 wfAppendToArrayIfNotDefault( 'hideAnons', (int)$hideAnons, $defaults, $nondefaults );
156156 wfAppendToArrayIfNotDefault( 'hideLiu' , (int)$hideLiu , $defaults, $nondefaults );
157 - wfAppendToArrayIfNotDefault( 'hideOwn' , (int)$hideOwn , $defaults, $nondefaults);
158 - wfAppendToArrayIfNotDefault( 'hideListUser', (int)$hideListUser, $defaults, $nondefaults);
159 - wfAppendToArrayIfNotDefault( 'collabwatchlist', $collabWatchlist, $defaults, $nondefaults);
 157+ wfAppendToArrayIfNotDefault( 'hideOwn' , (int)$hideOwn , $defaults, $nondefaults );
 158+ wfAppendToArrayIfNotDefault( 'hideListUser', (int)$hideListUser, $defaults, $nondefaults );
 159+ wfAppendToArrayIfNotDefault( 'collabwatchlist', $collabWatchlist, $defaults, $nondefaults );
160160 wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults );
161161 wfAppendToArrayIfNotDefault( 'filterTags', $filterTags , $defaults, $nondefaults );
162162 wfAppendToArrayIfNotDefault( 'invertTags', $invertTags , $defaults, $nondefaults );
163163 wfAppendToArrayIfNotDefault( 'invert', $invert , $defaults, $nondefaults );
164164
165 - if( $days <= 0 ) {
 165+ if ( $days <= 0 ) {
166166 $andcutoff = '';
167167 } else {
168 - $andcutoff = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'";
 168+ $andcutoff = "rc_timestamp > '" . $dbr->timestamp( time() - intval( $days * 86400 ) ) . "'";
169169 }
170170
171171 # If the watchlist is relatively short, it's simplest to zip
@@ -181,12 +181,12 @@
182182 $andHideMinor = $hideMinor ? "rc_minor = 0" : '';
183183 $andHideLiu = $hideLiu ? "rc_user = 0" : '';
184184 $andHideAnons = $hideAnons ? "rc_user != 0" : '';
185 - $andHideListUser = $hideListUser ? $this->wlGetFilterClauseListUser($collabWatchlist) : '';
 185+ $andHideListUser = $hideListUser ? $this->wlGetFilterClauseListUser( $collabWatchlist ) : '';
186186 $andHidePatrolled = $wgUser->useRCPatrol() && $hidePatrolled ? "rc_patrolled != 1" : '';
187187
188188 # Toggle watchlist content (all recent edits or just the latest)
189 - if( $wgUser->getOption( 'extendwatchlist' )) {
190 - $andLatest='';
 189+ if ( $wgUser->getOption( 'extendwatchlist' ) ) {
 190+ $andLatest = '';
191191 $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) );
192192 $usePage = false;
193193 } else {
@@ -197,7 +197,7 @@
198198 }
199199
200200 # Show a message about slave lag, if applicable
201 - if( ( $lag = $dbr->getLag() ) > 0 )
 201+ if ( ( $lag = $dbr->getLag() ) > 0 )
202202 $wgOut->showLagWarning( $lag );
203203
204204 # Create output form
@@ -206,21 +206,21 @@
207207 # Show watchlist header
208208 $form .= wfMsgExt( 'collabwatchlist-details', array( 'parseinline' ), $wgLang->formatNum( $nitems ) );
209209
210 - if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) {
 210+ if ( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist ) {
211211 $form .= wfMsgExt( 'wlheader-enotif', 'parse' ) . "\n";
212212 }
213213 $form .= '<hr />';
214214
215215 $tables = array( 'recentchanges', 'categorylinks' );
216216 $fields = array( "{$recentchanges}.*" );
217 - $categoryClause = $this->wlGetFilterClauseForCollabWatchlistIds($collabWatchlist, 'cl_to', 'rc_cur_id');
 217+ $categoryClause = $this->wlGetFilterClauseForCollabWatchlistIds( $collabWatchlist, 'cl_to', 'rc_cur_id' );
218218 // If this collaborative watchlist does not contain any categories, add a clause which gives
219219 // us an empty result
220 - $conds = isset($categoryClause) ? array($categoryClause) : array('false');
 220+ $conds = isset( $categoryClause ) ? array( $categoryClause ) : array( 'false' );
221221 $join_conds = array(
222 - 'categorylinks' => array('LEFT OUTER JOIN', "rc_cur_id=cl_from"),
 222+ 'categorylinks' => array( 'LEFT OUTER JOIN', "rc_cur_id=cl_from" ),
223223 );
224 - if( !empty($tagFilter) ) {
 224+ if ( !empty( $tagFilter ) ) {
225225 // The tag filter causes a query runtime of O(MxN), where M is relative to the number
226226 // of recentchanges we select (from a table which is purged periodically, limited to 250)
227227 // and N is relative the number of change_tag entries for a recentchange. Doing it
@@ -230,7 +230,7 @@
231231 // find a common SQL compliant way for using regular expressions which works across Postgre / Mysql
232232 // Furthermore, ChangeTags does not seem to prevent tags containing ',' from being set,
233233 // which renders tag_summary quite unusable
234 - if( $invertTags ) {
 234+ if ( $invertTags ) {
235235 $filter = 'EXISTS ';
236236 } else {
237237 $filter = 'NOT EXISTS ';
@@ -238,36 +238,36 @@
239239 $filter .= '(select ct_rc_id from change_tag
240240 JOIN collabwatchlistrevisiontag ON collabwatchlistrevisiontag.ct_id = change_tag.ct_id
241241 WHERE ct_rc_id = recentchanges.rc_id AND ct_tag ';
242 - if( count($tagFilter) > 1 )
243 - $filter .= 'IN (' . $dbr->makeList($tagFilter) . '))';
 242+ if ( count( $tagFilter ) > 1 )
 243+ $filter .= 'IN (' . $dbr->makeList( $tagFilter ) . '))';
244244 else
245 - $filter .= ' = ' . $dbr->addQuotes(current($tagFilter)) . ')';
 245+ $filter .= ' = ' . $dbr->addQuotes( current( $tagFilter ) ) . ')';
246246 $conds[] = $filter;
247247 }
248248 $options = array( 'ORDER BY' => 'rc_timestamp DESC' );
249 - if( $limitWatchlist ) {
 249+ if ( $limitWatchlist ) {
250250 $options['LIMIT'] = $limitWatchlist;
251251 }
252 - if( $andcutoff ) $conds[] = $andcutoff;
253 - if( $andLatest ) $conds[] = $andLatest;
254 - if( $andHideOwn ) $conds[] = $andHideOwn;
255 - if( $andHideBots ) $conds[] = $andHideBots;
256 - if( $andHideMinor ) $conds[] = $andHideMinor;
257 - if( $andHideLiu ) $conds[] = $andHideLiu;
258 - if( $andHideAnons ) $conds[] = $andHideAnons;
259 - if( $andHideListUser ) $conds[] = $andHideListUser;
260 - if( $andHidePatrolled ) $conds[] = $andHidePatrolled;
 252+ if ( $andcutoff ) $conds[] = $andcutoff;
 253+ if ( $andLatest ) $conds[] = $andLatest;
 254+ if ( $andHideOwn ) $conds[] = $andHideOwn;
 255+ if ( $andHideBots ) $conds[] = $andHideBots;
 256+ if ( $andHideMinor ) $conds[] = $andHideMinor;
 257+ if ( $andHideLiu ) $conds[] = $andHideLiu;
 258+ if ( $andHideAnons ) $conds[] = $andHideAnons;
 259+ if ( $andHideListUser ) $conds[] = $andHideListUser;
 260+ if ( $andHidePatrolled ) $conds[] = $andHidePatrolled;
261261
262 - $rollbacker = $wgUser->isAllowed('rollback');
 262+ $rollbacker = $wgUser->isAllowed( 'rollback' );
263263 if ( $usePage || $rollbacker ) {
264264 $tables[] = 'page';
265 - $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page.page_id');
266 - if ($rollbacker)
 265+ $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page.page_id' );
 266+ if ( $rollbacker )
267267 $fields[] = 'page_latest';
268268 }
269269
270270 ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
271 - wfRunHooks('SpecialCollabWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) );
 271+ wfRunHooks( 'SpecialCollabWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields ) );
272272
273273 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
274274 $numRows = $dbr->numRows( $res );
@@ -275,7 +275,7 @@
276276 /* Start bottom header */
277277
278278 $wlInfo = '';
279 - if( $days >= 1 ) {
 279+ if ( $days >= 1 ) {
280280 $wlInfo = wfMsgExt( 'rcnote', 'parseinline',
281281 $wgLang->formatNum( $numRows ),
282282 $wgLang->formatNum( $days ),
@@ -283,10 +283,10 @@
284284 $wgLang->date( wfTimestampNow(), true ),
285285 $wgLang->time( wfTimestampNow(), true )
286286 ) . '<br />';
287 - } elseif( $days > 0 ) {
 287+ } elseif ( $days > 0 ) {
288288 $wlInfo = wfMsgExt( 'wlnote', 'parseinline',
289289 $wgLang->formatNum( $numRows ),
290 - $wgLang->formatNum( round($days*24) )
 290+ $wgLang->formatNum( round( $days * 24 ) )
291291 ) . '<br />';
292292 }
293293
@@ -302,7 +302,7 @@
303303 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhidemine', 'hideOwn', $hideOwn );
304304 $links[] = $this->wlShowHideLink( $nondefaults, 'collabwatchlistshowhidelistusers', 'hideListUser', $hideListUser );
305305
306 - if( $wgUser->useRCPatrol() ) {
 306+ if ( $wgUser->useRCPatrol() ) {
307307 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled );
308308 }
309309
@@ -312,49 +312,49 @@
313313 $form .= $wgLang->pipeList( $links );
314314 $form .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $thisTitle->getLocalUrl() ) );
315315 $form .= '<hr /><p>';
316 - $tagsAndInfo = CollabWatchlistChangesList::getValidTagsAndInfo(array_keys($listIdsAndNames));
317 - if(count($tagsAndInfo) > 0) {
318 - $form .= wfMsg('collabwatchlistfiltertags') . ':&nbsp;&nbsp;';
 316+ $tagsAndInfo = CollabWatchlistChangesList::getValidTagsAndInfo( array_keys( $listIdsAndNames ) );
 317+ if ( count( $tagsAndInfo ) > 0 ) {
 318+ $form .= wfMsg( 'collabwatchlistfiltertags' ) . ':&nbsp;&nbsp;';
319319 }
320 - foreach( $tagsAndInfo as $tag => $tagInfo ) {
 320+ foreach ( $tagsAndInfo as $tag => $tagInfo ) {
321321 $tagAttr = array(
322322 'name' => 'collaborative-watchlist-filtertag-' . $tag,
323323 'type' => 'checkbox',
324 - 'value' => $tag);
325 - if (in_array($tag, $tagFilter) ) {
 324+ 'value' => $tag );
 325+ if ( in_array( $tag, $tagFilter ) ) {
326326 $tagAttr['checked'] = 'checked';
327327 }
328 - $form .= Xml::element('input', $tagAttr) . '&nbsp;' . Xml::label( $tag, 'collaborative-watchlist-filtertag-' . $tag ) . '&nbsp;';
 328+ $form .= Xml::element( 'input', $tagAttr ) . '&nbsp;' . Xml::label( $tag, 'collaborative-watchlist-filtertag-' . $tag ) . '&nbsp;';
329329 }
330 - if(count($tagsAndInfo) > 0) {
 330+ if ( count( $tagsAndInfo ) > 0 ) {
331331 $form .= '<br />';
332332 }
333 - $form .= Xml::checkLabel( wfMsg('collabwatchlistinverttags'), 'invertTags', 'nsinvertTags', $invertTags ) . '<br />';
334 - $form .= CollabWatchlistChangesList::collabWatchlistSelector( $listIdsAndNames, $collabWatchlist, '', 'collabwatchlist', wfMsg( 'collabwatchlist' )) . '&nbsp;';
335 - $form .= Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $invert ) . '&nbsp;';
 333+ $form .= Xml::checkLabel( wfMsg( 'collabwatchlistinverttags' ), 'invertTags', 'nsinvertTags', $invertTags ) . '<br />';
 334+ $form .= CollabWatchlistChangesList::collabWatchlistSelector( $listIdsAndNames, $collabWatchlist, '', 'collabwatchlist', wfMsg( 'collabwatchlist' ) ) . '&nbsp;';
 335+ $form .= Xml::checkLabel( wfMsg( 'invert' ), 'invert', 'nsinvert', $invert ) . '&nbsp;';
336336 $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>';
337337 $form .= Html::hidden( 'days', $days );
338 - if( $hideMinor )
 338+ if ( $hideMinor )
339339 $form .= Html::hidden( 'hideMinor', 1 );
340 - if( $hideBots )
 340+ if ( $hideBots )
341341 $form .= Html::hidden( 'hideBots', 1 );
342 - if( $hideAnons )
 342+ if ( $hideAnons )
343343 $form .= Html::hidden( 'hideAnons', 1 );
344 - if( $hideLiu )
 344+ if ( $hideLiu )
345345 $form .= Html::hidden( 'hideLiu', 1 );
346 - if( $hideOwn )
 346+ if ( $hideOwn )
347347 $form .= Html::hidden( 'hideOwn', 1 );
348 - if( $hideListUser )
 348+ if ( $hideListUser )
349349 $form .= Html::hidden( 'hideListUser', 1 );
350 - if( $wgUser->useRCPatrol() )
351 - if( $hidePatrolled )
352 - $form .= Html::hidden( 'hidePatrolled', 1);
 350+ if ( $wgUser->useRCPatrol() )
 351+ if ( $hidePatrolled )
 352+ $form .= Html::hidden( 'hidePatrolled', 1 );
353353 $form .= Xml::closeElement( 'form' );
354354 $form .= Xml::closeElement( 'fieldset' );
355355 $wgOut->addHTML( $form );
356356
357357 # If there's nothing to show, stop here
358 - if( $numRows == 0 ) {
 358+ if ( $numRows == 0 ) {
359359 $wgOut->addWikiMsg( 'watchnochange' );
360360 return;
361361 }
@@ -385,7 +385,7 @@
386386 $rc = RecentChange::newFromRow( $obj );
387387 $rc->counter = $counter++;
388388
389 - if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
 389+ if ( $wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
390390 $rc->numberofWatchingusers = $dbr->selectField( 'watchlist',
391391 'COUNT(*)',
392392 array(
@@ -397,7 +397,7 @@
398398 $rc->numberofWatchingusers = 0;
399399 }
400400
401 - $tags = $this->wlTagsForRevision($obj->rc_this_oldid, array($collabWatchlist), $invert);
 401+ $tags = $this->wlTagsForRevision( $obj->rc_this_oldid, array( $collabWatchlist ), $invert );
402402 // if( isset($tags) ) {
403403 // // Filter recentchanges which contain unwanted tags
404404 // $tagNames = array();
@@ -410,7 +410,7 @@
411411 // }
412412 $attrs = $rc->getAttributes();
413413 $attrs['collabwatchlist_tags'] = $tags;
414 - $rc->setAttribs($attrs);
 414+ $rc->setAttribs( $attrs );
415415
416416 $s .= $list->recentChangesLine( $rc, false, $counter );
417417 }
@@ -440,7 +440,7 @@
441441
442442 $sk = $wgUser->getSkin();
443443 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
444 - $options['days'] = ($h / 24.0);
 444+ $options['days'] = ( $h / 24.0 );
445445
446446 $s = $sk->linkKnown(
447447 $title,
@@ -458,7 +458,7 @@
459459 $sk = $wgUser->getSkin();
460460 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
461461 $options['days'] = $d;
462 - $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
 462+ $message = ( $d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
463463
464464 $s = $sk->linkKnown(
465465 $title,
@@ -479,15 +479,15 @@
480480 $hours = array( 1, 2, 6, 12 );
481481 $days = array( 1, 3, 7 );
482482 $i = 0;
483 - foreach( $hours as $h ) {
 483+ foreach ( $hours as $h ) {
484484 $hours[$i++] = $this->wlHoursLink( $h, $page, $options );
485485 }
486486 $i = 0;
487 - foreach( $days as $d ) {
 487+ foreach ( $days as $d ) {
488488 $days[$i++] = $this->wlDaysLink( $d, $page, $options );
489489 }
490 - return wfMsgExt('wlshowlast',
491 - array('parseinline', 'replaceafter'),
 490+ return wfMsgExt( 'wlshowlast',
 491+ array( 'parseinline', 'replaceafter' ),
492492 $wgLang->pipeList( $hours ),
493493 $wgLang->pipeList( $days ),
494494 $this->wlDaysLink( 0, $page, $options ) );
@@ -510,7 +510,7 @@
511511 $dbr->freeResult( $res );
512512
513513 # Halve to remove talk pages if needed
514 - if( !$talk )
 514+ if ( !$talk )
515515 $count = floor( $count / 2 );
516516
517517 return( $count );
@@ -532,98 +532,98 @@
533533 // Some DB stuff
534534 $dbr = wfGetDB( DB_SLAVE );
535535 $cond = array();
536 - if( isset($rl_ids) && !(count($rl_ids) == 1 && $rl_ids[0] == 0)) {
537 - if( $invert ) {
538 - $cond[] = "rl_id NOT IN (" . $dbr->makeList($rl_ids) . ")";
539 - }else {
540 - $cond = array("rl_id" => $rl_ids);
 536+ if ( isset( $rl_ids ) && !( count( $rl_ids ) == 1 && $rl_ids[0] == 0 ) ) {
 537+ if ( $invert ) {
 538+ $cond[] = "rl_id NOT IN (" . $dbr->makeList( $rl_ids ) . ")";
 539+ } else {
 540+ $cond = array( "rl_id" => $rl_ids );
541541 }
542542 }
543 - if( isset($filterTags) && count($filterTags) > 0) {
544 - $cond[] = "ct_tag not in (" . $dbr->makeList($filterTags) . ")";
 543+ if ( isset( $filterTags ) && count( $filterTags ) > 0 ) {
 544+ $cond[] = "ct_tag not in (" . $dbr->makeList( $filterTags ) . ")";
545545 }
546 - //$table, $vars, $conds='', $fname = 'Database::select', $options = array(), $join_conds = array()
547 - $res = $dbr->select( array('change_tag', 'collabwatchlistrevisiontag', 'user'), # Tables
548 - array('rl_id', 'ct_tag', 'collabwatchlistrevisiontag.user_id', 'user_name', 'rrt_comment'), # Fields
549 - array('ct_rev_id' => $rev_id) + $cond, # Conditions
 546+ // $table, $vars, $conds='', $fname = 'Database::select', $options = array(), $join_conds = array()
 547+ $res = $dbr->select( array( 'change_tag', 'collabwatchlistrevisiontag', 'user' ), # Tables
 548+ array( 'rl_id', 'ct_tag', 'collabwatchlistrevisiontag.user_id', 'user_name', 'rrt_comment' ), # Fields
 549+ array( 'ct_rev_id' => $rev_id ) + $cond, # Conditions
550550 __METHOD__, array(),
551551 # Join conditions
552 - array( 'collabwatchlistrevisiontag' => array('JOIN', 'change_tag.ct_id = collabwatchlistrevisiontag.ct_id'),
553 - 'user' => array('JOIN', 'collabwatchlistrevisiontag.user_id = user.user_id')
 552+ array( 'collabwatchlistrevisiontag' => array( 'JOIN', 'change_tag.ct_id = collabwatchlistrevisiontag.ct_id' ),
 553+ 'user' => array( 'JOIN', 'collabwatchlistrevisiontag.user_id = user.user_id' )
554554 )
555555 );
556556 $tags = array();
557 - foreach( $res as $row ) {
 557+ foreach ( $res as $row ) {
558558 $tags[] = get_object_vars( $row );
559559 }
560560 return $tags;
561561 }
562562
563 - function wlGetFilterClauseForCollabWatchlistIds($rl_ids, $catNameCol, $pageIdCol) {
 563+ function wlGetFilterClauseForCollabWatchlistIds( $rl_ids, $catNameCol, $pageIdCol ) {
564564 $excludedCatPageIds = array();
565565 $includedCatPageIds = array();
566566 $includedPageIds = array();
567567 $dbr = wfGetDB( DB_SLAVE );
568 - $res = $dbr->select( array('collabwatchlist', 'collabwatchlistcategory', 'page' ), # Tables
569 - array('cat_page_id', 'page_title', 'page_namespace', 'subtract'), # Fields
570 - $rl_ids != 0 ? array('collabwatchlist.rl_id' => $rl_ids) : array(), # Conditions
 568+ $res = $dbr->select( array( 'collabwatchlist', 'collabwatchlistcategory', 'page' ), # Tables
 569+ array( 'cat_page_id', 'page_title', 'page_namespace', 'subtract' ), # Fields
 570+ $rl_ids != 0 ? array( 'collabwatchlist.rl_id' => $rl_ids ) : array(), # Conditions
571571 __METHOD__, array(),
572572 # Join conditions
573 - array( 'collabwatchlistcategory' => array('JOIN', 'collabwatchlist.rl_id = collabwatchlistcategory.rl_id'),
574 - 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
 573+ array( 'collabwatchlistcategory' => array( 'JOIN', 'collabwatchlist.rl_id = collabwatchlistcategory.rl_id' ),
 574+ 'page' => array( 'JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id' ) )
575575 );
576 - foreach( $res as $row ) {
577 - if($row->page_namespace == NS_CATEGORY) {
578 - if($row->subtract) {
 576+ foreach ( $res as $row ) {
 577+ if ( $row->page_namespace == NS_CATEGORY ) {
 578+ if ( $row->subtract ) {
579579 $excludedCatPageIds[$row->cat_page_id] = $row->page_title;
580 - }else {
 580+ } else {
581581 $includedCatPageIds[$row->cat_page_id] = $row->page_title;
582582 }
583 - }else {
 583+ } else {
584584 $includedPageIds[$row->cat_page_id] = $row->page_title;
585585 }
586586 }
587587
588 - if($includedCatPageIds) {
 588+ if ( $includedCatPageIds ) {
589589 $catTree = new CategoryTreeManip();
590 - $catTree->initialiseFromCategoryNames(array_values($includedCatPageIds));
591 - $catTree->disableCategoryIds(array_keys($excludedCatPageIds));
 590+ $catTree->initialiseFromCategoryNames( array_values( $includedCatPageIds ) );
 591+ $catTree->disableCategoryIds( array_keys( $excludedCatPageIds ) );
592592 $enabledCategoryNames = $catTree->getEnabledCategoryNames();
593 - if(empty($enabledCategoryNames))
 593+ if ( empty( $enabledCategoryNames ) )
594594 return;
595 - $collabWatchlistClause = '(' . $catNameCol . " IN (" . implode(',', $this->addQuotes($dbr, $enabledCategoryNames)) . ") ";
596 - if(!empty($includedPageIds)) {
597 - $collabWatchlistClause .= ' OR ' . $pageIdCol . ' IN (' . implode(',', $this->addQuotes($dbr, array_keys($includedPageIds))) . ')';
 595+ $collabWatchlistClause = '(' . $catNameCol . " IN (" . implode( ',', $this->addQuotes( $dbr, $enabledCategoryNames ) ) . ") ";
 596+ if ( !empty( $includedPageIds ) ) {
 597+ $collabWatchlistClause .= ' OR ' . $pageIdCol . ' IN (' . implode( ',', $this->addQuotes( $dbr, array_keys( $includedPageIds ) ) ) . ')';
598598 }
599599 $collabWatchlistClause .= ')';
600 - }else if(!empty($includedPageIds)) {
601 - $collabWatchlistClause = $pageIdCol . ' IN (' . implode(',', $this->addQuotes($dbr, array_keys($includedPageIds))) . ')';
 600+ } else if ( !empty( $includedPageIds ) ) {
 601+ $collabWatchlistClause = $pageIdCol . ' IN (' . implode( ',', $this->addQuotes( $dbr, array_keys( $includedPageIds ) ) ) . ')';
602602 }
603603 return $collabWatchlistClause;
604604 }
605605
606 - function wlGetFilterClauseListUser($rl_id) {
 606+ function wlGetFilterClauseListUser( $rl_id ) {
607607 $excludedUserIds = array();
608608 $dbr = wfGetDB( DB_SLAVE );
609609 $res = $dbr->select( 'collabwatchlistuser', # Tables
610610 'user_id', # Fields
611 - array('collabwatchlistuser.rl_id' => $rl_id) # Conditions
 611+ array( 'collabwatchlistuser.rl_id' => $rl_id ) # Conditions
612612 );
613613 $clause = '';
614 - foreach( $res as $row ) {
 614+ foreach ( $res as $row ) {
615615 $excludedUserIds[] = $row->user_id;
616616 }
617 - if($res->numRows() > 0) {
 617+ if ( $res->numRows() > 0 ) {
618618 $clause = '( rc_user NOT IN (';
619 - $clause .= implode(',', $this->addQuotes($dbr, $excludedUserIds)) . ') )';
 619+ $clause .= implode( ',', $this->addQuotes( $dbr, $excludedUserIds ) ) . ') )';
620620 }
621621 return $clause;
622622 }
623623
624 - public static function addQuotes($db, $strings) {
 624+ public static function addQuotes( $db, $strings ) {
625625 $result = array();
626 - foreach($strings as $string) {
627 - $result[] = $db->addQuotes($string);
 626+ foreach ( $strings as $string ) {
 627+ $result[] = $db->addQuotes( $string );
628628 }
629629 return $result;
630630 }
Index: trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php
@@ -22,29 +22,29 @@
2323 /**
2424 * Constructor
2525 */
26 - function __construct($id = NULL, $name = NULL, $root = NULL, $parents = array()) {
 26+ function __construct( $id = NULL, $name = NULL, $root = NULL, $parents = array() ) {
2727 $this->id = $id;
2828 $this->name = $name;
29 - if(!is_null($root)) {
 29+ if ( !is_null( $root ) ) {
3030 $this->root = $root;
31 - }else {
 31+ } else {
3232 $this->root = $this;
3333 }
3434 $this->parents = $parents;
3535 }
3636
37 - private function addChildren($children) {
38 - if(!is_array($children))
39 - throw new Exception('Argument must be an array');
40 - foreach($children as $child) {
 37+ private function addChildren( $children ) {
 38+ if ( !is_array( $children ) )
 39+ throw new Exception( 'Argument must be an array' );
 40+ foreach ( $children as $child ) {
4141 $this->children[$child->id] = $child;
4242 }
4343 }
4444
45 - private function addParents($parents) {
46 - if(!is_array($parents))
47 - throw new Exception('Argument must be an array');
48 - foreach($parents as $parent) {
 45+ private function addParents( $parents ) {
 46+ if ( !is_array( $parents ) )
 47+ throw new Exception( 'Argument must be an array' );
 48+ foreach ( $parents as $parent ) {
4949 $this->parents[$parent->id] = $parent;
5050 }
5151 }
@@ -60,22 +60,22 @@
6161 *
6262 * @param array $catPageIds The page ids of the categories to disable
6363 */
64 - public function disableCategoryIds($catPageIds) {
65 - foreach($catPageIds as $catId) {
66 - $node = $this->getNodeForCatPageId($catId);
67 - if(isset($node)) {
 64+ public function disableCategoryIds( $catPageIds ) {
 65+ foreach ( $catPageIds as $catId ) {
 66+ $node = $this->getNodeForCatPageId( $catId );
 67+ if ( isset( $node ) ) {
6868 $node->disable();
6969 }
7070 }
7171 }
7272
73 - private function recursiveDisable($visitedNodeIds = array()) {
74 - if(!$this->enabled || array_key_exists($this->id, $visitedNodeIds))
 73+ private function recursiveDisable( $visitedNodeIds = array() ) {
 74+ if ( !$this->enabled || array_key_exists( $this->id, $visitedNodeIds ) )
7575 return; # Break the recursion
7676 $this->enabled = false;
7777 $visitedNodeIds[] = $this->id;
78 - foreach($this->children as $cat) {
79 - $cat->recursiveDisable($visitedNodeIds);
 78+ foreach ( $this->children as $cat ) {
 79+ $cat->recursiveDisable( $visitedNodeIds );
8080 }
8181 }
8282
@@ -87,7 +87,7 @@
8888 public function getEnabledCategoryNames() {
8989 $enabledNodes = $this->getEnabledNodeMap();
9090 $enabledCategories = array();
91 - foreach($enabledNodes as $nodeId => $node) {
 91+ foreach ( $enabledNodes as $nodeId => $node ) {
9292 $enabledCategories[] = $node->name;
9393 }
9494 return $enabledCategories;
@@ -102,14 +102,14 @@
103103 return $this->root->recursiveGetEnabledNodeMap();
104104 }
105105
106 - private function recursiveGetEnabledNodeMap(&$foundNodes = array()) {
107 - if(isset($this->id)) {
108 - if(!$this->enabled || array_key_exists($this->id, $foundNodes))
 106+ private function recursiveGetEnabledNodeMap( &$foundNodes = array() ) {
 107+ if ( isset( $this->id ) ) {
 108+ if ( !$this->enabled || array_key_exists( $this->id, $foundNodes ) )
109109 return $foundNodes; # Break the recursion
110110 $foundNodes[$this->id] = $this;
111111 }
112 - foreach($this->children as $cat) {
113 - $cat->recursiveGetEnabledNodeMap($foundNodes);
 112+ foreach ( $this->children as $cat ) {
 113+ $cat->recursiveGetEnabledNodeMap( $foundNodes );
114114 }
115115 return $foundNodes;
116116 }
@@ -119,12 +119,12 @@
120120 * @param $catPageId The page id of the category to retrieve
121121 * @return CategoryTreeManip The node
122122 */
123 - public function getNodeForCatPageId($catPageId) {
124 - if(array_key_exists($catPageId, $this->root->catPageIdToNode))
 123+ public function getNodeForCatPageId( $catPageId ) {
 124+ if ( array_key_exists( $catPageId, $this->root->catPageIdToNode ) )
125125 return $this->root->catPageIdToNode[$catPageId];
126126 }
127127
128 - private function addNode($node) {
 128+ private function addNode( $node ) {
129129 $this->root->catPageIdToNode[$node->id] = $node;
130130 }
131131
@@ -134,41 +134,41 @@
135135 * @param array $catNames An array of strings representing category names
136136 * @return
137137 */
138 - public function initialiseFromCategoryNames($catNames) {
 138+ public function initialiseFromCategoryNames( $catNames ) {
139139 $dbr = wfGetDB( DB_SLAVE );
140 - while($catNames) {
141 - $res = $dbr->select( array('categorylinks', 'page' ), # Tables
142 - array('cl_to AS parName', 'cl_from AS childId', 'page_title AS childName'), # Fields
143 - array('cl_to' => $catNames, 'page_namespace' => NS_CATEGORY), # Conditions
 140+ while ( $catNames ) {
 141+ $res = $dbr->select( array( 'categorylinks', 'page' ), # Tables
 142+ array( 'cl_to AS parName', 'cl_from AS childId', 'page_title AS childName' ), # Fields
 143+ array( 'cl_to' => $catNames, 'page_namespace' => NS_CATEGORY ), # Conditions
144144 __METHOD__, array(),
145145 # Join conditions
146 - array('page' => array('JOIN', 'page_id = cl_from') )
 146+ array( 'page' => array( 'JOIN', 'page_id = cl_from' ) )
147147 );
148148 $parentList = array();
149149 $childList = array();
150 - foreach( $res as $row ) {
151 - $parentList[$row->parName][] = array($row->childId, $row->childName);
152 - if(array_key_exists($row->childId, $childList)) {
 150+ foreach ( $res as $row ) {
 151+ $parentList[$row->parName][] = array( $row->childId, $row->childName );
 152+ if ( array_key_exists( $row->childId, $childList ) ) {
153153 $childEntry = $childList[$row->childId];
154154 $childEntry[1][] = $row->parName;
155 - }else {
156 - $childList[$row->childId] = array($row->childName, array($row->parName));
 155+ } else {
 156+ $childList[$row->childId] = array( $row->childName, array( $row->parName ) );
157157 }
158158 }
159159
160 - if(!isset($parentNameToNode) && !empty($parentList)) {
 160+ if ( !isset( $parentNameToNode ) && !empty( $parentList ) ) {
161161 // Fetch the page ids of the $catNames and add the parent categories if needed
162 - $res = $dbr->select( array('page' ), # Tables
163 - array('page_id, page_title'), # Fields
164 - array('page_title' => array_keys($parentList)) # Conditions
 162+ $res = $dbr->select( array( 'page' ), # Tables
 163+ array( 'page_id, page_title' ), # Fields
 164+ array( 'page_title' => array_keys( $parentList ) ) # Conditions
165165 );
166166 $parentNameToNode = array();
167 - foreach( $res as $row ) {
168 - $node = $this->getNodeForCatPageId($row->page_id);
169 - if(!isset($node)) {
170 - $node = new CategoryTreeManip($row->page_id, $row->page_title, $this->root);
171 - $this->addNode($node);
172 - $this->addChildren(array($node));
 167+ foreach ( $res as $row ) {
 168+ $node = $this->getNodeForCatPageId( $row->page_id );
 169+ if ( !isset( $node ) ) {
 170+ $node = new CategoryTreeManip( $row->page_id, $row->page_title, $this->root );
 171+ $this->addNode( $node );
 172+ $this->addChildren( array( $node ) );
173173 }
174174 $parentNameToNode[$row->page_title] = $node;
175175 }
@@ -176,23 +176,23 @@
177177
178178 $newChildNameToNode = array();
179179 // Add the new child nodes
180 - foreach($childList as $childPageId => $childInfo) {
181 - $childNode = $this->getNodeForCatPageId($childPageId);
182 - if(!isset($childNode)) {
183 - $childNode = new CategoryTreeManip($childPageId, $childInfo[0], $this->root);
184 - $this->addNode($childNode);
 180+ foreach ( $childList as $childPageId => $childInfo ) {
 181+ $childNode = $this->getNodeForCatPageId( $childPageId );
 182+ if ( !isset( $childNode ) ) {
 183+ $childNode = new CategoryTreeManip( $childPageId, $childInfo[0], $this->root );
 184+ $this->addNode( $childNode );
185185 $newChildNameToNode[$childInfo[0]] = $childNode;
186186 }
187 - foreach($childInfo[1] as $parentName) {
 187+ foreach ( $childInfo[1] as $parentName ) {
188188 $parent = $parentNameToNode[$parentName];
189 - $parent->addChildren(array($childNode));
190 - $childNode->addParents(array($parent));
 189+ $parent->addChildren( array( $childNode ) );
 190+ $childNode->addParents( array( $parent ) );
191191 }
192192 }
193193
194194 // Prepare for the next loop
195195 $parentNameToNode = $newChildNameToNode;
196 - $catNames = array_keys($parentNameToNode);
 196+ $catNames = array_keys( $parentNameToNode );
197197 }
198198 }
199199 }
Index: trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php
@@ -12,7 +12,7 @@
1313 * @param Skin $skin
1414 */
1515 public function __construct( $skin, $user ) {
16 - parent::__construct($skin);
 16+ parent::__construct( $skin );
1717 $this->user = $user;
1818 }
1919
@@ -23,11 +23,11 @@
2424 public function beginRecentChangesList() {
2525 global $wgRequest;
2626 $gwlSpeciaPageTitle = SpecialPage::getTitleFor( 'CollabWatchlist' );
27 - $result = Xml::openElement('form', array(
 27+ $result = Xml::openElement( 'form', array(
2828 'class' => 'mw-collaborative-watchlist-addtag-form',
2929 'method' => 'post',
30 - 'action' => $gwlSpeciaPageTitle->getLocalUrl( array( 'action' => 'setTags' ))));
31 - $result .= Xml::input('redirTarget', false, $wgRequest->getFullRequestURL(), array('type' => 'hidden'));
 30+ 'action' => $gwlSpeciaPageTitle->getLocalUrl( array( 'action' => 'setTags' ) ) ) );
 31+ $result .= Xml::input( 'redirTarget', false, $wgRequest->getFullRequestURL(), array( 'type' => 'hidden' ) );
3232 $result .= parent::beginRecentChangesList();
3333 return $result;
3434 }
@@ -41,13 +41,13 @@
4242 $collabWatchlist = $wgRequest->getIntOrNull( 'collabwatchlist' );
4343 $result = '';
4444 $result .= parent::endRecentChangesList();
45 - $glWlIdAndName = $this->getCollabWatchlistIdAndName($this->user->getId());
46 - $result .= $this->collabWatchlistAndTagSelectors($glWlIdAndName, $collabWatchlist, null, 'collabwatchlist', wfMsg( 'collabwatchlist' )) . '&nbsp;';
47 - $result .= Xml::label( wfMsg('collabwatchlisttagcomment'), 'tagcomment' ) . '&nbsp;' . Xml::input( 'tagcomment' ) . '&nbsp;';
48 - if( $this->user->useRCPatrol() )
49 - $result .= Xml::checkLabel( wfMsg('collabwatchlistpatrol'), 'setpatrolled', 'setpatrolled', true ) . '&nbsp;';
50 - $result .= Xml::submitButton(wfMsg( 'collabwatchlistsettagbutton' ));
51 - $result .= Xml::closeElement('form');
 45+ $glWlIdAndName = $this->getCollabWatchlistIdAndName( $this->user->getId() );
 46+ $result .= $this->collabWatchlistAndTagSelectors( $glWlIdAndName, $collabWatchlist, null, 'collabwatchlist', wfMsg( 'collabwatchlist' ) ) . '&nbsp;';
 47+ $result .= Xml::label( wfMsg( 'collabwatchlisttagcomment' ), 'tagcomment' ) . '&nbsp;' . Xml::input( 'tagcomment' ) . '&nbsp;';
 48+ if ( $this->user->useRCPatrol() )
 49+ $result .= Xml::checkLabel( wfMsg( 'collabwatchlistpatrol' ), 'setpatrolled', 'setpatrolled', true ) . '&nbsp;';
 50+ $result .= Xml::submitButton( wfMsg( 'collabwatchlistsettagbutton' ) );
 51+ $result .= Xml::closeElement( 'form' );
5252 return $result;
5353 }
5454
@@ -56,10 +56,10 @@
5757 * @see includes/EnhancedChangesList#insertBeforeRCFlags($r, $rcObj)
5858 */
5959 protected function insertBeforeRCFlags( &$r, &$rcObj ) {
60 - $r .= Xml::element('input', array(
 60+ $r .= Xml::element( 'input', array(
6161 'name' => 'collaborative-watchlist-addtag-' . $this->tagCheckboxIndex,
6262 'type' => 'checkbox',
63 - 'value' => ($rcObj->getTitle() . '|' . $rcObj->getAttribute('rc_this_oldid') . '|' . $rcObj->getAttribute('rc_id'))));
 63+ 'value' => ( $rcObj->getTitle() . '|' . $rcObj->getAttribute( 'rc_this_oldid' ) . '|' . $rcObj->getAttribute( 'rc_id' ) ) ) );
6464 $this->tagCheckboxIndex++;
6565 }
6666
@@ -68,10 +68,10 @@
6969 * @see includes/EnhancedChangesList#insertBeforeRCFlagsBlock($r, $block)
7070 */
7171 protected function insertBeforeRCFlagsBlock( &$r, &$block ) {
72 - $r .= Xml::element('input', array(
 72+ $r .= Xml::element( 'input', array(
7373 'name' => 'collaborative-watchlist-addtag-placeholder',
7474 'type' => 'checkbox',
75 - 'style' => 'visibility: hidden;'));
 75+ 'style' => 'visibility: hidden;' ) );
7676 }
7777
7878 /**
@@ -80,9 +80,9 @@
8181 */
8282 public function insertRollback( &$s, &$rc ) {
8383 global $wgUser;
84 - parent::insertRollback($s, $rc);
85 - if( !$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
86 - if ($wgUser->isAllowed('edit') ) {
 84+ parent::insertRollback( $s, $rc );
 85+ if ( !$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
 86+ if ( $wgUser->isAllowed( 'edit' ) ) {
8787 $rev = new Revision( array(
8888 'id' => $rc->mAttribs['rc_this_oldid'],
8989 'user' => $rc->mAttribs['rc_user'],
@@ -90,8 +90,8 @@
9191 'deleted' => $rc->mAttribs['rc_deleted']
9292 ) );
9393 $undoAfter = $rev->getPrevious();
94 - $undoLink = $this->generateUndoLink($this->skin, $rc->getTitle(), $rev, $undoAfter);
95 - if( isset($undoLink) )
 94+ $undoLink = $this->generateUndoLink( $this->skin, $rc->getTitle(), $rev, $undoAfter );
 95+ if ( isset( $undoLink ) )
9696 $s .= '&nbsp;' . $undoLink;
9797 }
9898 }
@@ -107,7 +107,7 @@
108108 public static function newFromUser( &$user ) {
109109 $sk = $user->getSkin();
110110 $list = NULL;
111 - if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
 111+ if ( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
112112 return new CollabWatchlistChangesList( $sk, $user );
113113 } else {
114114 return $list;
@@ -119,8 +119,8 @@
120120 * @see includes/ChangesList#insertTags($s, $rc, $classes)
121121 */
122122 public function insertTags( &$s, &$rc, &$classes ) {
123 - if ( !empty($rc->mAttribs['collabwatchlist_tags']) ) {
124 - list($tagSummary, $newClasses) = $this->formatReviewSummaryRow( $rc, 'changeslist' );
 123+ if ( !empty( $rc->mAttribs['collabwatchlist_tags'] ) ) {
 124+ list( $tagSummary, $newClasses ) = $this->formatReviewSummaryRow( $rc, 'changeslist' );
125125 $classes = array_merge( $classes, $newClasses );
126126 $s .= ' ' . $tagSummary;
127127 }
@@ -158,7 +158,7 @@
159159 private function formatReviewSummaryRow( $rc, $page ) {
160160 global $wgRequest;
161161 $s = '';
162 - if( !$rc )
 162+ if ( !$rc )
163163 return $s;
164164
165165 $attr = $rc->mAttribs;
@@ -167,13 +167,13 @@
168168 $classes = array();
169169
170170 $displayTags = array();
171 - foreach( $tagRows as $tagRow ) {
 171+ foreach ( $tagRows as $tagRow ) {
172172 $tag = $tagRow['ct_tag'];
173173 $collabwatchlistTag = Xml::tags(
174174 'span',
175175 array( 'class' => 'mw-collabwatchlist-tag-marker ' .
176176 Sanitizer::escapeClass( "mw-collabwatchlist-tag-marker-$tag" ),
177 - 'title' => $tagRow['rrt_comment']),
 177+ 'title' => $tagRow['rrt_comment'] ),
178178 ChangeTags::tagDescription( $tag )
179179 );
180180 $classes[] = Sanitizer::escapeClass( "mw-collabwatchlist-tag-$tag" );
@@ -181,7 +181,7 @@
182182 /** Insert links to user page, user talk page and eventually a blocking link */
183183 $userLink = $this->skin->userLink( $tagRow['user_id'], $tagRow['user_name'] );
184184 $delTagTarget = CollabWatchlistEditor::getUnsetTagUrl( $wgRequest->getFullRequestURL(), $attr['rc_title'], $tagRow['rl_id'], $tag, $attr['rc_id'] );
185 - $delTagLink = Xml::element('a', array('href' => $delTagTarget, 'class' => 'mw-collabwatchlist-unsettag-' . $tag), wfMsg('collabwatchlist-unset-tag'));
 185+ $delTagLink = Xml::element( 'a', array( 'href' => $delTagTarget, 'class' => 'mw-collabwatchlist-unsettag-' . $tag ), wfMsg( 'collabwatchlist-unset-tag' ) );
186186 $displayTags[] = $collabwatchlistTag . ' ' . $delTagLink . ' ' . $userLink;
187187 }
188188 $markers = '(' . implode( ', ', $displayTags ) . ')';
@@ -199,12 +199,12 @@
200200 * @param String $tagLabel The label for the tag selector
201201 * @return A string containing HTML
202202 */
203 - public static function collabWatchlistAndTagSelectors($glWlIdAndName, $selected = '', $all = null, $element_name = 'collabwatchlist', $rlLabel = null, $rlElementId = 'collabwatchlist', $tagLabel = null) {
 203+ public static function collabWatchlistAndTagSelectors( $glWlIdAndName, $selected = '', $all = null, $element_name = 'collabwatchlist', $rlLabel = null, $rlElementId = 'collabwatchlist', $tagLabel = null ) {
204204 global $wgJsMimeType;
205205 $tagElementIdBase = 'mw-collaborative-watchlist-addtag-selector';
206 - $ret = self::collabWatchlistSelector($glWlIdAndName, $selected, $all, $element_name, $rlLabel, $rlElementId, $tagElementIdBase);
 206+ $ret = self::collabWatchlistSelector( $glWlIdAndName, $selected, $all, $element_name, $rlLabel, $rlElementId, $tagElementIdBase );
207207 $ret .= '&nbsp;';
208 - $ret .= self::tagSelector(array_keys($glWlIdAndName), $tagLabel);
 208+ $ret .= self::tagSelector( array_keys( $glWlIdAndName ), $tagLabel );
209209 // Make sure the correct tags for the default selection are set
210210 $ret .= Xml::element( 'script',
211211 array(
@@ -232,7 +232,7 @@
233233 public static function collabWatchlistSelector( $glWlIdAndName, $selected = '', $all = null, $element_name = 'collabwatchlist', $label = null, $element_id = 'collabwatchlist', $tagElementIdBase = null ) {
234234 global $wgScriptPath, $wgJsMimeType;
235235 $ret = '';
236 - if(isset($tagElementIdBase)) {
 236+ if ( isset( $tagElementIdBase ) ) {
237237 $jsPath = "$wgScriptPath/extensions/CollabWatchlist/js";
238238 $ret .= Xml::element( 'script',
239239 array(
@@ -248,26 +248,26 @@
249249 // as strings since PHP is such a shithole.
250250 // But we also don't want blanks and nulls and "all"s matching 0,
251251 // so let's convert *just* string ints to clean ints.
252 - if( preg_match( '/^\d+$/', $selected ) ) {
 252+ if ( preg_match( '/^\d+$/', $selected ) ) {
253253 $selected = intval( $selected );
254254 }
255255
256 - if( !is_null( $all ) )
 256+ if ( !is_null( $all ) )
257257 $glWlIdAndName = array( $all => wfMsg( 'collabwatchlistsall' ) ) + $glWlIdAndName;
258 - foreach( $glWlIdAndName as $index => $name ) {
259 - if( $index < NS_MAIN )
 258+ foreach ( $glWlIdAndName as $index => $name ) {
 259+ if ( $index < NS_MAIN )
260260 continue;
261 - if( $index === 0 )
 261+ if ( $index === 0 )
262262 $name = wfMsg( 'blankcollabwatchlist' );
263 - $options[] = Xml::option( $name, $index, $index === $selected, isset($tagElementIdBase) ?
264 - array('onclick' => 'onCollabWatchlistSelection("' . $tagElementIdBase . '", this.value)') :
 263+ $options[] = Xml::option( $name, $index, $index === $selected, isset( $tagElementIdBase ) ?
 264+ array( 'onclick' => 'onCollabWatchlistSelection("' . $tagElementIdBase . '", this.value)' ) :
265265 array()
266266 );
267267 }
268268
269269 $selectorHtml = Xml::openElement( 'select', array(
270270 'id' => $element_id, 'name' => $element_name,
271 - 'class' => 'collabwatchlistselector', ))
 271+ 'class' => 'collabwatchlistselector', ) )
272272 . "\n"
273273 . implode( "\n", $options )
274274 . "\n"
@@ -290,39 +290,39 @@
291291 */
292292 public static function tagSelector( $rlIds, $label = '', $elemId = 'mw-collaborative-watchlist-addtag-selector' ) {
293293 global $wgContLang;
294 - $tagsAndInfo = CollabWatchlistChangesList::getValidTagsAndInfo($rlIds);
 294+ $tagsAndInfo = CollabWatchlistChangesList::getValidTagsAndInfo( $rlIds );
295295 $optionsAll = array();
296296 $options = array();
297 - foreach( $tagsAndInfo as $tagName => $info ) {
 297+ foreach ( $tagsAndInfo as $tagName => $info ) {
298298 $optionsAll[] = Xml::option( $tagName . ' ' . $info['rt_description'], $tagName );
299 - foreach( $info['rl_ids'] as $rlId ) {
 299+ foreach ( $info['rl_ids'] as $rlId ) {
300300 $options[$rlId][] = Xml::option( $tagName, $tagName );
301301 }
302302 }
303303 $ret = Xml::openElement( 'select', array(
304304 'id' => $elemId,
305305 'name' => 'collabwatchlisttag',
306 - 'class' => 'mw-collaborative-watchlist-tag-selector')) .
307 - implode("\n", $optionsAll) .
308 - Xml::closeElement('select');
 306+ 'class' => 'mw-collaborative-watchlist-tag-selector' ) ) .
 307+ implode( "\n", $optionsAll ) .
 308+ Xml::closeElement( 'select' );
309309 if ( !is_null( $label ) ) {
310310 $ret = Xml::label( $label, $elemId ) . '&nbsp;' . $ret;
311311 }
312 - foreach( $options as $rlId => $optionsRl) {
 312+ foreach ( $options as $rlId => $optionsRl ) {
313313 $ret .= Xml::openElement( 'select', array(
314314 'style' => 'display: none;',
315315 'id' => $elemId . '-' . $rlId,
316316 'name' => 'collabwatchlisttag-rl',
317 - 'class' => 'mw-collaborative-watchlist-tag-selector')) .
318 - implode("\n", $optionsRl) .
319 - Xml::closeElement('select');
 317+ 'class' => 'mw-collaborative-watchlist-tag-selector' ) ) .
 318+ implode( "\n", $optionsRl ) .
 319+ Xml::closeElement( 'select' );
320320 }
321321 $ret .= Xml::openElement( 'select', array(
322322 'style' => 'display: none;',
323323 'id' => $elemId . '-empty',
324324 'name' => 'collabwatchlisttag-rl',
325 - 'class' => 'mw-collaborative-watchlist-tag-selector')) .
326 - Xml::closeElement('select');
 325+ 'class' => 'mw-collaborative-watchlist-tag-selector' ) ) .
 326+ Xml::closeElement( 'select' );
327327
328328 return $ret;
329329 }
@@ -336,52 +336,52 @@
337337 * @return array Mapping from tag name to info
338338 */
339339 public static function getValidTagsAndInfo( $rlIds ) {
340 - if(!isset($rlIds) || empty($rlIds)) {
 340+ if ( !isset( $rlIds ) || empty( $rlIds ) ) {
341341 return array();
342342 }
343343 $dbr = wfGetDB( DB_SLAVE );
344 - $res = $dbr->select( array('collabwatchlisttag' ), # Tables
345 - array('rt_name', 'rt_description', 'rl_id'), # Fields
346 - array('rl_id' => $rlIds), # Conditions
 344+ $res = $dbr->select( array( 'collabwatchlisttag' ), # Tables
 345+ array( 'rt_name', 'rt_description', 'rl_id' ), # Fields
 346+ array( 'rl_id' => $rlIds ), # Conditions
347347 __METHOD__
348348 );
349349 $list = array();
350 - foreach( $res as $row ) {
351 - if(array_key_exists($row->rt_name, $list)) {
 350+ foreach ( $res as $row ) {
 351+ if ( array_key_exists( $row->rt_name, $list ) ) {
352352 $list[$row->rt_name]['rl_ids'][] = $row->rl_id;
353353 } else {
354 - $list[$row->rt_name] = array('rt_description' => $row->rt_description, 'rl_ids' => array($row->rl_id));
 354+ $list[$row->rt_name] = array( 'rt_description' => $row->rt_description, 'rl_ids' => array( $row->rl_id ) );
355355 }
356356 }
357357 return $list;
358358 }
359359
360 - //XXX Cache the result of this method in this class
 360+ // XXX Cache the result of this method in this class
361361 /** Get an array mapping from collab watchlist id to its name, filtering by member type
362362 * The method return only collab watchlist the given user is a member of, restricted by the allowed member types
363363 * @param int $user_id The id of the collab watchlist user
364364 * @param array $member_types A list of allowed membership types
365365 * @return array Mapping from collab watchlist id to its name
366366 */
367 - public static function getCollabWatchlistIdAndName( $user_id, $member_types = array(COLLABWATCHLISTUSER_OWNER, COLLABWATCHLISTUSER_USER) ) {
 367+ public static function getCollabWatchlistIdAndName( $user_id, $member_types = array( COLLABWATCHLISTUSER_OWNER, COLLABWATCHLISTUSER_USER ) ) {
368368 global $wgDBprefix;
369369 $dbr = wfGetDB( DB_SLAVE );
370370 $list = array();
371 - //$table, $vars, $conds='', $fname = 'Database::select', $options = array(), $join_conds = array()
372 - $res = $dbr->select( array('collabwatchlist', 'collabwatchlistuser' ), # Tables
373 - array($wgDBprefix . 'collabwatchlist.rl_id', 'rl_name'), # Fields
374 - array('rlu_type' => $member_types, $wgDBprefix . 'collabwatchlistuser.user_id' => $user_id), # Conditions
 371+ // $table, $vars, $conds='', $fname = 'Database::select', $options = array(), $join_conds = array()
 372+ $res = $dbr->select( array( 'collabwatchlist', 'collabwatchlistuser' ), # Tables
 373+ array( $wgDBprefix . 'collabwatchlist.rl_id', 'rl_name' ), # Fields
 374+ array( 'rlu_type' => $member_types, $wgDBprefix . 'collabwatchlistuser.user_id' => $user_id ), # Conditions
375375 __METHOD__, array(),
376376 # Join conditions
377 - array( 'collabwatchlistuser' => array('JOIN', $wgDBprefix . 'collabwatchlist.rl_id = ' . $wgDBprefix . 'collabwatchlistuser.rl_id') )
 377+ array( 'collabwatchlistuser' => array( 'JOIN', $wgDBprefix . 'collabwatchlist.rl_id = ' . $wgDBprefix . 'collabwatchlistuser.rl_id' ) )
378378 );
379 - foreach( $res as $row ) {
 379+ foreach ( $res as $row ) {
380380 $list[$row->rl_id] = $row->rl_name;
381381 }
382382 return $list;
383383 }
384384
385 - //XXX Copied from HistoryPage, we should patch HistoryPage to export that functionality
 385+ // XXX Copied from HistoryPage, we should patch HistoryPage to export that functionality
386386 // as a static function
387387 /**
388388 * @param Skin $skin
@@ -390,8 +390,8 @@
391391 * @param Revision $undoAfterRevision
392392 * @return String Undo Link
393393 */
394 - public static function generateUndoLink($skin, $title, $revision, $undoAfterRevision) {
395 - if( ! $revision instanceof Revision || ! $undoAfterRevision instanceof Revision ||
 394+ public static function generateUndoLink( $skin, $title, $revision, $undoAfterRevision ) {
 395+ if ( ! $revision instanceof Revision || ! $undoAfterRevision instanceof Revision ||
396396 ! $title instanceof Title || !$skin instanceof Skin )
397397 return null;
398398 # Create undo tooltip for the first (=latest) line only
Index: trunk/extensions/CollabWatchlist/includes/CollabWatchlistEditor.php
@@ -34,16 +34,16 @@
3535 */
3636 public function execute( $rlId, $listIdsAndNames, $output, $request, $mode ) {
3737 global $wgUser, $wgCollabWatchlistPermissionDeniedPage;
38 - if( wfReadOnly() ) {
 38+ if ( wfReadOnly() ) {
3939 $output->readOnlyPage();
4040 return;
4141 }
42 - if( ($mode === self::EDIT_CLEAR ||
 42+ if ( ( $mode === self::EDIT_CLEAR ||
4343 $mode === self::CATEGORIES_EDIT_RAW ||
4444 $mode === self::USERS_EDIT_RAW ||
4545 $mode === self::EDIT_NORMAL ||
4646 $mode === self::TAGS_EDIT_RAW ||
47 - $mode === self::DELETE_LIST) && (!isset($rlId) || $rlId === 0) ) {
 47+ $mode === self::DELETE_LIST ) && ( !isset( $rlId ) || $rlId === 0 ) ) {
4848 $thisTitle = SpecialPage::getTitleFor( 'CollabWatchlist' );
4949 $output->redirect( $thisTitle->getLocalURL() );
5050 return;
@@ -55,25 +55,25 @@
5656 // Pass on to the raw editor, from which it's very easy to clear.
5757 case self::CATEGORIES_EDIT_RAW:
5858 $output->setPageTitle( $listIdsAndNames[$rlId] . ' ' . wfMsg( 'collabwatchlistedit-raw-title' ) );
59 - if( $request->wasPosted() ) {
60 - if( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
 59+ if ( $request->wasPosted() ) {
 60+ if ( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
6161 $output->redirect( $permissionDeniedTarget );
6262 break;
6363 }
6464 $wanted = $this->extractCollabWatchlistCategories( $request->getText( 'titles' ) );
6565 $current = $this->getCollabWatchlistCategories( $rlId );
66 - if( count( $wanted ) > 0 ) {
 66+ if ( count( $wanted ) > 0 ) {
6767 $toWatch = array_diff( $wanted, $current );
6868 $toUnwatch = array_diff( $current, $wanted );
6969 $toWatch = $this->watchTitles( $toWatch, $rlId );
7070 $this->unwatchTitles( $toUnwatch, $rlId );
71 - if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 )
 71+ if ( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 )
7272 $output->addHTML( wfMsgExt( 'collabwatchlistedit-raw-done', 'parse' ) );
73 - if( ( $count = count( $toWatch ) ) > 0 ) {
 73+ if ( ( $count = count( $toWatch ) ) > 0 ) {
7474 $output->addHTML( wfMsgExt( 'collabwatchlistedit-raw-added', 'parse', $count ) );
7575 $this->showTitles( $toWatch, $output, $wgUser->getSkin() );
7676 }
77 - if( ( $count = count( $toUnwatch ) ) > 0 ) {
 77+ if ( ( $count = count( $toUnwatch ) ) > 0 ) {
7878 $output->addHTML( wfMsgExt( 'collabwatchlistedit-raw-removed', 'parse', $count ) );
7979 $this->showTitles( $toUnwatch, $output, $wgUser->getSkin() );
8080 }
@@ -87,36 +87,36 @@
8888 break;
8989 case self::USERS_EDIT_RAW:
9090 $output->setPageTitle( $listIdsAndNames[$rlId] . ' ' . wfMsg( 'collabwatchlistedit-users-raw-title' ) );
91 - if( $request->wasPosted() ) {
92 - if( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
 91+ if ( $request->wasPosted() ) {
 92+ if ( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
9393 $output->redirect( $permissionDeniedTarget );
9494 break;
9595 }
9696 $wanted = $this->extractCollabWatchlistUsers( $request->getText( 'titles' ) );
9797 $current = $this->getCollabWatchlistUsers( $rlId );
98 - $isOwnerCb = create_function('$a', 'return stripos($a, "' . COLLABWATCHLISTUSER_OWNER_TEXT . ' ' . '") === 0;');
99 - $wantedOwners = array_filter($wanted, $isOwnerCb);
100 - if( count( $wantedOwners ) < 1 ) {
 98+ $isOwnerCb = create_function( '$a', 'return stripos($a, "' . COLLABWATCHLISTUSER_OWNER_TEXT . ' ' . '") === 0;' );
 99+ $wantedOwners = array_filter( $wanted, $isOwnerCb );
 100+ if ( count( $wantedOwners ) < 1 ) {
101101 // Make sure there is at least one owner left
102 - $currentOwners = array_filter($current, $isOwnerCb);
103 - $reAddedOwner = current($currentOwners);
 102+ $currentOwners = array_filter( $current, $isOwnerCb );
 103+ $reAddedOwner = current( $currentOwners );
104104 $wanted[] = $reAddedOwner;
105 - list($type, $typeText, $titleText) = $this->extractTypeTypeTextAndUsername( $reAddedOwner );
 105+ list( $type, $typeText, $titleText ) = $this->extractTypeTypeTextAndUsername( $reAddedOwner );
106106 $output->addHTML( wfMsgExt( 'collabwatchlistedit-users-last-owner', 'parse' ) );
107 - $this->showTitles( array($titleText), $output, $wgUser->getSkin() );
 107+ $this->showTitles( array( $titleText ), $output, $wgUser->getSkin() );
108108 }
109 - if( count( $wanted ) > 0 ) {
 109+ if ( count( $wanted ) > 0 ) {
110110 $toAdd = array_diff( $wanted, $current );
111111 $toDel = array_diff( $current, $wanted );
112112 $toAdd = $this->addUsers( $toAdd, $rlId );
113113 $this->delUsers( $toDel, $rlId );
114 - if( count( $toAdd ) > 0 || count( $toDel ) > 0 )
 114+ if ( count( $toAdd ) > 0 || count( $toDel ) > 0 )
115115 $output->addHTML( wfMsgExt( 'collabwatchlistedit-users-raw-done', 'parse' ) );
116 - if( ( $count = count( $toAdd ) ) > 0 ) {
 116+ if ( ( $count = count( $toAdd ) ) > 0 ) {
117117 $output->addHTML( wfMsgExt( 'collabwatchlistedit-users-raw-added', 'parse', $count ) );
118118 $this->showTitles( $toAdd, $output, $wgUser->getSkin() );
119119 }
120 - if( ( $count = count( $toDel ) ) > 0 ) {
 120+ if ( ( $count = count( $toDel ) ) > 0 ) {
121121 $output->addHTML( wfMsgExt( 'collabwatchlistedit-users-raw-removed', 'parse', $count ) );
122122 $this->showTitles( $toDel, $output, $wgUser->getSkin() );
123123 }
@@ -130,25 +130,25 @@
131131 break;
132132 case self::TAGS_EDIT_RAW:
133133 $output->setPageTitle( $listIdsAndNames[$rlId] . ' ' . wfMsg( 'collabwatchlistedit-tags-raw-title' ) );
134 - if( $request->wasPosted() ) {
135 - if( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
 134+ if ( $request->wasPosted() ) {
 135+ if ( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
136136 $output->redirect( $permissionDeniedTarget );
137137 break;
138138 }
139139 $wanted = $this->extractCollabWatchlistTags( $request->getText( 'titles' ) );
140140 $current = $this->getCollabWatchlistTags( $rlId );
141 - if( count( $wanted ) > 0 ) {
 141+ if ( count( $wanted ) > 0 ) {
142142 $newTags = array_diff_assoc( $wanted, $current );
143143 $removeTags = array_diff_assoc( $current, $wanted );
144 - $this->removeTags( array_keys($removeTags), $rlId );
 144+ $this->removeTags( array_keys( $removeTags ), $rlId );
145145 $this->addTags( $newTags, $rlId );
146 - if( count( $newTags ) > 0 || count( $removeTags ) > 0 )
 146+ if ( count( $newTags ) > 0 || count( $removeTags ) > 0 )
147147 $output->addHTML( wfMsgExt( 'collabwatchlistedit-tags-raw-done', 'parse' ) );
148 - if( ( $count = count( $newTags ) ) > 0 ) {
 148+ if ( ( $count = count( $newTags ) ) > 0 ) {
149149 $output->addHTML( wfMsgExt( 'collabwatchlistedit-tags-raw-added', 'parse', $count ) );
150150 $this->showTagList( $newTags, $output, $wgUser->getSkin() );
151151 }
152 - if( ( $count = count( $removeTags ) ) > 0 ) {
 152+ if ( ( $count = count( $removeTags ) ) > 0 ) {
153153 $output->addHTML( wfMsgExt( 'collabwatchlistedit-tags-raw-removed', 'parse', $count ) );
154154 $this->showTagList( $removeTags, $output, $wgUser->getSkin() );
155155 }
@@ -162,8 +162,8 @@
163163 break;
164164 case self::EDIT_NORMAL:
165165 $output->setPageTitle( $listIdsAndNames[$rlId] . ' ' . wfMsg( 'collabwatchlistedit-normal-title' ) );
166 - if( $request->wasPosted() ) {
167 - if( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
 166+ if ( $request->wasPosted() ) {
 167+ if ( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
168168 $output->redirect( $permissionDeniedTarget );
169169 break;
170170 }
@@ -177,26 +177,26 @@
178178 break;
179179 case self::SET_TAGS:
180180 $redirTarget = SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl();
181 - if( $request->wasPosted() ) {
182 - $rlId = $request->getInt('collabwatchlist', -1);
183 - if( ! $this->checkPermissions( $wgUser, $rlId, array(COLLABWATCHLISTUSER_USER, COLLABWATCHLISTUSER_OWNER) ) ) {
 181+ if ( $request->wasPosted() ) {
 182+ $rlId = $request->getInt( 'collabwatchlist', -1 );
 183+ if ( ! $this->checkPermissions( $wgUser, $rlId, array( COLLABWATCHLISTUSER_USER, COLLABWATCHLISTUSER_OWNER ) ) ) {
184184 $output->redirect( $permissionDeniedTarget );
185185 break;
186186 }
187 - $redirTarget = $request->getText('redirTarget', $redirTarget);
188 - $tagToAdd = $request->getText('collabwatchlisttag');
189 - $tagcomment = $request->getText('tagcomment');
190 - $setPatrolled = $request->getBool('setpatrolled', false);
 187+ $redirTarget = $request->getText( 'redirTarget', $redirTarget );
 188+ $tagToAdd = $request->getText( 'collabwatchlisttag' );
 189+ $tagcomment = $request->getText( 'tagcomment' );
 190+ $setPatrolled = $request->getBool( 'setpatrolled', false );
191191 $pagesToTag = array();
192 - if( strlen($tagToAdd) !== 0 && $rlId !== -1 ) {
 192+ if ( strlen( $tagToAdd ) !== 0 && $rlId !== -1 ) {
193193 $postValues = $request->getValues();
194 - foreach( $postValues as $key => $value ) {
195 - if( stripos($key, 'collaborative-watchlist-addtag-') === 0 ) {
196 - $pageRevRcId = explode('|', $value);
197 - if( count($pageRevRcId) < 3 ) {
 194+ foreach ( $postValues as $key => $value ) {
 195+ if ( stripos( $key, 'collaborative-watchlist-addtag-' ) === 0 ) {
 196+ $pageRevRcId = explode( '|', $value );
 197+ if ( count( $pageRevRcId ) < 3 ) {
198198 continue;
199199 }
200 - $pagesToTag[$pageRevRcId[0]][] = array('rev_id' => $pageRevRcId[1], 'rc_id' => $pageRevRcId[2]);
 200+ $pagesToTag[$pageRevRcId[0]][] = array( 'rev_id' => $pageRevRcId[1], 'rc_id' => $pageRevRcId[2] );
201201 }
202202 }
203203 $this->setTags( $pagesToTag, $tagToAdd, $wgUser->getId(), $rlId, $tagcomment, $setPatrolled );
@@ -205,48 +205,48 @@
206206 $output->redirect( $redirTarget );
207207 break;
208208 case self::UNSET_TAGS:
209 - $rlId = $request->getInt('collabwatchlist', -1);
210 - if( ! $this->checkPermissions( $wgUser, $rlId, array(COLLABWATCHLISTUSER_USER, COLLABWATCHLISTUSER_OWNER) ) ) {
 209+ $rlId = $request->getInt( 'collabwatchlist', -1 );
 210+ if ( ! $this->checkPermissions( $wgUser, $rlId, array( COLLABWATCHLISTUSER_USER, COLLABWATCHLISTUSER_OWNER ) ) ) {
211211 $output->redirect( $permissionDeniedTarget );
212212 break;
213213 }
214214 $redirTarget = SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl();
215 - $redirTarget = $request->getText('redirTarget', $redirTarget);
216 - $page = $request->getText('collabwatchlistpage');
217 - $tagToDel = $request->getText('collabwatchlisttag');
218 - $rcId = $request->getInt('collabwatchlistrcid', -1);
219 - if( strlen($page) !== 0 && strlen($tagToDel) !== 0 && $rlId !== -1 && $rcId !== -1 ) {
220 - $pagesToUntag[$page][] = array('rc_id' => $rcId);
 215+ $redirTarget = $request->getText( 'redirTarget', $redirTarget );
 216+ $page = $request->getText( 'collabwatchlistpage' );
 217+ $tagToDel = $request->getText( 'collabwatchlisttag' );
 218+ $rcId = $request->getInt( 'collabwatchlistrcid', -1 );
 219+ if ( strlen( $page ) !== 0 && strlen( $tagToDel ) !== 0 && $rlId !== -1 && $rcId !== -1 ) {
 220+ $pagesToUntag[$page][] = array( 'rc_id' => $rcId );
221221 $this->unsetTags( $pagesToUntag, $tagToDel, $wgUser->getId(), $rlId );
222222 }
223223 $output->redirect( $redirTarget );
224224 break;
225225 case self::NEW_LIST:
226 - if( $request->wasPosted() ) {
 226+ if ( $request->wasPosted() ) {
227227 $redirTarget = SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl();
228 - $listId = $this->createNewList($request->getText('listname'));
229 - if( isset($listId) ) {
 228+ $listId = $this->createNewList( $request->getText( 'listname' ) );
 229+ if ( isset( $listId ) ) {
230230 $output->redirect( $redirTarget );
231231 } else {
232232 $output->addHTML( wfMsgExt( 'collabwatchlistnew-name-exists', 'parse' ) );
233233 }
234234 } else {
235 - $this->showNewListForm($output);
 235+ $this->showNewListForm( $output );
236236 }
237237 break;
238238 case self::DELETE_LIST:
239239 $output->setPageTitle( $listIdsAndNames[$rlId] . ' ' . wfMsg( 'collabwatchlistdelete-title' ) );
240 - $rlId = $request->getInt('collabwatchlist', -1);
241 - if( $request->wasPosted() ) {
242 - if( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
 240+ $rlId = $request->getInt( 'collabwatchlist', -1 );
 241+ if ( $request->wasPosted() ) {
 242+ if ( ! $this->checkToken( $request, $wgUser, $rlId ) ) {
243243 $output->redirect( $permissionDeniedTarget );
244244 break;
245245 }
246 - $this->deleteList($rlId);
 246+ $this->deleteList( $rlId );
247247 $redirTarget = SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl();
248248 $output->redirect( $redirTarget );
249249 } else {
250 - $this->showDeleteListForm($output, $rlId);
 250+ $this->showDeleteListForm( $output, $rlId );
251251 }
252252 break;
253253 }
@@ -261,14 +261,14 @@
262262 * @param $memberTypes Which types of members are allowed
263263 * @return bool
264264 */
265 - private function checkToken( $request, $user, $rlId, $memberTypes = array(COLLABWATCHLISTUSER_OWNER) ) {
 265+ private function checkToken( $request, $user, $rlId, $memberTypes = array( COLLABWATCHLISTUSER_OWNER ) ) {
266266 $tokenOk = $user->matchEditToken( $request->getVal( 'token' ), 'watchlistedit' ) && $request->getVal( 'collabwatchlist' ) !== 0;
267 - if( $tokenOk === false )
 267+ if ( $tokenOk === false )
268268 return $tokenOk;
269269 return $this->checkPermissions( $user, $rlId, $memberTypes );
270270 }
271271
272 - private function checkPermissions( $user, $rlId, $memberTypes = array(COLLABWATCHLISTUSER_OWNER) ) {
 272+ private function checkPermissions( $user, $rlId, $memberTypes = array( COLLABWATCHLISTUSER_OWNER ) ) {
273273 // Check permissions
274274 $dbr = wfGetDB( DB_MASTER );
275275 $res = $dbr->select( 'collabwatchlistuser',
@@ -289,22 +289,22 @@
290290 */
291291 private function extractCollabWatchlistCategories( $list ) {
292292 $titles = array();
293 - if( !is_array( $list ) ) {
 293+ if ( !is_array( $list ) ) {
294294 $list = explode( "\n", trim( $list ) );
295 - if( !is_array( $list ) )
 295+ if ( !is_array( $list ) )
296296 return array();
297297 }
298 - foreach( $list as $text ) {
 298+ foreach ( $list as $text ) {
299299 $subtract = false;
300300 $text = trim( $text );
301301 $titleText = $text;
302 - if( stripos($text, '- ') === 0 ) {
 302+ if ( stripos( $text, '- ' ) === 0 ) {
303303 $subtract = true;
304 - $titleText = trim( substr($text, 2) );
 304+ $titleText = trim( substr( $text, 2 ) );
305305 }
306 - if( strlen( $text ) > 0 ) {
 306+ if ( strlen( $text ) > 0 ) {
307307 $title = Title::newFromText( $titleText );
308 - if( $title instanceof Title && $title->isWatchable() ) {
 308+ if ( $title instanceof Title && $title->isWatchable() ) {
309309 $titles[] = $subtract ? '- ' . $title->getPrefixedText() : $title->getPrefixedText();
310310 }
311311 }
@@ -317,20 +317,20 @@
318318 $typeText = COLLABWATCHLISTUSER_USER_TEXT;
319319 $text = trim( $typeAndUsernameStr );
320320 $titleText = $text;
321 - if( stripos($text, COLLABWATCHLISTUSER_OWNER_TEXT . ' ') === 0 ) {
 321+ if ( stripos( $text, COLLABWATCHLISTUSER_OWNER_TEXT . ' ' ) === 0 ) {
322322 $type = COLLABWATCHLISTUSER_OWNER;
323323 $typeText = COLLABWATCHLISTUSER_OWNER_TEXT;
324 - $titleText = trim( substr($text, strlen(COLLABWATCHLISTUSER_OWNER_TEXT . ' ')) );
325 - }else if( stripos($text, COLLABWATCHLISTUSER_USER_TEXT . ' ') === 0 ) {
 324+ $titleText = trim( substr( $text, strlen( COLLABWATCHLISTUSER_OWNER_TEXT . ' ' ) ) );
 325+ } else if ( stripos( $text, COLLABWATCHLISTUSER_USER_TEXT . ' ' ) === 0 ) {
326326 $type = COLLABWATCHLISTUSER_USER;
327327 $typeText = COLLABWATCHLISTUSER_USER_TEXT;
328 - $titleText = trim( substr($text, strlen(COLLABWATCHLISTUSER_USER_TEXT . ' ')) );
329 - }else if( stripos($text, COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT . ' ') === 0 ) {
 328+ $titleText = trim( substr( $text, strlen( COLLABWATCHLISTUSER_USER_TEXT . ' ' ) ) );
 329+ } else if ( stripos( $text, COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT . ' ' ) === 0 ) {
330330 $type = COLLABWATCHLISTUSER_TRUSTED_EDITOR;
331331 $typeText = COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT;
332 - $titleText = trim( substr($text, strlen(COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT . ' ')) );
 332+ $titleText = trim( substr( $text, strlen( COLLABWATCHLISTUSER_TRUSTED_EDITOR_TEXT . ' ' ) ) );
333333 }
334 - return array($type, $typeText, $titleText);
 334+ return array( $type, $typeText, $titleText );
335335 }
336336
337337 /**
@@ -342,16 +342,16 @@
343343 */
344344 private function extractCollabWatchlistUsers( $list ) {
345345 $titles = array();
346 - if( !is_array( $list ) ) {
 346+ if ( !is_array( $list ) ) {
347347 $list = explode( "\n", trim( $list ) );
348 - if( !is_array( $list ) )
 348+ if ( !is_array( $list ) )
349349 return array();
350350 }
351 - foreach( $list as $text ) {
352 - list($type, $typeText, $titleText) = $this->extractTypeTypeTextAndUsername( $text );
353 - if( strlen( $text ) > 0 ) {
354 - $user = User::newFromName($titleText);
355 - if( $user instanceof User ) {
 351+ foreach ( $list as $text ) {
 352+ list( $type, $typeText, $titleText ) = $this->extractTypeTypeTextAndUsername( $text );
 353+ if ( strlen( $text ) > 0 ) {
 354+ $user = User::newFromName( $titleText );
 355+ if ( $user instanceof User ) {
356356 $titles[] = $typeText . ' ' . $user->getName();
357357 }
358358 }
@@ -368,21 +368,21 @@
369369 */
370370 private function extractCollabWatchlistTags( $list ) {
371371 $tags = array();
372 - if( !is_array( $list ) ) {
 372+ if ( !is_array( $list ) ) {
373373 $list = explode( "\n", trim( $list ) );
374 - if( !is_array( $list ) )
 374+ if ( !is_array( $list ) )
375375 return array();
376376 }
377 - foreach( $list as $text ) {
 377+ foreach ( $list as $text ) {
378378 $subtract = false;
379 - $text = trim($text);
380 - if( strlen( $text ) > 0 ) {
381 - $pipepos = stripos($text, '|');
 379+ $text = trim( $text );
 380+ if ( strlen( $text ) > 0 ) {
 381+ $pipepos = stripos( $text, '|' );
382382 $description = '';
383 - if( $pipepos > 0 ) {
384 - if( ($pipepos + 1) < strlen($text) )
385 - $description = trim(substr($text, $pipepos + 1));
386 - $text = trim(substr($text, 0, $pipepos));
 383+ if ( $pipepos > 0 ) {
 384+ if ( ( $pipepos + 1 ) < strlen( $text ) )
 385+ $description = trim( substr( $text, $pipepos + 1 ) );
 386+ $text = trim( substr( $text, 0, $pipepos ) );
387387 }
388388 $tags[$text] = $description;
389389 }
@@ -404,10 +404,10 @@
405405 $talk = wfMsgHtml( 'talkpagelinktext' );
406406 // Do a batch existence check
407407 $batch = new LinkBatch();
408 - foreach( $titles as $title ) {
409 - if( !$title instanceof Title )
 408+ foreach ( $titles as $title ) {
 409+ if ( !$title instanceof Title )
410410 $title = Title::newFromText( $title );
411 - if( $title instanceof Title ) {
 411+ if ( $title instanceof Title ) {
412412 $batch->addObj( $title );
413413 $batch->addObj( $title->getTalkPage() );
414414 }
@@ -415,10 +415,10 @@
416416 $batch->execute();
417417 // Print out the list
418418 $output->addHTML( "<ul>\n" );
419 - foreach( $titles as $title ) {
420 - if( !$title instanceof Title )
 419+ foreach ( $titles as $title ) {
 420+ if ( !$title instanceof Title )
421421 $title = Title::newFromText( $title );
422 - if( $title instanceof Title ) {
 422+ if ( $title instanceof Title ) {
423423 $output->addHTML( "<li>" . $skin->link( $title )
424424 . ' (' . $skin->link( $title->getTalkPage(), $talk ) . ")</li>\n" );
425425 }
@@ -439,7 +439,7 @@
440440 private function showTagList( $tagsAndDesc, $output, $skin ) {
441441 // Print out the list
442442 $output->addHTML( "<ul>\n" );
443 - foreach( $tagsAndDesc as $title => $description ) {
 443+ foreach ( $tagsAndDesc as $title => $description ) {
444444 $output->addHTML( "<li>" . $title
445445 . ' (' . $description . ")</li>\n" );
446446 }
@@ -509,19 +509,19 @@
510510 $list = array();
511511 $dbr = wfGetDB( DB_MASTER );
512512 $res = $dbr->select(
513 - array('collabwatchlistcategory', 'page'),
514 - array('page_title', 'page_namespace', 'subtract'),
 513+ array( 'collabwatchlistcategory', 'page' ),
 514+ array( 'page_title', 'page_namespace', 'subtract' ),
515515 array(
516516 'rl_id' => $rlId,
517517 ),
518518 __METHOD__, array(),
519519 # Join conditions
520 - array( 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
 520+ array( 'page' => array( 'JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id' ) )
521521 );
522 - if( $res->numRows() > 0 ) {
523 - foreach( $res as $row ) {
 522+ if ( $res->numRows() > 0 ) {
 523+ foreach ( $res as $row ) {
524524 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
525 - if( $title instanceof Title && !$title->isTalkPage() )
 525+ if ( $title instanceof Title && !$title->isTalkPage() )
526526 $list[] = $row->subtract ? '- ' . $title->getPrefixedText() : $title->getPrefixedText();
527527 }
528528 }
@@ -539,18 +539,18 @@
540540 $list = array();
541541 $dbr = wfGetDB( DB_MASTER );
542542 $res = $dbr->select(
543 - array('collabwatchlistuser', 'user'),
544 - array('user_name', 'rlu_type'),
 543+ array( 'collabwatchlistuser', 'user' ),
 544+ array( 'user_name', 'rlu_type' ),
545545 array(
546546 'rl_id' => $rlId,
547547 ),
548548 __METHOD__, array(),
549549 # Join conditions
550 - array( 'user' => array('JOIN', 'user.user_id = collabwatchlistuser.user_id') )
 550+ array( 'user' => array( 'JOIN', 'user.user_id = collabwatchlistuser.user_id' ) )
551551 );
552 - if( $res->numRows() > 0 ) {
553 - foreach( $res as $row ) {
554 - $typeText = fnCollabWatchlistUserTypeToText($row->rlu_type);
 552+ if ( $res->numRows() > 0 ) {
 553+ foreach ( $res as $row ) {
 554+ $typeText = fnCollabWatchlistUserTypeToText( $row->rlu_type );
555555 $list[] = $typeText . ' ' . $row->user_name;
556556 }
557557 }
@@ -568,14 +568,14 @@
569569 $list = array();
570570 $dbr = wfGetDB( DB_MASTER );
571571 $res = $dbr->select(
572 - array('collabwatchlisttag'),
573 - array('rt_name', 'rt_description'),
 572+ array( 'collabwatchlisttag' ),
 573+ array( 'rt_name', 'rt_description' ),
574574 array(
575575 'rl_id' => $rlId,
576576 ), __METHOD__
577577 );
578 - if( $res->numRows() > 0 ) {
579 - foreach( $res as $row ) {
 578+ if ( $res->numRows() > 0 ) {
 579+ foreach ( $res as $row ) {
580580 $list[$row->rt_name] = $row->rt_description;
581581 }
582582 }
@@ -595,30 +595,30 @@
596596 $dbr = wfGetDB( DB_MASTER );
597597
598598 $res = $dbr->select(
599 - array('collabwatchlistcategory', 'page'),
600 - array('page_title', 'page_namespace', 'page_id', 'page_len', 'page_is_redirect', 'subtract'),
 599+ array( 'collabwatchlistcategory', 'page' ),
 600+ array( 'page_title', 'page_namespace', 'page_id', 'page_len', 'page_is_redirect', 'subtract' ),
601601 array(
602602 'rl_id' => $rlId,
603603 ),
604604 __METHOD__, array(),
605605 # Join conditions
606 - array( 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
 606+ array( 'page' => array( 'JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id' ) )
607607 );
608608
609 - if( $res && $dbr->numRows( $res ) > 0 ) {
 609+ if ( $res && $dbr->numRows( $res ) > 0 ) {
610610 $cache = LinkCache::singleton();
611 - foreach( $res as $row ) {
 611+ foreach ( $res as $row ) {
612612 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
613 - if( $title instanceof Title ) {
 613+ if ( $title instanceof Title ) {
614614 // Update the link cache while we're at it
615 - if( $row->page_id ) {
 615+ if ( $row->page_id ) {
616616 $cache->addGoodLinkObj( $row->page_id, $title, $row->page_len, $row->page_is_redirect );
617617 } else {
618618 $cache->addBadLinkObj( $title );
619619 }
620620 // Ignore non-talk
621 - if( !$title->isTalkPage() )
622 - $titles[$row->page_namespace][$row->page_title] = array('redirect' => $row->page_is_redirect, 'subtract' => $row->subtract);
 621+ if ( !$title->isTalkPage() )
 622+ $titles[$row->page_namespace][$row->page_title] = array( 'redirect' => $row->page_is_redirect, 'subtract' => $row->subtract );
623623 }
624624 }
625625 }
@@ -634,7 +634,7 @@
635635 * @return int
636636 */
637637 private function showItemCount( $output, $rlId ) {
638 - if( ( $count = $this->countCollabWatchlistCategories( $rlId ) ) > 0 ) {
 638+ if ( ( $count = $this->countCollabWatchlistCategories( $rlId ) ) > 0 ) {
639639 $output->addHTML( wfMsgExt( 'collabwatchlistedit-numitems', 'parse',
640640 $GLOBALS['wgLang']->formatNum( $count ) ) );
641641 } else {
@@ -652,7 +652,7 @@
653653 * @return int
654654 */
655655 private function showTagItemCount( $output, $rlId ) {
656 - if( ( $count = $this->countCollabWatchlistTags( $rlId ) ) > 0 ) {
 656+ if ( ( $count = $this->countCollabWatchlistTags( $rlId ) ) > 0 ) {
657657 $output->addHTML( wfMsgExt( 'collabwatchlistedit-tags-numitems', 'parse',
658658 $GLOBALS['wgLang']->formatNum( $count ) ) );
659659 } else {
@@ -670,7 +670,7 @@
671671 * @return int
672672 */
673673 private function showSetTagsItemCount( $output, $rlId ) {
674 - if( ( $count = $this->countCollabWatchlistSetTags( $rlId ) ) > 0 ) {
 674+ if ( ( $count = $this->countCollabWatchlistSetTags( $rlId ) ) > 0 ) {
675675 $output->addHTML( wfMsgExt( 'collabwatchlistedit-set-tags-numitems', 'parse',
676676 $GLOBALS['wgLang']->formatNum( $count ) ) );
677677 } else {
@@ -688,7 +688,7 @@
689689 * @return int
690690 */
691691 private function showUserItemCount( $output, $rlId ) {
692 - if( ( $count = $this->countCollabWatchlistUsers( $rlId ) ) > 0 ) {
 692+ if ( ( $count = $this->countCollabWatchlistUsers( $rlId ) ) > 0 ) {
693693 $output->addHTML( wfMsgExt( 'collabwatchlistedit-users-numitems', 'parse',
694694 $GLOBALS['wgLang']->formatNum( $count ) ) );
695695 } else {
@@ -720,16 +720,16 @@
721721 $dbw = wfGetDB( DB_MASTER );
722722 $rows = array();
723723 $added = array();
724 - foreach( $titles as $title ) {
 724+ foreach ( $titles as $title ) {
725725 $subtract = false;
726726 $title = trim( $title );
727727 $titleText = $title;
728 - if( stripos($title, '- ') === 0 ) {
 728+ if ( stripos( $title, '- ' ) === 0 ) {
729729 $subtract = true;
730 - $titleText = trim( substr($title, 2) );
 730+ $titleText = trim( substr( $title, 2 ) );
731731 }
732732 $titleObj = Title::newFromText( $titleText );
733 - if( $titleObj instanceof Title && $titleObj->exists() ) {
 733+ if ( $titleObj instanceof Title && $titleObj->exists() ) {
734734 $rows[] = array(
735735 'rl_id' => $rlId,
736736 'cat_page_id' => $titleObj->getArticleID(),
@@ -754,10 +754,10 @@
755755 $dbw = wfGetDB( DB_MASTER );
756756 $rows = array();
757757 $added = array();
758 - foreach( $users as $userString ) {
759 - list($type, $typeText, $titleText) = $this->extractTypeTypeTextAndUsername( $userString );
760 - $user = User::newFromName($titleText);
761 - if( $user instanceof User && $user->getId() !== 0) {
 758+ foreach ( $users as $userString ) {
 759+ list( $type, $typeText, $titleText ) = $this->extractTypeTypeTextAndUsername( $userString );
 760+ $user = User::newFromName( $titleText );
 761+ if ( $user instanceof User && $user->getId() !== 0 ) {
762762 $rows[] = array(
763763 'rl_id' => $rlId,
764764 'user_id' => $user->getId(),
@@ -770,48 +770,48 @@
771771 return $added;
772772 }
773773
774 - private function setTags( $titlesAndTagInfo, $tag, $userId, $rlId, $comment, $setPatrolled = false) {
775 - //XXX Attach a hook to delete tags from the collabwatchlistrevisiontag table as soon as the actual tags are deleted from the change_tags table
776 - $allowedTagsAndInfo = $this->getCollabWatchlistTags($rlId);
777 - if(!array_key_exists($tag, $allowedTagsAndInfo)) {
 774+ private function setTags( $titlesAndTagInfo, $tag, $userId, $rlId, $comment, $setPatrolled = false ) {
 775+ // XXX Attach a hook to delete tags from the collabwatchlistrevisiontag table as soon as the actual tags are deleted from the change_tags table
 776+ $allowedTagsAndInfo = $this->getCollabWatchlistTags( $rlId );
 777+ if ( !array_key_exists( $tag, $allowedTagsAndInfo ) ) {
778778 return false;
779779 }
780780 $dbw = wfGetDB( DB_MASTER );
781 - foreach( $titlesAndTagInfo as $title => $infos ) {
 781+ foreach ( $titlesAndTagInfo as $title => $infos ) {
782782 $rcIds = array();
783783 // Add entries for the tag to the change_tags table
784784 // optionally mark edit as patrolled
785 - foreach( $infos as $infoKey => $info ) {
786 - ChangeTags::addTags($tag, $info['rc_id'], $info['rev_id']);
 785+ foreach ( $infos as $infoKey => $info ) {
 786+ ChangeTags::addTags( $tag, $info['rc_id'], $info['rev_id'] );
787787 $rcIds[] = $info['rc_id'];
788 - if( $setPatrolled ) {
789 - RecentChange::markPatrolled($info['rc_id']);
 788+ if ( $setPatrolled ) {
 789+ RecentChange::markPatrolled( $info['rc_id'] );
790790 }
791791 }
792792 // Add the tagged revisions to the collaborative watchlist
793793 $sql = 'INSERT IGNORE INTO collabwatchlistrevisiontag (ct_id, rl_id, user_id, rrt_comment)
794 - SELECT ct_id, ' . $dbw->strencode($rlId) . ',' .
795 - $dbw->strencode($userId) . ',' .
796 - $dbw->addQuotes($comment) . ' FROM change_tag WHERE ct_tag = ? AND ct_rc_id ';
797 - if( count($rcIds) > 1 ) {
798 - $sql .= 'IN (' . $dbw->makeList($rcIds) . ')';
 794+ SELECT ct_id, ' . $dbw->strencode( $rlId ) . ',' .
 795+ $dbw->strencode( $userId ) . ',' .
 796+ $dbw->addQuotes( $comment ) . ' FROM change_tag WHERE ct_tag = ? AND ct_rc_id ';
 797+ if ( count( $rcIds ) > 1 ) {
 798+ $sql .= 'IN (' . $dbw->makeList( $rcIds ) . ')';
799799 $params = array( $tag );
800 - }else {
 800+ } else {
801801 $sql .= '= ?';
802802 $params = array( $tag, $rcIds[0] );
803803 }
804 - $prepSql = $dbw->prepare($sql);
805 - $res = $dbw->execute($prepSql, $params);
806 - $dbw->freePrepared($prepSql);
 804+ $prepSql = $dbw->prepare( $sql );
 805+ $res = $dbw->execute( $prepSql, $params );
 806+ $dbw->freePrepared( $prepSql );
807807 return true;
808808 }
809809 }
810810
811811 private function unsetTags( $titlesAndTagInfo, $tag, $userId, $rlId ) {
812812 $dbw = wfGetDB( DB_MASTER );
813 - foreach( $titlesAndTagInfo as $title => $infos ) {
 813+ foreach ( $titlesAndTagInfo as $title => $infos ) {
814814 $rcIds = array();
815 - foreach( $infos as $infoKey => $info ) {
 815+ foreach ( $infos as $infoKey => $info ) {
816816 // XXX Remove entries for the tag from the change_tags table
817817 // ChangeTags::addTags($tag, $info['rc_id'], $info['rev_id']);
818818 $rcIds[] = $info['rc_id'];
@@ -820,16 +820,16 @@
821821 $sql = 'delete collabwatchlistrevisiontag from collabwatchlistrevisiontag JOIN change_tag
822822 ON change_tag.ct_id = collabwatchlistrevisiontag.ct_id
823823 WHERE ct_tag = ? AND ct_rc_id ';
824 - if( count($rcIds) > 1 ) {
825 - $sql .= 'IN (' . $dbw->makeList($rcIds) . ')';
 824+ if ( count( $rcIds ) > 1 ) {
 825+ $sql .= 'IN (' . $dbw->makeList( $rcIds ) . ')';
826826 $params = array( $tag );
827 - }else {
 827+ } else {
828828 $sql .= '= ?';
829829 $params = array( $tag, $rcIds[0] );
830830 }
831 - $prepSql = $dbw->prepare($sql);
832 - $res = $dbw->execute($prepSql, $params);
833 - $dbw->freePrepared($prepSql);
 831+ $prepSql = $dbw->prepare( $sql );
 832+ $res = $dbw->execute( $prepSql, $params );
 833+ $dbw->freePrepared( $prepSql );
834834 }
835835 }
836836
@@ -844,7 +844,7 @@
845845 private function addTags( $titles, $rlId ) {
846846 $dbw = wfGetDB( DB_MASTER );
847847 $rows = array();
848 - foreach( $titles as $title => $description ) {
 848+ foreach ( $titles as $title => $description ) {
849849 $rows[] = array(
850850 'rl_id' => $rlId,
851851 'rt_name' => $title,
@@ -865,16 +865,16 @@
866866 */
867867 private function unwatchTitles( $titles, $rlId ) {
868868 $dbw = wfGetDB( DB_MASTER );
869 - foreach( $titles as $title ) {
 869+ foreach ( $titles as $title ) {
870870 $subtract = false;
871871 $title = trim( $title );
872872 $titleText = $title;
873 - if( stripos($title, '- ') === 0 ) {
 873+ if ( stripos( $title, '- ' ) === 0 ) {
874874 $subtract = true;
875 - $titleText = trim( substr($title, 2) );
 875+ $titleText = trim( substr( $title, 2 ) );
876876 }
877877 $title = Title::newFromText( $titleText );
878 - if( $title instanceof Title ) {
 878+ if ( $title instanceof Title ) {
879879 $dbw->delete(
880880 'collabwatchlistcategory',
881881 array(
@@ -884,9 +884,9 @@
885885 ),
886886 __METHOD__
887887 );
888 - $article = new Article($title);
889 - //XXX Check if we can simply rename the hook, or if we need to register it
890 - wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
 888+ $article = new Article( $title );
 889+ // XXX Check if we can simply rename the hook, or if we need to register it
 890+ wfRunHooks( 'UnwatchArticleComplete', array( &$user, &$article ) );
891891 }
892892 }
893893 }
@@ -901,10 +901,10 @@
902902 */
903903 private function delUsers( $users, $rlId ) {
904904 $dbw = wfGetDB( DB_MASTER );
905 - foreach( $users as $userString ) {
906 - list($type, $typeText, $titleText) = $this->extractTypeTypeTextAndUsername( $userString );
907 - $user = User::newFromName($titleText);
908 - if( $user instanceof User && $user->getId() !== 0) {
 905+ foreach ( $users as $userString ) {
 906+ list( $type, $typeText, $titleText ) = $this->extractTypeTypeTextAndUsername( $userString );
 907+ $user = User::newFromName( $titleText );
 908+ if ( $user instanceof User && $user->getId() !== 0 ) {
909909 $dbw->delete(
910910 'collabwatchlistuser',
911911 array(
@@ -916,8 +916,8 @@
917917 );
918918 }
919919 }
920 - //XXX Check if we can simply rename the hook, or if we need to register it
921 - //wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
 920+ // XXX Check if we can simply rename the hook, or if we need to register it
 921+ // wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
922922 }
923923
924924 /**
@@ -930,7 +930,7 @@
931931 */
932932 private function removeTags( $titles, $rlId ) {
933933 $dbw = wfGetDB( DB_MASTER );
934 - foreach( $titles as $title ) {
 934+ foreach ( $titles as $title ) {
935935 $dbw->delete(
936936 'collabwatchlisttag',
937937 array(
@@ -939,9 +939,9 @@
940940 ),
941941 __METHOD__
942942 );
943 - //$article = new Article($title);
944 - //XXX Check if we can simply rename the hook, or if we need to register it
945 - //wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
 943+ // $article = new Article($title);
 944+ // XXX Check if we can simply rename the hook, or if we need to register it
 945+ // wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
946946 }
947947 }
948948
@@ -953,7 +953,7 @@
954954 */
955955 private function showNormalForm( $output, $rlId ) {
956956 global $wgUser;
957 - if( ( $count = $this->showItemCount( $output, $rlId ) ) > 0 ) {
 957+ if ( ( $count = $this->showItemCount( $output, $rlId ) ) > 0 ) {
958958 $self = SpecialPage::getTitleFor( 'CollabWatchlist' );
959959 $form = Xml::openElement( 'form', array( 'method' => 'post',
960960 'action' => $self->getLocalUrl( array( 'action' => 'edit' ) ) ) );
@@ -976,7 +976,7 @@
977977 $form .= Html::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) );
978978 $form .= "<fieldset>\n<legend>" . wfMsgHtml( 'collabwatchlistnew-legend' ) . "</legend>";
979979 $form .= wfMsgExt( 'collabwatchlistnew-explain', 'parse' );
980 - $form .= Xml::label( wfMsg('collabwatchlistnew-name'), 'listname' ) . '&nbsp;' . Xml::input( 'listname' ) . '&nbsp;';
 980+ $form .= Xml::label( wfMsg( 'collabwatchlistnew-name' ), 'listname' ) . '&nbsp;' . Xml::input( 'listname' ) . '&nbsp;';
981981 $form .= '<p>' . Xml::submitButton( wfMsg( 'collabwatchlistnew-submit' ) ) . '</p>';
982982 $form .= '</fieldset></form>';
983983 $output->addHTML( $form );
@@ -991,16 +991,16 @@
992992 $form .= Html::hidden( 'collabwatchlist', $rlId );
993993 $form .= "<fieldset>\n<legend>" . wfMsgHtml( 'collabwatchlistdelete-legend' ) . "</legend>";
994994 $form .= wfMsgExt( 'collabwatchlistdelete-explain', 'parse' );
995 - $this->showUserItemCount($output, $rlId);
996 - $this->showSetTagsItemCount($output, $rlId);
 995+ $this->showUserItemCount( $output, $rlId );
 996+ $this->showSetTagsItemCount( $output, $rlId );
997997 $form .= '<p>' . Xml::submitButton( wfMsg( 'collabwatchlistdelete-submit' ) ) . '</p>';
998998 $form .= '</fieldset></form>';
999999 $output->addHTML( $form );
10001000 }
10011001
1002 - private function createNewList($name) {
 1002+ private function createNewList( $name ) {
10031003 global $wgUser;
1004 - if( !isset($name) || empty($name) )
 1004+ if ( !isset( $name ) || empty( $name ) )
10051005 return;
10061006 $dbw = wfGetDB( DB_MASTER );
10071007 $dbw->begin();
@@ -1009,13 +1009,13 @@
10101010 $dbw->insert( 'collabwatchlist', array(
10111011 'rl_id' => $rl_id,
10121012 'rl_name' => $name,
1013 - 'rl_start' => wfTimestamp(TS_ISO_8601),
 1013+ 'rl_start' => wfTimestamp( TS_ISO_8601 ),
10141014 ), __METHOD__, 'IGNORE' );
10151015
10161016 $affected = $dbw->affectedRows();
1017 - if( $affected ) {
 1017+ if ( $affected ) {
10181018 $newid = $dbw->insertId();
1019 - }else {
 1019+ } else {
10201020 return;
10211021 }
10221022 $rlu_id = $dbw->nextSequenceValue( 'collabwatchlistuser_rlu_id_seq' );
@@ -1026,19 +1026,19 @@
10271027 'rlu_type' => COLLABWATCHLISTUSER_OWNER,
10281028 ), __METHOD__, 'IGNORE' );
10291029 $affected = $dbw->affectedRows();
1030 - if( ! $affected ) {
 1030+ if ( ! $affected ) {
10311031 $dbw->rollback();
10321032 return;
10331033 }
10341034 $dbw->commit();
10351035 return $newid;
1036 - }catch(Exception $e) {
 1036+ } catch ( Exception $e ) {
10371037 $dbw->rollback();
10381038 }
10391039 }
10401040
1041 - private function deleteList($rlId) {
1042 - if( !isset($rlId) || empty($rlId) )
 1041+ private function deleteList( $rlId ) {
 1042+ if ( !isset( $rlId ) || empty( $rlId ) )
10431043 return;
10441044 $dbw = wfGetDB( DB_MASTER );
10451045 $dbw->begin();
@@ -1059,13 +1059,13 @@
10601060 'rl_id' => $rlId,
10611061 ), __METHOD__ );
10621062 $affected = $dbw->affectedRows();
1063 - if( ! $affected ) {
 1063+ if ( ! $affected ) {
10641064 $dbw->rollback();
10651065 return;
10661066 }
10671067 $dbw->commit();
10681068 return $rlId;
1069 - }catch(Exception $e) {
 1069+ } catch ( Exception $e ) {
10701070 $dbw->rollback();
10711071 }
10721072 }
@@ -1082,7 +1082,7 @@
10831083 $list = "";
10841084 $toc = $skin->tocIndent();
10851085 $tocLength = 0;
1086 - foreach( $this->getWatchlistInfo( $rlId ) as $namespace => $pages ) {
 1086+ foreach ( $this->getWatchlistInfo( $rlId ) as $namespace => $pages ) {
10871087 $tocLength++;
10881088 $heading = htmlspecialchars( $this->getNamespaceHeading( $namespace ) );
10891089 $anchor = "editwatchlist-ns" . $namespace;
@@ -1091,14 +1091,14 @@
10921092 $toc .= $skin->tocLine( $anchor, $heading, $tocLength, 1 ) . $skin->tocLineEnd();
10931093
10941094 $list .= "<ul>\n";
1095 - foreach( $pages as $dbkey => $info ) {
 1095+ foreach ( $pages as $dbkey => $info ) {
10961096 $title = Title::makeTitleSafe( $namespace, $dbkey );
10971097 $list .= $this->buildRemoveLine( $title, $info, $skin );
10981098 }
10991099 $list .= "</ul>\n";
11001100 }
11011101 // ISSUE: omit the TOC if the total number of titles is low?
1102 - if( $tocLength > 1 ) {
 1102+ if ( $tocLength > 1 ) {
11031103 $list = $skin->tocList( $toc ) . $list;
11041104 }
11051105 return $list;
@@ -1129,10 +1129,10 @@
11301130 global $wgLang;
11311131
11321132 $link = $skin->link( $title );
1133 - if( $catInfo['redirect'] )
 1133+ if ( $catInfo['redirect'] )
11341134 $link = '<span class="watchlistredir">' . $link . '</span>';
11351135 $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) );
1136 - if( $title->exists() ) {
 1136+ if ( $title->exists() ) {
11371137 $tools[] = $skin->link(
11381138 $title,
11391139 wfMsgHtml( 'history_short' ),
@@ -1141,7 +1141,7 @@
11421142 array( 'known', 'noclasses' )
11431143 );
11441144 }
1145 - if( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
 1145+ if ( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
11461146 $tools[] = $skin->link(
11471147 SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
11481148 wfMsgHtml( 'contributions' ),
@@ -1151,7 +1151,7 @@
11521152 );
11531153 }
11541154 return "<li>"
1155 - . ($catInfo['subtract'] ? '<span class="collabwatchlistsubtract">- </span>' : '')
 1155+ . ( $catInfo['subtract'] ? '<span class="collabwatchlistsubtract">- </span>' : '' )
11561156 . Xml::check( 'titles[]', false, array( 'value' => $catInfo['subtract'] ? '- ' . $title->getPrefixedText() : $title->getPrefixedText() ) )
11571157 . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n";
11581158 }
@@ -1178,7 +1178,7 @@
11791179 $form .= Xml::openElement( 'textarea', array( 'id' => 'titles', 'name' => 'titles',
11801180 'rows' => $wgUser->getIntOption( 'rows' ), 'cols' => $wgUser->getIntOption( 'cols' ) ) );
11811181 $categories = $this->getCollabWatchlistCategories( $rlId );
1182 - foreach( $categories as $category )
 1182+ foreach ( $categories as $category )
11831183 $form .= htmlspecialchars( $category ) . "\n";
11841184 $form .= '</textarea>';
11851185 $form .= '<p>' . Xml::submitButton( wfMsg( 'watchlistedit-raw-submit' ) ) . '</p>';
@@ -1208,7 +1208,7 @@
12091209 $form .= Xml::openElement( 'textarea', array( 'id' => 'titles', 'name' => 'titles',
12101210 'rows' => $wgUser->getIntOption( 'rows' ), 'cols' => $wgUser->getIntOption( 'cols' ) ) );
12111211 $tags = $this->getCollabWatchlistTags( $rlId );
1212 - foreach( $tags as $tag => $description )
 1212+ foreach ( $tags as $tag => $description )
12131213 $form .= htmlspecialchars( $tag ) . "|" . $description . "\n";
12141214 $form .= '</textarea>';
12151215 $form .= '<p>' . Xml::submitButton( wfMsg( 'collabwatchlistedit-tags-raw-submit' ) ) . '</p>';
@@ -1238,7 +1238,7 @@
12391239 $form .= Xml::openElement( 'textarea', array( 'id' => 'titles', 'name' => 'titles',
12401240 'rows' => $wgUser->getIntOption( 'rows' ), 'cols' => $wgUser->getIntOption( 'cols' ) ) );
12411241 $users = $this->getCollabWatchlistUsers( $rlId );
1242 - foreach( $users as $userString )
 1242+ foreach ( $users as $userString )
12431243 $form .= htmlspecialchars( $userString ) . "\n";
12441244 $form .= '</textarea>';
12451245 $form .= '<p>' . Xml::submitButton( wfMsg( 'collabwatchlistedit-users-raw-submit' ) ) . '</p>';
@@ -1302,11 +1302,11 @@
13031303 array(),
13041304 array( 'known', 'noclasses' )
13051305 ) . '<br />';
1306 - if( !isset($listIdsAndNames) || empty($listIdsAndNames) )
 1306+ if ( !isset( $listIdsAndNames ) || empty( $listIdsAndNames ) )
13071307 return $r;
1308 - foreach( $listIdsAndNames as $listId => $listName) {
 1308+ foreach ( $listIdsAndNames as $listId => $listName ) {
13091309 $tools = array();
1310 - foreach( $modes as $mode => $subpage ) {
 1310+ foreach ( $modes as $mode => $subpage ) {
13111311 // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
13121312 $tools[] = $skin->link(
13131313 SpecialPage::getTitleFor( 'CollabWatchlist', $subpage ),
@@ -1331,13 +1331,13 @@
13321332 * @return String an URL string
13331333 */
13341334 public static function getUnsetTagUrl( $redirUrl, $pageName, $rlId, $tag, $rcId ) {
1335 - return SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl(array(
 1335+ return SpecialPage::getTitleFor( 'CollabWatchlist' )->getLocalUrl( array(
13361336 'action' => 'unsetTags',
13371337 'redirTarget' => $redirUrl,
13381338 'collabwatchlisttag' => $tag,
13391339 'collabwatchlist' => $rlId,
13401340 'collabwatchlistpage' => $pageName,
13411341 'collabwatchlistrcid' => $rcId
1342 - ));
 1342+ ) );
13431343 }
13441344 }

Status & tagging log