Index: trunk/extensions/LiquidThreads/classes/View.php |
— | — | @@ -346,6 +346,8 @@ |
347 | 347 | LqtHooks::$editType = 'new'; |
348 | 348 | LqtHooks::$editAppliesTo = null; |
349 | 349 | |
| 350 | + wfRunHooks( 'LiquidThreadsShowNewThreadForm', array( &$e, $talkpage ) ); |
| 351 | + |
350 | 352 | $e = new EditPage( $article ); |
351 | 353 | |
352 | 354 | global $wgRequest; |
— | — | @@ -392,7 +394,7 @@ |
393 | 395 | if ( $e->didSave ) { |
394 | 396 | $signature = $this->request->getVal( 'wpLqtSignature', null ); |
395 | 397 | |
396 | | - $thread = LqtView::newPostMetadataUpdates( |
| 398 | + $info = |
397 | 399 | array( |
398 | 400 | 'talkpage' => $talkpage, |
399 | 401 | 'text' => $e->textbox1, |
— | — | @@ -400,9 +402,13 @@ |
401 | 403 | 'signature' => $signature, |
402 | 404 | 'root' => $article, |
403 | 405 | 'subject' => $subject, |
404 | | - ) |
405 | | - ); |
| 406 | + ); |
406 | 407 | |
| 408 | + wfRunHooks( 'LiquidThreadsSaveNewThread', |
| 409 | + array( &$info, &$e, &$talkpage ) ); |
| 410 | + |
| 411 | + $thread = LqtView::newPostMetadataUpdates( $info ); |
| 412 | + |
407 | 413 | if ( $submitted_nonce && $nonce_key ) { |
408 | 414 | global $wgMemc; |
409 | 415 | $wgMemc->set( $nonce_key, 1, 3600 ); |
— | — | @@ -485,6 +491,8 @@ |
486 | 492 | Xml::tags( 'p', null, $signatureHTML ); |
487 | 493 | |
488 | 494 | $wgRequest->setVal( 'wpWatchThis', false ); |
| 495 | + |
| 496 | + wfRunHooks( 'LiquidThreadsShowReplyForm', array( &$e, $thread ) ); |
489 | 497 | |
490 | 498 | $e->edit(); |
491 | 499 | |
— | — | @@ -492,17 +500,20 @@ |
493 | 501 | $bump = $this->request->getBool( 'wpBumpThread' ); |
494 | 502 | $signature = $this->request->getVal( 'wpLqtSignature', null ); |
495 | 503 | |
496 | | - $newThread = LqtView::replyMetadataUpdates( |
497 | | - array( |
| 504 | + $info = array( |
498 | 505 | 'replyTo' => $thread, |
499 | 506 | 'text' => $e->textbox1, |
500 | 507 | 'summary' => $e->summary, |
501 | 508 | 'bump' => $bump, |
502 | 509 | 'signature' => $signature, |
503 | 510 | 'root' => $article, |
504 | | - ) |
505 | | - ); |
| 511 | + ); |
506 | 512 | |
| 513 | + wfRunHooks( 'LiquidThreadsSaveReply', |
| 514 | + array( &$info, &$e, &$thread ) ); |
| 515 | + |
| 516 | + $newThread = LqtView::replyMetadataUpdates( $info ); |
| 517 | + |
507 | 518 | if ( $submitted_nonce && $nonce_key ) { |
508 | 519 | global $wgMemc; |
509 | 520 | $wgMemc->set( $nonce_key, 1, 3600 ); |
— | — | @@ -1002,6 +1013,8 @@ |
1003 | 1014 | 'showlabel' => true, |
1004 | 1015 | 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' ) |
1005 | 1016 | ); |
| 1017 | + |
| 1018 | + wfRunHooks( 'LiquidThreadsThreadCommands', array( $thread, &$commands ) ); |
1006 | 1019 | |
1007 | 1020 | return $commands; |
1008 | 1021 | } |
— | — | @@ -1065,6 +1078,9 @@ |
1066 | 1079 | 'showlabel' => 1, |
1067 | 1080 | ); |
1068 | 1081 | } |
| 1082 | + |
| 1083 | + wfRunHooks( 'LiquidThreadsThreadMajorCommands', |
| 1084 | + array( $thread, &$commands ) ); |
1069 | 1085 | |
1070 | 1086 | return $commands; |
1071 | 1087 | } |
— | — | @@ -1126,6 +1142,8 @@ |
1127 | 1143 | 'href' => $summarizeUrl, |
1128 | 1144 | 'enabled' => true, |
1129 | 1145 | ); |
| 1146 | + |
| 1147 | + wfRunHooks( 'LiquidThreadsTopLevelCommands', array( $thread, &$commands ) ); |
1130 | 1148 | |
1131 | 1149 | return $commands; |
1132 | 1150 | } |
— | — | @@ -1358,7 +1376,9 @@ |
1359 | 1377 | } |
1360 | 1378 | |
1361 | 1379 | // If we're editing the thread, show the editing form. |
1362 | | - if ( $this->methodAppliesToThread( 'edit', $thread ) ) { |
| 1380 | + $showAnything = wfRunHooks( 'LiquidThreadsShowThreadBody', |
| 1381 | + array( $thread ) ); |
| 1382 | + if ( $this->methodAppliesToThread( 'edit', $thread ) && $showAnything ) { |
1363 | 1383 | $html = Xml::openElement( 'div', array( 'class' => $divClass ) ); |
1364 | 1384 | $this->output->addHTML( $html ); |
1365 | 1385 | $html = ''; |
— | — | @@ -1367,10 +1387,11 @@ |
1368 | 1388 | // so I'm just flushing the HTML and displaying it as-is. |
1369 | 1389 | $this->showPostEditingForm( $thread ); |
1370 | 1390 | $html .= Xml::closeElement( 'div' ); |
1371 | | - } else { |
| 1391 | + } elseif ($showAnything) { |
1372 | 1392 | $html .= Xml::openElement( 'div', array( 'class' => $divClass ) ); |
1373 | 1393 | |
1374 | | - $show = wfRunHooks( 'LiquidThreadsShowThreadBody', array( $thread, &$post ) ); |
| 1394 | + $show = wfRunHooks( 'LiquidThreadsShowPostContent', |
| 1395 | + array( $thread, &$post ) ); |
1375 | 1396 | if ($show) { |
1376 | 1397 | $html .= $this->showPostBody( $post, $oldid ); |
1377 | 1398 | } |
— | — | @@ -1481,11 +1502,17 @@ |
1482 | 1503 | $id = 'lqt-header-' . $thread->id(); |
1483 | 1504 | |
1484 | 1505 | $html = $thread->formattedSubject(); |
1485 | | - $html = Xml::tags( 'span', array( 'class' => 'mw-headline' ), $html ); |
1486 | | - $html .= Xml::hidden( 'raw-header', $thread->subject() ); |
1487 | | - $html = Xml::tags( 'h' . $this->headerLevel, |
1488 | | - array( 'class' => 'lqt_header', 'id' => $id ), |
1489 | | - $html ) . $commands_html; |
| 1506 | + |
| 1507 | + $show = wfRunHooks( 'LiquidThreadsShowThreadHeading', |
| 1508 | + array( $thread, &$html ) ); |
| 1509 | + |
| 1510 | + if ($show) { |
| 1511 | + $html = Xml::tags( 'span', array( 'class' => 'mw-headline' ), $html ); |
| 1512 | + $html .= Xml::hidden( 'raw-header', $thread->subject() ); |
| 1513 | + $html = Xml::tags( 'h' . $this->headerLevel, |
| 1514 | + array( 'class' => 'lqt_header', 'id' => $id ), |
| 1515 | + $html ) . $commands_html; |
| 1516 | + } |
1490 | 1517 | |
1491 | 1518 | return $html; |
1492 | 1519 | } |