* Introduce wfScript() wrapper around script path generation
authorRob Church <robchurch@users.mediawiki.org>
Fri, 6 Jul 2007 03:41:04 +0000 (03:41 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 6 Jul 2007 03:41:04 +0000 (03:41 +0000)
* Honour script extension in ApiFormatBase
* Fix up some uses of short open tags, which are discouraged, in ApiFormatBase

includes/GlobalFunctions.php
includes/api/ApiFormatBase.php

index 7248a02..6f671c3 100644 (file)
@@ -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}";
+}
\ No newline at end of file
index 996cbfe..209abd2 100644 (file)
@@ -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