Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | $parser->setFunctionHook( 'localurle', array( __CLASS__, 'localurle' ), SFH_NO_HASH ); |
27 | 27 | $parser->setFunctionHook( 'fullurl', array( __CLASS__, 'fullurl' ), SFH_NO_HASH ); |
28 | 28 | $parser->setFunctionHook( 'fullurle', array( __CLASS__, 'fullurle' ), SFH_NO_HASH ); |
| 29 | + $parser->setFunctionHook( 'apiurl', array( __CLASS__, 'apiurl' ), SFH_NO_HASH ); |
29 | 30 | $parser->setFunctionHook( 'formatnum', array( __CLASS__, 'formatnum' ), SFH_NO_HASH ); |
30 | 31 | $parser->setFunctionHook( 'grammar', array( __CLASS__, 'grammar' ), SFH_NO_HASH ); |
31 | 32 | $parser->setFunctionHook( 'plural', array( __CLASS__, 'plural' ), SFH_NO_HASH ); |
— | — | @@ -119,6 +120,19 @@ |
120 | 121 | static function localurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeLocalURL', $s, $arg ); } |
121 | 122 | static function fullurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getFullURL', $s, $arg ); } |
122 | 123 | static function fullurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeFullURL', $s, $arg ); } |
| 124 | + static function apiurl( $parser, $s = '', $arg = null ) { |
| 125 | + global $wgEnableApi; |
| 126 | + # Don't bother linking to the API if they can't use it. |
| 127 | + if ( $wgEnableApi === false ) { |
| 128 | + return array( 'found' => false ); |
| 129 | + } |
| 130 | + global $wgServer, $wgApiScript; |
| 131 | + $path = $wgServer . $wgApiScript . '?action=' . $s; |
| 132 | + if ( !is_null($arg ) ) { |
| 133 | + $path .= '&' . $arg; |
| 134 | + } |
| 135 | + return $path; |
| 136 | + } |
123 | 137 | |
124 | 138 | static function urlFunction( $func, $s = '', $arg = null ) { |
125 | 139 | $title = Title::newFromText( $s ); |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | |
55 | 55 | if( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR"; |
56 | 56 | if( $wgFileCacheDirectory === false ) $wgFileCacheDirectory = "{$wgUploadDirectory}/cache"; |
| 57 | +if( $wgApiScript == false ) $wgApiScript = "$wgScriptPath/api$wgScriptExtension"; |
57 | 58 | |
58 | 59 | if ( empty( $wgFileStore['deleted']['directory'] ) ) { |
59 | 60 | $wgFileStore['deleted']['directory'] = "{$wgUploadDirectory}/deleted"; |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -166,6 +166,7 @@ |
167 | 167 | $wgMathDirectory = false; ///< defaults to "{$wgUploadDirectory}/math" |
168 | 168 | $wgTmpDirectory = false; ///< defaults to "{$wgUploadDirectory}/tmp" |
169 | 169 | $wgUploadBaseUrl = ""; |
| 170 | +$wgApiScript = false; ///< defaults to "{$wgScriptPath}/api{$wgScriptExtension}" |
170 | 171 | /**@}*/ |
171 | 172 | |
172 | 173 | /** |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -312,6 +312,7 @@ |
313 | 313 | 'plural' => array( 0, 'PLURAL:' ), |
314 | 314 | 'fullurl' => array( 0, 'FULLURL:' ), |
315 | 315 | 'fullurle' => array( 0, 'FULLURLE:' ), |
| 316 | + 'apiurl' => array( 0, 'APIURL:' ), |
316 | 317 | 'lcfirst' => array( 0, 'LCFIRST:' ), |
317 | 318 | 'ucfirst' => array( 0, 'UCFIRST:' ), |
318 | 319 | 'lc' => array( 0, 'LC:' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -25,6 +25,9 @@ |
26 | 26 | empt all content namespaces.) |
27 | 27 | * $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4 |
28 | 28 | has been $wgSearchForwardUrl. |
| 29 | +* $wgApiScript can now be defined if your API isn't named api.php or it's not |
| 30 | + in the usual location. Setting to false defaults to "$wgScriptPath/api |
| 31 | + $wgScriptExtension". |
29 | 32 | |
30 | 33 | === New features in 1.14 === |
31 | 34 | |
— | — | @@ -36,6 +39,8 @@ |
37 | 40 | 'EditSectionLinkForOther' hook has been removed, but 'EditSectionLink' is |
38 | 41 | run in all cases instead, so extensions using the old hooks should still work |
39 | 42 | if they ran roughly the same code for both hooks (as is almost certain). |
| 43 | +* New parser function {{apiurl:}} links to the local API. {{apiurl:help}} would |
| 44 | + link to action=help. Other params are passed as well. |
40 | 45 | |
41 | 46 | === Bug fixes in 1.14 === |
42 | 47 | |