Index: trunk/extensions/CreatePage/SpecialCreatePage.php |
— | — | @@ -1,42 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Redirect the submission request of the createpage parser hook to the actual page. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialCreatePage.php |
10 | | - * @ingroup CreatePage |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -class SpecialCreatePage extends UnlistedSpecialPage { |
16 | | - |
17 | | - public function __construct() { |
18 | | - parent::__construct( 'CreatePage' ); |
19 | | - } |
20 | | - |
21 | | - public function execute( $subPage ) { |
22 | | - $req = $this->getRequest(); |
23 | | - |
24 | | - if ( $req->wasPosted() && $req->getCheck( 'pagename' ) ) { |
25 | | - $parts = array( $req->getText( 'pagename' ) ); |
26 | | - |
27 | | - if ( $req->getCheck( 'pagens' ) ) { |
28 | | - array_unshift( $parts, $req->getText( 'pagens' ) ); |
29 | | - } |
30 | | - |
31 | | - $target = Title::newFromText( implode( ':', $parts ) )->getLocalUrl( array( |
32 | | - 'action' => 'edit', |
33 | | - 'redlink' => '1' |
34 | | - ) ); |
35 | | - } |
36 | | - else { |
37 | | - $target = Title::newMainPage()->getLocalURL(); |
38 | | - } |
39 | | - |
40 | | - $this->getOutput()->redirect( $target ); |
41 | | - } |
42 | | - |
43 | | -} |
\ No newline at end of file |
Index: trunk/extensions/CreatePage/CreatePage.alias.php |
— | — | @@ -18,5 +18,5 @@ |
19 | 19 | * @author Jeroen De Dauw |
20 | 20 | */ |
21 | 21 | $specialPageAliases['en'] = array( |
22 | | - 'CreatePage' => array( 'CreatePage' ), |
| 22 | + 'CreatePageRedirect' => array( 'CreatePageRedirect' ), |
23 | 23 | ); |
\ No newline at end of file |
Index: trunk/extensions/CreatePage/CreatePage.i18n.php |
— | — | @@ -18,10 +18,18 @@ |
19 | 19 | * @author Jeroen De Dauw |
20 | 20 | */ |
21 | 21 | $messages['en'] = array( |
22 | | - 'cp-desc' => 'Allows placing an input that takes the name of a new page into pages', |
| 22 | + 'cp-desc' => 'Allows embedding an input into which users can enter the name of a page to be created and are taken to that page when they click create.', |
23 | 23 | 'cp-create' => 'Create page', |
24 | 24 | ); |
25 | 25 | |
| 26 | +/** Message documentation (Message documentation) |
| 27 | + * @author Jeroen De Dauw |
| 28 | + */ |
| 29 | +$messages['qqq'] = array( |
| 30 | + 'cp-desc' => 'Extension description for Special:Version', |
| 31 | + 'cp-create' => 'Create button text', |
| 32 | +); |
| 33 | + |
26 | 34 | /** Asturian (Asturianu) |
27 | 35 | * @author Xuacu |
28 | 36 | */ |
Index: trunk/extensions/CreatePage/CreatePage.php |
— | — | @@ -47,12 +47,12 @@ |
48 | 48 | $wgExtensionMessagesFiles['CreatePageMagic'] = dirname( __FILE__ ) . '/CreatePage.magic.php'; |
49 | 49 | |
50 | 50 | $wgAutoloadClasses['SpecialCreatePage'] = dirname( __FILE__ ) . '/SpecialCreatePage.php'; |
51 | | -$wgSpecialPages['CreatePage'] = 'SpecialCreatePage'; |
| 51 | +$wgSpecialPages['CreatePageRedirect'] = 'SpecialCreatePageRedirect'; |
52 | 52 | |
53 | 53 | $wgHooks['ParserFirstCallInit'][] = function( Parser &$parser ) { |
54 | 54 | $parser->setFunctionHook( 'createpage', function( Parser $parser, PPFrame $frame, array $args ) { |
55 | 55 | $html = Html::openElement( 'form', array( |
56 | | - 'action' => SpecialPage::getTitleFor( 'CreatePage' )->getLocalURL(), |
| 56 | + 'action' => SpecialPage::getTitleFor( 'CreatePageRedirect' )->getLocalURL(), |
57 | 57 | 'method' => 'post', |
58 | 58 | 'style' => 'display: inline', |
59 | 59 | ) ); |
Index: trunk/extensions/CreatePage/SpecialCreatePageRedirect.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Redirect the submission request of the createpage parser hook to the actual page. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SpecialCreatePage.php |
| 10 | + * @ingroup CreatePage |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialCreatePageRedirect extends UnlistedSpecialPage { |
| 16 | + |
| 17 | + public function __construct() { |
| 18 | + parent::__construct( 'CreatePageRedirect' ); |
| 19 | + } |
| 20 | + |
| 21 | + public function execute( $subPage ) { |
| 22 | + $req = $this->getRequest(); |
| 23 | + |
| 24 | + if ( $req->wasPosted() && $req->getCheck( 'pagename' ) ) { |
| 25 | + $parts = array( $req->getText( 'pagename' ) ); |
| 26 | + |
| 27 | + if ( $req->getCheck( 'pagens' ) ) { |
| 28 | + array_unshift( $parts, $req->getText( 'pagens' ) ); |
| 29 | + } |
| 30 | + |
| 31 | + $target = Title::newFromText( implode( ':', $parts ) )->getLocalUrl( array( |
| 32 | + 'action' => 'edit', |
| 33 | + 'redlink' => '1' |
| 34 | + ) ); |
| 35 | + } |
| 36 | + else { |
| 37 | + $target = Title::newMainPage()->getLocalURL(); |
| 38 | + } |
| 39 | + |
| 40 | + $this->getOutput()->redirect( $target, '301' ); |
| 41 | + } |
| 42 | + |
| 43 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/CreatePage/SpecialCreatePageRedirect.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |