r107615 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107614‎ | r107615 | r107616 >
Date:01:29, 30 December 2011
Author:reedy
Status:deferred
Tags:
Comment:
Few bits of documentation

Improve conditional setting of variables
Modified paths:
  • /trunk/extensions/TweetANew/TweetANew.body.php (modified) (history)
  • /trunk/extensions/TweetANew/TweetANew.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TweetANew/TweetANew.body.php
@@ -42,8 +42,8 @@
4343 /**
4444 * Function for tweeting new articles
4545 *
46 - * @param $article
47 - * @param $user
 46+ * @param $article Article
 47+ * @param $user User
4848 * @param $text
4949 * @param $summary
5050 * @return bool
@@ -88,7 +88,7 @@
8989 # Setup switcher using max number set by $wgTweetANewText['NewRandomMax']
9090 $switcher = rand( 1, $wgTweetANewText['NewRandomMax'] );
9191 # Parse random text
92 - $tweet_text .= wfMsg( 'tweetanew-new' . $switcher,
 92+ $tweet_text = wfMsg( 'tweetanew-new' . $switcher,
9393 array( $article->getTitle()->getText(), $finalurl )
9494 );
9595 } else {
@@ -96,7 +96,7 @@
9797 $tweet_body = wfMsg( 'tweetanew-newdefault',
9898 array( $article->getTitle()->getText(), $finalurl )
9999 );
100 - $tweet_text .= $tweet_body;
 100+ $tweet_text = $tweet_body;
101101 }
102102
103103 # Add author info if $wgTweetANewText['NewAuthor'] is true
@@ -133,11 +133,11 @@
134134 /**
135135 * Function for tweeting edited articles
136136 *
137 - * @param $article
138 - * @param $user
139 - * @param $text
140 - * @param $summary
141 - * @param $minoredit
 137+ * @param $article Article
 138+ * @param $user User
 139+ * @param $text string
 140+ * @param $summary string
 141+ * @param $minoredit bool
142142 * @param $revision
143143 * @return bool
144144 */
@@ -163,6 +163,7 @@
164164 __METHOD__,
165165 array( 'ORDER BY' => 'rev_id DESC', 'LIMIT' => '2' )
166166 );
 167+ $edittime = array();
167168 foreach ( $res as $row ) {
168169 $edittime[] = $row->rev_timestamp;
169170 }
@@ -180,7 +181,7 @@
181182 }
182183
183184 # Only proceed if this is not the first edit to the article, in which case it's new and TweetANewNewArticle is used instead
184 - if ( !$article->mTitle->exists() ) {
 185+ if ( !$article->getTitle()->exists() ) {
185186 return true;
186187 }
187188
@@ -209,6 +210,7 @@
210211 $author = $user->getName();
211212 }
212213
 214+ $tweet_text = '';
213215 # Add prefix indication that edit is minor if $wgTweetANewText['Minor'] is true and !$wgTweetANewTweet['SkipMinor'] is false
214216 if ( $minoredit !== 0 && $wgTweetANewText['Minor'] ) {
215217 $tweet_text = wfMsg( 'tweetanew-minoredit' );
@@ -264,4 +266,5 @@
265267 }
266268 return true;
267269 }
268 -}
\ No newline at end of file
 270+}
 271+
Index: trunk/extensions/TweetANew/TweetANew.php
@@ -11,7 +11,7 @@
1212 * @license GPL
1313 *
1414 * Version 1.0 and above based on merging extensions TweetANew v0.2 by Joachim De Schrijver, Wiki2twitter by Wendell Gaudencio,
15 - * SendToTwitter by Rohit Keshwani and SendToTwitter2 by Rohit Keshwani, Andrew Fitzgerald.
 15+ * SendToTwitter by Rohit Keshwani and SendToTwitter2 by Rohit Keshwani, Andrew Fitzgerald.
1616 *
1717 * Some code inspired by the Mail2Facebook extension by Thiemo Schuff
1818 *
@@ -36,7 +36,7 @@
3737 * SETTINGS
3838 * --------
3939 * The following variables may be reset in your LocalSettings.php file.
40 - *
 40+ *
4141 * $wgTweetANewTweet['New']
4242 * - Automatically tweet about new articles
4343 * Default is true
@@ -189,7 +189,7 @@
190190 * @param $tabindex
191191 * @return bool
192192 */
193 -function efTweetANewEditCheckBox( &$editpage, &$checkboxes, &$tabindex) {
 193+function efTweetANewEditCheckBox( &$editpage, &$checkboxes, &$tabindex) {
194194 global $wgTweetANewEditpage, $wgTweetANewTweet;
195195
196196 # Check if article is new - if checkboxes are enabled and if auto-tweets of edits are disabled
@@ -205,7 +205,7 @@
206206 Xml::check( 'wpTweetANewEdit', $wgTweetANewEditpage['Checked'], $attribs ) .
207207 "&nbsp;<label for='wpTweetANewEdit' title='". wfMsg('tweetanew-edittooltip')."'>".wfMsg('tweetanew-editaction')."</label>";
208208 }
209 - # Check if article is new - if checkboxes are enabled and if auto-tweets of new articles are disabled
 209+ # Check if article is new - if checkboxes are enabled and if auto-tweets of new articles are disabled
210210 elseif ( $wgTweetANewEditpage['Enable'] && !$wgTweetANewTweet['New'] ) {
211211 $attribs = array(
212212 'tabindex' => ++$tabindex,

Status & tagging log