Index: trunk/extensions/LiquidThreads/Lqt.i18n.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | 'lqt-newer' => 'newer', |
119 | 119 | 'lqt-searching' => 'Searching for threads', |
120 | 120 | 'lqt-read-message' => 'Read', |
121 | | - 'lqt-read-message-tooltip'=> 'Remove this thread from new messages. |
| 121 | + 'lqt-read-message-tooltip' => 'Remove this thread from new messages. |
122 | 122 | It will still be visible on its original talk page.', |
123 | 123 | 'lqt-read-all' => 'Mark all as read', |
124 | 124 | 'lqt-read-all-tooltip' => 'Remove all threads from new messages. |
— | — | @@ -2910,7 +2910,7 @@ |
2911 | 2911 | 'lqt_new_thread' => 'Start ein ny diskusjon', |
2912 | 2912 | 'lqt_in_response_to' => 'Som svar til $1 av $2, over:', |
2913 | 2913 | 'lqt_edited_notice' => 'Endra', |
2914 | | - 'lqt_move_placeholder' => 'Denne tråden finst berre for å syna at tråden $1 vart flytt frå denne sida til ei anna diskusjonssida. |
| 2914 | + 'lqt_move_placeholder' => 'Denne tråden finst berre for å syna at tråden $1 vart flytt frå denne sida til ei anna diskusjonssida. |
2915 | 2915 | Flyttinga vart gjort av $2 $3.', |
2916 | 2916 | 'lqt_reply' => 'Svar', |
2917 | 2917 | 'lqt_delete' => 'Slett', |
Index: trunk/extensions/LiquidThreads/LqtBaseView.php |
— | — | @@ -7,9 +7,9 @@ |
8 | 8 | * @licence GPL2 |
9 | 9 | */ |
10 | 10 | |
11 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
12 | 12 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
13 | | - die( -1 ); |
| 13 | + die( - 1 ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | class LqtDispatch { |
— | — | @@ -27,29 +27,29 @@ |
28 | 28 | 'SummaryPageView' => 'SummaryPageView' |
29 | 29 | ); |
30 | 30 | |
31 | | - static function talkpageMain(&$output, &$talk_article, &$title, &$user, &$request) { |
| 31 | + static function talkpageMain( &$output, &$talk_article, &$title, &$user, &$request ) { |
32 | 32 | // We are given a talkpage article and title. Find the associated |
33 | 33 | // non-talk article and pass that to the view. |
34 | | - $article = new Article($title->getSubjectPage()); |
| 34 | + $article = new Article( $title->getSubjectPage() ); |
35 | 35 | |
36 | | - if( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) { |
| 36 | + if ( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) { |
37 | 37 | // Threads don't have talk pages; redirect to the thread page. |
38 | | - $output->redirect($title->getSubjectPage()->getFullUrl()); |
| 38 | + $output->redirect( $title->getSubjectPage()->getFullUrl() ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /* Certain actions apply to the "header", which is stored in the actual talkpage |
42 | 42 | in the database. Drop everything and behave like a normal page if those |
43 | 43 | actions come up, to avoid hacking the various history, editing, etc. code. */ |
44 | | - $action = $request->getVal('action'); |
45 | | - $header_actions = array('history', 'edit', 'submit'); |
| 44 | + $action = $request->getVal( 'action' ); |
| 45 | + $header_actions = array( 'history', 'edit', 'submit' ); |
46 | 46 | global $wgRequest; |
47 | | - if ($request->getVal('lqt_method', null) === null && |
| 47 | + if ( $request->getVal( 'lqt_method', null ) === null && |
48 | 48 | ( in_array( $action, $header_actions ) || |
49 | | - $request->getVal('diff', null) !== null ) ) { |
| 49 | + $request->getVal( 'diff', null ) !== null ) ) { |
50 | 50 | $viewname = self::$views['TalkpageHeaderView']; |
51 | 51 | } else if ( $action == 'protect' || $action == 'unprotect' ) { |
52 | 52 | $viewname = self::$views['ThreadProtectionFormView']; |
53 | | - } else if ( $request->getVal('lqt_method') == 'talkpage_archive' ) { |
| 53 | + } else if ( $request->getVal( 'lqt_method' ) == 'talkpage_archive' ) { |
54 | 54 | $viewname = self::$views['TalkpageArchiveView']; |
55 | 55 | } else { |
56 | 56 | $viewname = self::$views['TalkpageView']; |
— | — | @@ -58,29 +58,29 @@ |
59 | 59 | return $view->show(); |
60 | 60 | } |
61 | 61 | |
62 | | - static function threadPermalinkMain(&$output, &$article, &$title, &$user, &$request) { |
| 62 | + static function threadPermalinkMain( &$output, &$article, &$title, &$user, &$request ) { |
63 | 63 | |
64 | | - $action = $request->getVal('action'); |
65 | | - $lqt_method = $request->getVal('lqt_method'); |
| 64 | + $action = $request->getVal( 'action' ); |
| 65 | + $lqt_method = $request->getVal( 'lqt_method' ); |
66 | 66 | |
67 | | - if( $lqt_method == 'thread_history' ) { |
| 67 | + if ( $lqt_method == 'thread_history' ) { |
68 | 68 | $viewname = self::$views['ThreadHistoryListingView']; |
69 | 69 | } |
70 | 70 | else if ( $lqt_method == 'diff' ) { // this clause and the next must be in this order. |
71 | 71 | $viewname = self::$views['ThreadDiffView']; |
72 | 72 | } |
73 | 73 | else if ( $action == 'history' |
74 | | - || $request->getVal('diff', null) !== null |
75 | | - || $request->getVal('oldid', null) !== null ) { |
| 74 | + || $request->getVal( 'diff', null ) !== null |
| 75 | + || $request->getVal( 'oldid', null ) !== null ) { |
76 | 76 | $viewname = self::$views['IndividualThreadHistoryView']; |
77 | 77 | } |
78 | 78 | else if ( $action == 'protect' || $action == 'unprotect' ) { |
79 | 79 | $viewname = self::$views['ThreadProtectionFormView']; |
80 | 80 | } |
81 | | - else if ( $request->getVal('lqt_oldid', null) !== null ) { |
| 81 | + else if ( $request->getVal( 'lqt_oldid', null ) !== null ) { |
82 | 82 | $viewname = self::$views['ThreadHistoricalRevisionView']; |
83 | 83 | } |
84 | | - else if( $action == 'watch' || $action == 'unwatch' ){ |
| 84 | + else if ( $action == 'watch' || $action == 'unwatch' ) { |
85 | 85 | $viewname = self::$views['ThreadWatchView']; |
86 | 86 | } |
87 | 87 | else { |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | return $view->show(); |
92 | 92 | } |
93 | 93 | |
94 | | - static function threadSummaryMain(&$output, &$article, &$title, &$user, &$request) { |
| 94 | + static function threadSummaryMain( &$output, &$article, &$title, &$user, &$request ) { |
95 | 95 | $viewname = self::$views['SummaryPageView']; |
96 | 96 | $view = new $viewname( $output, $article, $title, $user, $request ); |
97 | 97 | return $view->show(); |
— | — | @@ -102,11 +102,11 @@ |
103 | 103 | */ |
104 | 104 | static function tryPage( $output, $article, $title, $user, $request ) { |
105 | 105 | if ( $title->isTalkPage() ) { |
106 | | - return self::talkpageMain ($output, $article, $title, $user, $request); |
| 106 | + return self::talkpageMain ( $output, $article, $title, $user, $request ); |
107 | 107 | } else if ( $title->getNamespace() == NS_LQT_THREAD ) { |
108 | | - return self::threadPermalinkMain($output, $article, $title, $user, $request); |
| 108 | + return self::threadPermalinkMain( $output, $article, $title, $user, $request ); |
109 | 109 | } else if ( $title->getNamespace() == NS_LQT_SUMMARY ) { |
110 | | - return self::threadSummaryMain($output, $article, $title, $user, $request); |
| 110 | + return self::threadSummaryMain( $output, $article, $title, $user, $request ); |
111 | 111 | } |
112 | 112 | return true; |
113 | 113 | } |
— | — | @@ -114,10 +114,10 @@ |
115 | 115 | static function onPageMove( $movepage, $ot, $nt ) { |
116 | 116 | // We are being invoked on the subject page, not the talk page. |
117 | 117 | |
118 | | - $threads = Threads::where( array( Threads::articleClause(new Article($ot)), |
119 | | - Threads::topLevelClause() )); |
| 118 | + $threads = Threads::where( array( Threads::articleClause( new Article( $ot ) ), |
| 119 | + Threads::topLevelClause() ) ); |
120 | 120 | |
121 | | - foreach ($threads as $t) { |
| 121 | + foreach ( $threads as $t ) { |
122 | 122 | $t->moveToSubjectPage( $nt, false ); |
123 | 123 | } |
124 | 124 | |
— | — | @@ -125,17 +125,17 @@ |
126 | 126 | } |
127 | 127 | |
128 | 128 | static function makeLinkObj( &$returnValue, &$linker, $nt, $text, $query, $trail, $prefix ) { |
129 | | - if( ! $nt->isTalkPage() ) |
| 129 | + if ( ! $nt->isTalkPage() ) |
130 | 130 | return true; |
131 | 131 | |
132 | 132 | // Talkpages with headers. |
133 | | - if( $nt->getArticleID() != 0 ) |
| 133 | + if ( $nt->getArticleID() != 0 ) |
134 | 134 | return true; |
135 | 135 | |
136 | 136 | // Talkpages without headers -- check existance of threads. |
137 | | - $article = new Article($nt->getSubjectPage()); |
138 | | - $threads = Threads::where(Threads::articleClause($article), "LIMIT 1"); |
139 | | - if( count($threads) == 0 ) { |
| 137 | + $article = new Article( $nt->getSubjectPage() ); |
| 138 | + $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" ); |
| 139 | + if ( count( $threads ) == 0 ) { |
140 | 140 | // We want it to look like a broken link, but not have action=edit, since that |
141 | 141 | // will edit the header, so we can't use makeBrokenLinkObj. This code is copied |
142 | 142 | // from the body of that method. |
— | — | @@ -153,45 +153,45 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | // One major place that doesn't use makeLinkObj is the tabs. So override known/unknown there too. |
157 | | - static function tabAction(&$skintemplate, $title, $message, $selected, $checkEdit, |
158 | | - &$classes, &$query, &$text, &$result) { |
159 | | - if( ! $title->isTalkPage() ) |
| 157 | + static function tabAction( &$skintemplate, $title, $message, $selected, $checkEdit, |
| 158 | + &$classes, &$query, &$text, &$result ) { |
| 159 | + if ( ! $title->isTalkPage() ) |
160 | 160 | return true; |
161 | | - if( $title->getArticleID() != 0 ) { |
| 161 | + if ( $title->getArticleID() != 0 ) { |
162 | 162 | $query = ""; |
163 | 163 | return true; |
164 | 164 | } |
165 | 165 | // It's a talkpage without a header. Get rid of action=edit always, |
166 | 166 | // color as apropriate. |
167 | 167 | $query = ""; |
168 | | - $article = new Article($title->getSubjectPage()); |
169 | | - $threads = Threads::where(Threads::articleClause($article), "LIMIT 1"); |
170 | | - if( count($threads) != 0 ) { |
171 | | - $i = array_search('new', $classes); if( $i !== false ) { |
172 | | - array_splice($classes, $i, 1); |
| 168 | + $article = new Article( $title->getSubjectPage() ); |
| 169 | + $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" ); |
| 170 | + if ( count( $threads ) != 0 ) { |
| 171 | + $i = array_search( 'new', $classes ); if ( $i !== false ) { |
| 172 | + array_splice( $classes, $i, 1 ); |
173 | 173 | } |
174 | 174 | } |
175 | 175 | return true; |
176 | 176 | } |
177 | 177 | |
178 | | - static function customizeOldChangesList(&$changeslist, &$s, &$rc) { |
179 | | - if( $rc->getTitle()->getNamespace() == NS_LQT_THREAD ) { |
180 | | - $thread = Threads::withRoot(new Post( $rc->getTitle() )); |
181 | | - if( !$thread ) return true; |
| 178 | + static function customizeOldChangesList( &$changeslist, &$s, &$rc ) { |
| 179 | + if ( $rc->getTitle()->getNamespace() == NS_LQT_THREAD ) { |
| 180 | + $thread = Threads::withRoot( new Post( $rc->getTitle() ) ); |
| 181 | + if ( !$thread ) return true; |
182 | 182 | |
183 | 183 | LqtView::addJSandCSS(); // TODO only do this once. |
184 | 184 | wfLoadExtensionMessages( 'LiquidThreads' ); |
185 | 185 | |
186 | | - if( $rc->mAttribs['rc_type'] != RC_NEW ) { |
| 186 | + if ( $rc->mAttribs['rc_type'] != RC_NEW ) { |
187 | 187 | // Add whether it was original author. |
188 | 188 | // TODO: this only asks whether ANY edit has been by another, not this edit. |
189 | 189 | // But maybe that's what we want. |
190 | | - if( $thread->editedness() == Threads::EDITED_BY_OTHERS ) |
191 | | - $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_others">'. |
192 | | - wfMsg('lqt_rc_author_others').'</span>'; |
| 190 | + if ( $thread->editedness() == Threads::EDITED_BY_OTHERS ) |
| 191 | + $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_others">' . |
| 192 | + wfMsg( 'lqt_rc_author_others' ) . '</span>'; |
193 | 193 | else |
194 | | - $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_original">'. |
195 | | - wfMsg('lqt_rc_author_original').'</span>'; |
| 194 | + $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_original">' . |
| 195 | + wfMsg( 'lqt_rc_author_original' ) . '</span>'; |
196 | 196 | $s = preg_replace( '/\<\/li\>$/', $appendix . '</li>', $s ); |
197 | 197 | } |
198 | 198 | else { |
— | — | @@ -199,15 +199,15 @@ |
200 | 200 | $changeslist->insertUserRelatedLinks( $sig, $rc ); |
201 | 201 | |
202 | 202 | // This should be stored in RC. |
203 | | - $quote = Revision::newFromId($rc->mAttribs['rc_this_oldid'])->getText(); |
204 | | - if( strlen($quote) > 230 ) { |
205 | | - $quote = substr($quote, 0, 200) . |
206 | | - $changeslist->skin->link($thread->title(), wfMsg('lqt_rc_ellipsis'), |
207 | | - array('class'=>'lqt_rc_ellipsis'), array(), array('known')); |
| 203 | + $quote = Revision::newFromId( $rc->mAttribs['rc_this_oldid'] )->getText(); |
| 204 | + if ( strlen( $quote ) > 230 ) { |
| 205 | + $quote = substr( $quote, 0, 200 ) . |
| 206 | + $changeslist->skin->link( $thread->title(), wfMsg( 'lqt_rc_ellipsis' ), |
| 207 | + array( 'class' => 'lqt_rc_ellipsis' ), array(), array( 'known' ) ); |
208 | 208 | } |
209 | 209 | // TODO we must parse or sanitize the quote. |
210 | 210 | |
211 | | - if( $thread->isTopmostThread() ) { |
| 211 | + if ( $thread->isTopmostThread() ) { |
212 | 212 | $message_name = 'lqt_rc_new_discussion'; |
213 | 213 | $tmp_title = $thread->title(); |
214 | 214 | } else { |
— | — | @@ -219,36 +219,36 @@ |
220 | 220 | $thread_link = $changeslist->skin->link( |
221 | 221 | $tmp_title, |
222 | 222 | $thread->subjectWithoutIncrement(), |
223 | | - array(), array(), array('known')); |
| 223 | + array(), array(), array( 'known' ) ); |
224 | 224 | |
225 | 225 | $talkpage_link = $changeslist->skin->link( |
226 | 226 | $thread->article()->getTitle()->getTalkPage(), |
227 | 227 | null, |
228 | | - array(), array(), array('known')); |
| 228 | + array(), array(), array( 'known' ) ); |
229 | 229 | |
230 | | - $s = wfMsg($message_name, $thread_link, $talkpage_link, $sig) |
| 230 | + $s = wfMsg( $message_name, $thread_link, $talkpage_link, $sig ) |
231 | 231 | . "<blockquote class=\"lqt_rc_blockquote\">$quote</blockquote>"; |
232 | 232 | } |
233 | 233 | } |
234 | 234 | return true; |
235 | 235 | } |
236 | 236 | |
237 | | - static function setNewtalkHTML($skintemplate, $tpl) { |
| 237 | + static function setNewtalkHTML( $skintemplate, $tpl ) { |
238 | 238 | global $wgUser, $wgTitle, $wgOut; |
239 | 239 | wfLoadExtensionMessages( 'LiquidThreads' ); |
240 | 240 | $newmsg_t = SpecialPage::getTitleFor( 'NewMessages' ); |
241 | 241 | $watchlist_t = SpecialPage::getTitleFor( 'Watchlist' ); |
242 | 242 | $usertalk_t = $wgUser->getTalkPage(); |
243 | | - if( $wgUser->getNewtalk() |
244 | | - &&! $newmsg_t->equals($wgTitle) |
245 | | - &&! $watchlist_t->equals($wgTitle) |
246 | | - &&! $usertalk_t->equals($wgTitle) |
| 243 | + if ( $wgUser->getNewtalk() |
| 244 | + && ! $newmsg_t->equals( $wgTitle ) |
| 245 | + && ! $watchlist_t->equals( $wgTitle ) |
| 246 | + && ! $usertalk_t->equals( $wgTitle ) |
247 | 247 | ) { |
248 | | - $s = wfMsgExt('lqt_youhavenewmessages', array( 'parseinline' ), $newmsg_t->getFullURL()); |
249 | | - $tpl->set("newtalk", $s); |
250 | | - $wgOut->setSquidMaxage(0); |
| 248 | + $s = wfMsgExt( 'lqt_youhavenewmessages', array( 'parseinline' ), $newmsg_t->getFullURL() ); |
| 249 | + $tpl->set( "newtalk", $s ); |
| 250 | + $wgOut->setSquidMaxage( 0 ); |
251 | 251 | } else { |
252 | | - $tpl->set("newtalk", ''); |
| 252 | + $tpl->set( "newtalk", '' ); |
253 | 253 | } |
254 | 254 | |
255 | 255 | return true; |
— | — | @@ -276,9 +276,9 @@ |
277 | 277 | public $archive_start_days = 14; |
278 | 278 | public $archive_recent_days = 5; |
279 | 279 | |
280 | | - protected $sort_order=LQT_NEWEST_CHANGES; |
| 280 | + protected $sort_order = LQT_NEWEST_CHANGES; |
281 | 281 | |
282 | | - function __construct(&$output, &$article, &$title, &$user, &$request) { |
| 282 | + function __construct( &$output, &$article, &$title, &$user, &$request ) { |
283 | 283 | $this->article = $article; |
284 | 284 | $this->output = $output; |
285 | 285 | $this->user = $user; |
— | — | @@ -289,67 +289,67 @@ |
290 | 290 | $this->queries = $this->initializeQueries(); |
291 | 291 | } |
292 | 292 | |
293 | | - function setHeaderLevel($int) { |
| 293 | + function setHeaderLevel( $int ) { |
294 | 294 | $this->headerLevel = $int; |
295 | 295 | } |
296 | 296 | |
297 | 297 | function initializeQueries() { |
298 | 298 | |
299 | | - if( $this->methodApplies('talkpage_sort_order') ) { |
| 299 | + if ( $this->methodApplies( 'talkpage_sort_order' ) ) { |
300 | 300 | // Sort order is explicitly specified through UI |
301 | 301 | global $wgRequest; |
302 | | - $lqt_order=$wgRequest->getVal('lqt_order'); |
303 | | - switch($lqt_order) { |
| 302 | + $lqt_order = $wgRequest->getVal( 'lqt_order' ); |
| 303 | + switch( $lqt_order ) { |
304 | 304 | case 'nc': |
305 | | - $this->sort_order=LQT_NEWEST_CHANGES; |
| 305 | + $this->sort_order = LQT_NEWEST_CHANGES; |
306 | 306 | break; |
307 | 307 | case 'nt': |
308 | | - $this->sort_order=LQT_NEWEST_THREADS; |
| 308 | + $this->sort_order = LQT_NEWEST_THREADS; |
309 | 309 | break; |
310 | 310 | case 'ot': |
311 | | - $this->sort_order=LQT_OLDEST_THREADS; |
| 311 | + $this->sort_order = LQT_OLDEST_THREADS; |
312 | 312 | break; |
313 | 313 | } |
314 | 314 | } else { |
315 | 315 | // Sort order set in user preferences overrides default |
316 | 316 | global $wgUser; |
317 | | - $user_order = $wgUser->getOption('lqt_sort_order') ; |
318 | | - if( $user_order ) { |
319 | | - $this->sort_order=$user_order; |
| 317 | + $user_order = $wgUser->getOption( 'lqt_sort_order' ) ; |
| 318 | + if ( $user_order ) { |
| 319 | + $this->sort_order = $user_order; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | global $wgOut; |
323 | 323 | $g = new QueryGroup(); |
324 | | - $startdate = Date::now()->nDaysAgo($this->archive_start_days)->midnight(); |
325 | | - $recentstartdate = $startdate->nDaysAgo($this->archive_recent_days); |
326 | | - $article_clause = Threads::articleClause($this->article); |
327 | | - if($this->sort_order==LQT_NEWEST_CHANGES) { |
328 | | - $sort_clause='ORDER BY thread.thread_modified DESC'; |
329 | | - } elseif($this->sort_order==LQT_NEWEST_THREADS) { |
330 | | - $sort_clause='ORDER BY thread.thread_created DESC'; |
331 | | - } elseif($this->sort_order==LQT_OLDEST_THREADS) { |
332 | | - $sort_clause='ORDER BY thread.thread_created ASC'; |
| 324 | + $startdate = Date::now()->nDaysAgo( $this->archive_start_days )->midnight(); |
| 325 | + $recentstartdate = $startdate->nDaysAgo( $this->archive_recent_days ); |
| 326 | + $article_clause = Threads::articleClause( $this->article ); |
| 327 | + if ( $this->sort_order == LQT_NEWEST_CHANGES ) { |
| 328 | + $sort_clause = 'ORDER BY thread.thread_modified DESC'; |
| 329 | + } elseif ( $this->sort_order == LQT_NEWEST_THREADS ) { |
| 330 | + $sort_clause = 'ORDER BY thread.thread_created DESC'; |
| 331 | + } elseif ( $this->sort_order == LQT_OLDEST_THREADS ) { |
| 332 | + $sort_clause = 'ORDER BY thread.thread_created ASC'; |
333 | 333 | } |
334 | | - $g->addQuery('fresh', |
335 | | - array($article_clause, |
| 334 | + $g->addQuery( 'fresh', |
| 335 | + array( $article_clause, |
336 | 336 | 'thread.thread_parent is null', |
337 | 337 | '(thread.thread_modified >= ' . $startdate->text() . |
338 | 338 | ' OR (thread.thread_summary_page is NULL' . |
339 | | - ' AND thread.thread_type='.Threads::TYPE_NORMAL.'))'), |
340 | | - array($sort_clause)); |
341 | | - $g->addQuery('archived', |
342 | | - array($article_clause, |
| 339 | + ' AND thread.thread_type=' . Threads::TYPE_NORMAL . '))' ), |
| 340 | + array( $sort_clause ) ); |
| 341 | + $g->addQuery( 'archived', |
| 342 | + array( $article_clause, |
343 | 343 | 'thread.thread_parent is null', |
344 | 344 | '(thread.thread_summary_page is not null' . |
345 | | - ' OR thread.thread_type='.Threads::TYPE_NORMAL.')', |
346 | | - 'thread.thread_modified < ' . $startdate->text()), |
347 | | - array($sort_clause)); |
348 | | - $g->extendQuery('archived', 'recently-archived', |
349 | | - array('( thread.thread_modified >=' . $recentstartdate->text() . |
| 345 | + ' OR thread.thread_type=' . Threads::TYPE_NORMAL . ')', |
| 346 | + 'thread.thread_modified < ' . $startdate->text() ), |
| 347 | + array( $sort_clause ) ); |
| 348 | + $g->extendQuery( 'archived', 'recently-archived', |
| 349 | + array( '( thread.thread_modified >=' . $recentstartdate->text() . |
350 | 350 | ' OR rev_timestamp >= ' . $recentstartdate->text() . ')', |
351 | | - 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id'), |
| 351 | + 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id' ), |
352 | 352 | array(), |
353 | | - array('page summary_page', 'revision')); |
| 353 | + array( 'page summary_page', 'revision' ) ); |
354 | 354 | return $g; |
355 | 355 | } |
356 | 356 | |
— | — | @@ -363,31 +363,31 @@ |
364 | 364 | static function queryStringFromArray( $vars ) { |
365 | 365 | $q = ''; |
366 | 366 | if ( $vars && count( $vars ) != 0 ) { |
367 | | - foreach( $vars as $name => $value ) |
| 367 | + foreach ( $vars as $name => $value ) |
368 | 368 | $q .= "$name=$value&"; |
369 | 369 | } |
370 | 370 | return $q; |
371 | 371 | } |
372 | 372 | |
373 | 373 | function methodAppliesToThread( $method, $thread ) { |
374 | | - return $this->request->getVal('lqt_method') == $method && |
375 | | - $this->request->getVal('lqt_operand') == $thread->id(); |
| 374 | + return $this->request->getVal( 'lqt_method' ) == $method && |
| 375 | + $this->request->getVal( 'lqt_operand' ) == $thread->id(); |
376 | 376 | } |
377 | 377 | function methodApplies( $method ) { |
378 | | - return $this->request->getVal('lqt_method') == $method; |
| 378 | + return $this->request->getVal( 'lqt_method' ) == $method; |
379 | 379 | } |
380 | 380 | |
381 | 381 | static function permalinkUrl( $thread, $method = null, $operand = null ) { |
382 | 382 | $query = $method ? "lqt_method=$method" : ""; |
383 | 383 | $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query; |
384 | | - return $thread->root()->getTitle()->getFullUrl($query); |
| 384 | + return $thread->root()->getTitle()->getFullUrl( $query ); |
385 | 385 | } |
386 | 386 | |
387 | 387 | /* This is used for action=history so that the history tab works, which is |
388 | 388 | why we break the lqt_method paradigm. */ |
389 | 389 | static function permalinkUrlWithQuery( $thread, $query ) { |
390 | | - if ( is_array($query) ) $query = self::queryStringFromArray($query); |
391 | | - return $thread->root()->getTitle()->getFullUrl($query); |
| 390 | + if ( is_array( $query ) ) $query = self::queryStringFromArray( $query ); |
| 391 | + return $thread->root()->getTitle()->getFullUrl( $query ); |
392 | 392 | } |
393 | 393 | |
394 | 394 | static function permalinkUrlWithDiff( $thread ) { |
— | — | @@ -396,18 +396,18 @@ |
397 | 397 | $curr_rev = Revision::newFromTitle( $changed_thread->root()->getTitle(), $curr_rev_id ); |
398 | 398 | $prev_rev = $curr_rev->getPrevious(); |
399 | 399 | $oldid = $prev_rev ? $prev_rev->getId() : ""; |
400 | | - return self::permalinkUrlWithQuery( $changed_thread, array('lqt_method'=>'diff', 'diff'=>$curr_rev_id, 'oldid'=>$oldid) ); |
| 400 | + return self::permalinkUrlWithQuery( $changed_thread, array( 'lqt_method' => 'diff', 'diff' => $curr_rev_id, 'oldid' => $oldid ) ); |
401 | 401 | } |
402 | 402 | |
403 | 403 | static function talkpageUrl( $title, $method = null, $operand = null, $includeFragment = true ) { |
404 | 404 | global $wgRequest; // TODO global + ugly hack. |
405 | 405 | $query = $method ? "lqt_method=$method" : ""; |
406 | 406 | $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query; |
407 | | - $oldid = $wgRequest->getVal('oldid', null); if( $oldid !== null ) { |
| 407 | + $oldid = $wgRequest->getVal( 'oldid', null ); if ( $oldid !== null ) { |
408 | 408 | // this is an immensely ugly hack to make editing old revisions work. |
409 | 409 | $query = "$query&oldid=$oldid"; |
410 | 410 | } |
411 | | - return $title->getFullURL( $query ) . ($operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : ""); |
| 411 | + return $title->getFullURL( $query ) . ( $operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : "" ); |
412 | 412 | } |
413 | 413 | |
414 | 414 | |
— | — | @@ -430,7 +430,7 @@ |
431 | 431 | foreach ( $repls as $k => $v ) { |
432 | 432 | $vs[$k] = $v; |
433 | 433 | } |
434 | | - return $this->title->getFullURL(self::queryStringFromArray($vs)); |
| 434 | + return $this->title->getFullURL( self::queryStringFromArray( $vs ) ); |
435 | 435 | } |
436 | 436 | |
437 | 437 | /************************************************************* |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | * TODO: figure out a clean way to expand this to other forms. |
446 | 446 | */ |
447 | 447 | function perpetuate( $name, $as ) { |
448 | | - $value = $this->request->getVal($name, ''); |
| 448 | + $value = $this->request->getVal( $name, '' ); |
449 | 449 | if ( $as == 'hidden' ) { |
450 | 450 | return <<<HTML |
451 | 451 | <input type="hidden" name="$name" id="$name" value="$value"> |
— | — | @@ -452,12 +452,12 @@ |
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
456 | | - function showReplyProtectedNotice($thread) { |
| 456 | + function showReplyProtectedNotice( $thread ) { |
457 | 457 | wfLoadExtensionMessages( 'LiquidThreads' ); |
458 | | - $log_url = SpecialPage::getTitleFor('Log')->getFullURL( |
459 | | - "type=protect&user=&page={$thread->title()->getPrefixedURL()}"); |
460 | | - $this->output->addHTML('<p>' . wfMsg('lqt_protectedfromreply', |
461 | | - '<a href="'.$log_url.'">'.wfMsg('lqt_protectedfromreply_link').'</a>')); |
| 458 | + $log_url = SpecialPage::getTitleFor( 'Log' )->getFullURL( |
| 459 | + "type=protect&user=&page={$thread->title()->getPrefixedURL()}" ); |
| 460 | + $this->output->addHTML( '<p>' . wfMsg( 'lqt_protectedfromreply', |
| 461 | + '<a href="' . $log_url . '">' . wfMsg( 'lqt_protectedfromreply_link' ) . '</a>' ) ); |
462 | 462 | } |
463 | 463 | |
464 | 464 | function showNewThreadForm() { |
— | — | @@ -469,10 +469,10 @@ |
470 | 470 | } |
471 | 471 | |
472 | 472 | function showReplyForm( $thread ) { |
473 | | - if( $thread->root()->getTitle()->userCan( 'edit' ) ) { |
| 473 | + if ( $thread->root()->getTitle()->userCan( 'edit' ) ) { |
474 | 474 | $this->showEditingFormInGeneral( null, 'reply', $thread ); |
475 | 475 | } else { |
476 | | - $this->showReplyProtectedNotice($thread); |
| 476 | + $this->showReplyProtectedNotice( $thread ); |
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
— | — | @@ -488,36 +488,36 @@ |
489 | 489 | can temporarily use a random scratch title. It's fine if the title changes |
490 | 490 | throughout the edit cycle, since the article doesn't exist yet anyways. |
491 | 491 | */ |
492 | | - if ($edit_type == 'summarize' && $edit_applies_to->summary() ) { |
| 492 | + if ( $edit_type == 'summarize' && $edit_applies_to->summary() ) { |
493 | 493 | $article = $edit_applies_to->summary(); |
494 | | - } else if ($edit_type == 'summarize') { |
495 | | - $t = $this->newSummaryTitle($edit_applies_to); |
496 | | - $article = new Article($t); |
| 494 | + } else if ( $edit_type == 'summarize' ) { |
| 495 | + $t = $this->newSummaryTitle( $edit_applies_to ); |
| 496 | + $article = new Article( $t ); |
497 | 497 | } else if ( $thread == null ) { |
498 | | - $subject = $this->request->getVal('lqt_subject_field', ''); |
499 | | - if ($edit_type == 'new') { |
500 | | - $t = $this->newScratchTitle($subject); |
501 | | - } else if ($edit_type == 'reply') { |
502 | | - $t = $this->newReplyTitle($subject, $edit_applies_to); |
| 498 | + $subject = $this->request->getVal( 'lqt_subject_field', '' ); |
| 499 | + if ( $edit_type == 'new' ) { |
| 500 | + $t = $this->newScratchTitle( $subject ); |
| 501 | + } else if ( $edit_type == 'reply' ) { |
| 502 | + $t = $this->newReplyTitle( $subject, $edit_applies_to ); |
503 | 503 | } |
504 | | - $article = new Article($t); |
| 504 | + $article = new Article( $t ); |
505 | 505 | } else { |
506 | 506 | $article = $thread->root(); |
507 | 507 | } |
508 | 508 | |
509 | | - $e = new EditPage($article); |
| 509 | + $e = new EditPage( $article ); |
510 | 510 | |
511 | 511 | $e->suppressIntro = true; |
512 | 512 | $e->editFormTextBeforeContent .= |
513 | | - $this->perpetuate('lqt_method', 'hidden') . |
514 | | - $this->perpetuate('lqt_operand', 'hidden'); |
| 513 | + $this->perpetuate( 'lqt_method', 'hidden' ) . |
| 514 | + $this->perpetuate( 'lqt_operand', 'hidden' ); |
515 | 515 | |
516 | | - if ( $edit_type=='new' || ($thread && !$thread->hasSuperthread()) ) { |
| 516 | + if ( $edit_type == 'new' || ( $thread && !$thread->hasSuperthread() ) ) { |
517 | 517 | wfLoadExtensionMessages( 'LiquidThreads' ); |
518 | 518 | // This is a top-level post; show the subject line. |
519 | 519 | $db_subject = $thread ? $thread->subjectWithoutIncrement() : ''; |
520 | | - $subject = $this->request->getVal('lqt_subject_field', $db_subject); |
521 | | - $subject_label = wfMsg('lqt_subject'); |
| 520 | + $subject = $this->request->getVal( 'lqt_subject_field', $db_subject ); |
| 521 | + $subject_label = wfMsg( 'lqt_subject' ); |
522 | 522 | $e->editFormTextBeforeContent .= <<<HTML |
523 | 523 | <label for="lqt_subject_field">$subject_label</label> |
524 | 524 | <input type="text" size="60" name="lqt_subject_field" id="lqt_subject_field" value="$subject" tabindex="1"><br /> |
— | — | @@ -527,33 +527,33 @@ |
528 | 528 | $e->edit(); |
529 | 529 | |
530 | 530 | // Override what happens in EditPage::showEditForm, called from $e->edit(): |
531 | | -// $wgOut->setArticleRelated( false ); |
| 531 | + |
532 | 532 | $this->output->setArticleFlag( false ); |
533 | 533 | |
534 | 534 | // For replies and new posts, insert the associated thread object into the DB. |
535 | | - if ($edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave) { |
| 535 | + if ( $edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave ) { |
536 | 536 | if ( $edit_type == 'reply' ) { |
537 | 537 | $thread = Threads::newThread( $article, $this->article, $edit_applies_to, $e->summary ); |
538 | | - $edit_applies_to->commitRevision(Threads::CHANGE_REPLY_CREATED, $thread, $e->summary); |
| 538 | + $edit_applies_to->commitRevision( Threads::CHANGE_REPLY_CREATED, $thread, $e->summary ); |
539 | 539 | } else { |
540 | 540 | $thread = Threads::newThread( $article, $this->article, null, $e->summary ); |
541 | 541 | } |
542 | 542 | } |
543 | 543 | |
544 | | - if ($edit_type == 'summarize' && $e->didSave) { |
| 544 | + if ( $edit_type == 'summarize' && $e->didSave ) { |
545 | 545 | $edit_applies_to->setSummary( $article ); |
546 | | - $edit_applies_to->commitRevision(Threads::CHANGE_EDITED_SUMMARY, $edit_applies_to, $e->summary); |
| 546 | + $edit_applies_to->commitRevision( Threads::CHANGE_EDITED_SUMMARY, $edit_applies_to, $e->summary ); |
547 | 547 | } |
548 | 548 | |
549 | 549 | // Move the thread and replies if subject changed. |
550 | | - if( $edit_type == 'editExisting' && $e->didSave ) { |
551 | | - $subject = $this->request->getVal('lqt_subject_field', ''); |
| 550 | + if ( $edit_type == 'editExisting' && $e->didSave ) { |
| 551 | + $subject = $this->request->getVal( 'lqt_subject_field', '' ); |
552 | 552 | if ( $subject && $subject != $thread->subjectWithoutIncrement() ) { |
553 | | -// $reason = $this->request->getVal("wpSummary", ""); |
554 | | - $this->renameThread($thread, $subject, $e->summary); |
| 553 | + |
| 554 | + $this->renameThread( $thread, $subject, $e->summary ); |
555 | 555 | } |
556 | 556 | // this is unrelated to the subject change and is for all edits: |
557 | | - $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) ); |
| 557 | + $thread->setRootRevision( Revision::newFromTitle( $thread->root()->getTitle() ) ); |
558 | 558 | $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $e->summary ); |
559 | 559 | } |
560 | 560 | |
— | — | @@ -568,34 +568,34 @@ |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | | - function renameThread($t,$s,$reason) { |
573 | | - $this->simplePageMove($t->root()->getTitle(),$s, $reason); |
| 572 | + function renameThread( $t, $s, $reason ) { |
| 573 | + $this->simplePageMove( $t->root()->getTitle(), $s, $reason ); |
574 | 574 | // TODO here create a redirect from old page to new. |
575 | | - foreach( $t->subthreads() as $st ) { |
576 | | - $this->renameThread($st, $s, $reason); |
| 575 | + foreach ( $t->subthreads() as $st ) { |
| 576 | + $this->renameThread( $st, $s, $reason ); |
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
580 | 580 | function scratchTitle() { |
581 | | - $token = md5(uniqid(rand(), true)); |
| 581 | + $token = md5( uniqid( rand(), true ) ); |
582 | 582 | return Title::newFromText( "Thread:$token" ); |
583 | 583 | } |
584 | | - function newScratchTitle($subject) { |
| 584 | + function newScratchTitle( $subject ) { |
585 | 585 | wfLoadExtensionMessages( 'LiquidThreads' ); |
586 | | - return $this->incrementedTitle( $subject?$subject:wfMsg('lqt_nosubject'), NS_LQT_THREAD ); |
| 586 | + return $this->incrementedTitle( $subject ? $subject:wfMsg( 'lqt_nosubject' ), NS_LQT_THREAD ); |
587 | 587 | } |
588 | | - function newSummaryTitle($t) { |
| 588 | + function newSummaryTitle( $t ) { |
589 | 589 | return $this->incrementedTitle( $t->subject(), NS_LQT_SUMMARY ); |
590 | 590 | } |
591 | | - function newReplyTitle($s, $t) { |
| 591 | + function newReplyTitle( $s, $t ) { |
592 | 592 | return $this->incrementedTitle( $t->subjectWithoutIncrement(), NS_LQT_THREAD ); |
593 | 593 | } |
594 | 594 | /** Keep trying titles starting with $basename until one is unoccupied. */ |
595 | | - public static function incrementedTitle($basename, $namespace) { |
| 595 | + public static function incrementedTitle( $basename, $namespace ) { |
596 | 596 | $i = 1; do { |
597 | | - $t = Title::newFromText( $basename.'_('.$i.')', $namespace ); |
| 597 | + $t = Title::newFromText( $basename . '_(' . $i . ')', $namespace ); |
598 | 598 | $i++; |
599 | | - } while ( $t->exists() || in_array($t->getPrefixedDBkey(), self::$occupied_titles) ); |
| 599 | + } while ( $t->exists() || in_array( $t->getPrefixedDBkey(), self::$occupied_titles ) ); |
600 | 600 | return $t; |
601 | 601 | } |
602 | 602 | |
— | — | @@ -609,7 +609,7 @@ |
610 | 610 | # Variables beginning with 'o' for old article 'n' for new article |
611 | 611 | |
612 | 612 | $ot = $old_title; |
613 | | - $nt = $this->incrementedTitle($new_subject, $old_title->getNamespace()); |
| 613 | + $nt = $this->incrementedTitle( $new_subject, $old_title->getNamespace() ); |
614 | 614 | |
615 | 615 | self::$occupied_titles[] = $nt->getPrefixedDBkey(); |
616 | 616 | |
— | — | @@ -621,7 +621,7 @@ |
622 | 622 | |
623 | 623 | $error = $ot->moveTo( $nt, true, "Changed thread subject: $reason" ); |
624 | 624 | if ( $error !== true ) { |
625 | | - var_dump($error); |
| 625 | + var_dump( $error ); |
626 | 626 | echo "something bad happened trying to rename the thread."; // TODO |
627 | 627 | return false; |
628 | 628 | } |
— | — | @@ -644,61 +644,61 @@ |
645 | 645 | * 'enabled' => true ) |
646 | 646 | * ) |
647 | 647 | */ |
648 | | - function threadFooterCommands($thread) { |
| 648 | + function threadFooterCommands( $thread ) { |
649 | 649 | wfLoadExtensionMessages( 'LiquidThreads' ); |
650 | 650 | $commands = array(); |
651 | 651 | |
652 | 652 | $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' ); |
653 | 653 | |
654 | | - $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'), |
| 654 | + $commands[] = array( 'label' => $user_can_edit ? wfMsg( 'edit' ) : wfMsg( 'viewsource' ), |
655 | 655 | 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ), |
656 | 656 | 'enabled' => true ); |
657 | 657 | |
658 | | - $commands[] = array( 'label' => wfMsg('history_short'), |
659 | | - 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'), |
| 658 | + $commands[] = array( 'label' => wfMsg( 'history_short' ), |
| 659 | + 'href' => $this->permalinkUrlWithQuery( $thread, 'action=history' ), |
660 | 660 | 'enabled' => true ); |
661 | 661 | |
662 | | - $commands[] = array( 'label' => wfMsg('lqt_permalink'), |
| 662 | + $commands[] = array( 'label' => wfMsg( 'lqt_permalink' ), |
663 | 663 | 'href' => $this->permalinkUrl( $thread ), |
664 | 664 | 'enabled' => true ); |
665 | 665 | |
666 | | - if ( in_array('delete', $this->user->getRights()) ) { |
667 | | - $delete_url = SpecialPage::getTitleFor('DeleteThread')->getFullURL() |
| 666 | + if ( in_array( 'delete', $this->user->getRights() ) ) { |
| 667 | + $delete_url = SpecialPage::getTitleFor( 'DeleteThread' )->getFullURL() |
668 | 668 | . '/' . $thread->title()->getPrefixedURL(); |
669 | | - $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg('lqt_undelete') : wfMsg('delete'), |
| 669 | + $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg( 'lqt_undelete' ) : wfMsg( 'delete' ), |
670 | 670 | 'href' => $delete_url, |
671 | 671 | 'enabled' => true ); |
672 | 672 | } |
673 | 673 | |
674 | | - $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg('lqt_reply') . '</b>', |
| 674 | + $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg( 'lqt_reply' ) . '</b>', |
675 | 675 | 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ), |
676 | 676 | 'enabled' => $user_can_edit ); |
677 | 677 | |
678 | 678 | return $commands; |
679 | 679 | } |
680 | 680 | |
681 | | - function topLevelThreadCommands($thread) { |
| 681 | + function topLevelThreadCommands( $thread ) { |
682 | 682 | wfLoadExtensionMessages( 'LiquidThreads' ); |
683 | 683 | $commands = array(); |
684 | 684 | |
685 | | - $commands[] = array( 'label' => wfMsg('history_short'), |
686 | | - 'href' => $this->permalinkUrl($thread, 'thread_history'), |
| 685 | + $commands[] = array( 'label' => wfMsg( 'history_short' ), |
| 686 | + 'href' => $this->permalinkUrl( $thread, 'thread_history' ), |
687 | 687 | 'enabled' => true ); |
688 | 688 | |
689 | | - if( in_array('move', $this->user->getRights()) ) { |
690 | | - $move_href = SpecialPage::getTitleFor('MoveThread')->getFullURL() |
| 689 | + if ( in_array( 'move', $this->user->getRights() ) ) { |
| 690 | + $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getFullURL() |
691 | 691 | . '/' . $thread->title()->getPrefixedURL(); |
692 | | - $commands[] = array( 'label' => wfMsg('move'), |
| 692 | + $commands[] = array( 'label' => wfMsg( 'move' ), |
693 | 693 | 'href' => $move_href, |
694 | 694 | 'enabled' => true ); |
695 | 695 | } |
696 | | - if( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) { |
697 | | - $commands[] = array( 'label' => wfMsg('watch'), |
698 | | - 'href' => $this->permalinkUrlWithQuery($thread, 'action=watch'), |
| 696 | + if ( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) { |
| 697 | + $commands[] = array( 'label' => wfMsg( 'watch' ), |
| 698 | + 'href' => $this->permalinkUrlWithQuery( $thread, 'action=watch' ), |
699 | 699 | 'enabled' => true ); |
700 | | - } else if( !$this->user->isAnon() ) { |
701 | | - $commands[] = array( 'label' => wfMsg('unwatch'), |
702 | | - 'href' => $this->permalinkUrlWithQuery($thread, 'action=unwatch'), |
| 700 | + } else if ( !$this->user->isAnon() ) { |
| 701 | + $commands[] = array( 'label' => wfMsg( 'unwatch' ), |
| 702 | + 'href' => $this->permalinkUrlWithQuery( $thread, 'action=unwatch' ), |
703 | 703 | 'enabled' => true ); |
704 | 704 | } |
705 | 705 | |
— | — | @@ -721,7 +721,7 @@ |
722 | 722 | /*]]>*/</style> |
723 | 723 | |
724 | 724 | HTML; |
725 | | - $wgOut->addScript($s); |
| 725 | + $wgOut->addScript( $s ); |
726 | 726 | } |
727 | 727 | |
728 | 728 | /* @return False if the article and revision do not exist and we didn't show it, true if we did. */ |
— | — | @@ -734,7 +734,7 @@ |
735 | 735 | intval( $this->user->getOption( 'stubthreshold' ) ) == 0 && |
736 | 736 | $post->exists() && |
737 | 737 | $oldid === null; |
738 | | - wfDebug( 'LqtView::showPostBody using parser cache: ' . ($pcache ? 'yes' : 'no' ) . "\n" ); |
| 738 | + wfDebug( 'LqtView::showPostBody using parser cache: ' . ( $pcache ? 'yes' : 'no' ) . "\n" ); |
739 | 739 | if ( $this->user->getOption( 'stubthreshold' ) ) { |
740 | 740 | wfIncrStats( 'pcache_miss_stub' ); |
741 | 741 | } |
— | — | @@ -744,15 +744,15 @@ |
745 | 745 | $outputDone = $this->output->tryParserCache( $post, $this->user ); |
746 | 746 | } |
747 | 747 | |
748 | | - if (!$outputDone) { |
| 748 | + if ( !$outputDone ) { |
749 | 749 | // Cache miss; parse and output it. |
750 | 750 | $rev = Revision::newFromTitle( $post->getTitle(), $oldid ); |
751 | | - if ($rev && $oldid) { |
| 751 | + if ( $rev && $oldid ) { |
752 | 752 | // don't save oldids in the parser cache. |
753 | 753 | $this->output->addWikiText( $rev->getText() ); |
754 | 754 | return true; |
755 | 755 | } |
756 | | - else if ($rev) { |
| 756 | + else if ( $rev ) { |
757 | 757 | $post->outputWikiText( $rev->getText(), true ); |
758 | 758 | return true; |
759 | 759 | } else { |
— | — | @@ -765,68 +765,68 @@ |
766 | 766 | |
767 | 767 | function colorTest() { |
768 | 768 | $this->output->addHTML( '<div class="lqt_footer"><li class="lqt_footer_sig">' ); |
769 | | - for( $i = 1; $i <= self::number_of_user_colors; $i++ ) { |
770 | | - $this->output->addHTML("<span class=\"lqt_post_color_{$i}\"><a href=\"foo\">DavidMcCabe</a></span>"); |
| 769 | + for ( $i = 1; $i <= self::number_of_user_colors; $i++ ) { |
| 770 | + $this->output->addHTML( "<span class=\"lqt_post_color_{$i}\"><a href=\"foo\">DavidMcCabe</a></span>" ); |
771 | 771 | } |
772 | | - $this->output->addHTML('</li></div>'); |
| 772 | + $this->output->addHTML( '</li></div>' ); |
773 | 773 | } |
774 | 774 | |
775 | 775 | function showThreadFooter( $thread ) { |
776 | 776 | global $wgLang; // TODO global. |
777 | 777 | |
778 | 778 | $author = $thread->root()->originalAuthor(); |
779 | | - $color_number = $this->selectNewUserColor($author); |
| 779 | + $color_number = $this->selectNewUserColor( $author ); |
780 | 780 | |
781 | 781 | $sig = $this->user->getSkin()->userLink( $author->getID(), $author->getName() ) . |
782 | 782 | $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() ); |
783 | 783 | |
784 | | - $timestamp = $wgLang->timeanddate($thread->created()); |
| 784 | + $timestamp = $wgLang->timeanddate( $thread->created() ); |
785 | 785 | |
786 | | - $this->output->addHTML(<<<HTML |
| 786 | + $this->output->addHTML( <<<HTML |
787 | 787 | <ul class="lqt_footer"> |
788 | 788 | <span class="lqt_footer_sig"> |
789 | 789 | <li class="lqt_author_sig lqt_post_color_{$color_number}">$sig</li> |
790 | 790 | HTML |
791 | 791 | ); |
792 | 792 | |
793 | | - if( $thread->editedness() == Threads::EDITED_BY_AUTHOR || $thread->editedness() == Threads::EDITED_BY_OTHERS ) { |
| 793 | + if ( $thread->editedness() == Threads::EDITED_BY_AUTHOR || $thread->editedness() == Threads::EDITED_BY_OTHERS ) { |
794 | 794 | wfLoadExtensionMessages( 'LiquidThreads' ); |
795 | | - $editedness_url = $this->permalinkUrlWithQuery($thread, 'action=history'); |
| 795 | + $editedness_url = $this->permalinkUrlWithQuery( $thread, 'action=history' ); |
796 | 796 | $editedness_color_number = $thread->editedness() == Threads::EDITED_BY_AUTHOR ? |
797 | | - $color_number : ($color_number == self::number_of_user_colors ? 1 : $color_number + 1); |
798 | | - $this->output->addHTML("<li class=\"lqt_edited_notice lqt_post_color_{$editedness_color_number}\">". |
799 | | - '<a href="'.$editedness_url.'">'.wfMsg('lqt_edited_notice').'</a>'.'</li>'); |
| 797 | + $color_number : ( $color_number == self::number_of_user_colors ? 1 : $color_number + 1 ); |
| 798 | + $this->output->addHTML( "<li class=\"lqt_edited_notice lqt_post_color_{$editedness_color_number}\">" . |
| 799 | + '<a href="' . $editedness_url . '">' . wfMsg( 'lqt_edited_notice' ) . '</a>' . '</li>' ); |
800 | 800 | } |
801 | 801 | |
802 | | - $this->output->addHTML("</span><li>$timestamp</li>"); |
| 802 | + $this->output->addHTML( "</span><li>$timestamp</li>" ); |
803 | 803 | |
804 | | - $this->output->addHTML('<span class="lqt_footer_commands">' . |
805 | | - $this->listItemsForCommands($this->threadFooterCommands($thread)) . |
806 | | - '</span>'); |
| 804 | + $this->output->addHTML( '<span class="lqt_footer_commands">' . |
| 805 | + $this->listItemsForCommands( $this->threadFooterCommands( $thread ) ) . |
| 806 | + '</span>' ); |
807 | 807 | |
808 | | - $this->output->addHTML('</ul>'); |
| 808 | + $this->output->addHTML( '</ul>' ); |
809 | 809 | } |
810 | 810 | |
811 | | - function listItemsForCommands($commands) { |
| 811 | + function listItemsForCommands( $commands ) { |
812 | 812 | $result = array(); |
813 | | - foreach( $commands as $command ) { |
| 813 | + foreach ( $commands as $command ) { |
814 | 814 | $label = $command['label']; |
815 | 815 | $href = $command['href']; |
816 | 816 | $enabled = $command['enabled']; |
817 | 817 | |
818 | | - if( $enabled ) { |
| 818 | + if ( $enabled ) { |
819 | 819 | $result[] = "<li><a href=\"$href\">$label</a></li>"; |
820 | 820 | } else { |
821 | 821 | $result[] = "<li><span class=\"lqt_command_disabled\">$label</span></li>"; |
822 | 822 | } |
823 | 823 | } |
824 | | - return join("", $result); |
| 824 | + return join( "", $result ); |
825 | 825 | } |
826 | 826 | |
827 | 827 | function selectNewUserColor( $user ) { |
828 | 828 | $userkey = $user->isAnon() ? "anon:" . $user->getName() : "user:" . $user->getId(); |
829 | 829 | |
830 | | - if( !array_key_exists( $userkey, $this->user_colors ) ) { |
| 830 | + if ( !array_key_exists( $userkey, $this->user_colors ) ) { |
831 | 831 | $this->user_colors[$userkey] = $this->user_color_index; |
832 | 832 | $this->user_color_index += 1; |
833 | 833 | if ( $this->user_color_index > self::number_of_user_colors ) { |
— | — | @@ -839,8 +839,8 @@ |
840 | 840 | function showRootPost( $thread ) { |
841 | 841 | $popts = $this->output->parserOptions(); |
842 | 842 | $previous_editsection = $popts->getEditSection(); |
843 | | - $popts->setEditSection(false); |
844 | | - $this->output->parserOptions($popts); |
| 843 | + $popts->setEditSection( false ); |
| 844 | + $this->output->parserOptions( $popts ); |
845 | 845 | |
846 | 846 | $post = $thread->root(); |
847 | 847 | |
— | — | @@ -849,40 +849,40 @@ |
850 | 850 | // or from oldid (which is a page rev). But oldid only applies to the |
851 | 851 | // thread being requested, not any replies. TODO: eliminate the need |
852 | 852 | // for article-level histories. |
853 | | - $page_rev = $this->request->getVal('oldid', null); |
854 | | - if( $page_rev !== null && $this->title->equals($thread->root()->getTitle()) ) { |
| 853 | + $page_rev = $this->request->getVal( 'oldid', null ); |
| 854 | + if ( $page_rev !== null && $this->title->equals( $thread->root()->getTitle() ) ) { |
855 | 855 | $oldid = $page_rev; |
856 | 856 | } else { |
857 | 857 | $oldid = $thread->isHistorical() ? $thread->rootRevision() : null; |
858 | 858 | } |
859 | 859 | |
860 | | - $this->openDiv( $this->postDivClass($thread) ); |
| 860 | + $this->openDiv( $this->postDivClass( $thread ) ); |
861 | 861 | |
862 | | - if( $this->methodAppliesToThread( 'edit', $thread ) ) { |
| 862 | + if ( $this->methodAppliesToThread( 'edit', $thread ) ) { |
863 | 863 | $this->showPostEditingForm( $thread ); |
864 | | - } else{ |
| 864 | + } else { |
865 | 865 | $this->showPostBody( $post, $oldid ); |
866 | 866 | $this->showThreadFooter( $thread ); |
867 | 867 | } |
868 | 868 | |
869 | 869 | $this->closeDiv(); |
870 | 870 | |
871 | | - if( $this->methodAppliesToThread( 'reply', $thread ) ) { |
872 | | - $this->indent($thread); |
| 871 | + if ( $this->methodAppliesToThread( 'reply', $thread ) ) { |
| 872 | + $this->indent( $thread ); |
873 | 873 | $this->showReplyForm( $thread ); |
874 | | - $this->unindent($thread); |
| 874 | + $this->unindent( $thread ); |
875 | 875 | } |
876 | 876 | |
877 | | - $popts->setEditSection($previous_editsection); |
878 | | - $this->output->parserOptions($popts); |
| 877 | + $popts->setEditSection( $previous_editsection ); |
| 878 | + $this->output->parserOptions( $popts ); |
879 | 879 | } |
880 | 880 | |
881 | 881 | function showThreadHeading( $thread ) { |
882 | 882 | if ( $thread->hasDistinctSubject() ) { |
883 | | - if( $thread->hasSuperthread() ) { |
| 883 | + if ( $thread->hasSuperthread() ) { |
884 | 884 | $commands_html = ""; |
885 | 885 | } else { |
886 | | - $lis = $this->listItemsForCommands($this->topLevelThreadCommands($thread)); |
| 886 | + $lis = $this->listItemsForCommands( $this->topLevelThreadCommands( $thread ) ); |
887 | 887 | $commands_html = "<ul class=\"lqt_threadlevel_commands\">$lis</ul>"; |
888 | 888 | } |
889 | 889 | |
— | — | @@ -898,7 +898,7 @@ |
899 | 899 | return 'lqt_post'; |
900 | 900 | } |
901 | 901 | |
902 | | - static function anchorName($thread) { |
| 902 | + static function anchorName( $thread ) { |
903 | 903 | return "lqt_thread_{$thread->id()}"; |
904 | 904 | } |
905 | 905 | |
— | — | @@ -906,16 +906,16 @@ |
907 | 907 | global $wgLang; # TODO global. |
908 | 908 | |
909 | 909 | if ( $thread->type() == Threads::TYPE_DELETED |
910 | | - && ! $this->request->getBool('lqt_show_deleted_threads') ) |
| 910 | + && ! $this->request->getBool( 'lqt_show_deleted_threads' ) ) |
911 | 911 | return; |
912 | 912 | |
913 | | - if( $this->lastUnindentedSuperthread ) { |
| 913 | + if ( $this->lastUnindentedSuperthread ) { |
914 | 914 | wfLoadExtensionMessages( 'LiquidThreads' ); |
915 | 915 | $tmp = $this->lastUnindentedSuperthread; |
916 | | - $msg = wfMsg('lqt_in_response_to', |
917 | | - '<a href="#lqt_thread_'.$tmp->id().'">'.$tmp->title()->getText().'</a>', |
918 | | - $tmp->root()->originalAuthor()->getName()); |
919 | | - $this->output->addHTML('<span class="lqt_nonindent_message">←'.$msg.'</span>'); |
| 916 | + $msg = wfMsg( 'lqt_in_response_to', |
| 917 | + '<a href="#lqt_thread_' . $tmp->id() . '">' . $tmp->title()->getText() . '</a>', |
| 918 | + $tmp->root()->originalAuthor()->getName() ); |
| 919 | + $this->output->addHTML( '<span class="lqt_nonindent_message">←' . $msg . '</span>' ); |
920 | 920 | } |
921 | 921 | |
922 | 922 | |
— | — | @@ -923,7 +923,7 @@ |
924 | 924 | |
925 | 925 | $this->output->addHTML( "<a name=\"{$this->anchorName($thread)}\" ></a>" ); |
926 | 926 | |
927 | | - if ($thread->type() == Threads::TYPE_MOVED) { |
| 927 | + if ( $thread->type() == Threads::TYPE_MOVED ) { |
928 | 928 | wfLoadExtensionMessages( 'LiquidThreads' ); |
929 | 929 | $revision = Revision::newFromTitle( $thread->title() ); |
930 | 930 | $target = Title::newFromRedirect( $revision->getText() ); |
— | — | @@ -931,90 +931,90 @@ |
932 | 932 | $author = $thread->root()->originalAuthor(); |
933 | 933 | $sig = $this->user->getSkin()->userLink( $author->getID(), $author->getName() ) . |
934 | 934 | $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() ); |
935 | | - $this->output->addHTML( wfMsg('lqt_move_placeholder', |
936 | | - '<a href="'.$target->getFullURL().'">'.$target->getText().'</a>', |
| 935 | + $this->output->addHTML( wfMsg( 'lqt_move_placeholder', |
| 936 | + '<a href="' . $target->getFullURL() . '">' . $target->getText() . '</a>', |
937 | 937 | $sig, |
938 | | - $wgLang->timeanddate($thread->modified()) |
939 | | - )); |
| 938 | + $wgLang->timeanddate( $thread->modified() ) |
| 939 | + ) ); |
940 | 940 | return; |
941 | 941 | } |
942 | 942 | |
943 | 943 | if ( $thread->type() == Threads::TYPE_DELETED ) { |
944 | 944 | wfLoadExtensionMessages( 'LiquidThreads' ); |
945 | | - if ( in_array('deletedhistory', $this->user->getRights()) ) { |
946 | | - $this->output->addHTML('<p>'. wfMsg('lqt_thread_deleted_for_sysops', |
947 | | - '<b>'.wfMsg('lqt_thread_deleted_for_sysops_deleted').'</b>') .'</p>'); |
| 945 | + if ( in_array( 'deletedhistory', $this->user->getRights() ) ) { |
| 946 | + $this->output->addHTML( '<p>' . wfMsg( 'lqt_thread_deleted_for_sysops', |
| 947 | + '<b>' . wfMsg( 'lqt_thread_deleted_for_sysops_deleted' ) . '</b>' ) . '</p>' ); |
948 | 948 | } |
949 | 949 | else { |
950 | | - $this->output->addHTML('<p><em>'.wfMsg('lqt_thread_deleted').'</em></p>'); |
| 950 | + $this->output->addHTML( '<p><em>' . wfMsg( 'lqt_thread_deleted' ) . '</em></p>' ); |
951 | 951 | return; |
952 | 952 | } |
953 | 953 | } |
954 | 954 | |
955 | | - $timestamp = new Date($thread->modified()); |
956 | | - if( $thread->summary() ) { |
957 | | - $this->showSummary($thread); |
958 | | - } else if ( $timestamp->isBefore(Date::now()->nDaysAgo($this->archive_start_days)) |
| 955 | + $timestamp = new Date( $thread->modified() ); |
| 956 | + if ( $thread->summary() ) { |
| 957 | + $this->showSummary( $thread ); |
| 958 | + } else if ( $timestamp->isBefore( Date::now()->nDaysAgo( $this->archive_start_days ) ) |
959 | 959 | && !$thread->summary() && !$thread->hasSuperthread() && !$thread->isHistorical() ) |
960 | 960 | { |
961 | 961 | wfLoadExtensionMessages( 'LiquidThreads' ); |
962 | | - $this->output->addHTML('<p class="lqt_summary_notice">'. wfMsg('lqt_summary_notice', |
963 | | - '<a href="'.$this->permalinkUrl($thread, 'summarize').'">'.wfMsg('lqt_summary_notice_link').'</a>', |
| 962 | + $this->output->addHTML( '<p class="lqt_summary_notice">' . wfMsg( 'lqt_summary_notice', |
| 963 | + '<a href="' . $this->permalinkUrl( $thread, 'summarize' ) . '">' . wfMsg( 'lqt_summary_notice_link' ) . '</a>', |
964 | 964 | $this->archive_start_days |
965 | | - ) .'</p>'); |
| 965 | + ) . '</p>' ); |
966 | 966 | } |
967 | 967 | |
968 | 968 | |
969 | 969 | |
970 | | - $this->openDiv('lqt_thread', "lqt_thread_id_{$thread->id()}"); |
| 970 | + $this->openDiv( 'lqt_thread', "lqt_thread_id_{$thread->id()}" ); |
971 | 971 | |
972 | 972 | $this->showRootPost( $thread ); |
973 | 973 | |
974 | | - if( $thread->hasSubthreads() ) $this->indent($thread); |
975 | | - foreach( $thread->subthreads() as $st ) { |
976 | | - $this->showThread($st); |
| 974 | + if ( $thread->hasSubthreads() ) $this->indent( $thread ); |
| 975 | + foreach ( $thread->subthreads() as $st ) { |
| 976 | + $this->showThread( $st ); |
977 | 977 | } |
978 | | - if( $thread->hasSubthreads() ) $this->unindent($thread); |
| 978 | + if ( $thread->hasSubthreads() ) $this->unindent( $thread ); |
979 | 979 | |
980 | 980 | $this->closeDiv(); |
981 | 981 | |
982 | 982 | } |
983 | 983 | |
984 | | - function indent($thread) { |
985 | | - if( $this->headerLevel <= $this->maxIndentationLevel ) { |
986 | | - $this->output->addHTML('<dl class="lqt_replies"><dd>'); |
| 984 | + function indent( $thread ) { |
| 985 | + if ( $this->headerLevel <= $this->maxIndentationLevel ) { |
| 986 | + $this->output->addHTML( '<dl class="lqt_replies"><dd>' ); |
987 | 987 | } else { |
988 | | - $this->output->addHTML('<div class="lqt_replies_without_indent">'); |
| 988 | + $this->output->addHTML( '<div class="lqt_replies_without_indent">' ); |
989 | 989 | } |
990 | 990 | $this->lastUnindentedSuperthread = null; |
991 | 991 | $this->headerLevel += 1; |
992 | 992 | } |
993 | | - function unindent($thread) { |
994 | | - if( $this->headerLevel <= $this->maxIndentationLevel + 1 ) { |
995 | | - $this->output->addHTML('</dd></dl>'); |
| 993 | + function unindent( $thread ) { |
| 994 | + if ( $this->headerLevel <= $this->maxIndentationLevel + 1 ) { |
| 995 | + $this->output->addHTML( '</dd></dl>' ); |
996 | 996 | } else { |
997 | | - $this->output->addHTML('</div>'); |
| 997 | + $this->output->addHTML( '</div>' ); |
998 | 998 | } |
999 | 999 | // See the beginning of showThread(). |
1000 | 1000 | $this->lastUnindentedSuperthread = $thread->superthread(); |
1001 | 1001 | $this->headerLevel -= 1; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | | - function openDiv( $class='', $id='' ) { |
1005 | | - $this->output->addHTML( Xml::openElement( 'div', array('class'=>$class, 'id'=>$id) ) ); |
| 1004 | + function openDiv( $class = '', $id = '' ) { |
| 1005 | + $this->output->addHTML( Xml::openElement( 'div', array( 'class' => $class, 'id' => $id ) ) ); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | function closeDiv() { |
1009 | 1009 | $this->output->addHTML( Xml::closeElement( 'div' ) ); |
1010 | 1010 | } |
1011 | 1011 | |
1012 | | - function showSummary($t) { |
| 1012 | + function showSummary( $t ) { |
1013 | 1013 | if ( !$t->summary() ) return; |
1014 | 1014 | wfLoadExtensionMessages( 'LiquidThreads' ); |
1015 | | - $label = wfMsg('lqt_summary_label'); |
1016 | | - $edit = strtolower(wfMsg('edit')); |
1017 | | - $link = strtolower(wfMsg('lqt_permalink')); |
1018 | | - $this->output->addHTML(<<<HTML |
| 1015 | + $label = wfMsg( 'lqt_summary_label' ); |
| 1016 | + $edit = strtolower( wfMsg( 'edit' ) ); |
| 1017 | + $link = strtolower( wfMsg( 'lqt_permalink' ) ); |
| 1018 | + $this->output->addHTML( <<<HTML |
1019 | 1019 | <div class='lqt_thread_permalink_summary'> |
1020 | 1020 | <span class="lqt_thread_permalink_summary_title"> |
1021 | 1021 | $label |
— | — | @@ -1024,8 +1024,8 @@ |
1025 | 1025 | </span> |
1026 | 1026 | HTML |
1027 | 1027 | ); |
1028 | | - $this->openDiv('lqt_thread_permalink_summary_body'); |
1029 | | - $this->showPostBody($t->summary()); |
| 1028 | + $this->openDiv( 'lqt_thread_permalink_summary_body' ); |
| 1029 | + $this->showPostBody( $t->summary() ); |
1030 | 1030 | $this->closeDiv(); |
1031 | 1031 | $this->closeDiv(); |
1032 | 1032 | } |
Index: trunk/extensions/LiquidThreads/LqtFunctions.php |
— | — | @@ -1,10 +1,10 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) |
4 | 4 | die(); |
5 | 5 | |
6 | | -function efArrayDefault($name, $key, $default) { |
| 6 | +function efArrayDefault( $name, $key, $default ) { |
7 | 7 | global $$name; |
8 | | - if( isset($$name) && is_array($$name) && array_key_exists($key, $$name) ) { |
| 8 | + if ( isset( $$name ) && is_array( $$name ) && array_key_exists( $key, $$name ) ) { |
9 | 9 | $foo = $$name; |
10 | 10 | return $foo[$key]; |
11 | 11 | } |
— | — | @@ -21,13 +21,13 @@ |
22 | 22 | function efInsertIntoAssoc( $new_key, $new_value, $before, &$original_array ) { |
23 | 23 | $ordered = array(); |
24 | 24 | $i = 0; |
25 | | - foreach($original_array as $key=>$value) { |
26 | | - $ordered[$i] = array($key, $value); |
| 25 | + foreach ( $original_array as $key => $value ) { |
| 26 | + $ordered[$i] = array( $key, $value ); |
27 | 27 | $i += 1; |
28 | 28 | } |
29 | 29 | $new_assoc = array(); |
30 | | - foreach($ordered as $pair) { |
31 | | - if( $pair[0] == $before ) { |
| 30 | + foreach ( $ordered as $pair ) { |
| 31 | + if ( $pair[0] == $before ) { |
32 | 32 | $new_assoc[$new_key] = $new_value; |
33 | 33 | } |
34 | 34 | $new_assoc[$pair[0]] = $pair[1]; |
— | — | @@ -35,32 +35,32 @@ |
36 | 36 | $original_array = $new_assoc; |
37 | 37 | } |
38 | 38 | |
39 | | -function efVarDump($value) { |
| 39 | +function efVarDump( $value ) { |
40 | 40 | global $wgOut; |
41 | 41 | ob_start(); |
42 | | - var_dump($value); |
43 | | - $tmp=ob_get_contents(); |
| 42 | + var_dump( $value ); |
| 43 | + $tmp = ob_get_contents(); |
44 | 44 | ob_end_clean(); |
45 | | - $wgOut->addHTML(/*'<pre>' . htmlspecialchars($tmp,ENT_QUOTES) . '</pre>'*/ $tmp); |
| 45 | + $wgOut->addHTML( /*'<pre>' . htmlspecialchars($tmp,ENT_QUOTES) . '</pre>'*/ $tmp ); |
46 | 46 | } |
47 | 47 | |
48 | | -function efThreadTable($ts) { |
| 48 | +function efThreadTable( $ts ) { |
49 | 49 | global $wgOut; |
50 | | - $wgOut->addHTML('<table>'); |
51 | | - foreach($ts as $t) |
52 | | - efThreadTableHelper($t, 0); |
53 | | - $wgOut->addHTML('</table>'); |
| 50 | + $wgOut->addHTML( '<table>' ); |
| 51 | + foreach ( $ts as $t ) |
| 52 | + efThreadTableHelper( $t, 0 ); |
| 53 | + $wgOut->addHTML( '</table>' ); |
54 | 54 | } |
55 | 55 | |
56 | | -function efThreadTableHelper($t, $indent) { |
| 56 | +function efThreadTableHelper( $t, $indent ) { |
57 | 57 | global $wgOut; |
58 | | - $wgOut->addHTML('<tr>'); |
59 | | - $wgOut->addHTML('<td>' . $indent); |
60 | | - $wgOut->addHTML('<td>' . $t->id()); |
61 | | - $wgOut->addHTML('<td>' . $t->title()->getPrefixedText()); |
62 | | - $wgOut->addHTML('</tr>'); |
63 | | - foreach($t->subthreads() as $st) |
64 | | - efThreadTableHelper($st, $indent + 1); |
| 58 | + $wgOut->addHTML( '<tr>' ); |
| 59 | + $wgOut->addHTML( '<td>' . $indent ); |
| 60 | + $wgOut->addHTML( '<td>' . $t->id() ); |
| 61 | + $wgOut->addHTML( '<td>' . $t->title()->getPrefixedText() ); |
| 62 | + $wgOut->addHTML( '</tr>' ); |
| 63 | + foreach ( $t->subthreads() as $st ) |
| 64 | + efThreadTableHelper( $st, $indent + 1 ); |
65 | 65 | } |
66 | 66 | |
67 | 67 | function wfLqtBeforeWatchlistHook( &$conds, &$tables, &$join_conds, &$fields ) { |
— | — | @@ -68,24 +68,24 @@ |
69 | 69 | |
70 | 70 | if ( !in_array( 'page', $tables ) ) { |
71 | 71 | $tables[] = 'page'; |
72 | | - $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id'); |
| 72 | + $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' ); |
73 | 73 | } |
74 | 74 | $conds[] = "page_namespace != " . NS_LQT_THREAD; |
75 | 75 | |
76 | | - $talkpage_messages = NewMessages::newUserMessages($wgUser); |
77 | | - $tn = count($talkpage_messages); |
| 76 | + $talkpage_messages = NewMessages::newUserMessages( $wgUser ); |
| 77 | + $tn = count( $talkpage_messages ); |
78 | 78 | |
79 | | - $watch_messages = NewMessages::watchedThreadsForUser($wgUser); |
80 | | - $wn = count($watch_messages); |
| 79 | + $watch_messages = NewMessages::watchedThreadsForUser( $wgUser ); |
| 80 | + $wn = count( $watch_messages ); |
81 | 81 | |
82 | | - if( $tn == 0 && $wn == 0 ) |
| 82 | + if ( $tn == 0 && $wn == 0 ) |
83 | 83 | return true; |
84 | 84 | |
85 | 85 | LqtView::addJSandCSS(); |
86 | 86 | wfLoadExtensionMessages( 'LiquidThreads' ); |
87 | | - $messages_url = SpecialPage::getPage('NewMessages')->getTitle()->getFullURL(); |
| 87 | + $messages_url = SpecialPage::getPage( 'NewMessages' )->getTitle()->getFullURL(); |
88 | 88 | $new_messages = wfMsg ( 'lqt-new-messages' ); |
89 | | - $wgOut->addHTML(<<< HTML |
| 89 | + $wgOut->addHTML( <<< HTML |
90 | 90 | <a href="$messages_url" class="lqt_watchlist_messages_notice"> |
91 | 91 | ✒ {$new_messages} |
92 | 92 | </a> |
Index: trunk/extensions/LiquidThreads/LICENSE |
— | — | @@ -336,4 +336,4 @@ |
337 | 337 | proprietary programs. If your program is a subroutine library, you may |
338 | 338 | consider it more useful to permit linking proprietary applications with the |
339 | 339 | library. If this is what you want to do, use the GNU Lesser General |
340 | | -Public License instead of this License. |
\ No newline at end of file |
| 340 | +Public License instead of this License. |
Index: trunk/extensions/LiquidThreads/lqt.css |
— | — | @@ -467,4 +467,3 @@ |
468 | 468 | .lqt_rc_author_notice_others { |
469 | 469 | color: #cd9800; |
470 | 470 | } |
471 | | - |
Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) |
5 | 5 | die(); |
6 | 6 | |
7 | 7 | $wgExtensionCredits['other'][] = array( |
— | — | @@ -12,15 +12,15 @@ |
13 | 13 | 'descriptionmsg' => 'lqt-desc', |
14 | 14 | ); |
15 | 15 | |
16 | | -require( 'LqtFunctions.php'); |
| 16 | +require( 'LqtFunctions.php' ); |
17 | 17 | |
18 | | -define('NS_LQT_THREAD', efArrayDefault('egLqtNamespaceNumbers', 'Thread', 90)); |
19 | | -define('NS_LQT_THREAD_TALK', efArrayDefault('egLqtNamespaceNumbers', 'Thread_talk', 91)); |
20 | | -define('NS_LQT_SUMMARY', efArrayDefault('egLqtNamespaceNumbers', 'Summary', 92)); |
21 | | -define('NS_LQT_SUMMARY_TALK', efArrayDefault('egLqtNamespaceNumbers', 'Summary_talk', 93)); |
22 | | -define('LQT_NEWEST_CHANGES',1); |
23 | | -define('LQT_NEWEST_THREADS',2); |
24 | | -define('LQT_OLDEST_THREADS',3); |
| 18 | +define( 'NS_LQT_THREAD', efArrayDefault( 'egLqtNamespaceNumbers', 'Thread', 90 ) ); |
| 19 | +define( 'NS_LQT_THREAD_TALK', efArrayDefault( 'egLqtNamespaceNumbers', 'Thread_talk', 91 ) ); |
| 20 | +define( 'NS_LQT_SUMMARY', efArrayDefault( 'egLqtNamespaceNumbers', 'Summary', 92 ) ); |
| 21 | +define( 'NS_LQT_SUMMARY_TALK', efArrayDefault( 'egLqtNamespaceNumbers', 'Summary_talk', 93 ) ); |
| 22 | +define( 'LQT_NEWEST_CHANGES', 1 ); |
| 23 | +define( 'LQT_NEWEST_THREADS', 2 ); |
| 24 | +define( 'LQT_OLDEST_THREADS', 3 ); |
25 | 25 | |
26 | 26 | $wgCanonicalNamespaceNames[NS_LQT_THREAD] = 'Thread'; |
27 | 27 | $wgCanonicalNamespaceNames[NS_LQT_THREAD_TALK] = 'Thread_talk'; |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | $wgExtraNamespaces[NS_LQT_SUMMARY] = 'Summary'; |
34 | 34 | $wgExtraNamespaces[NS_LQT_SUMMARY_TALK] = 'Summary_talk'; |
35 | 35 | |
36 | | -$dir = dirname(__FILE__) . '/'; |
| 36 | +$dir = dirname( __FILE__ ) . '/'; |
37 | 37 | $wgExtensionMessagesFiles['LiquidThreads'] = $dir . 'Lqt.i18n.php'; |
38 | 38 | $wgExtensionAliasesFiles['LiquidThreads'] = $dir . 'Lqt.alias.php'; |
39 | 39 | |
— | — | @@ -49,28 +49,28 @@ |
50 | 50 | $wgSpecialPages['MoveThread'] = 'SpecialMoveThread'; |
51 | 51 | $wgSpecialPages['NewMessages'] = 'SpecialNewMessages'; |
52 | 52 | |
53 | | -$wgAutoloadClasses['LqtDispatch'] = $dir.'LqtBaseView.php'; |
54 | | -$wgAutoloadClasses['LqtView'] = $dir.'LqtBaseView.php'; |
55 | | -$wgAutoloadClasses['Date'] = $dir.'classes/LqtDate.php'; |
56 | | -$wgAutoloadClasses['Post'] = $dir.'classes/LqtPost.php'; |
57 | | -$wgAutoloadClasses['ThreadHistoryIterator'] = $dir.'classes/LqtThreadHistoryIterator.php'; |
58 | | -$wgAutoloadClasses['HistoricalThread'] = $dir.'classes/LqtHistoricalThread.php'; |
59 | | -$wgAutoloadClasses['Thread'] = $dir.'classes/LqtThread.php'; |
60 | | -$wgAutoloadClasses['Threads'] = $dir.'classes/LqtThreads.php'; |
61 | | -$wgAutoloadClasses['QueryGroup'] = $dir.'classes/LqtQueryGroup.php'; |
62 | | -$wgAutoloadClasses['NewMessages'] = $dir.'classes/LqtNewMessages.php'; |
63 | | -$wgAutoloadClasses['TalkpageView'] = $dir.'pages/TalkpageView.php'; |
64 | | -$wgAutoloadClasses['TalkpageArchiveView'] = $dir.'pages/TalkpageArchiveView.php'; |
65 | | -$wgAutoloadClasses['ThreadPermalinkView'] = $dir.'pages/ThreadPermalinkView.php'; |
66 | | -$wgAutoloadClasses['TalkpageHeaderView'] = $dir.'pages/TalkpageHeaderView.php'; |
67 | | -$wgAutoloadClasses['IndividualThreadHistoryView'] = $dir.'pages/IndividualThreadHistoryView.php'; |
68 | | -$wgAutoloadClasses['ThreadDiffView'] = $dir.'pages/ThreadDiffView.php'; |
69 | | -$wgAutoloadClasses['ThreadWatchView'] = $dir.'pages/ThreadWatchView.php'; |
70 | | -$wgAutoloadClasses['ThreadProtectionFormView'] = $dir.'pages/ThreadProtectionFormView.php'; |
71 | | -$wgAutoloadClasses['ThreadHistoryListingView'] = $dir.'pages/ThreadHistoryListingView.php'; |
72 | | -$wgAutoloadClasses['ThreadHistoricalRevisionView'] = $dir.'pages/ThreadHistoricalRevisionView.php'; |
73 | | -$wgAutoloadClasses['SummaryPageView'] = $dir.'pages/SummaryPageView.php'; |
74 | | -$wgAutoloadClasses['SpecialMoveThread'] = $dir.'pages/SpecialMoveThread.php'; |
75 | | -$wgAutoloadClasses['SpecialDeleteThread'] = $dir.'pages/SpecialDeleteThread.php'; |
76 | | -$wgAutoloadClasses['NewUserMessagesView'] = $dir.'pages/NewUserMessagesView.php'; |
77 | | -$wgAutoloadClasses['SpecialNewMessages'] = $dir.'pages/SpecialNewMessages.php'; |
\ No newline at end of file |
| 53 | +$wgAutoloadClasses['LqtDispatch'] = $dir . 'LqtBaseView.php'; |
| 54 | +$wgAutoloadClasses['LqtView'] = $dir . 'LqtBaseView.php'; |
| 55 | +$wgAutoloadClasses['Date'] = $dir . 'classes/LqtDate.php'; |
| 56 | +$wgAutoloadClasses['Post'] = $dir . 'classes/LqtPost.php'; |
| 57 | +$wgAutoloadClasses['ThreadHistoryIterator'] = $dir . 'classes/LqtThreadHistoryIterator.php'; |
| 58 | +$wgAutoloadClasses['HistoricalThread'] = $dir . 'classes/LqtHistoricalThread.php'; |
| 59 | +$wgAutoloadClasses['Thread'] = $dir . 'classes/LqtThread.php'; |
| 60 | +$wgAutoloadClasses['Threads'] = $dir . 'classes/LqtThreads.php'; |
| 61 | +$wgAutoloadClasses['QueryGroup'] = $dir . 'classes/LqtQueryGroup.php'; |
| 62 | +$wgAutoloadClasses['NewMessages'] = $dir . 'classes/LqtNewMessages.php'; |
| 63 | +$wgAutoloadClasses['TalkpageView'] = $dir . 'pages/TalkpageView.php'; |
| 64 | +$wgAutoloadClasses['TalkpageArchiveView'] = $dir . 'pages/TalkpageArchiveView.php'; |
| 65 | +$wgAutoloadClasses['ThreadPermalinkView'] = $dir . 'pages/ThreadPermalinkView.php'; |
| 66 | +$wgAutoloadClasses['TalkpageHeaderView'] = $dir . 'pages/TalkpageHeaderView.php'; |
| 67 | +$wgAutoloadClasses['IndividualThreadHistoryView'] = $dir . 'pages/IndividualThreadHistoryView.php'; |
| 68 | +$wgAutoloadClasses['ThreadDiffView'] = $dir . 'pages/ThreadDiffView.php'; |
| 69 | +$wgAutoloadClasses['ThreadWatchView'] = $dir . 'pages/ThreadWatchView.php'; |
| 70 | +$wgAutoloadClasses['ThreadProtectionFormView'] = $dir . 'pages/ThreadProtectionFormView.php'; |
| 71 | +$wgAutoloadClasses['ThreadHistoryListingView'] = $dir . 'pages/ThreadHistoryListingView.php'; |
| 72 | +$wgAutoloadClasses['ThreadHistoricalRevisionView'] = $dir . 'pages/ThreadHistoricalRevisionView.php'; |
| 73 | +$wgAutoloadClasses['SummaryPageView'] = $dir . 'pages/SummaryPageView.php'; |
| 74 | +$wgAutoloadClasses['SpecialMoveThread'] = $dir . 'pages/SpecialMoveThread.php'; |
| 75 | +$wgAutoloadClasses['SpecialDeleteThread'] = $dir . 'pages/SpecialDeleteThread.php'; |
| 76 | +$wgAutoloadClasses['NewUserMessagesView'] = $dir . 'pages/NewUserMessagesView.php'; |
| 77 | +$wgAutoloadClasses['SpecialNewMessages'] = $dir . 'pages/SpecialNewMessages.php'; |
Index: trunk/extensions/LiquidThreads/README |
— | — | @@ -11,13 +11,13 @@ |
12 | 12 | 1. Rename this directory to extensions/LiquidThreads inside your |
13 | 13 | MediaWiki directory. |
14 | 14 | 2. Add database tables from lqt.sql using the sql.php MediaWiki tool. |
15 | | - (On Unix, if the current directory is the MediaWiki root directory, you can |
| 15 | + (On Unix, if the current directory is the MediaWiki root directory, you can |
16 | 16 | say "php maintenance/sql.php extensions/LiquidThreads/lqt.sql".) |
17 | 17 | If you haven't created the AdminSettings.php file, you will have to do that |
18 | 18 | first; see http://www.mediawiki.org/wiki/Manual:AdminSettings.php |
19 | 19 | Alternatively, you can run lqt.sql manually (you can use the command |
20 | 20 | "mysql -u $USER -p -e 'source lqt.sql'" on Unix), but you might have to |
21 | | - edit it first, and replace the /*$wgDBprefix*/ and /*$wgDBTableOptions*/ |
| 21 | + edit it first, and replace the /*$wgDBprefix*/ and /*$wgDBTableOptions*/ |
22 | 22 | strings with the corresponding settings. |
23 | 23 | 3. Add this line to the end of your LocalSettings.php: |
24 | 24 | require_once('extensions/LiquidThreads/LiquidThreads.php'); |
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | | - |
6 | 5 | class Thread { |
7 | 6 | /* SCHEMA changes must be reflected here. */ |
8 | 7 | |
— | — | @@ -57,11 +56,11 @@ |
58 | 57 | return $this->revisionNumber; |
59 | 58 | } |
60 | 59 | |
61 | | - function atRevision($r) { |
| 60 | + function atRevision( $r ) { |
62 | 61 | if ( $r == $this->revisionNumber() ) |
63 | 62 | return $this; |
64 | 63 | else |
65 | | - return HistoricalThread::withIdAtRevision($this->id(), $r); |
| 64 | + return HistoricalThread::withIdAtRevision( $this->id(), $r ); |
66 | 65 | } |
67 | 66 | |
68 | 67 | function historicalRevisions() { |
— | — | @@ -69,11 +68,11 @@ |
70 | 69 | $res = $dbr->select( |
71 | 70 | 'historical_thread', |
72 | 71 | 'hthread_contents', |
73 | | - array('hthread_id' => $this->id()), |
74 | | - __METHOD__); |
| 72 | + array( 'hthread_id' => $this->id() ), |
| 73 | + __METHOD__ ); |
75 | 74 | $results = array(); |
76 | | - while($l = $dbr->fetchObject($res)) { |
77 | | - $results[] = HistoricalThread::fromTextRepresentation($l->hthread_contents); |
| 75 | + while ( $l = $dbr->fetchObject( $res ) ) { |
| 76 | + $results[] = HistoricalThread::fromTextRepresentation( $l->hthread_contents ); |
78 | 77 | } |
79 | 78 | return $results; |
80 | 79 | } |
— | — | @@ -87,48 +86,48 @@ |
88 | 87 | return Threads::where($where); |
89 | 88 | } |
90 | 89 | */ |
91 | | - private function bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp) { |
| 90 | + private function bumpRevisionsOnAncestors( $change_type, $change_object, $change_reason, $timestamp ) { |
92 | 91 | global $wgUser; // TODO global. |
93 | 92 | |
94 | 93 | $this->revisionNumber += 1; |
95 | | - $this->setChangeType($change_type); |
96 | | - $this->setChangeObject($change_object); |
| 94 | + $this->setChangeType( $change_type ); |
| 95 | + $this->setChangeObject( $change_object ); |
97 | 96 | $this->changeComment = $change_reason; |
98 | 97 | $this->changeUser = $wgUser->getID(); |
99 | 98 | $this->changeUserText = $wgUser->getName(); |
100 | 99 | |
101 | | - if( $this->hasSuperthread() ) |
102 | | - $this->superthread()->bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp); |
| 100 | + if ( $this->hasSuperthread() ) |
| 101 | + $this->superthread()->bumpRevisionsOnAncestors( $change_type, $change_object, $change_reason, $timestamp ); |
103 | 102 | $dbr =& wfGetDB( DB_MASTER ); |
104 | 103 | $res = $dbr->update( 'thread', |
105 | | - /* SET */ array('thread_revision' => $this->revisionNumber, |
106 | | - 'thread_change_type'=>$this->changeType, |
107 | | - 'thread_change_object'=>$this->changeObject, |
| 104 | + /* SET */ array( 'thread_revision' => $this->revisionNumber, |
| 105 | + 'thread_change_type' => $this->changeType, |
| 106 | + 'thread_change_object' => $this->changeObject, |
108 | 107 | 'thread_change_comment' => $this->changeComment, |
109 | 108 | 'thread_change_user' => $this->changeUser, |
110 | 109 | 'thread_change_user_text' => $this->changeUserText, |
111 | | - 'thread_modified' => $timestamp), |
| 110 | + 'thread_modified' => $timestamp ), |
112 | 111 | /* WHERE */ array( 'thread_id' => $this->id ), |
113 | | - __METHOD__); |
| 112 | + __METHOD__ ); |
114 | 113 | } |
115 | 114 | |
116 | | - private static function setChangeOnDescendents($thread, $change_type, $change_object) { |
| 115 | + private static function setChangeOnDescendents( $thread, $change_type, $change_object ) { |
117 | 116 | // TODO this is ludicrously inefficient. |
118 | | - $thread->setChangeType($change_type); |
119 | | - $thread->setChangeObject($change_object); |
| 117 | + $thread->setChangeType( $change_type ); |
| 118 | + $thread->setChangeObject( $change_object ); |
120 | 119 | $dbr =& wfGetDB( DB_MASTER ); |
121 | 120 | $res = $dbr->update( 'thread', |
122 | | - /* SET */ array('thread_revision' => $thread->revisionNumber, |
123 | | - 'thread_change_type'=>$thread->changeType, |
124 | | - 'thread_change_object'=>$thread->changeObject), |
| 121 | + /* SET */ array( 'thread_revision' => $thread->revisionNumber, |
| 122 | + 'thread_change_type' => $thread->changeType, |
| 123 | + 'thread_change_object' => $thread->changeObject ), |
125 | 124 | /* WHERE */ array( 'thread_id' => $thread->id ), |
126 | | - __METHOD__); |
127 | | - foreach($thread->replies() as $r) |
128 | | - self::setChangeOnDescendents($r, $change_type, $change_object); |
| 125 | + __METHOD__ ); |
| 126 | + foreach ( $thread->replies() as $r ) |
| 127 | + self::setChangeOnDescendents( $r, $change_type, $change_object ); |
129 | 128 | return $thread; |
130 | 129 | } |
131 | 130 | |
132 | | - function commitRevision($change_type, $change_object = null, $reason = "") { |
| 131 | + function commitRevision( $change_type, $change_object = null, $reason = "" ) { |
133 | 132 | global $wgUser; // TODO global. |
134 | 133 | /* |
135 | 134 | $this->changeComment = $reason; |
— | — | @@ -138,17 +137,17 @@ |
139 | 138 | // TODO open a transaction. |
140 | 139 | HistoricalThread::create( $this->double, $change_type, $change_object ); |
141 | 140 | |
142 | | - $this->bumpRevisionsOnAncestors($change_type, $change_object, $reason, wfTimestampNow()); |
143 | | - self::setChangeOnDescendents($this->topmostThread(), $change_type, $change_object); |
| 141 | + $this->bumpRevisionsOnAncestors( $change_type, $change_object, $reason, wfTimestampNow() ); |
| 142 | + self::setChangeOnDescendents( $this->topmostThread(), $change_type, $change_object ); |
144 | 143 | |
145 | | - if( $change_type == Threads::CHANGE_REPLY_CREATED |
| 144 | + if ( $change_type == Threads::CHANGE_REPLY_CREATED |
146 | 145 | && $this->editedness == Threads::EDITED_NEVER ) { |
147 | 146 | $this->editedness = Threads::EDITED_HAS_REPLY; |
148 | 147 | } |
149 | | - else if( $change_type == Threads::CHANGE_EDITED_ROOT ) { |
150 | | - if( $wgUser->getId() == 0 || $wgUser->getId() != $this->root()->originalAuthor()->getId() ) { |
| 148 | + else if ( $change_type == Threads::CHANGE_EDITED_ROOT ) { |
| 149 | + if ( $wgUser->getId() == 0 || $wgUser->getId() != $this->root()->originalAuthor()->getId() ) { |
151 | 150 | $this->editedness = Threads::EDITED_BY_OTHERS; |
152 | | - } else if( $this->editedness == Threads::EDITED_HAS_REPLY ) { |
| 151 | + } else if ( $this->editedness == Threads::EDITED_HAS_REPLY ) { |
153 | 152 | $this->editedness = Threads::EDITED_BY_AUTHOR; |
154 | 153 | } |
155 | 154 | } |
— | — | @@ -167,59 +166,59 @@ |
168 | 167 | 'thread_editedness' => $this->editedness, |
169 | 168 | ), |
170 | 169 | /* WHERE */ array( 'thread_id' => $this->id, ), |
171 | | - __METHOD__); |
| 170 | + __METHOD__ ); |
172 | 171 | |
173 | | - if( $change_type == Threads::CHANGE_EDITED_ROOT ) { |
174 | | - NewMessages::writeMessageStateForUpdatedThread($this); |
| 172 | + if ( $change_type == Threads::CHANGE_EDITED_ROOT ) { |
| 173 | + NewMessages::writeMessageStateForUpdatedThread( $this ); |
175 | 174 | } |
176 | 175 | } |
177 | 176 | |
178 | | - function delete($reason) { |
| 177 | + function delete( $reason ) { |
179 | 178 | $this->type = Threads::TYPE_DELETED; |
180 | 179 | $this->revisionNumber += 1; |
181 | | - $this->commitRevision(Threads::CHANGE_DELETED, $this, $reason); |
| 180 | + $this->commitRevision( Threads::CHANGE_DELETED, $this, $reason ); |
182 | 181 | /* TODO: mark thread as read by all users, or we get blank thingies in New Messages. */ |
183 | 182 | } |
184 | | - function undelete($reason) { |
| 183 | + function undelete( $reason ) { |
185 | 184 | $this->type = Threads::TYPE_NORMAL; |
186 | 185 | $this->revisionNumber += 1; |
187 | | - $this->commitRevision(Threads::CHANGE_UNDELETED, $this, $reason); |
| 186 | + $this->commitRevision( Threads::CHANGE_UNDELETED, $this, $reason ); |
188 | 187 | } |
189 | 188 | |
190 | | - function moveToSubjectPage($title, $reason, $leave_trace) { |
| 189 | + function moveToSubjectPage( $title, $reason, $leave_trace ) { |
191 | 190 | $dbr =& wfGetDB( DB_MASTER ); |
192 | 191 | |
193 | 192 | $new_articleNamespace = $title->getNamespace(); |
194 | 193 | $new_articleTitle = $title->getDBkey(); |
195 | 194 | |
196 | | - foreach($this->replies as $r) { |
| 195 | + foreach ( $this->replies as $r ) { |
197 | 196 | $res = $dbr->update( 'thread', |
198 | 197 | /* SET */array( |
199 | 198 | 'thread_revision' => $r->revisionNumber() + 1, |
200 | 199 | 'thread_article_namespace' => $new_articleNamespace, |
201 | | - 'thread_article_title' => $new_articleTitle), |
| 200 | + 'thread_article_title' => $new_articleTitle ), |
202 | 201 | /* WHERE */ array( 'thread_id' => $r->id(), ), |
203 | | - __METHOD__); |
| 202 | + __METHOD__ ); |
204 | 203 | } |
205 | 204 | |
206 | 205 | $this->articleNamespace = $new_articleNamespace; |
207 | 206 | $this->articleTitle = $new_articleTitle; |
208 | 207 | $this->revisionNumber += 1; |
209 | | - $this->commitRevision(Threads::CHANGE_MOVED_TALKPAGE, null, $reason); |
| 208 | + $this->commitRevision( Threads::CHANGE_MOVED_TALKPAGE, null, $reason ); |
210 | 209 | |
211 | | - if($leave_trace) { |
212 | | - $this->leaveTrace($reason); |
| 210 | + if ( $leave_trace ) { |
| 211 | + $this->leaveTrace( $reason ); |
213 | 212 | } |
214 | 213 | } |
215 | 214 | |
216 | | - function leaveTrace($reason) { |
| 215 | + function leaveTrace( $reason ) { |
217 | 216 | /* Adapted from Title::moveToNewTitle. But now the new title exists on the old talkpage. */ |
218 | 217 | $dbw =& wfGetDB( DB_MASTER ); |
219 | 218 | |
220 | 219 | $mwRedir = MagicWord::get( 'redirect' ); |
221 | 220 | $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $this->title()->getPrefixedText() . "]]\n"; |
222 | 221 | $redirectArticle = new Article( LqtView::incrementedTitle( $this->subjectWithoutIncrement(), |
223 | | - NS_LQT_THREAD) ); ## TODO move to model. |
| 222 | + NS_LQT_THREAD ) ); # # TODO move to model. |
224 | 223 | $newid = $redirectArticle->insertOn( $dbw ); |
225 | 224 | $redirectRevision = new Revision( array( |
226 | 225 | 'page' => $newid, |
— | — | @@ -230,7 +229,7 @@ |
231 | 230 | |
232 | 231 | # Log the move |
233 | 232 | $log = new LogPage( 'move' ); |
234 | | - $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText()) ); |
| 233 | + $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText() ) ); |
235 | 234 | |
236 | 235 | # Purge caches as per article creation |
237 | 236 | Article::onArticleCreate( $redirectArticle->getTitle() ); |
— | — | @@ -244,7 +243,7 @@ |
245 | 244 | __METHOD__ ); |
246 | 245 | |
247 | 246 | $thread = Threads::newThread( $redirectArticle, $this->double->article(), null, |
248 | | - Threads::TYPE_MOVED, $log); |
| 247 | + Threads::TYPE_MOVED, $log ); |
249 | 248 | |
250 | 249 | # Purge old title from squid |
251 | 250 | # The new title, and links to the new title, are purged in Article::onArticleCreate() |
— | — | @@ -253,7 +252,7 @@ |
254 | 253 | |
255 | 254 | |
256 | 255 | |
257 | | - function __construct($line, $children) { |
| 256 | + function __construct( $line, $children ) { |
258 | 257 | /* SCHEMA changes must be reflected here. */ |
259 | 258 | |
260 | 259 | $this->id = $line->thread_id; |
— | — | @@ -275,8 +274,8 @@ |
276 | 275 | $this->editedness = $line->thread_editedness; |
277 | 276 | |
278 | 277 | $root_title = Title::makeTitle( $line->page_namespace, $line->page_title ); |
279 | | - $this->root = new Post($root_title); |
280 | | - $this->root->loadPageData($line); |
| 278 | + $this->root = new Post( $root_title ); |
| 279 | + $this->root->loadPageData( $line ); |
281 | 280 | $this->rootRevision = $this->root->mLatest; |
282 | 281 | } |
283 | 282 | |
— | — | @@ -294,7 +293,7 @@ |
295 | 294 | // Update: this doesn't work for some reason, but why do we update the replies array |
296 | 295 | // in the first place after creating a new reply? |
297 | 296 | $new_array = array(); |
298 | | - foreach( $this->replies as $r ) |
| 297 | + foreach ( $this->replies as $r ) |
299 | 298 | $new_array[] = $r; |
300 | 299 | $this->replies = $new_array; |
301 | 300 | } |
— | — | @@ -304,20 +303,20 @@ |
305 | 304 | These methods do not alter the childrens' superthread field. All they do |
306 | 305 | is make sure the latest info gets into any historicalthreads we commit. |
307 | 306 | */ |
308 | | - function addReply($thread) { |
| 307 | + function addReply( $thread ) { |
309 | 308 | // TODO: question for myself to ponder: We don't want the latest info in the |
310 | 309 | // historical thread, duh. Why were we doing this? |
311 | 310 | // $this->replies[] = $thread; |
312 | 311 | } |
313 | | - function removeReplyWithId($id) { |
| 312 | + function removeReplyWithId( $id ) { |
314 | 313 | $target = null; |
315 | | - foreach($this->replies as $k=>$r) { |
316 | | - if ($r->id() == $id) { |
| 314 | + foreach ( $this->replies as $k => $r ) { |
| 315 | + if ( $r->id() == $id ) { |
317 | 316 | $target = $k; break; |
318 | 317 | } |
319 | 318 | } |
320 | | - if ($target) { |
321 | | - unset($this->replies[$target]); |
| 319 | + if ( $target ) { |
| 320 | + unset( $this->replies[$target] ); |
322 | 321 | return true; |
323 | 322 | } else { |
324 | 323 | return false; |
— | — | @@ -327,13 +326,13 @@ |
328 | 327 | return $this->replies; |
329 | 328 | } |
330 | 329 | |
331 | | - function setSuperthread($thread) { |
| 330 | + function setSuperthread( $thread ) { |
332 | 331 | $this->parentId = $thread->id(); |
333 | 332 | $this->ancestorId = $thread->ancestorId(); |
334 | 333 | } |
335 | 334 | |
336 | 335 | function superthread() { |
337 | | - if( !$this->hasSuperthread() ) { |
| 336 | + if ( !$this->hasSuperthread() ) { |
338 | 337 | return null; |
339 | 338 | } else { |
340 | 339 | return Threads::withId( $this->parentId ); |
— | — | @@ -349,17 +348,17 @@ |
350 | 349 | // if we always use Threads::withId instead of returning $this, |
351 | 350 | // the historical revision is not incremented and we get a |
352 | 351 | // duplicate key. |
353 | | - if( $this->ancestorId == $this->id ) |
| 352 | + if ( $this->ancestorId == $this->id ) |
354 | 353 | return $this; |
355 | 354 | else |
356 | 355 | return Threads::withId( $this->ancestorId ); |
357 | 356 | } |
358 | | - |
| 357 | + |
359 | 358 | function isTopmostThread() { |
360 | 359 | return $this->ancestorId == $this->id; |
361 | 360 | } |
362 | 361 | |
363 | | - function setArticle($a) { |
| 362 | + function setArticle( $a ) { |
364 | 363 | $this->articleId = $a->getID(); |
365 | 364 | $this->articleNamespace = $a->getTitle()->getNamespace(); |
366 | 365 | $this->articleTitle = $a->getTitle()->getDBkey(); |
— | — | @@ -368,14 +367,14 @@ |
369 | 368 | |
370 | 369 | function article() { |
371 | 370 | if ( $this->article ) return $this->article; |
372 | | - $title = Title::newFromID($this->articleId); |
373 | | - if($title) { |
374 | | - $a = new Article($title); |
| 371 | + $title = Title::newFromID( $this->articleId ); |
| 372 | + if ( $title ) { |
| 373 | + $a = new Article( $title ); |
375 | 374 | } |
376 | | - if (isset($a) && $a->exists()) { |
| 375 | + if ( isset( $a ) && $a->exists() ) { |
377 | 376 | return $a; |
378 | 377 | } else { |
379 | | - return new Article( Title::makeTitle($this->articleNamespace, $this->articleTitle) ); |
| 378 | + return new Article( Title::makeTitle( $this->articleNamespace, $this->articleTitle ) ); |
380 | 379 | } |
381 | 380 | } |
382 | 381 | |
— | — | @@ -394,10 +393,10 @@ |
395 | 394 | return $this->root; |
396 | 395 | } |
397 | 396 | |
398 | | - function setRootRevision($rr) { |
399 | | - if( (is_object($rr)) ) { |
| 397 | + function setRootRevision( $rr ) { |
| 398 | + if ( ( is_object( $rr ) ) ) { |
400 | 399 | $this->rootRevision = $rr->getId(); |
401 | | - } else if (is_int($rr)) { |
| 400 | + } else if ( is_int( $rr ) ) { |
402 | 401 | $this->rootRevision = $rr; |
403 | 402 | } |
404 | 403 | } |
— | — | @@ -429,9 +428,9 @@ |
430 | 429 | return $this->root()->getTitle(); |
431 | 430 | } |
432 | 431 | |
433 | | - private function splitIncrementFromSubject($subject_string) { |
434 | | - preg_match('/^(.*) \((\d+)\)$/', $subject_string, $matches); |
435 | | - if( count($matches) != 3 ) |
| 432 | + private function splitIncrementFromSubject( $subject_string ) { |
| 433 | + preg_match( '/^(.*) \((\d+)\)$/', $subject_string, $matches ); |
| 434 | + if ( count( $matches ) != 3 ) |
436 | 435 | throw new MWException( __METHOD__ . ": thread subject has no increment: " . $subject_string ); |
437 | 436 | else |
438 | 437 | return $matches; |
— | — | @@ -446,19 +445,19 @@ |
447 | 446 | } |
448 | 447 | |
449 | 448 | function wikilinkWithoutIncrement() { |
450 | | - $tmp = $this->splitIncrementFromSubject($this->wikilink()); return $tmp[1]; |
| 449 | + $tmp = $this->splitIncrementFromSubject( $this->wikilink() ); return $tmp[1]; |
451 | 450 | } |
452 | 451 | |
453 | 452 | function subjectWithoutIncrement() { |
454 | | - $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[1]; |
| 453 | + $tmp = $this->splitIncrementFromSubject( $this->subject() ); return $tmp[1]; |
455 | 454 | } |
456 | 455 | |
457 | 456 | function increment() { |
458 | | - $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[2]; |
| 457 | + $tmp = $this->splitIncrementFromSubject( $this->subject() ); return $tmp[2]; |
459 | 458 | } |
460 | 459 | |
461 | 460 | function hasDistinctSubject() { |
462 | | - if( $this->hasSuperthread() ) { |
| 461 | + if ( $this->hasSuperthread() ) { |
463 | 462 | return $this->superthread()->subjectWithoutIncrement() |
464 | 463 | != $this->subjectWithoutIncrement(); |
465 | 464 | } else { |
— | — | @@ -467,7 +466,7 @@ |
468 | 467 | } |
469 | 468 | |
470 | 469 | function hasSubthreads() { |
471 | | - return count($this->replies) != 0; |
| 470 | + return count( $this->replies ) != 0; |
472 | 471 | } |
473 | 472 | |
474 | 473 | function subthreads() { |
— | — | @@ -490,13 +489,13 @@ |
491 | 490 | return $this->changeType; |
492 | 491 | } |
493 | 492 | |
494 | | - private function replyWithId($id) { |
495 | | - if( $this->id == $id ) return $this; |
| 493 | + private function replyWithId( $id ) { |
| 494 | + if ( $this->id == $id ) return $this; |
496 | 495 | foreach ( $this->replies as $r ) { |
497 | | - if( $r->id() == $id ) return $r; |
| 496 | + if ( $r->id() == $id ) return $r; |
498 | 497 | else { |
499 | | - $s = $r->replyWithId($id); |
500 | | - if( $s ) return $s; |
| 498 | + $s = $r->replyWithId( $id ); |
| 499 | + if ( $s ) return $s; |
501 | 500 | } |
502 | 501 | } |
503 | 502 | return null; |
— | — | @@ -505,17 +504,17 @@ |
506 | 505 | return $this->replyWithId( $this->changeObject ); |
507 | 506 | } |
508 | 507 | |
509 | | - function setChangeType($t) { |
510 | | - if (in_array($t, Threads::$VALID_CHANGE_TYPES)) { |
| 508 | + function setChangeType( $t ) { |
| 509 | + if ( in_array( $t, Threads::$VALID_CHANGE_TYPES ) ) { |
511 | 510 | $this->changeType = $t; |
512 | 511 | } else { |
513 | 512 | throw new MWException( __METHOD__ . ": invalid changeType $t." ); |
514 | 513 | } |
515 | 514 | } |
516 | 515 | |
517 | | - function setChangeObject($o) { |
| 516 | + function setChangeObject( $o ) { |
518 | 517 | # we assume $o to be a Thread. |
519 | | - if($o === null) { |
| 518 | + if ( $o === null ) { |
520 | 519 | $this->changeObject = null; |
521 | 520 | } else { |
522 | 521 | $this->changeObject = $o->id(); |
— | — | @@ -523,10 +522,10 @@ |
524 | 523 | } |
525 | 524 | |
526 | 525 | function changeUser() { |
527 | | - if( $this->changeUser == 0 ) { |
528 | | - return User::newFromName($this->changeUserText, false); |
| 526 | + if ( $this->changeUser == 0 ) { |
| 527 | + return User::newFromName( $this->changeUserText, false ); |
529 | 528 | } else { |
530 | | - return User::newFromId($this->changeUser); |
| 529 | + return User::newFromId( $this->changeUser ); |
531 | 530 | } |
532 | 531 | } |
533 | 532 | |
— | — | @@ -535,18 +534,18 @@ |
536 | 535 | } |
537 | 536 | |
538 | 537 | function redirectThread() { |
539 | | - $rev = Revision::newFromId($this->root()->getLatest()); |
540 | | - $rtitle = Title::newFromRedirect($rev->getRawText()); |
541 | | - if( !$rtitle ) return null; |
542 | | - $rthread = Threads::withRoot(new Article($rtitle)); |
| 538 | + $rev = Revision::newFromId( $this->root()->getLatest() ); |
| 539 | + $rtitle = Title::newFromRedirect( $rev->getRawText() ); |
| 540 | + if ( !$rtitle ) return null; |
| 541 | + $rthread = Threads::withRoot( new Article( $rtitle ) ); |
543 | 542 | return $rthread; |
544 | 543 | } |
545 | 544 | |
546 | 545 | // Called from hook in Title::isProtected. |
547 | | - static function getRestrictionsForTitle($title, $action, &$result) { |
548 | | - $thread = Threads::withRoot(new Post($title)); |
549 | | - if ($thread) |
550 | | - return $thread->getRestrictions($action, $result); |
| 546 | + static function getRestrictionsForTitle( $title, $action, &$result ) { |
| 547 | + $thread = Threads::withRoot( new Post( $title ) ); |
| 548 | + if ( $thread ) |
| 549 | + return $thread->getRestrictions( $action, $result ); |
551 | 550 | else |
552 | 551 | return true; // not a thread; do normal protection check. |
553 | 552 | } |
— | — | @@ -554,16 +553,16 @@ |
555 | 554 | // This only makes sense when called from the hook, because it uses the hook's |
556 | 555 | // default behavior to check whether this thread itself is protected, so you'll |
557 | 556 | // get false negatives if you use it from some other context. |
558 | | - function getRestrictions($action, &$result) { |
559 | | - if( $this->hasSuperthread() ) { |
560 | | - $parent_restrictions = $this->superthread()->root()->getTitle()->getRestrictions($action); |
| 557 | + function getRestrictions( $action, &$result ) { |
| 558 | + if ( $this->hasSuperthread() ) { |
| 559 | + $parent_restrictions = $this->superthread()->root()->getTitle()->getRestrictions( $action ); |
561 | 560 | } else { |
562 | | - $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions($action); |
| 561 | + $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions( $action ); |
563 | 562 | } |
564 | 563 | |
565 | 564 | // TODO this may not be the same as asking "are the parent restrictions more restrictive than |
566 | 565 | // our own restrictions?", which is what we really want. |
567 | | - if( count($parent_restrictions) == 0 ) { |
| 566 | + if ( count( $parent_restrictions ) == 0 ) { |
568 | 567 | return true; // go to normal protection check. |
569 | 568 | } else { |
570 | 569 | $result = $parent_restrictions; |
— | — | @@ -571,4 +570,4 @@ |
572 | 571 | } |
573 | 572 | |
574 | 573 | } |
575 | | -} |
\ No newline at end of file |
| 574 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThread.php |
___________________________________________________________________ |
Added: svn:eol-style |
576 | 575 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | class HistoricalThread extends Thread { |
6 | | - function __construct($t) { |
| 6 | + function __construct( $t ) { |
7 | 7 | /* SCHEMA changes must be reflected here. */ |
8 | 8 | $this->rootId = $t->rootId; |
9 | 9 | $this->rootRevision = $t->rootRevision; |
— | — | @@ -24,42 +24,47 @@ |
25 | 25 | $this->editedness = $t->editedness; |
26 | 26 | |
27 | 27 | $this->replies = array(); |
28 | | - foreach ($t->replies as $r) { |
29 | | - $this->replies[] = new HistoricalThread($r); |
| 28 | + foreach ( $t->replies as $r ) { |
| 29 | + $this->replies[] = new HistoricalThread( $r ); |
30 | 30 | } |
31 | 31 | } |
32 | | - static function textRepresentation($t) { |
33 | | - $ht = new HistoricalThread($t); |
34 | | - return serialize($ht); |
| 32 | + |
| 33 | + static function textRepresentation( $t ) { |
| 34 | + $ht = new HistoricalThread( $t ); |
| 35 | + return serialize( $ht ); |
35 | 36 | } |
36 | | - static function fromTextRepresentation($r) { |
37 | | - return unserialize($r); |
| 37 | + |
| 38 | + static function fromTextRepresentation( $r ) { |
| 39 | + return unserialize( $r ); |
38 | 40 | } |
| 41 | + |
39 | 42 | static function create( $t, $change_type, $change_object ) { |
40 | 43 | $tmt = $t->topmostThread(); |
41 | | - $contents = HistoricalThread::textRepresentation($tmt); |
| 44 | + $contents = HistoricalThread::textRepresentation( $tmt ); |
42 | 45 | $dbr =& wfGetDB( DB_MASTER ); |
43 | 46 | $res = $dbr->insert( 'historical_thread', array( |
44 | | - 'hthread_id'=>$tmt->id(), |
45 | | - 'hthread_revision'=>$tmt->revisionNumber(), |
46 | | - 'hthread_contents'=>$contents, |
47 | | - 'hthread_change_type'=>$tmt->changeType(), |
48 | | - 'hthread_change_object'=>$tmt->changeObject() ? $tmt->changeObject()->id() : null), |
| 47 | + 'hthread_id' => $tmt->id(), |
| 48 | + 'hthread_revision' => $tmt->revisionNumber(), |
| 49 | + 'hthread_contents' => $contents, |
| 50 | + 'hthread_change_type' => $tmt->changeType(), |
| 51 | + 'hthread_change_object' => $tmt->changeObject() ? $tmt->changeObject()->id() : null ), |
49 | 52 | __METHOD__ ); |
50 | 53 | } |
| 54 | + |
51 | 55 | static function withIdAtRevision( $id, $rev ) { |
52 | 56 | $dbr =& wfGetDB( DB_SLAVE ); |
53 | 57 | $line = $dbr->selectRow( |
54 | 58 | 'historical_thread', |
55 | 59 | 'hthread_contents', |
56 | | - array('hthread_id' => $id, 'hthread_revision' => $rev), |
57 | | - __METHOD__); |
| 60 | + array( 'hthread_id' => $id, 'hthread_revision' => $rev ), |
| 61 | + __METHOD__ ); |
58 | 62 | if ( $line ) |
59 | | - return HistoricalThread::fromTextRepresentation($line->hthread_contents); |
| 63 | + return HistoricalThread::fromTextRepresentation( $line->hthread_contents ); |
60 | 64 | else |
61 | 65 | return null; |
62 | 66 | } |
| 67 | + |
63 | 68 | function isHistorical() { |
64 | 69 | return true; |
65 | 70 | } |
66 | | -} |
\ No newline at end of file |
| 71 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php |
___________________________________________________________________ |
Added: svn:eol-style |
67 | 72 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtThreads.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | /** Module of factory methods. */ |
6 | 6 | class Threads { |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | const TYPE_NORMAL = 0; |
9 | 9 | const TYPE_MOVED = 1; |
10 | 10 | const TYPE_DELETED = 2; |
11 | | - static $VALID_TYPES = array(self::TYPE_NORMAL, self::TYPE_MOVED, self::TYPE_DELETED); |
| 11 | + static $VALID_TYPES = array( self::TYPE_NORMAL, self::TYPE_MOVED, self::TYPE_DELETED ); |
12 | 12 | |
13 | 13 | const CHANGE_NEW_THREAD = 0; |
14 | 14 | const CHANGE_REPLY_CREATED = 1; |
— | — | @@ -16,9 +16,9 @@ |
17 | 17 | const CHANGE_DELETED = 4; |
18 | 18 | const CHANGE_UNDELETED = 5; |
19 | 19 | const CHANGE_MOVED_TALKPAGE = 6; |
20 | | - static $VALID_CHANGE_TYPES = array(self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT, |
| 20 | + static $VALID_CHANGE_TYPES = array( self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT, |
21 | 21 | self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED, |
22 | | - self::CHANGE_MOVED_TALKPAGE); |
| 22 | + self::CHANGE_MOVED_TALKPAGE ); |
23 | 23 | |
24 | 24 | // Possible values of Thread->editedness. |
25 | 25 | const EDITED_NEVER = 0; |
— | — | @@ -35,11 +35,11 @@ |
36 | 36 | |
37 | 37 | $dbw =& wfGetDB( DB_MASTER ); |
38 | 38 | |
39 | | - if ( !in_array($type, self::$VALID_TYPES) ) { |
40 | | - throw new MWException(__METHOD__ . ": invalid type $type."); |
| 39 | + if ( !in_array( $type, self::$VALID_TYPES ) ) { |
| 40 | + throw new MWException( __METHOD__ . ": invalid type $type." ); |
41 | 41 | } |
42 | 42 | |
43 | | - if ($superthread) { |
| 43 | + if ( $superthread ) { |
44 | 44 | $change_type = self::CHANGE_REPLY_CREATED; |
45 | 45 | } else { |
46 | 46 | $change_type = self::CHANGE_NEW_THREAD; |
— | — | @@ -48,36 +48,36 @@ |
49 | 49 | global $wgUser; // TODO global. |
50 | 50 | |
51 | 51 | $timestamp = wfTimestampNow(); |
52 | | - |
| 52 | + |
53 | 53 | // TODO PG support |
54 | 54 | $newid = $dbw->nextSequenceValue( 'thread_thread_id' ); |
55 | | - |
56 | | - $row = array('thread_root' => $root->getID(), |
57 | | - 'thread_parent' => $superthread ? $superthread->id() : null, |
58 | | - 'thread_article_namespace' => $article->getTitle()->getNamespace(), |
59 | | - 'thread_article_title' => $article->getTitle()->getDBkey(), |
60 | | - 'thread_modified' => $timestamp, |
61 | | - 'thread_created' => $timestamp, |
62 | | - 'thread_change_type' => $change_type, |
63 | | - 'thread_change_comment' => "", // TODO |
64 | | - 'thread_change_user' => $wgUser->getID(), |
65 | | - 'thread_change_user_text' => $wgUser->getName(), |
66 | | - 'thread_type' => $type, |
67 | | - 'thread_editedness' => self::EDITED_NEVER); |
68 | | - |
69 | | - if( $superthread ) { |
| 55 | + |
| 56 | + $row = array( 'thread_root' => $root->getID(), |
| 57 | + 'thread_parent' => $superthread ? $superthread->id() : null, |
| 58 | + 'thread_article_namespace' => $article->getTitle()->getNamespace(), |
| 59 | + 'thread_article_title' => $article->getTitle()->getDBkey(), |
| 60 | + 'thread_modified' => $timestamp, |
| 61 | + 'thread_created' => $timestamp, |
| 62 | + 'thread_change_type' => $change_type, |
| 63 | + 'thread_change_comment' => "", // TODO |
| 64 | + 'thread_change_user' => $wgUser->getID(), |
| 65 | + 'thread_change_user_text' => $wgUser->getName(), |
| 66 | + 'thread_type' => $type, |
| 67 | + 'thread_editedness' => self::EDITED_NEVER ); |
| 68 | + |
| 69 | + if ( $superthread ) { |
70 | 70 | $row['thread_ancestor'] = $superthread->ancestorId(); |
71 | 71 | $row['thread_change_object'] = $newid; |
72 | 72 | } else { |
73 | 73 | $row['thread_change_object'] = null; |
74 | 74 | } |
75 | 75 | |
76 | | - $res = $dbw->insert('thread', $row, __METHOD__); |
| 76 | + $res = $dbw->insert( 'thread', $row, __METHOD__ ); |
77 | 77 | |
78 | 78 | $newid = $dbw->insertId(); |
79 | | - |
| 79 | + |
80 | 80 | $row['thread_id'] = $newid; |
81 | | - |
| 81 | + |
82 | 82 | // Ew, we have to do a SECOND update |
83 | 83 | if ( $superthread ) { |
84 | 84 | $row['thread_change_object'] = $newid; |
— | — | @@ -86,45 +86,45 @@ |
87 | 87 | array( 'thread_id' => $newid ), |
88 | 88 | __METHOD__ ); |
89 | 89 | } |
90 | | - |
| 90 | + |
91 | 91 | // Sigh, convert row to an object |
92 | 92 | $rowObj = new stdClass(); |
93 | | - foreach( $row as $key => $value ) { |
| 93 | + foreach ( $row as $key => $value ) { |
94 | 94 | $rowObj->$key = $value; |
95 | 95 | } |
96 | 96 | |
97 | 97 | // We just created the thread, it won't have any children. |
98 | | - $newthread = new Thread( $rowObj, array() ); |
99 | | - |
100 | | - if (!$newthread) |
101 | | - throw new MWException( "No new thread with ID $newid\n" ); |
102 | | - |
103 | | - if($superthread) { |
| 98 | + $newthread = new Thread( $rowObj, array() ); |
| 99 | + |
| 100 | + if ( !$newthread ) |
| 101 | + throw new MWException( "No new thread with ID $newid\n" ); |
| 102 | + |
| 103 | + if ( $superthread ) { |
104 | 104 | $superthread->addReply( $newthread ); |
105 | 105 | } |
106 | 106 | |
107 | | - self::createTalkpageIfNeeded($article); |
| 107 | + self::createTalkpageIfNeeded( $article ); |
108 | 108 | |
109 | | - NewMessages::writeMessageStateForUpdatedThread($newthread); |
| 109 | + NewMessages::writeMessageStateForUpdatedThread( $newthread ); |
110 | 110 | |
111 | 111 | return $newthread; |
112 | | - } |
| 112 | + } |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Create the talkpage if it doesn't exist so that links to it |
116 | 116 | * will show up blue instead of red. For use upon new thread creation. |
117 | 117 | */ |
118 | | - protected static function createTalkpageIfNeeded($subjectPage) { |
| 118 | + protected static function createTalkpageIfNeeded( $subjectPage ) { |
119 | 119 | $talkpage_t = $subjectPage->getTitle()->getTalkpage(); |
120 | | - $talkpage = new Article($talkpage_t); |
121 | | - if( ! $talkpage->exists() ) { |
| 120 | + $talkpage = new Article( $talkpage_t ); |
| 121 | + if ( ! $talkpage->exists() ) { |
122 | 122 | try { |
123 | 123 | wfLoadExtensionMessages( 'LiquidThreads' ); |
124 | | - $talkpage->doEdit( "", wfMsg('lqt_talkpage_autocreate_summary'), EDIT_NEW | EDIT_SUPPRESS_RC ); |
| 124 | + $talkpage->doEdit( "", wfMsg( 'lqt_talkpage_autocreate_summary' ), EDIT_NEW | EDIT_SUPPRESS_RC ); |
125 | 125 | |
126 | | - } catch( DBQueryError $e ) { |
| 126 | + } catch ( DBQueryError $e ) { |
127 | 127 | // The article already existed by now. No need to do anything. |
128 | | - wfDebug(__METHOD__ . ": Article already existed by the time we tried to create it."); |
| 128 | + wfDebug( __METHOD__ . ": Article already existed by the time we tried to create it." ); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
— | — | @@ -133,15 +133,15 @@ |
134 | 134 | $joins = "" ) { |
135 | 135 | global $wgDBprefix; |
136 | 136 | $dbr = wfGetDB( DB_SLAVE ); |
137 | | - if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND ); |
138 | | - if ( is_array($options) ) $options = implode(',', $options); |
| 137 | + if ( is_array( $where ) ) $where = $dbr->makeList( $where, LIST_AND ); |
| 138 | + if ( is_array( $options ) ) $options = implode( ',', $options ); |
139 | 139 | |
140 | | - if( is_array($extra_tables) && count($extra_tables) != 0 ) { |
141 | | - if(!empty($wgDBprefix)) { |
142 | | - foreach($extra_tables as $tablekey=>$extra_table) |
143 | | - $extra_tables[$tablekey]=$wgDBprefix.$extra_table; |
| 140 | + if ( is_array( $extra_tables ) && count( $extra_tables ) != 0 ) { |
| 141 | + if ( !empty( $wgDBprefix ) ) { |
| 142 | + foreach ( $extra_tables as $tablekey => $extra_table ) |
| 143 | + $extra_tables[$tablekey] = $wgDBprefix . $extra_table; |
144 | 144 | } |
145 | | - $tables = implode(',', $extra_tables) . ', '; |
| 145 | + $tables = implode( ',', $extra_tables ) . ', '; |
146 | 146 | } else if ( is_string( $extra_tables ) ) { |
147 | 147 | $tables = $extra_tables . ', '; |
148 | 148 | } else { |
— | — | @@ -155,20 +155,20 @@ |
156 | 156 | WHERE $where |
157 | 157 | $options |
158 | 158 | SQL; |
159 | | - $selection_res = $dbr->query($selection_sql); |
| 159 | + $selection_res = $dbr->query( $selection_sql ); |
160 | 160 | |
161 | 161 | $ancestor_conds = array(); |
162 | 162 | $selection_conds = array(); |
163 | | - while( $line = $dbr->fetchObject($selection_res) ) { |
| 163 | + while ( $line = $dbr->fetchObject( $selection_res ) ) { |
164 | 164 | $ancestor_conds[] = $line->thread_ancestor; |
165 | 165 | $selection_conds[] = $line->thread_id; |
166 | 166 | } |
167 | | - if( count($selection_conds) == 0 ) { |
| 167 | + if ( count( $selection_conds ) == 0 ) { |
168 | 168 | // No threads were found, so we can skip the second query. |
169 | 169 | return array(); |
170 | 170 | } // List comprehensions, how I miss thee. |
171 | | - $ancestor_clause = join(', ', $ancestor_conds); |
172 | | - $selection_clause = join(', ', $selection_conds); |
| 171 | + $ancestor_clause = join( ', ', $ancestor_conds ); |
| 172 | + $selection_clause = join( ', ', $selection_conds ); |
173 | 173 | |
174 | 174 | $children_sql = <<< SQL |
175 | 175 | SELECT DISTINCT thread.*, page.*, |
— | — | @@ -178,107 +178,107 @@ |
179 | 179 | AND page.page_id = thread.thread_root |
180 | 180 | $options |
181 | 181 | SQL; |
182 | | - $res = $dbr->query($children_sql); |
| 182 | + $res = $dbr->query( $children_sql ); |
183 | 183 | |
184 | 184 | $threads = array(); |
185 | 185 | $top_level_threads = array(); |
186 | 186 | $thread_children = array(); |
187 | 187 | |
188 | | - while ( $line = $dbr->fetchObject($res) ) { |
189 | | - $new_thread = new Thread($line, null); |
| 188 | + while ( $line = $dbr->fetchObject( $res ) ) { |
| 189 | + $new_thread = new Thread( $line, null ); |
190 | 190 | $threads[] = $new_thread; |
191 | | - if( $line->selected ) |
| 191 | + if ( $line->selected ) |
192 | 192 | // thread is one of those that was directly queried for. |
193 | 193 | $top_level_threads[] = $new_thread; |
194 | | - if( $line->thread_parent !== null ) { |
195 | | - if( !array_key_exists( $line->thread_parent, $thread_children ) ) |
| 194 | + if ( $line->thread_parent !== null ) { |
| 195 | + if ( !array_key_exists( $line->thread_parent, $thread_children ) ) |
196 | 196 | $thread_children[$line->thread_parent] = array(); |
197 | 197 | // Can have duplicate if thread is both top_level and child of another top_level thread. |
198 | | - if( !self::arrayContainsThreadWithId($thread_children[$line->thread_parent], $new_thread->id()) ) |
| 198 | + if ( !self::arrayContainsThreadWithId( $thread_children[$line->thread_parent], $new_thread->id() ) ) |
199 | 199 | $thread_children[$line->thread_parent][] = $new_thread; |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | | - foreach( $threads as $thread ) { |
204 | | - if( array_key_exists( $thread->id(), $thread_children ) ) { |
| 203 | + foreach ( $threads as $thread ) { |
| 204 | + if ( array_key_exists( $thread->id(), $thread_children ) ) { |
205 | 205 | $thread->initWithReplies( $thread_children[$thread->id()] ); |
206 | 206 | } else { |
207 | 207 | $thread->initWithReplies( array() ); |
208 | 208 | } |
209 | | - |
| 209 | + |
210 | 210 | self::$cache_by_root[$thread->root()->getID()] = $thread; |
211 | 211 | self::$cache_by_id[$thread->id()] = $thread; |
212 | 212 | } |
213 | | - |
| 213 | + |
214 | 214 | return $top_level_threads; |
215 | 215 | } |
216 | 216 | |
217 | 217 | private static function databaseError( $msg ) { |
218 | 218 | // TODO tie into MW's error reporting facilities. |
219 | | - throw new MWException("Corrupt liquidthreads database: $msg"); |
| 219 | + throw new MWException( "Corrupt liquidthreads database: $msg" ); |
220 | 220 | } |
221 | 221 | |
222 | 222 | private static function assertSingularity( $threads, $attribute, $value ) { |
223 | | - if( count($threads) == 0 ) { return null; } |
224 | | - if( count($threads) == 1 ) { return $threads[0]; } |
225 | | - if( count($threads) > 1 ) { |
226 | | - Threads::databaseError("More than one thread with $attribute = $value."); |
| 223 | + if ( count( $threads ) == 0 ) { return null; } |
| 224 | + if ( count( $threads ) == 1 ) { return $threads[0]; } |
| 225 | + if ( count( $threads ) > 1 ) { |
| 226 | + Threads::databaseError( "More than one thread with $attribute = $value." ); |
227 | 227 | return null; |
228 | 228 | } |
229 | 229 | } |
230 | | - |
| 230 | + |
231 | 231 | private static function arrayContainsThreadWithId( $a, $id ) { |
232 | 232 | // There's gotta be a nice way to express this in PHP. Anyone? |
233 | | - foreach($a as $t) |
234 | | - if($t->id() == $id) |
| 233 | + foreach ( $a as $t ) |
| 234 | + if ( $t->id() == $id ) |
235 | 235 | return true; |
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | |
239 | 239 | static function withRoot( $post ) { |
240 | | - if( $post->getTitle()->getNamespace() != NS_LQT_THREAD ) { |
| 240 | + if ( $post->getTitle()->getNamespace() != NS_LQT_THREAD ) { |
241 | 241 | // No articles outside the thread namespace have threads associated with them; |
242 | 242 | // avoiding the query saves time during the TitleGetRestrictions hook. |
243 | 243 | return null; |
244 | 244 | } |
245 | | - if( array_key_exists( $post->getID(), self::$cache_by_root ) ) { |
| 245 | + if ( array_key_exists( $post->getID(), self::$cache_by_root ) ) { |
246 | 246 | return self::$cache_by_root[$post->getID()]; |
247 | 247 | } |
248 | | - $ts = Threads::where( array('thread.thread_root' => $post->getID()) ); |
249 | | - return self::assertSingularity($ts, 'thread_root', $post->getID()); |
| 248 | + $ts = Threads::where( array( 'thread.thread_root' => $post->getID() ) ); |
| 249 | + return self::assertSingularity( $ts, 'thread_root', $post->getID() ); |
250 | 250 | } |
251 | 251 | |
252 | 252 | static function withId( $id ) { |
253 | | - if( array_key_exists( $id, self::$cache_by_id ) ) { |
| 253 | + if ( array_key_exists( $id, self::$cache_by_id ) ) { |
254 | 254 | return self::$cache_by_id[$id]; |
255 | 255 | } |
256 | | - $ts = Threads::where( array('thread.thread_id' => $id ) ); |
257 | | - return self::assertSingularity($ts, 'thread_id', $id); |
| 256 | + $ts = Threads::where( array( 'thread.thread_id' => $id ) ); |
| 257 | + return self::assertSingularity( $ts, 'thread_id', $id ); |
258 | 258 | } |
259 | 259 | |
260 | 260 | static function withSummary( $article ) { |
261 | | - $ts = Threads::where( array('thread.thread_summary_page' => $article->getId())); |
262 | | - return self::assertSingularity($ts, 'thread_summary_page', $article->getId()); |
| 261 | + $ts = Threads::where( array( 'thread.thread_summary_page' => $article->getId() ) ); |
| 262 | + return self::assertSingularity( $ts, 'thread_summary_page', $article->getId() ); |
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Horrible, horrible! |
267 | 267 | * List of months in which there are >0 threads, suitable for threadsOfArticleInMonth. */ |
268 | 268 | static function monthsWhereArticleHasThreads( $article ) { |
269 | | - $threads = Threads::where( Threads::articleClause($article) ); |
| 269 | + $threads = Threads::where( Threads::articleClause( $article ) ); |
270 | 270 | $months = array(); |
271 | | - foreach( $threads as $t ) { |
| 271 | + foreach ( $threads as $t ) { |
272 | 272 | $m = substr( $t->modified(), 0, 6 ); |
273 | 273 | if ( !array_key_exists( $m, $months ) ) { |
274 | | - if (!in_array( $m, $months )) $months[] = $m; |
| 274 | + if ( !in_array( $m, $months ) ) $months[] = $m; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | return $months; |
278 | 278 | } |
279 | 279 | |
280 | | - static function articleClause($article) { |
281 | | - $dbr = wfGetDB(DB_SLAVE); |
282 | | - $q_article= $dbr->addQuotes($article->getTitle()->getDBkey()); |
| 280 | + static function articleClause( $article ) { |
| 281 | + $dbr = wfGetDB( DB_SLAVE ); |
| 282 | + $q_article = $dbr->addQuotes( $article->getTitle()->getDBkey() ); |
283 | 283 | return <<<SQL |
284 | 284 | (thread.thread_article_title = $q_article |
285 | 285 | AND thread.thread_article_namespace = {$article->getTitle()->getNamespace()}) |
— | — | @@ -288,5 +288,4 @@ |
289 | 289 | static function topLevelClause() { |
290 | 290 | return 'thread.thread_parent is null'; |
291 | 291 | } |
292 | | - |
293 | | -} |
\ No newline at end of file |
| 292 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThreads.php |
___________________________________________________________________ |
Added: svn:eol-style |
294 | 293 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtDate.php |
— | — | @@ -1,12 +1,12 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | class Date { |
6 | 6 | public $year, $month, $day, $hour, $minute, $second; |
7 | 7 | |
8 | 8 | // ex. "20070530033751" |
9 | 9 | function __construct( $text ) { |
10 | | - if ( !strlen( $text ) == 14 || !ctype_digit($text) ) { |
| 10 | + if ( !strlen( $text ) == 14 || !ctype_digit( $text ) ) { |
11 | 11 | $this->isValid = false; |
12 | 12 | return null; |
13 | 13 | } |
— | — | @@ -17,13 +17,16 @@ |
18 | 18 | $this->minute = intval( substr( $text, 10, 2 ) ); |
19 | 19 | $this->second = intval( substr( $text, 12, 2 ) ); |
20 | 20 | } |
| 21 | + |
21 | 22 | function lastMonth() { |
22 | | - return $this->moved('-1 month'); |
| 23 | + return $this->moved( '-1 month' ); |
23 | 24 | } |
| 25 | + |
24 | 26 | function nextMonth() { |
25 | | - return $this->moved('+1 month'); |
| 27 | + return $this->moved( '+1 month' ); |
26 | 28 | } |
27 | | - function moved($str) { |
| 29 | + |
| 30 | + function moved( $str ) { |
28 | 31 | // Try to set local timezone to attempt to avoid E_STRICT errors. |
29 | 32 | global $wgLocaltimezone; |
30 | 33 | if ( isset( $wgLocaltimezone ) ) { |
— | — | @@ -45,48 +48,52 @@ |
46 | 49 | // Return the generated date object. |
47 | 50 | return $date; |
48 | 51 | } |
49 | | - /* function monthString() { |
50 | | - return sprintf( '%04d%02d', $this->year, $this->month ); |
| 52 | + |
| 53 | + static function monthString( $text ) { |
| 54 | + return substr( $text, 0, 6 ); |
51 | 55 | } |
52 | | - */ |
53 | | - static function monthString($text) { |
54 | | - return substr($text, 0, 6); |
55 | | - } |
56 | 56 | |
57 | 57 | function delta( $o ) { |
58 | 58 | $t = clone $this; |
59 | | - $els = array('year', 'month', 'day', 'hour', 'minute', 'second'); |
| 59 | + $els = array( 'year', 'month', 'day', 'hour', 'minute', 'second' ); |
60 | 60 | $deltas = array(); |
61 | | - foreach ($els as $e) {$deltas[$e] = $t->$e - $o->$e; |
| 61 | + foreach ( $els as $e ) { $deltas[$e] = $t->$e - $o->$e; |
62 | 62 | $t->$e += $t->$e - $o->$e; |
63 | 63 | } |
64 | 64 | |
65 | 65 | // format in style of date(). |
66 | 66 | $result = ""; |
67 | | - foreach( $deltas as $name => $val ) { |
| 67 | + foreach ( $deltas as $name => $val ) { |
68 | 68 | $result .= "$val $name "; |
69 | 69 | } |
70 | 70 | return $result; |
71 | 71 | } |
72 | | - static function beginningOfMonth($yyyymm) { return $yyyymm . '00000000'; } |
73 | | - static function endOfMonth($yyyymm) { return $yyyymm . '31235959'; } |
| 72 | + |
| 73 | + static function beginningOfMonth( $yyyymm ) { return $yyyymm . '00000000'; } |
| 74 | + |
| 75 | + static function endOfMonth( $yyyymm ) { return $yyyymm . '31235959'; } |
| 76 | + |
74 | 77 | function text() { |
75 | 78 | return sprintf( '%04d%02d%02d%02d%02d%02d', $this->year, $this->month, $this->day, |
76 | 79 | $this->hour, $this->minute, $this->second ); |
77 | 80 | } |
| 81 | + |
78 | 82 | static function now() { |
79 | | - return new Date(wfTimestampNow()); |
| 83 | + return new Date( wfTimestampNow() ); |
80 | 84 | } |
81 | | - function nDaysAgo($n) { |
82 | | - return $this->moved("-$n days"); |
| 85 | + |
| 86 | + function nDaysAgo( $n ) { |
| 87 | + return $this->moved( "-$n days" ); |
83 | 88 | } |
| 89 | + |
84 | 90 | function midnight() { |
85 | 91 | $d = clone $this; |
86 | 92 | $d->hour = $d->minute = $d->second = 0; |
87 | 93 | return $d; |
88 | 94 | } |
89 | | - function isBefore($d) { |
90 | | - foreach(array('year', 'month', 'day', 'hour', 'minute', 'second') as $part) { |
| 95 | + |
| 96 | + function isBefore( $d ) { |
| 97 | + foreach ( array( 'year', 'month', 'day', 'hour', 'minute', 'second' ) as $part ) { |
91 | 98 | if ( $this->$part < $d->$part ) return true; |
92 | 99 | if ( $this->$part > $d->$part ) return false; |
93 | 100 | } |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtDate.php |
___________________________________________________________________ |
Added: svn:eol-style |
94 | 101 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php |
— | — | @@ -1,39 +1,38 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | | - |
6 | 5 | class NewMessages { |
7 | 6 | |
8 | | - static function markThreadAsUnreadByUser($thread, $user) { |
9 | | - self::writeUserMessageState($thread, $user, null); |
| 7 | + static function markThreadAsUnreadByUser( $thread, $user ) { |
| 8 | + self::writeUserMessageState( $thread, $user, null ); |
10 | 9 | } |
11 | 10 | |
12 | | - static function markThreadAsReadByUser($thread, $user) { |
13 | | - self::writeUserMessageState($thread, $user, wfTimestampNow()); |
| 11 | + static function markThreadAsReadByUser( $thread, $user ) { |
| 12 | + self::writeUserMessageState( $thread, $user, wfTimestampNow() ); |
14 | 13 | } |
15 | 14 | |
16 | | - private static function writeUserMessageState($thread, $user, $timestamp) { |
| 15 | + private static function writeUserMessageState( $thread, $user, $timestamp ) { |
17 | 16 | global $wgDBprefix; |
18 | | - if( is_object($thread) ) $thread_id = $thread->id(); |
19 | | - else if( is_integer($thread) ) $thread_id = $thread; |
20 | | - else throw new MWException("writeUserMessageState expected Thread or integer but got $thread"); |
| 17 | + if ( is_object( $thread ) ) $thread_id = $thread->id(); |
| 18 | + else if ( is_integer( $thread ) ) $thread_id = $thread; |
| 19 | + else throw new MWException( "writeUserMessageState expected Thread or integer but got $thread" ); |
21 | 20 | |
22 | | - if( is_object($user) ) $user_id = $user->getID(); |
23 | | - else if( is_integer($user) ) $user_id = $user; |
24 | | - else throw new MWException("writeUserMessageState expected User or integer but got $user"); |
| 21 | + if ( is_object( $user ) ) $user_id = $user->getID(); |
| 22 | + else if ( is_integer( $user ) ) $user_id = $user; |
| 23 | + else throw new MWException( "writeUserMessageState expected User or integer but got $user" ); |
25 | 24 | |
26 | 25 | if ( $timestamp === null ) $timestamp = "NULL"; |
27 | 26 | |
28 | 27 | // use query() directly to pass in 'true' for don't-die-on-errors. |
29 | 28 | $dbr =& wfGetDB( DB_MASTER ); |
30 | | - $success = $dbr->query("insert into {$wgDBprefix}user_message_state values ($user_id, $thread_id, $timestamp)", |
31 | | - __METHOD__, true); |
| 29 | + $success = $dbr->query( "insert into {$wgDBprefix}user_message_state values ($user_id, $thread_id, $timestamp)", |
| 30 | + __METHOD__, true ); |
32 | 31 | |
33 | | - if( !$success ) { |
| 32 | + if ( !$success ) { |
34 | 33 | // duplicate key; update. |
35 | | - $dbr->query("update {$wgDBprefix}user_message_state set ums_read_timestamp = $timestamp" . |
36 | | - " where ums_thread = $thread_id and ums_user = $user_id", |
37 | | - __METHOD__); |
| 34 | + $dbr->query( "update {$wgDBprefix}user_message_state set ums_read_timestamp = $timestamp" . |
| 35 | + " where ums_thread = $thread_id and ums_user = $user_id", |
| 36 | + __METHOD__ ); |
38 | 37 | } |
39 | 38 | } |
40 | 39 | |
— | — | @@ -41,15 +40,15 @@ |
42 | 41 | * Write a user_message_state for each user who is watching the thread. |
43 | 42 | * If the thread is on a user's talkpage, set that user's newtalk. |
44 | 43 | */ |
45 | | - static function writeMessageStateForUpdatedThread($t) { |
| 44 | + static function writeMessageStateForUpdatedThread( $t ) { |
46 | 45 | global $wgDBprefix, $wgUser; |
47 | 46 | |
48 | | - if( $t->article()->getTitle()->getNamespace() == NS_USER ) { |
| 47 | + if ( $t->article()->getTitle()->getNamespace() == NS_USER ) { |
49 | 48 | $name = $t->article()->getTitle()->getDBkey(); |
50 | | - list($name) = split('/', $name); // subpages |
51 | | - $user = User::newFromName($name); |
52 | | - if( $user && $user->getID() != $wgUser->getID() ) { |
53 | | - $user->setNewtalk(true); |
| 49 | + list( $name ) = split( '/', $name ); // subpages |
| 50 | + $user = User::newFromName( $name ); |
| 51 | + if ( $user && $user->getID() != $wgUser->getID() ) { |
| 52 | + $user->setNewtalk( true ); |
54 | 53 | } |
55 | 54 | } |
56 | 55 | |
— | — | @@ -58,8 +57,8 @@ |
59 | 58 | $talkpage_t = $t->article()->getTitle(); |
60 | 59 | $root_t = $t->root()->getTitle(); |
61 | 60 | |
62 | | - $q_talkpage_t = $dbw->addQuotes($talkpage_t->getDBkey()); |
63 | | - $q_root_t = $dbw->addQuotes($root_t->getDBkey()); |
| 61 | + $q_talkpage_t = $dbw->addQuotes( $talkpage_t->getDBkey() ); |
| 62 | + $q_root_t = $dbw->addQuotes( $root_t->getDBkey() ); |
64 | 63 | |
65 | 64 | // Select any applicable watchlist entries for the thread. |
66 | 65 | $where_clause = <<<SQL |
— | — | @@ -71,24 +70,23 @@ |
72 | 71 | |
73 | 72 | // it sucks to not have 'on duplicate key update'. first update users who already have a ums for this thread |
74 | 73 | // and who have already read it, by setting their state to unread. |
75 | | - $dbw->query("update {$wgDBprefix}user_message_state, {$wgDBprefix}watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause"); |
| 74 | + $dbw->query( "update {$wgDBprefix}user_message_state, {$wgDBprefix}watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause" ); |
76 | 75 | |
77 | | - $dbw->query("insert ignore into {$wgDBprefix}user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from {$wgDBprefix}user, {$wgDBprefix}watchlist where user_id = wl_user and $where_clause;"); |
| 76 | + $dbw->query( "insert ignore into {$wgDBprefix}user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from {$wgDBprefix}user, {$wgDBprefix}watchlist where user_id = wl_user and $where_clause;" ); |
78 | 77 | } |
79 | 78 | |
80 | | - static function newUserMessages($user) { |
| 79 | + static function newUserMessages( $user ) { |
81 | 80 | global $wgDBprefix; |
82 | | - return Threads::where( array('ums_read_timestamp is null', |
83 | | - Threads::articleClause(new Article($user->getUserPage()))), |
| 81 | + return Threads::where( array( 'ums_read_timestamp is null', |
| 82 | + Threads::articleClause( new Article( $user->getUserPage() ) ) ), |
84 | 83 | array(), array(), "left outer join {$wgDBprefix}user_message_state on ums_user is null or (ums_user = {$user->getID()} and ums_thread = thread.thread_id)" ); |
85 | 84 | } |
86 | 85 | |
87 | | - static function watchedThreadsForUser($user) { |
88 | | - return Threads::where( array('ums_read_timestamp is null', |
89 | | - 'ums_user' => $user->getID(), |
90 | | - 'ums_thread = thread.thread_id', |
91 | | - 'NOT (' . Threads::articleClause(new Article($user->getUserPage())) . ')' ), |
92 | | - array(), array('user_message_state') ); |
| 86 | + static function watchedThreadsForUser( $user ) { |
| 87 | + return Threads::where( array( 'ums_read_timestamp is null', |
| 88 | + 'ums_user' => $user->getID(), |
| 89 | + 'ums_thread = thread.thread_id', |
| 90 | + 'NOT (' . Threads::articleClause( new Article( $user->getUserPage() ) ) . ')' ), |
| 91 | + array(), array( 'user_message_state' ) ); |
93 | 92 | } |
94 | | - |
95 | | -} |
\ No newline at end of file |
| 93 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php |
___________________________________________________________________ |
Added: svn:eol-style |
96 | 94 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | class QueryGroup { |
6 | 6 | protected $queries; |
— | — | @@ -9,24 +9,24 @@ |
10 | 10 | } |
11 | 11 | |
12 | 12 | function addQuery( $name, $where, $options = array(), $extra_tables = array() ) { |
13 | | - $this->queries[$name] = array($where, $options, $extra_tables); |
| 13 | + $this->queries[$name] = array( $where, $options, $extra_tables ); |
14 | 14 | } |
15 | 15 | |
16 | | - function extendQuery( $original, $newname, $where, $options = array(), $extra_tables=array() ) { |
17 | | - if (!array_key_exists($original,$this->queries)) return; |
| 16 | + function extendQuery( $original, $newname, $where, $options = array(), $extra_tables = array() ) { |
| 17 | + if ( !array_key_exists( $original, $this->queries ) ) return; |
18 | 18 | $q = $this->queries[$original]; |
19 | | - $this->queries[$newname] = array( array_merge($q[0], $where), |
20 | | - array_merge($q[1], $options), |
21 | | - array_merge($q[2], $extra_tables) ); |
| 19 | + $this->queries[$newname] = array( array_merge( $q[0], $where ), |
| 20 | + array_merge( $q[1], $options ), |
| 21 | + array_merge( $q[2], $extra_tables ) ); |
22 | 22 | } |
23 | 23 | |
24 | 24 | function deleteQuery( $name ) { |
25 | | - unset ($this->queries[$name]); |
| 25 | + unset ( $this->queries[$name] ); |
26 | 26 | } |
27 | 27 | |
28 | | - function query($name) { |
29 | | - if ( !array_key_exists($name,$this->queries) ) return array(); |
30 | | - list($where, $options, $extra_tables) = $this->queries[$name]; |
31 | | - return Threads::where($where, $options, $extra_tables); |
| 28 | + function query( $name ) { |
| 29 | + if ( !array_key_exists( $name, $this->queries ) ) return array(); |
| 30 | + list( $where, $options, $extra_tables ) = $this->queries[$name]; |
| 31 | + return Threads::where( $where, $options, $extra_tables ); |
32 | 32 | } |
33 | 33 | } |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php |
___________________________________________________________________ |
Added: svn:eol-style |
34 | 34 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtThreadHistoryIterator.php |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | class ThreadHistoryIterator extends ArrayIterator { |
6 | 6 | |
7 | | - function __construct($thread, $limit, $offset) { |
| 7 | + function __construct( $thread, $limit, $offset ) { |
8 | 8 | $this->thread = $thread; |
9 | 9 | $this->limit = $limit; |
10 | 10 | $this->offset = $offset; |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | } |
13 | 13 | |
14 | 14 | private function loadRows() { |
15 | | - if( $this->offset == 0 ) { |
| 15 | + if ( $this->offset == 0 ) { |
16 | 16 | $this->append( $this->thread ); |
17 | 17 | $this->limit -= 1; |
18 | 18 | } else { |
— | — | @@ -22,13 +22,13 @@ |
23 | 23 | $res = $dbr->select( |
24 | 24 | 'historical_thread', |
25 | 25 | 'hthread_contents, hthread_revision', |
26 | | - array('hthread_id' => $this->thread->id()), |
| 26 | + array( 'hthread_id' => $this->thread->id() ), |
27 | 27 | __METHOD__, |
28 | | - array('ORDER BY' => 'hthread_revision DESC', |
| 28 | + array( 'ORDER BY' => 'hthread_revision DESC', |
29 | 29 | 'LIMIT' => $this->limit, |
30 | | - 'OFFSET' => $this->offset)); |
31 | | - while($l = $dbr->fetchObject($res)) { |
32 | | - $this->append( HistoricalThread::fromTextRepresentation($l->hthread_contents) ); |
| 30 | + 'OFFSET' => $this->offset ) ); |
| 31 | + while ( $l = $dbr->fetchObject( $res ) ) { |
| 32 | + $this->append( HistoricalThread::fromTextRepresentation( $l->hthread_contents ) ); |
33 | 33 | } |
34 | 34 | } |
35 | | -} |
\ No newline at end of file |
| 35 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThreadHistoryIterator.php |
___________________________________________________________________ |
Added: svn:eol-style |
36 | 36 | + native |
Index: trunk/extensions/LiquidThreads/classes/LqtPost.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die; |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | 4 | |
5 | 5 | // TODO get rid of this class. sheesh. |
6 | 6 | class Post extends Article { |
— | — | @@ -10,15 +10,15 @@ |
11 | 11 | function originalAuthor() { |
12 | 12 | $dbr =& wfGetDB( DB_SLAVE ); |
13 | 13 | |
14 | | - $line = $dbr->selectRow( array('revision', 'page'), 'rev_user_text', |
15 | | - array('rev_page = page_id', |
16 | | - 'page_id' => $this->getID()), |
| 14 | + $line = $dbr->selectRow( array( 'revision', 'page' ), 'rev_user_text', |
| 15 | + array( 'rev_page = page_id', |
| 16 | + 'page_id' => $this->getID() ), |
17 | 17 | __METHOD__, |
18 | | - array('ORDER BY'=> 'rev_timestamp', |
19 | | - 'LIMIT' => '1') ); |
| 18 | + array( 'ORDER BY' => 'rev_timestamp', |
| 19 | + 'LIMIT' => '1' ) ); |
20 | 20 | if ( $line ) |
21 | | - return User::newFromName($line->rev_user_text, false); |
| 21 | + return User::newFromName( $line->rev_user_text, false ); |
22 | 22 | else |
23 | 23 | return null; |
24 | 24 | } |
25 | | -} |
\ No newline at end of file |
| 25 | +} |
Property changes on: trunk/extensions/LiquidThreads/classes/LqtPost.php |
___________________________________________________________________ |
Added: svn:eol-style |
26 | 26 | + native |
Index: trunk/extensions/LiquidThreads/pages/SummaryPageView.php |
— | — | @@ -1,17 +1,17 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class SummaryPageView extends LqtView { |
7 | 7 | function show() { |
8 | 8 | wfLoadExtensionMessages( 'LiquidThreads' ); |
9 | | - $thread = Threads::withSummary($this->article); |
10 | | - if( $thread ) { |
| 9 | + $thread = Threads::withSummary( $this->article ); |
| 10 | + if ( $thread ) { |
11 | 11 | $url = $thread->root()->getTitle()->getFullURL(); |
12 | 12 | $name = $thread->root()->getTitle()->getPrefixedText(); |
13 | 13 | $this->output->setSubtitle( |
14 | | - wfMsg('lqt_summary_subtitle', |
15 | | - '<a href="'.$url.'">'.$name.'</a>')); |
| 14 | + wfMsg( 'lqt_summary_subtitle', |
| 15 | + '<a href="' . $url . '">' . $name . '</a>' ) ); |
16 | 16 | } |
17 | 17 | return true; |
18 | 18 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/SummaryPageView.php |
___________________________________________________________________ |
Added: svn:eol-style |
19 | 19 | + native |
Index: trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php |
— | — | @@ -1,175 +1,175 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class TalkpageArchiveView extends TalkpageView { |
7 | | - function __construct(&$output, &$article, &$title, &$user, &$request) { |
8 | | - parent::__construct($output, $article, $title, $user, $request); |
| 7 | + function __construct( &$output, &$article, &$title, &$user, &$request ) { |
| 8 | + parent::__construct( $output, $article, $title, $user, $request ); |
9 | 9 | $this->loadQueryFromRequest(); |
10 | 10 | } |
11 | | - |
12 | | - function showThread($t) { |
13 | | - $this->output->addHTML(<<<HTML |
| 11 | + |
| 12 | + function showThread( $t ) { |
| 13 | + $this->output->addHTML( <<<HTML |
14 | 14 | <tr> |
15 | 15 | <td><a href="{$this->permalinkUrl($t)}">{$t->subjectWithoutIncrement()}</a></td> |
16 | 16 | <td> |
17 | 17 | HTML |
18 | | - ); if( $t->hasSummary() ) { |
19 | | - $this->showPostBody($t->summary()); |
| 18 | + ); if ( $t->hasSummary() ) { |
| 19 | + $this->showPostBody( $t->summary() ); |
20 | 20 | } else if ( $t->type() == Threads::TYPE_MOVED ) { |
21 | 21 | $rthread = $t->redirectThread(); |
22 | | - if( $rthread && $rthread->summary() ) { |
23 | | - $this->showPostBody($rthread->summary()); |
| 22 | + if ( $rthread && $rthread->summary() ) { |
| 23 | + $this->showPostBody( $rthread->summary() ); |
24 | 24 | } |
25 | 25 | } |
26 | | - $this->output->addHTML(<<<HTML |
| 26 | + $this->output->addHTML( <<<HTML |
27 | 27 | </td> |
28 | 28 | </tr> |
29 | 29 | HTML |
30 | 30 | ); |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | function loadQueryFromRequest() { |
34 | 34 | wfLoadExtensionMessages( 'LiquidThreads' ); |
35 | 35 | // Begin with with the requirements for being *in* the archive. |
36 | | - $startdate = Date::now()->nDaysAgo($this->archive_start_days)->midnight(); |
37 | | - $where = array(Threads::articleClause($this->article), |
| 36 | + $startdate = Date::now()->nDaysAgo( $this->archive_start_days )->midnight(); |
| 37 | + $where = array( Threads::articleClause( $this->article ), |
38 | 38 | 'thread.thread_parent is null', |
39 | 39 | '(thread.thread_summary_page is not null' . |
40 | | - ' OR thread.thread_type = '.Threads::TYPE_MOVED.')', |
41 | | - 'thread.thread_modified < ' . $startdate->text()); |
42 | | - $options = array('ORDER BY thread.thread_modified DESC'); |
43 | | - |
44 | | - $annotations = array( wfMsg ( 'lqt-searching' )); |
45 | | - |
| 40 | + ' OR thread.thread_type = ' . Threads::TYPE_MOVED . ')', |
| 41 | + 'thread.thread_modified < ' . $startdate->text() ); |
| 42 | + $options = array( 'ORDER BY thread.thread_modified DESC' ); |
| 43 | + |
| 44 | + $annotations = array( wfMsg ( 'lqt-searching' ) ); |
| 45 | + |
46 | 46 | $r = $this->request; |
47 | | - |
| 47 | + |
48 | 48 | /* START AND END DATES */ |
49 | 49 | // $this->start and $this->end are clipped into the range of available |
50 | 50 | // months, for use in the actual query and the selects. $this->raw* are |
51 | 51 | // as actually provided, for use by the 'older' and 'newer' buttons. |
52 | | - $ignore_dates = ! $r->getVal('lqt_archive_filter_by_date', true); |
| 52 | + $ignore_dates = ! $r->getVal( 'lqt_archive_filter_by_date', true ); |
53 | 53 | if ( !$ignore_dates ) { |
54 | | - $months = Threads::monthsWhereArticleHasThreads($this->article); |
| 54 | + $months = Threads::monthsWhereArticleHasThreads( $this->article ); |
55 | 55 | } |
56 | | - $s = $r->getVal('lqt_archive_start'); |
57 | | - if ($s && ctype_digit($s) && strlen($s) == 6 && !$ignore_dates) { |
| 56 | + $s = $r->getVal( 'lqt_archive_start' ); |
| 57 | + if ( $s && ctype_digit( $s ) && strlen( $s ) == 6 && !$ignore_dates ) { |
58 | 58 | $this->selstart = new Date( "{$s}01000000" ); |
59 | | - $this->starti = array_search($s, $months); |
| 59 | + $this->starti = array_search( $s, $months ); |
60 | 60 | $where[] = 'thread.thread_modified >= ' . $this->selstart->text(); |
61 | 61 | } |
62 | | - $e = $r->getVal('lqt_archive_end'); |
63 | | - if ($e && ctype_digit($e) && strlen($e) == 6 && !$ignore_dates) { |
64 | | - $this->selend = new Date("{$e}01000000"); |
65 | | - $this->endi = array_search($e, $months); |
| 62 | + $e = $r->getVal( 'lqt_archive_end' ); |
| 63 | + if ( $e && ctype_digit( $e ) && strlen( $e ) == 6 && !$ignore_dates ) { |
| 64 | + $this->selend = new Date( "{$e}01000000" ); |
| 65 | + $this->endi = array_search( $e, $months ); |
66 | 66 | $where[] = 'thread.thread_modified < ' . $this->selend->nextMonth()->text(); |
67 | 67 | } |
68 | | - if ( isset($this->selstart) && isset($this->selend) ) { |
69 | | - |
| 68 | + if ( isset( $this->selstart ) && isset( $this->selend ) ) { |
| 69 | + |
70 | 70 | $this->datespan = $this->starti - $this->endi; |
71 | | - |
72 | | - $formattedFrom = $this->formattedMonth($this->selstart->text()); |
73 | | - $formattedTo = $this->formattedMonth($this->selend->text()); |
74 | | - |
75 | | - if( $this->datespan == 0 ) { |
76 | | - $annotations[] = wfMsg('lqt_archive_month_annotation', $formattedFrom); |
| 71 | + |
| 72 | + $formattedFrom = $this->formattedMonth( $this->selstart->text() ); |
| 73 | + $formattedTo = $this->formattedMonth( $this->selend->text() ); |
| 74 | + |
| 75 | + if ( $this->datespan == 0 ) { |
| 76 | + $annotations[] = wfMsg( 'lqt_archive_month_annotation', $formattedFrom ); |
77 | 77 | } else { |
78 | | - $annotations[] = wfMsg('lqt_archive_month_range_annotation', $formattedFrom, $formattedTo); |
| 78 | + $annotations[] = wfMsg( 'lqt_archive_month_range_annotation', $formattedFrom, $formattedTo ); |
79 | 79 | } |
80 | | - } else if (isset($this->selstart)) { |
| 80 | + } else if ( isset( $this->selstart ) ) { |
81 | 81 | $annotations[] = "after {$this->selstart->text()}"; |
82 | | - } else if (isset($this->selend)) { |
| 82 | + } else if ( isset( $this->selend ) ) { |
83 | 83 | $annotations[] = "before {$this->selend->text()}"; |
84 | 84 | } |
85 | | - |
| 85 | + |
86 | 86 | $this->where = $where; |
87 | 87 | $this->options = $options; |
88 | | - $this->annotations = implode("<br />\n", $annotations); |
| 88 | + $this->annotations = implode( "<br />\n", $annotations ); |
89 | 89 | } |
90 | | - |
| 90 | + |
91 | 91 | function threads() { |
92 | | - return Threads::where($this->where, $this->options); |
| 92 | + return Threads::where( $this->where, $this->options ); |
93 | 93 | } |
94 | | - |
95 | | - function formattedMonth($yyyymm) { |
| 94 | + |
| 95 | + function formattedMonth( $yyyymm ) { |
96 | 96 | global $wgLang; // TODO global. |
97 | | - return $wgLang->getMonthName( substr($yyyymm, 4, 2) ).' '.substr($yyyymm, 0, 4); |
| 97 | + return $wgLang->getMonthName( substr( $yyyymm, 4, 2 ) ) . ' ' . substr( $yyyymm, 0, 4 ); |
98 | 98 | } |
99 | | - |
100 | | - function monthSelect($months, $name) { |
101 | | - $selection = $this->request->getVal($name); |
102 | | - |
| 99 | + |
| 100 | + function monthSelect( $months, $name ) { |
| 101 | + $selection = $this->request->getVal( $name ); |
| 102 | + |
103 | 103 | // Silently adjust to stay in range. |
104 | | - $selection = max( min( $selection, $months[0] ), $months[count($months)-1] ); |
105 | | - |
| 104 | + $selection = max( min( $selection, $months[0] ), $months[count( $months ) - 1] ); |
| 105 | + |
106 | 106 | $options = array(); |
107 | | - foreach($months as $m) { |
108 | | - $options[$this->formattedMonth($m)] = $m; |
| 107 | + foreach ( $months as $m ) { |
| 108 | + $options[$this->formattedMonth( $m )] = $m; |
109 | 109 | } |
110 | 110 | $result = "<select name=\"$name\" id=\"$name\">"; |
111 | | - foreach( $options as $label => $value ) { |
| 111 | + foreach ( $options as $label => $value ) { |
112 | 112 | $selected = $selection == $value ? 'selected="true"' : ''; |
113 | 113 | $result .= "<option value=\"$value\" $selected>$label"; |
114 | 114 | } |
115 | 115 | $result .= "</select>"; |
116 | 116 | return $result; |
117 | 117 | } |
118 | | - |
| 118 | + |
119 | 119 | function clip( $vals, $min, $max ) { |
120 | 120 | $res = array(); |
121 | | - foreach($vals as $val) $res[] = max( min( $val, $max ), $min ); |
| 121 | + foreach ( $vals as $val ) $res[] = max( min( $val, $max ), $min ); |
122 | 122 | return $res; |
123 | 123 | } |
124 | | - |
| 124 | + |
125 | 125 | /* @return True if there are no threads to show, false otherwise. |
126 | 126 | TODO is is somewhat bizarre. */ |
127 | 127 | function showSearchForm() { |
128 | | - $months = Threads::monthsWhereArticleHasThreads($this->article); |
129 | | - if (count($months) == 0) { |
| 128 | + $months = Threads::monthsWhereArticleHasThreads( $this->article ); |
| 129 | + if ( count( $months ) == 0 ) { |
130 | 130 | return true; |
131 | 131 | } |
132 | 132 | wfLoadExtensionMessages( 'LiquidThreads' ); |
133 | | - |
134 | | - $use_dates = $this->request->getVal('lqt_archive_filter_by_date', null); |
| 133 | + |
| 134 | + $use_dates = $this->request->getVal( 'lqt_archive_filter_by_date', null ); |
135 | 135 | if ( $use_dates === null ) { |
136 | | - $use_dates = $this->request->getBool('lqt_archive_start', false) || |
137 | | - $this->request->getBool('lqt_archive_end', false); |
| 136 | + $use_dates = $this->request->getBool( 'lqt_archive_start', false ) || |
| 137 | + $this->request->getBool( 'lqt_archive_end', false ); |
138 | 138 | } |
139 | 139 | $any_date_check = !$use_dates ? 'checked="1"' : ''; |
140 | 140 | $these_dates_check = $use_dates ? 'checked="1"' : ''; |
141 | 141 | $any_date = wfMsg ( 'lqt-any-date' ); |
142 | | - $only_date= wfMsg ( 'lqt-only-date' ); |
143 | | - $date_from= wfMsg ( 'lqt-date-from' ); |
| 142 | + $only_date = wfMsg ( 'lqt-only-date' ); |
| 143 | + $date_from = wfMsg ( 'lqt-date-from' ); |
144 | 144 | $date_to = wfMsg ( 'lqt-date-to' ); |
145 | 145 | $date_info = wfMsg ( 'lqt-date-info' ); |
146 | | - if( isset($this->datespan) ) { |
| 146 | + if ( isset( $this->datespan ) ) { |
147 | 147 | $oatte = $this->starti + 1; |
148 | 148 | $oatts = $this->starti + 1 + $this->datespan; |
149 | | - |
| 149 | + |
150 | 150 | $natts = $this->endi - 1; |
151 | 151 | $natte = $this->endi - 1 - $this->datespan; |
152 | | - |
153 | | - list($oe, $os, $ns, $ne) = |
154 | | - $this->clip( array($oatte, $oatts, $natts, $natte), |
155 | | - 0, count($months)-1 ); |
156 | | - |
157 | | - $older = '<a class="lqt_newer_older" href="' . $this->queryReplace(array( |
158 | | - 'lqt_archive_filter_by_date'=>'1', |
| 152 | + |
| 153 | + list( $oe, $os, $ns, $ne ) = |
| 154 | + $this->clip( array( $oatte, $oatts, $natts, $natte ), |
| 155 | + 0, count( $months ) - 1 ); |
| 156 | + |
| 157 | + $older = '<a class="lqt_newer_older" href="' . $this->queryReplace( array( |
| 158 | + 'lqt_archive_filter_by_date' => '1', |
159 | 159 | 'lqt_archive_start' => $months[$os], |
160 | | - 'lqt_archive_end' => $months[$oe])) |
161 | | - . '">«'.wfMsg ( 'lqt-older' ).'</a>'; |
162 | | - $newer = '<a class="lqt_newer_older" href="' . $this->queryReplace(array( |
163 | | - 'lqt_archive_filter_by_date'=>'1', |
| 160 | + 'lqt_archive_end' => $months[$oe] ) ) |
| 161 | + . '">«' . wfMsg ( 'lqt-older' ) . '</a>'; |
| 162 | + $newer = '<a class="lqt_newer_older" href="' . $this->queryReplace( array( |
| 163 | + 'lqt_archive_filter_by_date' => '1', |
164 | 164 | 'lqt_archive_start' => $months[$ns], |
165 | | - 'lqt_archive_end' => $months[$ne])) |
166 | | - . '">'.wfMsg ( 'lqt-newer' ).'»</a>'; |
| 165 | + 'lqt_archive_end' => $months[$ne] ) ) |
| 166 | + . '">' . wfMsg ( 'lqt-newer' ) . '»</a>'; |
167 | 167 | } |
168 | 168 | else { |
169 | | - $older = '<span class="lqt_newer_older_disabled" title="'.wfMsg ( 'lqt-date-info' ).'">«'.wfMsg ( 'lqt-older' ).'</span>'; |
170 | | - $newer = '<span class="lqt_newer_older_disabled" title="'.wfMsg ( 'lqt-date-info' ).'">'.wfMsg ( 'lqt-newer' ).'»</span>'; |
| 169 | + $older = '<span class="lqt_newer_older_disabled" title="' . wfMsg ( 'lqt-date-info' ) . '">«' . wfMsg ( 'lqt-older' ) . '</span>'; |
| 170 | + $newer = '<span class="lqt_newer_older_disabled" title="' . wfMsg ( 'lqt-date-info' ) . '">' . wfMsg ( 'lqt-newer' ) . '»</span>'; |
171 | 171 | } |
172 | | - |
173 | | - $this->output->addHTML(<<<HTML |
| 172 | + |
| 173 | + $this->output->addHTML( <<<HTML |
174 | 174 | <form id="lqt_archive_search_form" action="{$this->title->getLocalURL()}"> |
175 | 175 | <input type="hidden" name="lqt_method" value="talkpage_archive"> |
176 | 176 | <input type="hidden" name="title" value="{$this->title->getPrefixedURL()}" |
— | — | @@ -194,23 +194,23 @@ |
195 | 195 | ); |
196 | 196 | return false; |
197 | 197 | } |
198 | | - |
| 198 | + |
199 | 199 | function show() { |
200 | 200 | global $wgHooks; |
201 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
202 | | - |
| 201 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 202 | + |
203 | 203 | $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() ); |
204 | 204 | self::addJSandCSS(); |
205 | 205 | wfLoadExtensionMessages( 'LiquidThreads' ); |
206 | | - |
| 206 | + |
207 | 207 | $empty = $this->showSearchForm(); |
208 | | - if ($empty) { |
209 | | - $this->output->addHTML('<p><br /><b>'. wfMsg('lqt-nothread' ) . '</b></p>' ); |
| 208 | + if ( $empty ) { |
| 209 | + $this->output->addHTML( '<p><br /><b>' . wfMsg( 'lqt-nothread' ) . '</b></p>' ); |
210 | 210 | return false; |
211 | 211 | } |
212 | | - $lqt_title = wfMsg ( 'lqt-title'); |
| 212 | + $lqt_title = wfMsg ( 'lqt-title' ); |
213 | 213 | $lqt_summary = wfMsg ( 'lqt-summary' ); |
214 | | - $this->output->addHTML(<<<HTML |
| 214 | + $this->output->addHTML( <<<HTML |
215 | 215 | <p class="lqt_search_annotations">{$this->annotations}</p> |
216 | 216 | <table class="lqt_archive_listing"> |
217 | 217 | <col class="lqt_titles" /> |
— | — | @@ -218,11 +218,11 @@ |
219 | 219 | <tr><th>{$lqt_title}<th>{$lqt_summary}</tr> |
220 | 220 | HTML |
221 | 221 | ); |
222 | | - foreach ($this->threads() as $t) { |
223 | | - $this->showThread($t); |
| 222 | + foreach ( $this->threads() as $t ) { |
| 223 | + $this->showThread( $t ); |
224 | 224 | } |
225 | | - $this->output->addHTML('</table>'); |
226 | | - |
| 225 | + $this->output->addHTML( '</table>' ); |
| 226 | + |
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php |
___________________________________________________________________ |
Added: svn:eol-style |
230 | 230 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php |
— | — | @@ -1,10 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadPermalinkView extends LqtView { |
7 | 7 | protected $thread; |
8 | | - |
| 8 | + |
9 | 9 | function customizeTabs( $skintemplate, $content_actions ) { |
10 | 10 | wfLoadExtensionMessages( 'LiquidThreads' ); |
11 | 11 | // Insert fake 'article' and 'discussion' tabs before the thread tab. |
— | — | @@ -12,112 +12,112 @@ |
13 | 13 | // the access key for the talk tab doesn't work. |
14 | 14 | $article_t = $this->thread->article()->getTitle(); |
15 | 15 | $talk_t = $this->thread->article()->getTitle()->getTalkPage(); |
16 | | - efInsertIntoAssoc('article', array( |
17 | | - 'text'=>wfMsg($article_t->getNamespaceKey()), |
18 | | - 'href'=>$article_t->getFullURL(), |
19 | | - 'class' => $article_t->exists() ? '' : 'new'), |
20 | | - 'nstab-thread', $content_actions); |
21 | | - efInsertIntoAssoc('not_talk', array( |
| 16 | + efInsertIntoAssoc( 'article', array( |
| 17 | + 'text' => wfMsg( $article_t->getNamespaceKey() ), |
| 18 | + 'href' => $article_t->getFullURL(), |
| 19 | + 'class' => $article_t->exists() ? '' : 'new' ), |
| 20 | + 'nstab-thread', $content_actions ); |
| 21 | + efInsertIntoAssoc( 'not_talk', array( |
22 | 22 | // talkpage certainly exists since this thread is from it. |
23 | | - 'text'=>wfMsg('talk'), |
24 | | - 'href'=>$talk_t->getFullURL()), |
25 | | - 'nstab-thread', $content_actions); |
26 | | - |
27 | | - unset($content_actions['edit']); |
28 | | - unset($content_actions['viewsource']); |
29 | | - unset($content_actions['talk']); |
30 | | - if( array_key_exists( 'move', $content_actions ) && $this->thread ) { |
| 23 | + 'text' => wfMsg( 'talk' ), |
| 24 | + 'href' => $talk_t->getFullURL() ), |
| 25 | + 'nstab-thread', $content_actions ); |
| 26 | + |
| 27 | + unset( $content_actions['edit'] ); |
| 28 | + unset( $content_actions['viewsource'] ); |
| 29 | + unset( $content_actions['talk'] ); |
| 30 | + if ( array_key_exists( 'move', $content_actions ) && $this->thread ) { |
31 | 31 | $content_actions['move']['href'] = |
32 | | - SpecialPage::getTitleFor('MoveThread')->getFullURL() . '/' . |
| 32 | + SpecialPage::getTitleFor( 'MoveThread' )->getFullURL() . '/' . |
33 | 33 | $this->thread->title()->getPrefixedURL(); |
34 | 34 | } |
35 | | - if( array_key_exists( 'delete', $content_actions ) && $this->thread ) { |
| 35 | + if ( array_key_exists( 'delete', $content_actions ) && $this->thread ) { |
36 | 36 | $content_actions['delete']['href'] = |
37 | | - SpecialPage::getTitleFor('DeleteThread')->getFullURL() . '/' . |
| 37 | + SpecialPage::getTitleFor( 'DeleteThread' )->getFullURL() . '/' . |
38 | 38 | $this->thread->title()->getPrefixedURL(); |
39 | 39 | } |
40 | | - |
41 | | - if( array_key_exists('history', $content_actions) ) { |
| 40 | + |
| 41 | + if ( array_key_exists( 'history', $content_actions ) ) { |
42 | 42 | $content_actions['history']['href'] = $this->permalinkUrl( $this->thread, 'thread_history' ); |
43 | | - if( $this->methodApplies('thread_history') ) { |
| 43 | + if ( $this->methodApplies( 'thread_history' ) ) { |
44 | 44 | $content_actions['history']['class'] = 'selected'; |
45 | 45 | } |
46 | 46 | } |
47 | | - |
| 47 | + |
48 | 48 | return true; |
49 | 49 | } |
50 | | - |
| 50 | + |
51 | 51 | function showThreadHeading( $thread ) { |
52 | 52 | if ( $this->headerLevel == 2 ) { |
53 | 53 | $this->output->setPageTitle( $thread->wikilink() ); |
54 | 54 | } else { |
55 | | - parent::showThreadHeading($thread); |
| 55 | + parent::showThreadHeading( $thread ); |
56 | 56 | } |
57 | 57 | } |
58 | | - |
| 58 | + |
59 | 59 | function noSuchRevision() { |
60 | 60 | wfLoadExtensionMessages( 'LiquidThreads' ); |
61 | | - $this->output->addHTML(wfMsg('lqt_nosuchrevision')); |
| 61 | + $this->output->addHTML( wfMsg( 'lqt_nosuchrevision' ) ); |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | function showMissingThreadPage() { |
65 | 65 | wfLoadExtensionMessages( 'LiquidThreads' ); |
66 | | - $this->output->addHTML(wfMsg('lqt_nosuchthread')); |
| 66 | + $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) ); |
67 | 67 | } |
68 | | - |
| 68 | + |
69 | 69 | function getSubtitle() { |
70 | 70 | wfLoadExtensionMessages( 'LiquidThreads' ); |
71 | 71 | // TODO the archive month part is obsolete. |
72 | | - if (Date::now()->nDaysAgo(30)->midnight()->isBefore( new Date($this->thread->modified()) )) |
| 72 | + if ( Date::now()->nDaysAgo( 30 )->midnight()->isBefore( new Date( $this->thread->modified() ) ) ) |
73 | 73 | $query = ''; |
74 | 74 | else |
75 | | - $query = 'lqt_archive_month=' . substr($this->thread->modified(),0,6); |
| 75 | + $query = 'lqt_archive_month=' . substr( $this->thread->modified(), 0, 6 ); |
76 | 76 | $talkpage = $this->thread->article()->getTitle()->getTalkpage(); |
77 | | - $talkpage_link = $this->user->getSkin()->makeKnownLinkObj($talkpage, '', $query); |
| 77 | + $talkpage_link = $this->user->getSkin()->makeKnownLinkObj( $talkpage, '', $query ); |
78 | 78 | if ( $this->thread->hasSuperthread() ) { |
79 | | - return wfMsg('lqt_fragment',"<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">".wfMsg('lqt_discussion_link')."</a>",$talkpage_link); |
| 79 | + return wfMsg( 'lqt_fragment', "<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">" . wfMsg( 'lqt_discussion_link' ) . "</a>", $talkpage_link ); |
80 | 80 | } else { |
81 | | - return wfMsg('lqt_from_talk', $talkpage_link); |
| 81 | + return wfMsg( 'lqt_from_talk', $talkpage_link ); |
82 | 82 | } |
83 | 83 | } |
84 | | - |
85 | | - function __construct(&$output, &$article, &$title, &$user, &$request) { |
86 | | - |
87 | | - parent::__construct($output, $article, $title, $user, $request); |
88 | | - |
| 84 | + |
| 85 | + function __construct( &$output, &$article, &$title, &$user, &$request ) { |
| 86 | + |
| 87 | + parent::__construct( $output, $article, $title, $user, $request ); |
| 88 | + |
89 | 89 | $t = Threads::withRoot( $this->article ); |
90 | | - $r = $this->request->getVal('lqt_oldid', null); if( $r ) { |
91 | | - $t = $t->atRevision($r); |
92 | | - if( !$t ) { $this->noSuchRevision(); return; } |
93 | | - |
| 90 | + $r = $this->request->getVal( 'lqt_oldid', null ); if ( $r ) { |
| 91 | + $t = $t->atRevision( $r ); |
| 92 | + if ( !$t ) { $this->noSuchRevision(); return; } |
| 93 | + |
94 | 94 | } |
95 | 95 | $this->thread = $t; |
96 | | - if( ! $t ) { |
| 96 | + if ( ! $t ) { |
97 | 97 | return; // error reporting is handled in show(). this kinda sucks. |
98 | 98 | } |
99 | | - |
| 99 | + |
100 | 100 | // $this->article gets saved to thread_article, so we want it to point to the |
101 | 101 | // subject page associated with the talkpage, always, not the permalink url. |
102 | 102 | $this->article = $t->article(); # for creating reply threads. |
103 | | - |
| 103 | + |
104 | 104 | } |
105 | | - |
| 105 | + |
106 | 106 | function show() { |
107 | 107 | global $wgHooks; |
108 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
109 | | - |
110 | | - if( ! $this->thread ) { |
| 108 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 109 | + |
| 110 | + if ( ! $this->thread ) { |
111 | 111 | $this->showMissingThreadPage(); |
112 | 112 | return false; |
113 | 113 | } |
114 | | - |
| 114 | + |
115 | 115 | self::addJSandCSS(); |
116 | | - $this->output->setSubtitle($this->getSubtitle()); |
117 | | - |
118 | | - if( $this->methodApplies('summarize') ) |
119 | | - $this->showSummarizeForm($this->thread); |
120 | | - |
121 | | - $this->showThread($this->thread); |
| 116 | + $this->output->setSubtitle( $this->getSubtitle() ); |
| 117 | + |
| 118 | + if ( $this->methodApplies( 'summarize' ) ) |
| 119 | + $this->showSummarizeForm( $this->thread ); |
| 120 | + |
| 121 | + $this->showThread( $this->thread ); |
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php |
___________________________________________________________________ |
Added: svn:eol-style |
125 | 125 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadWatchView.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadWatchView extends ThreadPermalinkView { |
7 | 7 | function show() { |
8 | 8 | global $wgHooks; |
9 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
| 9 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
10 | 10 | return true; |
11 | 11 | } |
12 | 12 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadWatchView.php |
___________________________________________________________________ |
Added: svn:eol-style |
13 | 13 | + native |
Index: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class NewUserMessagesView extends LqtView { |
7 | | - |
| 7 | + |
8 | 8 | protected $threads; |
9 | 9 | protected $tops; |
10 | 10 | protected $targets; |
11 | | - |
12 | | - protected function htmlForReadButton($label, $title, $class, $ids) { |
13 | | - $ids_s = implode(',', $ids); |
| 11 | + |
| 12 | + protected function htmlForReadButton( $label, $title, $class, $ids ) { |
| 13 | + $ids_s = implode( ',', $ids ); |
14 | 14 | return <<<HTML |
15 | 15 | <form method="POST" class="{$class}"> |
16 | 16 | <input type="hidden" name="lqt_method" value="mark_as_read" /> |
— | — | @@ -18,28 +18,28 @@ |
19 | 19 | </form> |
20 | 20 | HTML; |
21 | 21 | } |
22 | | - |
23 | | - function showReadAllButton($threads) { |
| 22 | + |
| 23 | + function showReadAllButton( $threads ) { |
24 | 24 | wfLoadExtensionMessages( 'LiquidThreads' ); |
25 | | - $ids = array_map(create_function('$t', 'return $t->id();'), $threads); |
| 25 | + $ids = array_map( create_function( '$t', 'return $t->id();' ), $threads ); |
26 | 26 | $this->output->addHTML( |
27 | 27 | $this->htmlForReadButton( |
28 | | - wfMsg('lqt-read-all'), |
29 | | - wfMsg('lqt-read-all-tooltip'), |
| 28 | + wfMsg( 'lqt-read-all' ), |
| 29 | + wfMsg( 'lqt-read-all-tooltip' ), |
30 | 30 | "lqt_newmessages_read_all_button", |
31 | 31 | $ids ) |
32 | 32 | ); |
33 | 33 | } |
34 | | - |
35 | | - function preShowThread($t) { |
| 34 | + |
| 35 | + function preShowThread( $t ) { |
36 | 36 | wfLoadExtensionMessages( 'LiquidThreads' ); |
37 | 37 | // $t_ids = implode(',', array_map(create_function('$t', 'return $t->id();'), $this->targets[$t->id()])); |
38 | 38 | $read_button = $this->htmlForReadButton( |
39 | | - wfMsg('lqt-read-message'), |
40 | | - wfMsg('lqt-read-message-tooltip'), |
| 39 | + wfMsg( 'lqt-read-message' ), |
| 40 | + wfMsg( 'lqt-read-message-tooltip' ), |
41 | 41 | 'lqt_newmessages_read_button', |
42 | | - $this->targets[$t->id()]); |
43 | | - $this->output->addHTML(<<<HTML |
| 42 | + $this->targets[$t->id()] ); |
| 43 | + $this->output->addHTML( <<<HTML |
44 | 44 | <table ><tr> |
45 | 45 | <td style="padding-right: 1em; vertical-align: top; padding-top: 1em;" > |
46 | 46 | $read_button |
— | — | @@ -48,30 +48,30 @@ |
49 | 49 | HTML |
50 | 50 | ); |
51 | 51 | } |
52 | | - |
53 | | - function postShowThread($t) { |
54 | | - $this->output->addHTML(<<<HTML |
| 52 | + |
| 53 | + function postShowThread( $t ) { |
| 54 | + $this->output->addHTML( <<<HTML |
55 | 55 | </td> |
56 | 56 | </tr></table> |
57 | 57 | HTML |
58 | 58 | ); |
59 | 59 | } |
60 | | - |
61 | | - function showUndo($ids) { |
| 60 | + |
| 61 | + function showUndo( $ids ) { |
62 | 62 | wfLoadExtensionMessages( 'LiquidThreads' ); |
63 | | - if( count($ids) == 1 ) { |
64 | | - $t = Threads::withId($ids[0]); |
65 | | - if( !$t ) |
| 63 | + if ( count( $ids ) == 1 ) { |
| 64 | + $t = Threads::withId( $ids[0] ); |
| 65 | + if ( !$t ) |
66 | 66 | return; // empty or just bogus operand. |
67 | | - $msg = wfMsg( 'lqt-marked-read',$t->subject() ); |
| 67 | + $msg = wfMsg( 'lqt-marked-read', $t->subject() ); |
68 | 68 | } else { |
69 | | - $count = count($ids); |
70 | | - $msg = wfMsg( 'lqt-count-marked-read',$count ); |
| 69 | + $count = count( $ids ); |
| 70 | + $msg = wfMsg( 'lqt-count-marked-read', $count ); |
71 | 71 | } |
72 | | - $operand = implode(',', $ids); |
| 72 | + $operand = implode( ',', $ids ); |
73 | 73 | $lqt_email_undo = wfMsg ( 'lqt-email-undo' ); |
74 | 74 | $lqt_info_undo = wfMsg ( 'lqt-email-info-undo' ); |
75 | | - $this->output->addHTML(<<<HTML |
| 75 | + $this->output->addHTML( <<<HTML |
76 | 76 | <form method="POST" class="lqt_undo_mark_as_read"> |
77 | 77 | $msg |
78 | 78 | <input type="hidden" name="lqt_method" value="mark_as_unread" /> |
— | — | @@ -81,86 +81,87 @@ |
82 | 82 | HTML |
83 | 83 | ); |
84 | 84 | } |
85 | | - |
86 | | - function postDivClass($thread) { |
| 85 | + |
| 86 | + function postDivClass( $thread ) { |
87 | 87 | $topid = $thread->topmostThread()->id(); |
88 | | - if( in_array($thread->id(), $this->targets[$topid]) ) |
| 88 | + if ( in_array( $thread->id(), $this->targets[$topid] ) ) |
89 | 89 | return 'lqt_post_new_message'; |
90 | 90 | else |
91 | 91 | return 'lqt_post'; |
92 | 92 | } |
93 | | - |
| 93 | + |
94 | 94 | function showOnce() { |
95 | 95 | self::addJSandCSS(); |
96 | | - |
97 | | - if( $this->request->wasPosted() ) { |
| 96 | + |
| 97 | + if ( $this->request->wasPosted() ) { |
98 | 98 | // If they just viewed this page, maybe they still want that notice. |
99 | 99 | // But if they took the time to dismiss even one message, they |
100 | 100 | // probably don't anymore. |
101 | | - $this->user->setNewtalk(false); |
| 101 | + $this->user->setNewtalk( false ); |
102 | 102 | } |
103 | | - |
104 | | - if( $this->request->wasPosted() && $this->methodApplies('mark_as_unread') ) { |
105 | | - $ids = explode(',', $this->request->getVal('lqt_operand', '')); |
106 | | - if( $ids !== false ) { |
107 | | - foreach($ids as $id) { |
108 | | - $tmp_thread = Threads::withId($id); if($tmp_thread) |
109 | | - NewMessages::markThreadAsReadByUser($tmp_thread, $this->user); |
| 103 | + |
| 104 | + if ( $this->request->wasPosted() && $this->methodApplies( 'mark_as_unread' ) ) { |
| 105 | + $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) ); |
| 106 | + if ( $ids !== false ) { |
| 107 | + foreach ( $ids as $id ) { |
| 108 | + $tmp_thread = Threads::withId( $id ); if ( $tmp_thread ) |
| 109 | + NewMessages::markThreadAsReadByUser( $tmp_thread, $this->user ); |
110 | 110 | } |
111 | 111 | $this->output->redirect( $this->title->getFullURL() ); |
112 | 112 | } |
113 | 113 | } |
114 | | - |
115 | | - else if( $this->request->wasPosted() && $this->methodApplies('mark_as_read') ) { |
116 | | - $ids = explode(',', $this->request->getVal('lqt_operand')); |
117 | | - if( $ids !== false ) { |
118 | | - foreach($ids as $id) { |
119 | | - $tmp_thread = Threads::withId($id); if($tmp_thread) |
120 | | - NewMessages::markThreadAsReadByUser($tmp_thread, $this->user); |
| 114 | + |
| 115 | + else if ( $this->request->wasPosted() && $this->methodApplies( 'mark_as_read' ) ) { |
| 116 | + $ids = explode( ',', $this->request->getVal( 'lqt_operand' ) ); |
| 117 | + if ( $ids !== false ) { |
| 118 | + foreach ( $ids as $id ) { |
| 119 | + $tmp_thread = Threads::withId( $id ); |
| 120 | + if ( $tmp_thread ) |
| 121 | + NewMessages::markThreadAsReadByUser( $tmp_thread, $this->user ); |
121 | 122 | } |
122 | | - $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode(',', $ids); |
123 | | - $this->output->redirect( $this->title->getFullURL($query) ); |
| 123 | + $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode( ',', $ids ); |
| 124 | + $this->output->redirect( $this->title->getFullURL( $query ) ); |
124 | 125 | } |
125 | 126 | } |
126 | | - |
127 | | - else if( $this->methodApplies('undo_mark_as_read') ) { |
128 | | - $ids = explode(',', $this->request->getVal('lqt_operand', '')); |
129 | | - $this->showUndo($ids); |
| 127 | + |
| 128 | + else if ( $this->methodApplies( 'undo_mark_as_read' ) ) { |
| 129 | + $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) ); |
| 130 | + $this->showUndo( $ids ); |
130 | 131 | } |
131 | 132 | } |
132 | | - |
| 133 | + |
133 | 134 | function show() { |
134 | 135 | if ( ! is_array( $this->threads ) ) { |
135 | | - throw new MWException('You must use NewUserMessagesView::setThreads() before calling NewUserMessagesView::show().'); |
| 136 | + throw new MWException( 'You must use NewUserMessagesView::setThreads() before calling NewUserMessagesView::show().' ); |
136 | 137 | } |
137 | | - |
| 138 | + |
138 | 139 | // Do everything by id, because we can't depend on reference identity; a simple Thread::withId |
139 | 140 | // can change the cached value and screw up your references. |
140 | | - |
| 141 | + |
141 | 142 | $this->targets = array(); |
142 | 143 | $this->tops = array(); |
143 | | - foreach( $this->threads as $t ) { |
| 144 | + foreach ( $this->threads as $t ) { |
144 | 145 | $top = $t->topmostThread(); |
145 | | - if( !in_array($top->id(), $this->tops) ) |
| 146 | + if ( !in_array( $top->id(), $this->tops ) ) |
146 | 147 | $this->tops[] = $top->id(); |
147 | | - if( !array_key_exists($top->id(), $this->targets) ) |
| 148 | + if ( !array_key_exists( $top->id(), $this->targets ) ) |
148 | 149 | $this->targets[$top->id()] = array(); |
149 | 150 | $this->targets[$top->id()][] = $t->id(); |
150 | 151 | } |
151 | | - |
152 | | - foreach($this->tops as $t_id) { |
153 | | - $t = Threads::withId($t_id); |
| 152 | + |
| 153 | + foreach ( $this->tops as $t_id ) { |
| 154 | + $t = Threads::withId( $t_id ); |
154 | 155 | // It turns out that with lqtviews composed of threads from various talkpages, |
155 | 156 | // each thread is going to have a different article... this is pretty ugly. |
156 | 157 | $this->article = $t->article(); |
157 | | - |
158 | | - $this->preShowThread($t); |
159 | | - $this->showThread($t); |
160 | | - $this->postShowThread($t); |
| 158 | + |
| 159 | + $this->preShowThread( $t ); |
| 160 | + $this->showThread( $t ); |
| 161 | + $this->postShowThread( $t ); |
161 | 162 | } |
162 | 163 | return false; |
163 | 164 | } |
164 | | - |
| 165 | + |
165 | 166 | function setThreads( $threads ) { |
166 | 167 | $this->threads = $threads; |
167 | 168 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php |
___________________________________________________________________ |
Added: svn:eol-style |
168 | 169 | + native |
Index: trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class SpecialDeleteThread extends UnlistedSpecialPage { |
7 | 7 | private $user, $output, $request, $title, $thread; |
8 | | - |
| 8 | + |
9 | 9 | function __construct() { |
10 | 10 | parent::__construct( 'Deletethread' ); |
11 | 11 | $this->includable( false ); |
12 | 12 | } |
13 | | - |
| 13 | + |
14 | 14 | /** |
15 | 15 | * @see SpecialPage::getDescription |
16 | 16 | */ |
— | — | @@ -17,28 +17,29 @@ |
18 | 18 | wfLoadExtensionMessages( 'LiquidThreads' ); |
19 | 19 | return wfMsg( 'lqt_deletethread' ); |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function handleGet() { |
23 | | - if( !$this->checkUserRights() ) return; |
| 23 | + if ( !$this->checkUserRights() ) |
| 24 | + return; |
24 | 25 | wfLoadExtensionMessages( 'LiquidThreads' ); |
25 | | - |
| 26 | + |
26 | 27 | $form_action = $this->title->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL(); |
27 | 28 | $thread_name = $this->thread->title()->getPrefixedText(); |
28 | 29 | $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText(); |
29 | | - |
| 30 | + |
30 | 31 | $deleting = $this->thread->type() != Threads::TYPE_DELETED; |
31 | | - |
| 32 | + |
32 | 33 | $operation_message = $deleting ? |
33 | | - wfMsg('lqt_delete_deleting', "<b>$thread_name</b>", '<b>'.wfMsg('lqt_delete_deleting_allreplies').'</b>') |
| 34 | + wfMsg( 'lqt_delete_deleting', "<b>$thread_name</b>", '<b>' . wfMsg( 'lqt_delete_deleting_allreplies' ) . '</b>' ) |
34 | 35 | // "Deleting <b>$thread_name</b> and <b>all replies</b> to it." |
35 | | - : wfMsg('lqt_delete_undeleting', "<b>$thread_name</b>"); |
| 36 | + : wfMsg( 'lqt_delete_undeleting', "<b>$thread_name</b>" ); |
36 | 37 | $button_label = $deleting ? |
37 | | - wfMsg('lqt_delete_deletethread') |
38 | | - : wfMsg('lqt_delete_undeletethread'); |
39 | | - $part_of = wfMsg('lqt_delete_partof', '<b>'.$article_name.'</b>'); |
40 | | - $reason = wfMsg('movereason'); // XXX arguably wrong to use movereason. |
41 | | - |
42 | | - $this->output->addHTML(<<<HTML |
| 38 | + wfMsg( 'lqt_delete_deletethread' ) |
| 39 | + : wfMsg( 'lqt_delete_undeletethread' ); |
| 40 | + $part_of = wfMsg( 'lqt_delete_partof', '<b>' . $article_name . '</b>' ); |
| 41 | + $reason = wfMsg( 'movereason' ); // XXX arguably wrong to use movereason. |
| 42 | + |
| 43 | + $this->output->addHTML( <<<HTML |
43 | 44 | <p>$operation_message |
44 | 45 | $part_of</p> |
45 | 46 | <form id="lqt_delete_thread_form" action="{$form_action}" method="POST"> |
— | — | @@ -54,80 +55,80 @@ |
55 | 56 | </form> |
56 | 57 | HTML |
57 | 58 | ); |
58 | | - |
| 59 | + |
59 | 60 | } |
60 | | - |
| 61 | + |
61 | 62 | function checkUserRights() { |
62 | | - if( in_array('delete', $this->user->getRights()) ) { |
| 63 | + if ( in_array( 'delete', $this->user->getRights() ) ) { |
63 | 64 | return true; |
64 | 65 | } else { |
65 | 66 | wfLoadExtensionMessages( 'LiquidThreads' ); |
66 | | - $this->output->addHTML(wfMsg('lqt_delete_unallowed')); |
| 67 | + $this->output->addHTML( wfMsg( 'lqt_delete_unallowed' ) ); |
67 | 68 | return false; |
68 | 69 | } |
69 | 70 | } |
70 | | - |
71 | | - function redisplayForm($problem_fields, $message) { |
72 | | - $this->output->addHTML($message); |
| 71 | + |
| 72 | + function redisplayForm( $problem_fields, $message ) { |
| 73 | + $this->output->addHTML( $message ); |
73 | 74 | $this->handleGet(); |
74 | 75 | } |
75 | | - |
| 76 | + |
76 | 77 | function handlePost() { |
77 | 78 | // in theory the model should check rights... |
78 | | - if( !$this->checkUserRights() ) return; |
| 79 | + if ( !$this->checkUserRights() ) return; |
79 | 80 | wfLoadExtensionMessages( 'LiquidThreads' ); |
80 | | - |
81 | | - $reason = $this->request->getVal('lqt_delete_thread_reason', wfMsg('lqt_noreason')); |
82 | | - |
| 81 | + |
| 82 | + $reason = $this->request->getVal( 'lqt_delete_thread_reason', wfMsg( 'lqt_noreason' ) ); |
| 83 | + |
83 | 84 | // TODO: in theory, two fast-acting sysops could undo each others' work. |
84 | 85 | $is_deleted_already = $this->thread->type() == Threads::TYPE_DELETED; |
85 | 86 | if ( $is_deleted_already ) { |
86 | | - $this->thread->undelete($reason); |
| 87 | + $this->thread->undelete( $reason ); |
87 | 88 | } else { |
88 | | - $this->thread->delete($reason); |
| 89 | + $this->thread->delete( $reason ); |
89 | 90 | } |
90 | 91 | $this->showSuccessMessage( $is_deleted_already ); |
91 | 92 | } |
92 | | - |
| 93 | + |
93 | 94 | function showSuccessMessage( $is_deleted_already ) { |
94 | 95 | wfLoadExtensionMessages( 'LiquidThreads' ); |
95 | 96 | // TODO talkpageUrl should accept threads, and look up their talk pages. |
96 | | - $talkpage_url = LqtView::talkpageUrl($this->thread->article()->getTitle()->getTalkpage()); |
97 | | - $message = $is_deleted_already ? wfMsg('lqt_delete_undeleted') : wfMsg('lqt_delete_deleted'); |
| 97 | + $talkpage_url = LqtView::talkpageUrl( $this->thread->article()->getTitle()->getTalkpage() ); |
| 98 | + $message = $is_deleted_already ? wfMsg( 'lqt_delete_undeleted' ) : wfMsg( 'lqt_delete_deleted' ); |
98 | 99 | $message .= ' '; |
99 | | - $message .= wfMsg('lqt_delete_return', '<a href="'.$talkpage_url.'">'.wfMsg('lqt_delete_return_link').'</a>'); |
100 | | - $this->output->addHTML($message); |
| 100 | + $message .= wfMsg( 'lqt_delete_return', '<a href="' . $talkpage_url . '">' . wfMsg( 'lqt_delete_return_link' ) . '</a>' ); |
| 101 | + $this->output->addHTML( $message ); |
101 | 102 | } |
102 | | - |
| 103 | + |
103 | 104 | function execute( $par ) { |
104 | 105 | global $wgOut, $wgRequest, $wgTitle, $wgUser; |
105 | 106 | $this->user = $wgUser; |
106 | 107 | $this->output = $wgOut; |
107 | 108 | $this->request = $wgRequest; |
108 | 109 | $this->title = $wgTitle; |
109 | | - |
| 110 | + |
110 | 111 | $this->setHeaders(); |
111 | | - |
112 | | - if( $par === null || $par === "") { |
| 112 | + |
| 113 | + if ( $par === null || $par === "" ) { |
113 | 114 | wfLoadExtensionMessages( 'LiquidThreads' ); |
114 | | - $this->output->addHTML(wfMsg('lqt_threadrequired')); |
| 115 | + $this->output->addHTML( wfMsg( 'lqt_threadrequired' ) ); |
115 | 116 | return; |
116 | 117 | } |
117 | 118 | // TODO should implement Threads::withTitle(...). |
118 | | - $thread = Threads::withRoot( new Article(Title::newFromURL($par)) ); |
119 | | - if (!$thread) { |
| 119 | + $thread = Threads::withRoot( new Article( Title::newFromURL( $par ) ) ); |
| 120 | + if ( !$thread ) { |
120 | 121 | wfLoadExtensionMessages( 'LiquidThreads' ); |
121 | | - $this->output->addHTML(wfMsg('lqt_nosuchthread')); |
| 122 | + $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) ); |
122 | 123 | return; |
123 | 124 | } |
124 | | - |
| 125 | + |
125 | 126 | $this->thread = $thread; |
126 | | - |
| 127 | + |
127 | 128 | if ( $this->request->wasPosted() ) { |
128 | 129 | $this->handlePost(); |
129 | 130 | } else { |
130 | 131 | $this->handleGet(); |
131 | 132 | } |
132 | | - |
| 133 | + |
133 | 134 | } |
134 | 135 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php |
___________________________________________________________________ |
Added: svn:eol-style |
135 | 136 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadDiffView.php |
— | — | @@ -1,22 +1,22 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadDiffView { |
7 | 7 | function customizeTabs( $skintemplate, $content_actions ) { |
8 | | - unset($content_actions['edit']); |
9 | | - unset($content_actions['viewsource']); |
10 | | - unset($content_actions['talk']); |
11 | | - |
| 8 | + unset( $content_actions['edit'] ); |
| 9 | + unset( $content_actions['viewsource'] ); |
| 10 | + unset( $content_actions['talk'] ); |
| 11 | + |
12 | 12 | $content_actions['talk']['class'] = false; |
13 | 13 | $content_actions['history']['class'] = 'selected'; |
14 | | - |
| 14 | + |
15 | 15 | return true; |
16 | 16 | } |
17 | | - |
| 17 | + |
18 | 18 | function show() { |
19 | 19 | global $wgHooks; |
20 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
| 20 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadDiffView.php |
___________________________________________________________________ |
Added: svn:eol-style |
24 | 24 | + native |
Index: trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php |
— | — | @@ -1,40 +1,40 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class TalkpageHeaderView extends LqtView { |
7 | 7 | function customizeTabs( $skintemplate, $content_actions ) { |
8 | | - unset($content_actions['edit']); |
9 | | - unset($content_actions['addsection']); |
10 | | - unset($content_actions['history']); |
11 | | - unset($content_actions['watch']); |
12 | | - unset($content_actions['move']); |
13 | | - |
| 8 | + unset( $content_actions['edit'] ); |
| 9 | + unset( $content_actions['addsection'] ); |
| 10 | + unset( $content_actions['history'] ); |
| 11 | + unset( $content_actions['watch'] ); |
| 12 | + unset( $content_actions['move'] ); |
| 13 | + |
14 | 14 | $content_actions['talk']['class'] = false; |
15 | | - $content_actions['header'] = array( 'class'=>'selected', |
16 | | - 'text'=>'header', |
17 | | - 'href'=>''); |
18 | | - |
| 15 | + $content_actions['header'] = array( 'class' => 'selected', |
| 16 | + 'text' => 'header', |
| 17 | + 'href' => '' ); |
| 18 | + |
19 | 19 | return true; |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function show() { |
23 | 23 | global $wgHooks, $wgOut, $wgTitle, $wgRequest; |
24 | 24 | // Why is a hook added here? |
25 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
26 | | - |
27 | | - if( $wgRequest->getVal('action') === 'edit' ) { |
| 25 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 26 | + |
| 27 | + if ( $wgRequest->getVal( 'action' ) === 'edit' ) { |
28 | 28 | wfLoadExtensionMessages( 'LiquidThreads' ); |
29 | | - $warn_bold = '<strong>' . wfMsg('lqt_header_warning_bold') . '</strong>'; |
30 | | - $warn_link = '<a href="'.$this->talkpageUrl($wgTitle, 'talkpage_new_thread').'">'. |
31 | | - wfMsg('lqt_header_warning_new_discussion').'</a>'; |
32 | | - $wgOut->addHTML('<p class="lqt_header_warning">' . |
33 | | - wfMsg('lqt_header_warning_before_big', $warn_bold, $warn_link) . |
34 | | - '<big>' . wfMsg('lqt_header_warning_big', $warn_bold, $warn_link) . '</big>' . |
35 | | - wfMsg('lqt_header_warning_after_big', $warn_bold, $warn_link) . |
36 | | - '</p>'); |
| 29 | + $warn_bold = '<strong>' . wfMsg( 'lqt_header_warning_bold' ) . '</strong>'; |
| 30 | + $warn_link = '<a href="' . $this->talkpageUrl( $wgTitle, 'talkpage_new_thread' ) . '">' . |
| 31 | + wfMsg( 'lqt_header_warning_new_discussion' ) . '</a>'; |
| 32 | + $wgOut->addHTML( '<p class="lqt_header_warning">' . |
| 33 | + wfMsg( 'lqt_header_warning_before_big', $warn_bold, $warn_link ) . |
| 34 | + '<big>' . wfMsg( 'lqt_header_warning_big', $warn_bold, $warn_link ) . '</big>' . |
| 35 | + wfMsg( 'lqt_header_warning_after_big', $warn_bold, $warn_link ) . |
| 36 | + '</p>' ); |
37 | 37 | } |
38 | | - |
| 38 | + |
39 | 39 | return true; |
40 | 40 | } |
41 | 41 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php |
___________________________________________________________________ |
Added: svn:eol-style |
42 | 42 | + native |
Index: trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php |
— | — | @@ -1,47 +1,47 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class IndividualThreadHistoryView extends ThreadPermalinkView { |
7 | 7 | protected $oldid; |
8 | | - |
| 8 | + |
9 | 9 | function customizeTabs( $skintemplate, $content_actions ) { |
10 | 10 | $content_actions['history']['class'] = 'selected'; |
11 | | - parent::customizeTabs($skintemplate, $content_actions); |
| 11 | + parent::customizeTabs( $skintemplate, $content_actions ); |
12 | 12 | return true; |
13 | 13 | } |
14 | | - |
| 14 | + |
15 | 15 | /* This customizes the subtitle of a history *listing* from the hook, |
16 | 16 | and of an old revision from getSubtitle() below. */ |
17 | 17 | function customizeSubtitle() { |
18 | 18 | wfLoadExtensionMessages( 'LiquidThreads' ); |
19 | | - $msg = wfMsg('lqt_hist_view_whole_thread'); |
| 19 | + $msg = wfMsg( 'lqt_hist_view_whole_thread' ); |
20 | 20 | $threadhist = "<a href=\"{$this->permalinkUrl($this->thread->topmostThread(), 'thread_history')}\">$msg</a>"; |
21 | 21 | $this->output->setSubtitle( parent::getSubtitle() . '<br />' . $this->output->getSubtitle() . "<br />$threadhist" ); |
22 | 22 | return true; |
23 | 23 | } |
24 | | - |
| 24 | + |
25 | 25 | /* */ |
26 | 26 | function getSubtitle() { |
27 | | - $this->article->setOldSubtitle($this->oldid); |
| 27 | + $this->article->setOldSubtitle( $this->oldid ); |
28 | 28 | $this->customizeSubtitle(); |
29 | 29 | return $this->output->getSubtitle(); |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | function show() { |
33 | 33 | global $wgHooks; |
34 | 34 | /* |
35 | 35 | $this->oldid = $this->request->getVal('oldid', null); |
36 | 36 | if( $this->oldid !== null ) { |
37 | | - |
| 37 | + |
38 | 38 | parent::show(); |
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | */ |
42 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
43 | | - |
44 | | - $wgHooks['PageHistoryBeforeList'][] = array($this, 'customizeSubtitle'); |
45 | | - |
| 42 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 43 | + |
| 44 | + $wgHooks['PageHistoryBeforeList'][] = array( $this, 'customizeSubtitle' ); |
| 45 | + |
46 | 46 | return true; |
47 | 47 | } |
48 | 48 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php |
___________________________________________________________________ |
Added: svn:eol-style |
49 | 49 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadProtectionFormView.php |
— | — | @@ -1,26 +1,26 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadProtectionFormView { |
7 | 7 | function customizeTabs( $skintemplate, $content_actions ) { |
8 | | - unset($content_actions['edit']); |
9 | | - unset($content_actions['addsection']); |
10 | | - unset($content_actions['viewsource']); |
11 | | - unset($content_actions['talk']); |
12 | | - |
| 8 | + unset( $content_actions['edit'] ); |
| 9 | + unset( $content_actions['addsection'] ); |
| 10 | + unset( $content_actions['viewsource'] ); |
| 11 | + unset( $content_actions['talk'] ); |
| 12 | + |
13 | 13 | $content_actions['talk']['class'] = false; |
14 | | - if ( array_key_exists('protect', $content_actions) ) |
| 14 | + if ( array_key_exists( 'protect', $content_actions ) ) |
15 | 15 | $content_actions['protect']['class'] = 'selected'; |
16 | | - else if ( array_key_exists('unprotect', $content_actions) ) |
| 16 | + else if ( array_key_exists( 'unprotect', $content_actions ) ) |
17 | 17 | $content_actions['unprotect']['class'] = 'selected'; |
18 | | - |
| 18 | + |
19 | 19 | return true; |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function show() { |
23 | 23 | global $wgHooks; |
24 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
| 24 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
25 | 25 | return true; |
26 | 26 | } |
27 | 27 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadProtectionFormView.php |
___________________________________________________________________ |
Added: svn:eol-style |
28 | 28 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php |
— | — | @@ -1,107 +1,107 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadHistoryListingView extends ThreadPermalinkView { |
7 | | - |
8 | | - private function rowForThread($t) { |
| 7 | + |
| 8 | + private function rowForThread( $t ) { |
9 | 9 | global $wgLang, $wgOut; // TODO global. |
10 | 10 | wfLoadExtensionMessages( 'LiquidThreads' ); |
11 | 11 | /* TODO: best not to refer to LqtView class directly. */ |
12 | 12 | /* We don't use oldid because that has side-effects. */ |
13 | 13 | $result = array(); |
14 | | - $change_names = array( Threads::CHANGE_EDITED_ROOT => wfMsg('lqt_hist_comment_edited'), |
15 | | - Threads::CHANGE_EDITED_SUMMARY => wfMsg('lqt_hist_summary_changed'), |
16 | | - Threads::CHANGE_REPLY_CREATED => wfMsg('lqt_hist_reply_created'), |
17 | | - Threads::CHANGE_NEW_THREAD => wfMsg('lqt_hist_thread_created'), |
18 | | - Threads::CHANGE_DELETED => wfMsg('lqt_hist_deleted'), |
19 | | - Threads::CHANGE_UNDELETED => wfMsg('lqt_hist_undeleted'), |
20 | | - Threads::CHANGE_MOVED_TALKPAGE => wfMsg('lqt_hist_moved_talkpage')); |
21 | | - $change_label = array_key_exists($t->changeType(), $change_names) ? $change_names[$t->changeType()] : ""; |
22 | | - |
| 14 | + $change_names = array( Threads::CHANGE_EDITED_ROOT => wfMsg( 'lqt_hist_comment_edited' ), |
| 15 | + Threads::CHANGE_EDITED_SUMMARY => wfMsg( 'lqt_hist_summary_changed' ), |
| 16 | + Threads::CHANGE_REPLY_CREATED => wfMsg( 'lqt_hist_reply_created' ), |
| 17 | + Threads::CHANGE_NEW_THREAD => wfMsg( 'lqt_hist_thread_created' ), |
| 18 | + Threads::CHANGE_DELETED => wfMsg( 'lqt_hist_deleted' ), |
| 19 | + Threads::CHANGE_UNDELETED => wfMsg( 'lqt_hist_undeleted' ), |
| 20 | + Threads::CHANGE_MOVED_TALKPAGE => wfMsg( 'lqt_hist_moved_talkpage' ) ); |
| 21 | + $change_label = array_key_exists( $t->changeType(), $change_names ) ? $change_names[$t->changeType()] : ""; |
| 22 | + |
23 | 23 | $url = LqtView::permalinkUrlWithQuery( $this->thread, 'lqt_oldid=' . $t->revisionNumber() ); |
24 | | - |
| 24 | + |
25 | 25 | $user_id = $t->changeUser()->getID(); # ever heard of a User object? |
26 | 26 | $user_text = $t->changeUser()->getName(); |
27 | 27 | $sig = $this->user->getSkin()->userLink( $user_id, $user_text ) . |
28 | 28 | $this->user->getSkin()->userToolLinks( $user_id, $user_text ); |
29 | | - |
30 | | - $change_comment=$t->changeComment(); |
31 | | - if(!empty($change_comment)) |
32 | | - $change_comment="<em>($change_comment)</em>"; |
33 | | - |
| 29 | + |
| 30 | + $change_comment = $t->changeComment(); |
| 31 | + if ( !empty( $change_comment ) ) |
| 32 | + $change_comment = "<em>($change_comment)</em>"; |
| 33 | + |
34 | 34 | $result[] = "<tr>"; |
35 | | - $result[] = "<td><a href=\"$url\">" . $wgLang->timeanddate($t->modified()) . "</a></td>"; |
| 35 | + $result[] = "<td><a href=\"$url\">" . $wgLang->timeanddate( $t->modified() ) . "</a></td>"; |
36 | 36 | $result[] = "<td>" . $sig . "</td>"; |
37 | 37 | $result[] = "<td>$change_label</td>"; |
38 | 38 | $result[] = "<td>$change_comment</td>"; |
39 | 39 | $result[] = "</tr>"; |
40 | | - return implode('', $result); |
| 40 | + return implode( '', $result ); |
41 | 41 | } |
42 | | - |
43 | | - function showHistoryListing($t) { |
| 42 | + |
| 43 | + function showHistoryListing( $t ) { |
44 | 44 | wfLoadExtensionMessages( 'LiquidThreads' ); |
45 | | - $revisions = new ThreadHistoryIterator($t, $this->perPage, $this->perPage * ($this->page - 1)); |
46 | | - |
47 | | - $this->output->addHTML('<table>'); |
48 | | - foreach($revisions as $ht) { |
49 | | - $this->output->addHTML($this->rowForThread($ht)); |
| 45 | + $revisions = new ThreadHistoryIterator( $t, $this->perPage, $this->perPage * ( $this->page - 1 ) ); |
| 46 | + |
| 47 | + $this->output->addHTML( '<table>' ); |
| 48 | + foreach ( $revisions as $ht ) { |
| 49 | + $this->output->addHTML( $this->rowForThread( $ht ) ); |
50 | 50 | } |
51 | | - $this->output->addHTML('</table>'); |
52 | | - |
53 | | - if ( count($revisions) == 0 && $this->page == 1 ) { |
54 | | - $this->output->addHTML('<p>'.wfMsg('lqt_hist_no_revisions_error')); |
| 51 | + $this->output->addHTML( '</table>' ); |
| 52 | + |
| 53 | + if ( count( $revisions ) == 0 && $this->page == 1 ) { |
| 54 | + $this->output->addHTML( '<p>' . wfMsg( 'lqt_hist_no_revisions_error' ) ); |
55 | 55 | } |
56 | | - else if ( count($revisions) == 0 ) { |
| 56 | + else if ( count( $revisions ) == 0 ) { |
57 | 57 | // we could redirect to the previous page... yow. |
58 | | - $this->output->addHTML('<p>'.wfMsg('lqt_hist_past_last_page_error')); |
| 58 | + $this->output->addHTML( '<p>' . wfMsg( 'lqt_hist_past_last_page_error' ) ); |
59 | 59 | } |
60 | | - |
61 | | - if( $this->page > 1 ) { |
62 | | - $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page - 1)) .'">'.wfMsg('lqt_newer').'</a>' ); |
| 60 | + |
| 61 | + if ( $this->page > 1 ) { |
| 62 | + $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace( array( 'lqt_hist_page' => $this->page - 1 ) ) . '">' . wfMsg( 'lqt_newer' ) . '</a>' ); |
63 | 63 | } else { |
64 | | - $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="'.wfMsg('lqt_hist_tooltip_newer_disabled').'">'.wfMsg('lqt_newer').'</span>' ); |
| 64 | + $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="' . wfMsg( 'lqt_hist_tooltip_newer_disabled' ) . '">' . wfMsg( 'lqt_newer' ) . '</span>' ); |
65 | 65 | } |
66 | | - |
| 66 | + |
67 | 67 | $is_last_page = false; |
68 | | - foreach($revisions as $r) |
69 | | - if( $r->changeType() == Threads::CHANGE_NEW_THREAD ) |
| 68 | + foreach ( $revisions as $r ) |
| 69 | + if ( $r->changeType() == Threads::CHANGE_NEW_THREAD ) |
70 | 70 | $is_last_page = true; |
71 | | - if( $is_last_page ) { |
72 | | - $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="'.wfMsg('lqt_hist_tooltip_older_disabled').'">'.wfMsg('lqt_older').'</span>' ); |
| 71 | + if ( $is_last_page ) { |
| 72 | + $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="' . wfMsg( 'lqt_hist_tooltip_older_disabled' ) . '">' . wfMsg( 'lqt_older' ) . '</span>' ); |
73 | 73 | } else { |
74 | | - $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page + 1)) . '">'.wfMsg('lqt_older').'</a>' ); |
| 74 | + $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace( array( 'lqt_hist_page' => $this->page + 1 ) ) . '">' . wfMsg( 'lqt_older' ) . '</a>' ); |
75 | 75 | } |
76 | 76 | } |
77 | | - |
78 | | - function __construct(&$output, &$article, &$title, &$user, &$request) { |
79 | | - parent::__construct($output, $article, $title, $user, $request); |
| 77 | + |
| 78 | + function __construct( &$output, &$article, &$title, &$user, &$request ) { |
| 79 | + parent::__construct( $output, $article, $title, $user, $request ); |
80 | 80 | $this->loadParametersFromRequest(); |
81 | 81 | } |
82 | | - |
| 82 | + |
83 | 83 | function loadParametersFromRequest() { |
84 | | - $this->perPage = $this->request->getInt('lqt_hist_per_page', 10); |
85 | | - $this->page = $this->request->getInt('lqt_hist_page', 1); |
| 84 | + $this->perPage = $this->request->getInt( 'lqt_hist_per_page', 10 ); |
| 85 | + $this->page = $this->request->getInt( 'lqt_hist_page', 1 ); |
86 | 86 | } |
87 | | - |
| 87 | + |
88 | 88 | function show() { |
89 | 89 | global $wgHooks; |
90 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
91 | | - |
92 | | - if( ! $this->thread ) { |
| 90 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 91 | + |
| 92 | + if ( ! $this->thread ) { |
93 | 93 | $this->showMissingThreadPage(); |
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | self::addJSandCSS(); |
97 | 97 | wfLoadExtensionMessages( 'LiquidThreads' ); |
98 | | - |
99 | | - $this->output->setSubtitle($this->getSubtitle() . '<br />' . wfMsg('lqt_hist_listing_subtitle')); |
100 | | - |
101 | | - $this->showThreadHeading($this->thread); |
102 | | - $this->showHistoryListing($this->thread); |
103 | | - |
104 | | - $this->showThread($this->thread); |
105 | | - |
| 98 | + |
| 99 | + $this->output->setSubtitle( $this->getSubtitle() . '<br />' . wfMsg( 'lqt_hist_listing_subtitle' ) ); |
| 100 | + |
| 101 | + $this->showThreadHeading( $this->thread ); |
| 102 | + $this->showHistoryListing( $this->thread ); |
| 103 | + |
| 104 | + $this->showThread( $this->thread ); |
| 105 | + |
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php |
___________________________________________________________________ |
Added: svn:eol-style |
109 | 109 | + native |
Index: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class SpecialMoveThread extends UnlistedSpecialPage { |
7 | 7 | private $user, $output, $request, $title, $thread; |
8 | | - |
| 8 | + |
9 | 9 | function __construct() { |
10 | 10 | parent::__construct( 'Movethread' ); |
11 | 11 | $this->includable( false ); |
12 | 12 | } |
13 | | - |
| 13 | + |
14 | 14 | /** |
15 | 15 | * @see SpecialPage::getDescription |
16 | 16 | */ |
— | — | @@ -17,15 +17,15 @@ |
18 | 18 | wfLoadExtensionMessages( 'LiquidThreads' ); |
19 | 19 | return wfMsg( 'lqt_movethread' ); |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function handleGet() { |
23 | 23 | wfLoadExtensionMessages( 'LiquidThreads' ); |
24 | 24 | $form_action = $this->title->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL(); |
25 | 25 | $thread_name = $this->thread->title()->getPrefixedText(); |
26 | 26 | $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText(); |
27 | | - $edit_url = LqtView::permalinkUrl($this->thread, 'edit', $this->thread); |
| 27 | + $edit_url = LqtView::permalinkUrl( $this->thread, 'edit', $this->thread ); |
28 | 28 | $wfMsg = 'wfMsg'; // functions can only be called within string expansion by variable name. |
29 | | - $this->output->addHTML(<<<HTML |
| 29 | + $this->output->addHTML( <<<HTML |
30 | 30 | <p>{$wfMsg('lqt_move_movingthread', "<b>$thread_name</b>", "<b>$article_name</b>")}</p> |
31 | 31 | <p>{$wfMsg('lqt_move_torename', "<a href=\"$edit_url\">{$wfMsg('lqt_move_torename_edit')}</a>")}</p> |
32 | 32 | <form id="lqt_move_thread_form" action="$form_action" method="POST"> |
— | — | @@ -44,9 +44,9 @@ |
45 | 45 | </form> |
46 | 46 | HTML |
47 | 47 | ); |
48 | | - |
| 48 | + |
49 | 49 | } |
50 | | - |
| 50 | + |
51 | 51 | function checkUserRights() { |
52 | 52 | if ( !$this->user->isAllowed( 'move' ) ) { |
53 | 53 | $this->output->showErrorPage( 'movenologin', 'movenologintext' ); |
— | — | @@ -67,66 +67,66 @@ |
68 | 68 | /* Am I forgetting anything? */ |
69 | 69 | return true; |
70 | 70 | } |
71 | | - |
72 | | - function redisplayForm($problem_fields, $message) { |
73 | | - $this->output->addHTML($message); |
| 71 | + |
| 72 | + function redisplayForm( $problem_fields, $message ) { |
| 73 | + $this->output->addHTML( $message ); |
74 | 74 | $this->handleGet(); |
75 | 75 | } |
76 | | - |
| 76 | + |
77 | 77 | function handlePost() { |
78 | | - if( !$this->checkUserRights() ) return; |
| 78 | + if ( !$this->checkUserRights() ) return; |
79 | 79 | wfLoadExtensionMessages( 'LiquidThreads' ); |
80 | | - |
81 | | - $tmp = $this->request->getVal('lqt_move_thread_target_title'); |
82 | | - if( $tmp === "" ) { |
83 | | - $this->redisplayForm(array('lqt_move_thread_target_title'), wfMsg('lqt_move_nodestination')); |
| 80 | + |
| 81 | + $tmp = $this->request->getVal( 'lqt_move_thread_target_title' ); |
| 82 | + if ( $tmp === "" ) { |
| 83 | + $this->redisplayForm( array( 'lqt_move_thread_target_title' ), wfMsg( 'lqt_move_nodestination' ) ); |
84 | 84 | return; |
85 | 85 | } |
86 | 86 | $newtitle = Title::newFromText( $tmp )->getSubjectPage(); |
87 | | - |
88 | | - $reason = $this->request->getVal('lqt_move_thread_reason', wfMsg('lqt_noreason')); |
89 | | - |
| 87 | + |
| 88 | + $reason = $this->request->getVal( 'lqt_move_thread_reason', wfMsg( 'lqt_noreason' ) ); |
| 89 | + |
90 | 90 | // TODO no status code from this method. |
91 | 91 | $this->thread->moveToSubjectPage( $newtitle, $reason, true ); |
92 | | - |
| 92 | + |
93 | 93 | $this->showSuccessMessage( $newtitle->getTalkPage() ); |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | function showSuccessMessage( $target_title ) { |
97 | 97 | wfLoadExtensionMessages( 'LiquidThreads' ); |
98 | | - $this->output->addHTML(wfMsg('lqt_move_success', |
99 | | - '<a href="'.$target_title->getFullURL().'">'.$target_title->getPrefixedText().'</a>')); |
| 98 | + $this->output->addHTML( wfMsg( 'lqt_move_success', |
| 99 | + '<a href="' . $target_title->getFullURL() . '">' . $target_title->getPrefixedText() . '</a>' ) ); |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | function execute( $par ) { |
103 | 103 | global $wgOut, $wgRequest, $wgTitle, $wgUser; |
104 | 104 | $this->user = $wgUser; |
105 | 105 | $this->output = $wgOut; |
106 | 106 | $this->request = $wgRequest; |
107 | 107 | $this->title = $wgTitle; |
108 | | - |
| 108 | + |
109 | 109 | $this->setHeaders(); |
110 | | - |
111 | | - if( $par === null || $par === "") { |
| 110 | + |
| 111 | + if ( $par === null || $par === "" ) { |
112 | 112 | wfLoadExtensionMessages( 'LiquidThreads' ); |
113 | | - $this->output->addHTML(wfMsg('lqt_threadrequired')); |
| 113 | + $this->output->addHTML( wfMsg( 'lqt_threadrequired' ) ); |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | // TODO should implement Threads::withTitle(...). |
117 | | - $thread = Threads::withRoot( new Article(Title::newFromURL($par)) ); |
118 | | - if (!$thread) { |
| 117 | + $thread = Threads::withRoot( new Article( Title::newFromURL( $par ) ) ); |
| 118 | + if ( !$thread ) { |
119 | 119 | wfLoadExtensionMessages( 'LiquidThreads' ); |
120 | | - $this->output->addHTML(wfMsg('lqt_nosuchthread')); |
| 120 | + $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) ); |
121 | 121 | return; |
122 | 122 | } |
123 | | - |
| 123 | + |
124 | 124 | $this->thread = $thread; |
125 | | - |
| 125 | + |
126 | 126 | if ( $this->request->wasPosted() ) { |
127 | 127 | $this->handlePost(); |
128 | 128 | } else { |
129 | 129 | $this->handleGet(); |
130 | 130 | } |
131 | | - |
| 131 | + |
132 | 132 | } |
133 | 133 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php |
___________________________________________________________________ |
Added: svn:eol-style |
134 | 134 | + native |
Index: trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class SpecialNewMessages extends SpecialPage { |
7 | 7 | private $user, $output, $request, $title; |
8 | | - |
| 8 | + |
9 | 9 | function __construct() { |
10 | 10 | SpecialPage::SpecialPage( 'Newmessages' ); |
11 | 11 | $this->includable( true ); |
12 | 12 | } |
13 | | - |
| 13 | + |
14 | 14 | /** |
15 | 15 | * @see SpecialPage::getDescription |
16 | 16 | */ |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | wfLoadExtensionMessages( 'LiquidThreads' ); |
19 | 19 | return wfMsg( 'lqt_newmessages' ); |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function execute( $par ) { |
23 | 23 | global $wgOut, $wgRequest, $wgTitle, $wgUser; |
24 | 24 | wfLoadExtensionMessages( 'LiquidThreads' ); |
— | — | @@ -25,30 +25,30 @@ |
26 | 26 | $this->output = $wgOut; |
27 | 27 | $this->request = $wgRequest; |
28 | 28 | $this->title = $wgTitle; |
29 | | - |
| 29 | + |
30 | 30 | $this->setHeaders(); |
31 | | - |
32 | | - $view = new NewUserMessagesView( $this->output, new Article($this->title), |
| 31 | + |
| 32 | + $view = new NewUserMessagesView( $this->output, new Article( $this->title ), |
33 | 33 | $this->title, $this->user, $this->request ); |
34 | | - |
| 34 | + |
35 | 35 | $view->showOnce(); // handles POST etc. |
36 | | - |
37 | | - $first_set = NewMessages::newUserMessages($this->user); |
38 | | - $second_set = NewMessages::watchedThreadsForUser($this->user); |
39 | | - $both_sets = array_merge($first_set, $second_set); |
40 | | - if( count($both_sets) == 0 ) { |
41 | | - $wgOut->addWikitext( wfMsg('lqt-no-new-messages') ); |
| 36 | + |
| 37 | + $first_set = NewMessages::newUserMessages( $this->user ); |
| 38 | + $second_set = NewMessages::watchedThreadsForUser( $this->user ); |
| 39 | + $both_sets = array_merge( $first_set, $second_set ); |
| 40 | + if ( count( $both_sets ) == 0 ) { |
| 41 | + $wgOut->addWikitext( wfMsg( 'lqt-no-new-messages' ) ); |
42 | 42 | return; |
43 | 43 | } |
44 | | - $view->showReadAllButton($both_sets); // ugly hack. |
45 | | - |
46 | | - $view->setHeaderLevel(3); |
47 | | - |
48 | | - $this->output->addHTML('<h2 class="lqt_newmessages_section">'.wfMsg ( 'lqt-messages-sent' ).'</h2>'); |
| 44 | + $view->showReadAllButton( $both_sets ); // ugly hack. |
| 45 | + |
| 46 | + $view->setHeaderLevel( 3 ); |
| 47 | + |
| 48 | + $this->output->addHTML( '<h2 class="lqt_newmessages_section">' . wfMsg ( 'lqt-messages-sent' ) . '</h2>' ); |
49 | 49 | $view->setThreads( $first_set ); |
50 | 50 | $view->show(); |
51 | | - |
52 | | - $this->output->addHTML('<h2 class="lqt_newmessages_section">'.wfMsg ( 'lqt-other-messages' ).'</h2>'); |
| 51 | + |
| 52 | + $this->output->addHTML( '<h2 class="lqt_newmessages_section">' . wfMsg ( 'lqt-other-messages' ) . '</h2>' ); |
53 | 53 | $view->setThreads( $second_set ); |
54 | 54 | $view->show(); |
55 | 55 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php |
___________________________________________________________________ |
Added: svn:eol-style |
56 | 56 | + native |
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
— | — | @@ -1,18 +1,18 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class TalkpageView extends LqtView { |
7 | 7 | /* Added to SkinTemplateTabs hook in TalkpageView::show(). */ |
8 | 8 | function customizeTabs( $skintemplate, $content_actions ) { |
9 | 9 | // The arguments are passed in by reference. |
10 | | - unset($content_actions['edit']); |
11 | | - unset($content_actions['viewsource']); |
12 | | - unset($content_actions['addsection']); |
13 | | - unset($content_actions['history']); |
14 | | - unset($content_actions['watch']); |
15 | | - unset($content_actions['move']); |
16 | | - |
| 10 | + unset( $content_actions['edit'] ); |
| 11 | + unset( $content_actions['viewsource'] ); |
| 12 | + unset( $content_actions['addsection'] ); |
| 13 | + unset( $content_actions['history'] ); |
| 14 | + unset( $content_actions['watch'] ); |
| 15 | + unset( $content_actions['move'] ); |
| 16 | + |
17 | 17 | /* |
18 | 18 | TODO: |
19 | 19 | We could make these tabs actually follow the tab metaphor if we repointed |
— | — | @@ -22,120 +22,120 @@ |
23 | 23 | */ |
24 | 24 | return true; |
25 | 25 | } |
26 | | - |
27 | | - function permalinksForThreads($ts, $method = null, $operand = null) { |
| 26 | + |
| 27 | + function permalinksForThreads( $ts, $method = null, $operand = null ) { |
28 | 28 | $ps = array(); |
29 | | - foreach ($ts as $t) { |
30 | | - $u = $this->permalinkUrl($t, $method, $operand); |
| 29 | + foreach ( $ts as $t ) { |
| 30 | + $u = $this->permalinkUrl( $t, $method, $operand ); |
31 | 31 | $l = $t->subjectWithoutIncrement(); |
32 | 32 | $ps[] = "<a href=\"$u\">$l</a>"; |
33 | 33 | } |
34 | 34 | return $ps; |
35 | 35 | } |
36 | | - |
| 36 | + |
37 | 37 | function showHeader() { |
38 | 38 | /* Show the contents of the actual talkpage article if it exists. */ |
39 | | - |
| 39 | + |
40 | 40 | $article = new Article( $this->title ); |
41 | | - $revision = Revision::newFromId($article->getLatest()); |
42 | | - if( $revision ) $article_text = $revision->getRawText(); |
43 | | - |
44 | | - $oldid = $this->request->getVal('oldid', null); |
| 41 | + $revision = Revision::newFromId( $article->getLatest() ); |
| 42 | + if ( $revision ) $article_text = $revision->getRawText(); |
| 43 | + |
| 44 | + $oldid = $this->request->getVal( 'oldid', null ); |
45 | 45 | $editlink = $this->title->getFullURL( 'action=edit' ); |
46 | | - |
| 46 | + |
47 | 47 | wfLoadExtensionMessages( 'LiquidThreads' ); |
48 | 48 | // If $article_text == "", the talkpage was probably just created |
49 | 49 | // when the first thread was posted to make the links blue. |
50 | 50 | if ( $article->exists() && $article_text != "" ) { |
51 | 51 | $historylink = $this->title->getFullURL( 'action=history' ); |
52 | | - $this->openDiv('lqt_header_content'); |
53 | | - $this->showPostBody($article, $oldid); |
54 | | - $this->outputList('ul', 'lqt_header_commands', null, array( |
55 | | - "[<a href=\"$editlink\">".wfMsg('edit')."↑</a>]", |
56 | | - "[<a href=\"$historylink\">".wfMsg('history_short')."↑</a>]" |
57 | | - )); |
| 52 | + $this->openDiv( 'lqt_header_content' ); |
| 53 | + $this->showPostBody( $article, $oldid ); |
| 54 | + $this->outputList( 'ul', 'lqt_header_commands', null, array( |
| 55 | + "[<a href=\"$editlink\">" . wfMsg( 'edit' ) . "↑</a>]", |
| 56 | + "[<a href=\"$historylink\">" . wfMsg( 'history_short' ) . "↑</a>]" |
| 57 | + ) ); |
58 | 58 | $this->closeDiv(); |
59 | 59 | } else { |
60 | | - $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"$editlink\">".wfMsg('lqt_add_header')."</a>]</p>"); |
| 60 | + $this->output->addHTML( "<p class=\"lqt_header_notice\">[<a href=\"$editlink\">" . wfMsg( 'lqt_add_header' ) . "</a>]</p>" ); |
61 | 61 | } |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | function outputList( $kind, $class, $id, $contents ) { |
65 | | - $this->output->addHTML(Xml::openElement($kind, array('class'=>$class,'id'=>$id))); |
66 | | - foreach ($contents as $li) { |
67 | | - $this->output->addHTML( Xml::openElement('li') ); |
| 65 | + $this->output->addHTML( Xml::openElement( $kind, array( 'class' => $class, 'id' => $id ) ) ); |
| 66 | + foreach ( $contents as $li ) { |
| 67 | + $this->output->addHTML( Xml::openElement( 'li' ) ); |
68 | 68 | $this->output->addHTML( $li ); |
69 | | - $this->output->addHTML( Xml::closeElement('li') ); |
| 69 | + $this->output->addHTML( Xml::closeElement( 'li' ) ); |
70 | 70 | } |
71 | | - $this->output->addHTML(Xml::closeElement($kind)); |
| 71 | + $this->output->addHTML( Xml::closeElement( $kind ) ); |
72 | 72 | } |
73 | | - |
74 | | - function showTOC($threads) { |
| 73 | + |
| 74 | + function showTOC( $threads ) { |
75 | 75 | wfLoadExtensionMessages( 'LiquidThreads' ); |
76 | | - |
| 76 | + |
77 | 77 | $sk = $this->user->getSkin(); |
78 | 78 | $toclines = array(); |
79 | 79 | $i = 1; |
80 | 80 | $toclines[] = $sk->tocIndent(); |
81 | | - foreach($threads as $t) { |
82 | | - $toclines[] = $sk->tocLine($this->anchorName($t), $t->subjectWithoutIncrement(), $i, 1); |
| 81 | + foreach ( $threads as $t ) { |
| 82 | + $toclines[] = $sk->tocLine( $this->anchorName( $t ), $t->subjectWithoutIncrement(), $i, 1 ); |
83 | 83 | $i++; |
84 | 84 | } |
85 | | - $toclines[] = $sk->tocUnindent(1); |
86 | | - |
87 | | - $this->openDiv('lqt_toc_wrapper'); |
88 | | - $this->output->addHTML('<h2 class="lqt_toc_title">'.wfMsg('lqt_contents_title').'</h2> <ul>'); |
89 | | - |
90 | | - foreach($threads as $t) { |
91 | | - $this->output->addHTML('<li><a href="#'.$this->anchorName($t).'">'.$t->subjectWithoutIncrement().'</a></li>'); |
| 85 | + $toclines[] = $sk->tocUnindent( 1 ); |
| 86 | + |
| 87 | + $this->openDiv( 'lqt_toc_wrapper' ); |
| 88 | + $this->output->addHTML( '<h2 class="lqt_toc_title">' . wfMsg( 'lqt_contents_title' ) . '</h2> <ul>' ); |
| 89 | + |
| 90 | + foreach ( $threads as $t ) { |
| 91 | + $this->output->addHTML( '<li><a href="#' . $this->anchorName( $t ) . '">' . $t->subjectWithoutIncrement() . '</a></li>' ); |
92 | 92 | } |
93 | | - |
94 | | - $this->output->addHTML('</ul></div>'); |
| 93 | + |
| 94 | + $this->output->addHTML( '</ul></div>' ); |
95 | 95 | } |
96 | | - |
97 | | - function showArchiveWidget($threads) { |
| 96 | + |
| 97 | + function showArchiveWidget( $threads ) { |
98 | 98 | wfLoadExtensionMessages( 'LiquidThreads' ); |
99 | | - |
100 | | - $threadlinks = $this->permalinksForThreads($threads); |
101 | | - $url = $this->talkpageUrl($this->title, 'talkpage_archive'); |
102 | | - |
103 | | - if ( count($threadlinks) > 0 ) { |
104 | | - $this->openDiv('lqt_archive_teaser'); |
105 | | - $this->output->addHTML('<h2 class="lqt_recently_archived">'.wfMsg('lqt_recently_archived').'</h2>'); |
| 99 | + |
| 100 | + $threadlinks = $this->permalinksForThreads( $threads ); |
| 101 | + $url = $this->talkpageUrl( $this->title, 'talkpage_archive' ); |
| 102 | + |
| 103 | + if ( count( $threadlinks ) > 0 ) { |
| 104 | + $this->openDiv( 'lqt_archive_teaser' ); |
| 105 | + $this->output->addHTML( '<h2 class="lqt_recently_archived">' . wfMsg( 'lqt_recently_archived' ) . '</h2>' ); |
106 | 106 | // $this->output->addHTML("<span class=\"lqt_browse_archive\">[<a href=\"$url\">".wfMsg('lqt_browse_archive_with_recent')."</a>]</span></h2>"); |
107 | | - $this->outputList('ul', '', '', $threadlinks); |
| 107 | + $this->outputList( 'ul', '', '', $threadlinks ); |
108 | 108 | $this->closeDiv(); |
109 | 109 | } else { |
110 | 110 | } |
111 | 111 | } |
112 | | - |
113 | | - function showTalkpageViewOptions($article) { |
| 112 | + |
| 113 | + function showTalkpageViewOptions( $article ) { |
114 | 114 | wfLoadExtensionMessages( 'LiquidThreads' ); |
115 | 115 | // TODO WTF who wrote this? |
116 | | - |
117 | | - if( $this->methodApplies('talkpage_sort_order') ) { |
118 | | - $remember_sort_checked = $this->request->getBool('lqt_remember_sort') ? 'checked ' : ''; |
119 | | - $this->user->setOption('lqt_sort_order', $this->sort_order); |
| 116 | + |
| 117 | + if ( $this->methodApplies( 'talkpage_sort_order' ) ) { |
| 118 | + $remember_sort_checked = $this->request->getBool( 'lqt_remember_sort' ) ? 'checked ' : ''; |
| 119 | + $this->user->setOption( 'lqt_sort_order', $this->sort_order ); |
120 | 120 | $this->user->saveSettings(); |
121 | 121 | } else { |
122 | 122 | $remember_sort_checked = ''; |
123 | | - } |
124 | | - |
125 | | - if($article->exists()) { |
126 | | - $nc_sort = $this->sort_order==LQT_NEWEST_CHANGES ? ' selected' : ''; |
127 | | - $nt_sort = $this->sort_order==LQT_NEWEST_THREADS ? ' selected' : ''; |
128 | | - $ot_sort = $this->sort_order==LQT_OLDEST_THREADS ? ' selected' : ''; |
129 | | - $newest_changes = wfMsg('lqt_sort_newest_changes'); |
130 | | - $newest_threads = wfMsg('lqt_sort_newest_threads'); |
131 | | - $oldest_threads = wfMsg('lqt_sort_oldest_threads'); |
132 | | - $lqt_remember_sort = wfMsg('lqt_remember_sort') ; |
133 | | - $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order'); |
134 | | - $lqt_sorting_order = wfMsg('lqt_sorting_order'); |
135 | | - $lqt_sort_newest_changes = wfMsg('lqt_sort_newest_changes'); |
136 | | - $lqt_sort_newest_threads = wfMsg('lqt_sort_newest_threads'); |
137 | | - $lqt_sort_oldest_threads = wfMsg('lqt_sort_oldest_threads'); |
138 | | - $go=wfMsg('go'); |
139 | | - if($this->user->isLoggedIn()) { |
| 123 | + } |
| 124 | + |
| 125 | + if ( $article->exists() ) { |
| 126 | + $nc_sort = $this->sort_order == LQT_NEWEST_CHANGES ? ' selected' : ''; |
| 127 | + $nt_sort = $this->sort_order == LQT_NEWEST_THREADS ? ' selected' : ''; |
| 128 | + $ot_sort = $this->sort_order == LQT_OLDEST_THREADS ? ' selected' : ''; |
| 129 | + $newest_changes = wfMsg( 'lqt_sort_newest_changes' ); |
| 130 | + $newest_threads = wfMsg( 'lqt_sort_newest_threads' ); |
| 131 | + $oldest_threads = wfMsg( 'lqt_sort_oldest_threads' ); |
| 132 | + $lqt_remember_sort = wfMsg( 'lqt_remember_sort' ) ; |
| 133 | + $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order' ); |
| 134 | + $lqt_sorting_order = wfMsg( 'lqt_sorting_order' ); |
| 135 | + $lqt_sort_newest_changes = wfMsg( 'lqt_sort_newest_changes' ); |
| 136 | + $lqt_sort_newest_threads = wfMsg( 'lqt_sort_newest_threads' ); |
| 137 | + $lqt_sort_oldest_threads = wfMsg( 'lqt_sort_oldest_threads' ); |
| 138 | + $go = wfMsg( 'go' ); |
| 139 | + if ( $this->user->isLoggedIn() ) { |
140 | 140 | $remember_sort = |
141 | 141 | <<<HTML |
142 | 142 | <br /> |
— | — | @@ -146,8 +146,8 @@ |
147 | 147 | } else { |
148 | 148 | $remember_sort = ''; |
149 | 149 | } |
150 | | - if ( in_array('deletedhistory', $this->user->getRights()) ) { |
151 | | - $show_deleted_checked = $this->request->getBool('lqt_show_deleted_threads') ? 'checked ' : ''; |
| 150 | + if ( in_array( 'deletedhistory', $this->user->getRights() ) ) { |
| 151 | + $show_deleted_checked = $this->request->getBool( 'lqt_show_deleted_threads' ) ? 'checked ' : ''; |
152 | 152 | $show_deleted = "<br />\n" . |
153 | 153 | "<label for=\"lqt_show_deleted_threads_checkbox\">\n" . |
154 | 154 | "<input id=\"lqt_show_deleted_threads_checkbox\" name=\"lqt_show_deleted_threads\" type=\"checkbox\" value=\"1\" $show_deleted_checked />\n" . |
— | — | @@ -155,9 +155,9 @@ |
156 | 156 | } else { |
157 | 157 | $show_deleted = ""; |
158 | 158 | } |
159 | | - $this->openDiv('lqt_view_options'); |
| 159 | + $this->openDiv( 'lqt_view_options' ); |
160 | 160 | $this->output->addHTML( |
161 | | - |
| 161 | + |
162 | 162 | <<<HTML |
163 | 163 | <form name="lqt_sort" action="$form_action_url" method="post">$lqt_sorting_order |
164 | 164 | <select name="lqt_order" class="lqt_sort_select"> |
— | — | @@ -173,50 +173,50 @@ |
174 | 174 | ); |
175 | 175 | $this->closeDiv(); |
176 | 176 | } |
177 | | - |
| 177 | + |
178 | 178 | } |
179 | | - |
| 179 | + |
180 | 180 | function show() { |
181 | 181 | global $wgHooks; |
182 | 182 | wfLoadExtensionMessages( 'LiquidThreads' ); |
183 | 183 | // Why is a hook added here? |
184 | | - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
185 | | - |
| 184 | + $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' ); |
| 185 | + |
186 | 186 | $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() ); |
187 | 187 | self::addJSandCSS(); |
188 | 188 | $article = new Article( $this->title ); // Added in r29715 sorting. Why? |
189 | | - |
| 189 | + |
190 | 190 | // Removed in r29715 sorting. Again, why? |
191 | 191 | $this->showHeader(); |
192 | 192 | |
193 | 193 | global $wgRequest; // TODO |
194 | | - if( $this->methodApplies('talkpage_new_thread') ) { |
| 194 | + if ( $this->methodApplies( 'talkpage_new_thread' ) ) { |
195 | 195 | $this->showNewThreadForm(); |
196 | 196 | } else { |
197 | | - $this->showTalkpageViewOptions($article); |
| 197 | + $this->showTalkpageViewOptions( $article ); |
198 | 198 | $url = $this->talkpageUrl( $this->title, 'talkpage_new_thread' ); |
199 | | - $this->output->addHTML("<strong><a class=\"lqt_start_discussion\" href=\"$url\">".wfMsg('lqt_new_thread')."</a></strong>"); |
| 199 | + $this->output->addHTML( "<strong><a class=\"lqt_start_discussion\" href=\"$url\">" . wfMsg( 'lqt_new_thread' ) . "</a></strong>" ); |
200 | 200 | } |
201 | | - |
202 | | - $threads = $this->queries->query('fresh'); |
203 | | - |
204 | | - $this->openDiv('lqt_toc_archive_wrapper'); |
205 | | - |
206 | | - $this->openDiv('lqt_archive_teaser_empty'); |
207 | | - $this->output->addHTML("<div class=\"lqt_browse_archive\"><a href=\"{$this->talkpageUrl($this->title, 'talkpage_archive')}\">". |
208 | | - wfMsg('lqt_browse_archive_without_recent')."</a></div>"); |
| 201 | + |
| 202 | + $threads = $this->queries->query( 'fresh' ); |
| 203 | + |
| 204 | + $this->openDiv( 'lqt_toc_archive_wrapper' ); |
| 205 | + |
| 206 | + $this->openDiv( 'lqt_archive_teaser_empty' ); |
| 207 | + $this->output->addHTML( "<div class=\"lqt_browse_archive\"><a href=\"{$this->talkpageUrl($this->title, 'talkpage_archive')}\">" . |
| 208 | + wfMsg( 'lqt_browse_archive_without_recent' ) . "</a></div>" ); |
209 | 209 | $this->closeDiv(); |
210 | | - $recently_archived_threads = $this->queries->query('recently-archived'); |
211 | | - if(count($threads) > 3 || count($recently_archived_threads) > 0) { |
212 | | - $this->showTOC($threads); |
| 210 | + $recently_archived_threads = $this->queries->query( 'recently-archived' ); |
| 211 | + if ( count( $threads ) > 3 || count( $recently_archived_threads ) > 0 ) { |
| 212 | + $this->showTOC( $threads ); |
213 | 213 | } |
214 | | - $this->showArchiveWidget($recently_archived_threads); |
| 214 | + $this->showArchiveWidget( $recently_archived_threads ); |
215 | 215 | $this->closeDiv(); |
216 | 216 | // Clear any floats |
217 | | - $this->output->addHTML('<br clear="all" />'); |
218 | | - |
219 | | - foreach($threads as $t) { |
220 | | - $this->showThread($t); |
| 217 | + $this->output->addHTML( '<br clear="all" />' ); |
| 218 | + |
| 219 | + foreach ( $threads as $t ) { |
| 220 | + $this->showThread( $t ); |
221 | 221 | } |
222 | 222 | return false; |
223 | 223 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageView.php |
___________________________________________________________________ |
Added: svn:eol-style |
224 | 224 | + native |
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php |
— | — | @@ -1,12 +1,12 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if (!defined('MEDIAWIKI')) die; |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) die; |
5 | 5 | |
6 | 6 | class ThreadHistoricalRevisionView extends ThreadPermalinkView { |
7 | | - |
| 7 | + |
8 | 8 | /* TOOD: customize tabs so that History is highlighted. */ |
9 | | - |
10 | | - function postDivClass($thread) { |
| 9 | + |
| 10 | + function postDivClass( $thread ) { |
11 | 11 | $is_changed_thread = $thread->changeObject() && |
12 | 12 | $thread->changeObject()->id() == $thread->id(); |
13 | 13 | if ( $is_changed_thread ) |
— | — | @@ -14,26 +14,26 @@ |
15 | 15 | else |
16 | 16 | return 'lqt_post'; |
17 | 17 | } |
18 | | - |
| 18 | + |
19 | 19 | function showHistoryInfo() { |
20 | 20 | global $wgLang; // TODO global. |
21 | 21 | wfLoadExtensionMessages( 'LiquidThreads' ); |
22 | | - $this->openDiv('lqt_history_info'); |
23 | | - $this->output->addHTML(wfMsg('lqt_revision_as_of', $wgLang->timeanddate($this->thread->modified())) .'<br />' ); |
24 | | - |
| 22 | + $this->openDiv( 'lqt_history_info' ); |
| 23 | + $this->output->addHTML( wfMsg( 'lqt_revision_as_of', $wgLang->timeanddate( $this->thread->modified() ) ) . '<br />' ); |
| 24 | + |
25 | 25 | $ct = $this->thread->changeType(); |
26 | | - if( $ct == Threads::CHANGE_NEW_THREAD ) $msg = wfMsg('lqt_change_new_thread'); |
27 | | - else if( $ct == Threads::CHANGE_REPLY_CREATED ) $msg = wfMsg('lqt_change_reply_created'); |
28 | | - else if( $ct == Threads::CHANGE_EDITED_ROOT ) { |
29 | | - $diff_url = $this->permalinkUrlWithDiff($this->thread); |
30 | | - $msg = wfMsg('lqt_change_edited_root') . " [<a href=\"$diff_url\">" . wfMsg('diff') . '</a>]'; |
| 26 | + if ( $ct == Threads::CHANGE_NEW_THREAD ) $msg = wfMsg( 'lqt_change_new_thread' ); |
| 27 | + else if ( $ct == Threads::CHANGE_REPLY_CREATED ) $msg = wfMsg( 'lqt_change_reply_created' ); |
| 28 | + else if ( $ct == Threads::CHANGE_EDITED_ROOT ) { |
| 29 | + $diff_url = $this->permalinkUrlWithDiff( $this->thread ); |
| 30 | + $msg = wfMsg( 'lqt_change_edited_root' ) . " [<a href=\"$diff_url\">" . wfMsg( 'diff' ) . '</a>]'; |
31 | 31 | } |
32 | | - $this->output->addHTML($msg); |
| 32 | + $this->output->addHTML( $msg ); |
33 | 33 | $this->closeDiv(); |
34 | 34 | } |
35 | | - |
| 35 | + |
36 | 36 | function show() { |
37 | | - if( ! $this->thread ) { |
| 37 | + if ( ! $this->thread ) { |
38 | 38 | $this->showMissingThreadPage(); |
39 | 39 | return false; |
40 | 40 | } |
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php |
___________________________________________________________________ |
Added: svn:eol-style |
41 | 41 | + native |