Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | global $wgUser, $wgRequest; |
76 | 76 | # This only applies to viewing content pages |
77 | 77 | $action = $wgRequest->getVal( 'action', 'view' ); |
78 | | - if( ($action !='view' && $action !='purge') || !$this->isReviewable() ) |
| 78 | + if( !self::isViewAction($action) || !$this->isReviewable() ) |
79 | 79 | return false; |
80 | 80 | # Does not apply to diffs/old revision. Explicit requests |
81 | 81 | # for a certain stable version will be handled elsewhere. |
— | — | @@ -98,6 +98,15 @@ |
99 | 99 | } |
100 | 100 | return false; |
101 | 101 | } |
| 102 | + |
| 103 | + /** |
| 104 | + * Is this a view page action? |
| 105 | + * @param $action string |
| 106 | + * @returns bool |
| 107 | + */ |
| 108 | + protected static function isViewAction( $action ) { |
| 109 | + return ( $action == 'view' || $action == 'purge' || $action == 'render' ); |
| 110 | + } |
102 | 111 | |
103 | 112 | /** |
104 | 113 | * Is the stable version shown by default for this page? |
— | — | @@ -243,7 +252,7 @@ |
244 | 253 | global $wgRequest, $wgOut, $wgUser, $wgLang; |
245 | 254 | # Only trigger on article view for content pages, not for protect/delete/hist... |
246 | 255 | $action = $wgRequest->getVal( 'action', 'view' ); |
247 | | - if( ($action !='view' && $action !='purge') || !$this->parent->exists() ) |
| 256 | + if( !self::isViewAction($action) || !$this->parent->exists() ) |
248 | 257 | return true; |
249 | 258 | # Do not clutter up diffs any further and leave archived versions alone... |
250 | 259 | if( $wgRequest->getVal('diff') || $wgRequest->getVal('oldid') ) { |
— | — | @@ -750,7 +759,7 @@ |
751 | 760 | } |
752 | 761 | # Check action and if page is protected |
753 | 762 | $action = $wgRequest->getVal( 'action', 'view' ); |
754 | | - if( ($action !='view' && $action !='purge') ) { |
| 763 | + if( !self::isViewAction($action) ) { |
755 | 764 | return true; |
756 | 765 | } |
757 | 766 | $this->addQuickReview( $data, $wgRequest->getVal('diff'), false ); |
— | — | @@ -768,7 +777,7 @@ |
769 | 778 | } |
770 | 779 | # Check action and if page is protected |
771 | 780 | $action = $wgRequest->getVal( 'action', 'view' ); |
772 | | - if( ($action !='view' && $action !='purge') ) { |
| 781 | + if( !self::isViewAction($action) ) { |
773 | 782 | return true; |
774 | 783 | } |
775 | 784 | if( $wgUser->isAllowed( 'feedback' ) ) { |
— | — | @@ -881,7 +890,7 @@ |
882 | 891 | $draftTabCss = ''; |
883 | 892 | $stableTabCss = 'selected'; |
884 | 893 | // We are looking at the talk page or diffs/hist/oldids |
885 | | - } else if( !in_array($action,array('view','purge','edit')) || $skin->mTitle->isTalkPage() ) { |
| 894 | + } else if( !(self::isViewAction($action) || $action=='edit') || $skin->mTitle->isTalkPage() ) { |
886 | 895 | $draftTabCss = ''; |
887 | 896 | $stableTabCss = ''; |
888 | 897 | // We are looking at the current revision or in edit mode |
— | — | @@ -1564,8 +1573,9 @@ |
1565 | 1574 | global $wgUser, $wgRequest; |
1566 | 1575 | |
1567 | 1576 | $action = $wgRequest->getVal( 'action', 'view' ); |
| 1577 | + if( $action == 'purge' ) return true; // already purging! |
1568 | 1578 | # Only trigger on article view for content pages, not for protect/delete/hist |
1569 | | - if( $action !='view' || !$wgUser->isAllowed( 'review' ) ) |
| 1579 | + if( !self::isViewAction($action) || !$wgUser->isAllowed( 'review' ) ) |
1570 | 1580 | return true; |
1571 | 1581 | if( !$this->parent->exists() || !$this->isReviewable() ) |
1572 | 1582 | return true; |