From dcd57754d93ff9673d81ee35b65834e98c1b9b98 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 6 Jul 2007 03:41:04 +0000 Subject: [PATCH] * 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 --- includes/GlobalFunctions.php | 12 +++++++++++- includes/api/ApiFormatBase.php | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7248a027e6..6f671c3897 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 996cbfe2f3..209abd23d4 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -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 {
-You are looking at the HTML representation of the mFormat?> format.
+You are looking at the HTML representation of the mFormat ); ?> format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or -API help for more information. +API help for more information.