revert r28340, r28343 to r28349, r28351, r28364
[T119942Repr.git] / SpecialIncludable.php
blob3ee61583f8b4e08d1313e60e67627d65d98a09d9
1 <?php
2 if (!defined('MEDIAWIKI')) die();
3 /**
4 * A Special Page sample that can be included on a wikipage like
5 * {{Special:Inc}} as well as being accessed on [[Special:Inc]]
7 * @addtogroup Extensions
9 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
10 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
11 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
14 $wgExtensionFunctions[] = 'wfIncludable';
15 $wgExtensionCredits['specialpage'][] = array(
16 'name' => 'Includable',
17 'description' => 'a sample includable Special Page',
18 'author' => 'Ævar Arnfjörð Bjarmason'
22 function wfIncludable() {
23 global $IP, $wgMessageCache;
25 $wgMessageCache->addMessage( 'includable', 'Includable' );
27 require_once "$IP/includes/SpecialPage.php";
28 class SpecialIncludable extends SpecialPage {
29 /**
30 * Constructor
32 function SpecialIncludable() {
33 SpecialPage::SpecialPage( 'Includable' );
34 $this->includable( true );
37 /**
38 * main()
40 function execute( $par = null ) {
41 global $wgOut;
43 if ( $this->including() )
44 $out = "I'm being included";
45 else {
46 $out = "I'm being viewed as a Special Page";
47 $this->setHeaders();
50 $wgOut->addHtml( $out );
54 SpecialPage::addPage( new SpecialIncludable );