MediaWiki REL1_32
SpecialPageData.php
Go to the documentation of this file.
1<?php
32
36 private $requestHandler = null;
37
38 public function __construct() {
39 parent::__construct( 'PageData' );
40 }
41
53 $this->requestHandler = $requestHandler;
54 }
55
60 protected function initDependencies() {
61 if ( $this->requestHandler === null ) {
62 $this->requestHandler = $this->newDefaultRequestHandler();
63 }
64 }
65
71 private function newDefaultRequestHandler() {
72 return new PageDataRequestHandler();
73 }
74
82 public function execute( $subPage ) {
83 $this->initDependencies();
84
85 // If there is no title, show an HTML form
86 // TODO: Don't do this if HTML is not acceptable according to HTTP headers.
87 if ( !$this->requestHandler->canHandleRequest( $subPage, $this->getRequest() ) ) {
88 $this->showForm();
89 return;
90 }
91
92 $this->requestHandler->handleRequest( $subPage, $this->getRequest(), $this->getOutput() );
93 }
94
98 public function showForm() {
99 $this->getOutput()->showErrorPage( 'pagedata-title', 'pagedata-text' );
100 }
101
102 public function isListed() {
103 // Do not list this page in Special:SpecialPages
104 return false;
105 }
106
107}
Request handler implementing a data interface for mediawiki pages.
initDependencies()
Initialize any un-initialized members from global context.
PageDataRequestHandler null $requestHandler
newDefaultRequestHandler()
Creates a PageDataRequestHandler based on global defaults.
showForm()
Shows an informative page to the user; Called when there is no page to output.
isListed()
Whether this special page is listed in Special:SpecialPages.
setRequestHandler(PageDataRequestHandler $requestHandler)
Sets the request handler to be used by the special page.
Parent class for all special pages.
getOutput()
Get the OutputPage being used for this instance.
getRequest()
Get the WebRequest being used for this instance.