Index: trunk/extensions/TweetANew/TweetANew.body.php |
— | — | @@ -42,8 +42,8 @@ |
43 | 43 | /** |
44 | 44 | * Function for tweeting new articles |
45 | 45 | * |
46 | | - * @param $article |
47 | | - * @param $user |
| 46 | + * @param $article Article |
| 47 | + * @param $user User |
48 | 48 | * @param $text |
49 | 49 | * @param $summary |
50 | 50 | * @return bool |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | # Setup switcher using max number set by $wgTweetANewText['NewRandomMax'] |
90 | 90 | $switcher = rand( 1, $wgTweetANewText['NewRandomMax'] ); |
91 | 91 | # Parse random text |
92 | | - $tweet_text .= wfMsg( 'tweetanew-new' . $switcher, |
| 92 | + $tweet_text = wfMsg( 'tweetanew-new' . $switcher, |
93 | 93 | array( $article->getTitle()->getText(), $finalurl ) |
94 | 94 | ); |
95 | 95 | } else { |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $tweet_body = wfMsg( 'tweetanew-newdefault', |
98 | 98 | array( $article->getTitle()->getText(), $finalurl ) |
99 | 99 | ); |
100 | | - $tweet_text .= $tweet_body; |
| 100 | + $tweet_text = $tweet_body; |
101 | 101 | } |
102 | 102 | |
103 | 103 | # Add author info if $wgTweetANewText['NewAuthor'] is true |
— | — | @@ -133,11 +133,11 @@ |
134 | 134 | /** |
135 | 135 | * Function for tweeting edited articles |
136 | 136 | * |
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 |
142 | 142 | * @param $revision |
143 | 143 | * @return bool |
144 | 144 | */ |
— | — | @@ -163,6 +163,7 @@ |
164 | 164 | __METHOD__, |
165 | 165 | array( 'ORDER BY' => 'rev_id DESC', 'LIMIT' => '2' ) |
166 | 166 | ); |
| 167 | + $edittime = array(); |
167 | 168 | foreach ( $res as $row ) { |
168 | 169 | $edittime[] = $row->rev_timestamp; |
169 | 170 | } |
— | — | @@ -180,7 +181,7 @@ |
181 | 182 | } |
182 | 183 | |
183 | 184 | # 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() ) { |
185 | 186 | return true; |
186 | 187 | } |
187 | 188 | |
— | — | @@ -209,6 +210,7 @@ |
210 | 211 | $author = $user->getName(); |
211 | 212 | } |
212 | 213 | |
| 214 | + $tweet_text = ''; |
213 | 215 | # Add prefix indication that edit is minor if $wgTweetANewText['Minor'] is true and !$wgTweetANewTweet['SkipMinor'] is false |
214 | 216 | if ( $minoredit !== 0 && $wgTweetANewText['Minor'] ) { |
215 | 217 | $tweet_text = wfMsg( 'tweetanew-minoredit' ); |
— | — | @@ -264,4 +266,5 @@ |
265 | 267 | } |
266 | 268 | return true; |
267 | 269 | } |
268 | | -} |
\ No newline at end of file |
| 270 | +} |
| 271 | + |
Index: trunk/extensions/TweetANew/TweetANew.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @license GPL |
13 | 13 | * |
14 | 14 | * 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. |
16 | 16 | * |
17 | 17 | * Some code inspired by the Mail2Facebook extension by Thiemo Schuff |
18 | 18 | * |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | * SETTINGS |
38 | 38 | * -------- |
39 | 39 | * The following variables may be reset in your LocalSettings.php file. |
40 | | - * |
| 40 | + * |
41 | 41 | * $wgTweetANewTweet['New'] |
42 | 42 | * - Automatically tweet about new articles |
43 | 43 | * Default is true |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | * @param $tabindex |
191 | 191 | * @return bool |
192 | 192 | */ |
193 | | -function efTweetANewEditCheckBox( &$editpage, &$checkboxes, &$tabindex) { |
| 193 | +function efTweetANewEditCheckBox( &$editpage, &$checkboxes, &$tabindex) { |
194 | 194 | global $wgTweetANewEditpage, $wgTweetANewTweet; |
195 | 195 | |
196 | 196 | # Check if article is new - if checkboxes are enabled and if auto-tweets of edits are disabled |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | Xml::check( 'wpTweetANewEdit', $wgTweetANewEditpage['Checked'], $attribs ) . |
207 | 207 | " <label for='wpTweetANewEdit' title='". wfMsg('tweetanew-edittooltip')."'>".wfMsg('tweetanew-editaction')."</label>"; |
208 | 208 | } |
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 |
210 | 210 | elseif ( $wgTweetANewEditpage['Enable'] && !$wgTweetANewTweet['New'] ) { |
211 | 211 | $attribs = array( |
212 | 212 | 'tabindex' => ++$tabindex, |