* Introduce wfScript() wrapper around script path generation
* Honour script extension in ApiFormatBase * Fix up some uses of short open tags, which are discouraged, in ApiFormatBase
This commit is contained in:
parent
4247af6c2d
commit
dcd57754d9
2 changed files with 15 additions and 4 deletions
|
|
@ -2278,4 +2278,14 @@ function wfQueriesMustScale() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the path to a specified script file, respecting file
|
||||
* extensions; this is a wrapper around $wgScriptExtension etc.
|
||||
*
|
||||
* @param string $script Script filename, sans extension
|
||||
* @return string
|
||||
*/
|
||||
function wfScript( $script = 'index' ) {
|
||||
global $wgScriptPath, $wgScriptExtension;
|
||||
return "{$wgScriptPath}/{$script}{$wgScriptExtension}";
|
||||
}
|
||||
|
|
@ -85,6 +85,7 @@ abstract class ApiFormatBase extends ApiBase {
|
|||
function initPrinter($isError) {
|
||||
$isHtml = $this->getIsHtml();
|
||||
$mime = $isHtml ? 'text/html' : $this->getMimeType();
|
||||
$script = wfScript( 'api' );
|
||||
|
||||
// Some printers (ex. Feed) do their own header settings,
|
||||
// in which case $mime will be set to null
|
||||
|
|
@ -104,14 +105,14 @@ abstract class ApiFormatBase extends ApiBase {
|
|||
<?php
|
||||
|
||||
|
||||
if (!$isError) {
|
||||
if( !$isError ) {
|
||||
?>
|
||||
<br/>
|
||||
<small>
|
||||
You are looking at the HTML representation of the <?=$this->mFormat?> format.<br/>
|
||||
You are looking at the HTML representation of the <?php echo( $this->mFormat ); ?> format.<br/>
|
||||
HTML is good for debugging, but probably is not suitable for your application.<br/>
|
||||
See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
|
||||
<a href='api.php'>API help</a> for more information.
|
||||
<a href='<?php echo( $script ); ?>'>API help</a> for more information.
|
||||
</small>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue