Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php |
— | — | @@ -1 +1,68 @@ |
2 | 2 | <?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Interface to modify the semantic watchlist groups. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SpecialWatchlistConditions.php |
| 10 | + * @ingroup SemanticWatchlist |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialWatchlistConditions extends SpecialPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'WatchlistConditions', 'semanticwatchgroups' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see SpecialPage::getDescription |
| 28 | + * |
| 29 | + * @since 0.1 |
| 30 | + */ |
| 31 | + public function getDescription() { |
| 32 | + return wfMsg( 'special-' . strtolower( $this->mName ) ); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Sets headers - this should be called from the execute() method of all derived classes! |
| 37 | + * |
| 38 | + * @since 0.1 |
| 39 | + */ |
| 40 | + public function setHeaders() { |
| 41 | + global $wgOut; |
| 42 | + $wgOut->setArticleRelated( false ); |
| 43 | + $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 44 | + $wgOut->setPageTitle( $this->getDescription() ); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Main method. |
| 49 | + * |
| 50 | + * @since 0.1 |
| 51 | + * |
| 52 | + * @param string $arg |
| 53 | + */ |
| 54 | + public function execute( $arg ) { |
| 55 | + global $wgOut, $wgUser, $wgRequest; |
| 56 | + |
| 57 | + $this->setHeaders(); |
| 58 | + $this->outputHeader(); |
| 59 | + |
| 60 | + // If the user is authorized, display the page, if not, show an error. |
| 61 | + if ( !$this->userCanExecute( $wgUser ) ) { |
| 62 | + $this->displayRestrictionError(); |
| 63 | + return; |
| 64 | + } |
| 65 | + |
| 66 | + |
| 67 | + } |
| 68 | + |
| 69 | +} |
Index: trunk/extensions/SemanticWatchlist/specials/SpecialSemanticWatchlist.php |
— | — | @@ -1 +1,68 @@ |
2 | 2 | <?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Semantic watchlist page listing changes to watched properties. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SemanticWatchlist.php |
| 10 | + * @ingroup SemanticWatchlist |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialSemanticWatchlist extends SpecialPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'SemanticWatchlist', 'semanticwatch' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see SpecialPage::getDescription |
| 28 | + * |
| 29 | + * @since 0.1 |
| 30 | + */ |
| 31 | + public function getDescription() { |
| 32 | + return wfMsg( 'special-' . strtolower( $this->mName ) ); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Sets headers - this should be called from the execute() method of all derived classes! |
| 37 | + * |
| 38 | + * @since 0.1 |
| 39 | + */ |
| 40 | + public function setHeaders() { |
| 41 | + global $wgOut; |
| 42 | + $wgOut->setArticleRelated( false ); |
| 43 | + $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 44 | + $wgOut->setPageTitle( $this->getDescription() ); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Main method. |
| 49 | + * |
| 50 | + * @since 0.1 |
| 51 | + * |
| 52 | + * @param string $arg |
| 53 | + */ |
| 54 | + public function execute( $arg ) { |
| 55 | + global $wgOut, $wgUser, $wgRequest; |
| 56 | + |
| 57 | + $this->setHeaders(); |
| 58 | + $this->outputHeader(); |
| 59 | + |
| 60 | + // If the user is authorized, display the page, if not, show an error. |
| 61 | + if ( !$this->userCanExecute( $wgUser ) ) { |
| 62 | + $this->displayRestrictionError(); |
| 63 | + return; |
| 64 | + } |
| 65 | + |
| 66 | + |
| 67 | + } |
| 68 | + |
| 69 | +} |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -22,6 +22,9 @@ |
23 | 23 | |
24 | 24 | 'right-semanticwatch' => 'Use semantic watchlist', |
25 | 25 | 'right-semanticwatchgroups' => '[[Special:WatchlistConditions|Modify]] the semantic watchlist groups', |
| 26 | + |
| 27 | + 'special-semanticwatchlist' => 'Semantic watchlist page listing changes to watched properties.', |
| 28 | + 'special-watchlistconditions' => 'Interface to modify the semantic watchlist groups.', |
26 | 29 | ); |
27 | 30 | |
28 | 31 | /** Message documentation (Message documentation) |