Inherits ApiBase.
Inherited by ApiFormatDbg, ApiFormatFeedWrapper, ApiFormatJson, ApiFormatPhp, ApiFormatRaw, ApiFormatTxt, ApiFormatWddx, ApiFormatXml, and ApiFormatYaml.
Public Member Functions | |
__construct ($main, $format) | |
Constructor If $format ends with 'fm', pretty-print the output in HTML. | |
getMimeType () | |
Overriding class returns the mime type that should be sent to the client. | |
getNeedsRawData () | |
Whether this formatter needs raw data such as _element tags. | |
getFormat () | |
Get the internal format name. | |
setUnescapeAmps ($b) | |
Specify whether or not sequences like " should be unescaped to " . | |
getIsHtml () | |
Returns true when the HTML pretty-printer should be used. | |
initPrinter ($isError) | |
Initialize the printer function and prepare the output headers, etc. | |
closePrinter () | |
Finish printing. | |
printText ($text) | |
The main format printing function. | |
setHelp ($help=true) | |
Sets whether the pretty-printer should format *bold* and $italics$. | |
getDescription () | |
Returns the description string for this module. | |
Static Public Member Functions | |
static | getBaseVersion () |
Returns a string that identifies the version of this class. | |
Protected Member Functions | |
formatHTML ($text) | |
Prety-print various elements in HTML format, such as xml tags and URLs. | |
getExamples () | |
Returns usage examples for this module. | |
Private Attributes | |
$mIsHtml | |
$mFormat | |
$mUnescapeAmps | |
$mHelp | |
$mCleared |
Definition at line 36 of file ApiFormatBase.php.
ApiFormatBase::__construct | ( | $ | main, | |
$ | format | |||
) |
Constructor If $format ends with 'fm', pretty-print the output in HTML.
$main | ApiMain | |
$format | string Format name |
Reimplemented in ApiFormatDbg, ApiFormatJson, ApiFormatPhp, ApiFormatRaw, ApiFormatTxt, ApiFormatWddx, ApiFormatXml, and ApiFormatYaml.
Definition at line 46 of file ApiFormatBase.php.
ApiFormatBase::closePrinter | ( | ) |
Finish printing.
Closes HTML tags.
Definition at line 161 of file ApiFormatBase.php.
References getIsHtml().
ApiFormatBase::formatHTML | ( | $ | text | ) | [protected] |
Prety-print various elements in HTML format, such as xml tags and URLs.
This method also escapes characters like <
$text | string |
Definition at line 211 of file ApiFormatBase.php.
References $text, and $wgUrlProtocols.
Referenced by printText().
static ApiFormatBase::getBaseVersion | ( | ) | [static] |
Returns a string that identifies the version of this class.
Reimplemented from ApiBase.
Definition at line 250 of file ApiFormatBase.php.
ApiFormatBase::getDescription | ( | ) |
Returns the description string for this module.
Reimplemented from ApiBase.
Reimplemented in ApiFormatDbg, ApiFormatJson, ApiFormatPhp, ApiFormatTxt, ApiFormatWddx, ApiFormatXml, and ApiFormatYaml.
Definition at line 246 of file ApiFormatBase.php.
References getIsHtml().
ApiFormatBase::getExamples | ( | ) | [protected] |
Returns usage examples for this module.
Return null if no examples are available.
Reimplemented from ApiBase.
Definition at line 242 of file ApiFormatBase.php.
References ApiBase::getModuleName().
ApiFormatBase::getFormat | ( | ) |
ApiFormatBase::getIsHtml | ( | ) |
Returns true when the HTML pretty-printer should be used.
The default implementation assumes that formats ending with 'fm' should be formatted in HTML.
Definition at line 100 of file ApiFormatBase.php.
Referenced by closePrinter(), ApiFormatXml::execute(), ApiFormatWddx::execute(), ApiFormatJson::execute(), getDescription(), initPrinter(), printText(), and ApiFormatWddx::slowWddxPrinter().
ApiFormatBase::getMimeType | ( | ) | [abstract] |
Overriding class returns the mime type that should be sent to the client.
This method is not called if getIsHtml() returns true.
Reimplemented in ApiFormatFeedWrapper, ApiFormatDbg, ApiFormatJson, ApiFormatPhp, ApiFormatRaw, ApiFormatTxt, ApiFormatWddx, ApiFormatXml, and ApiFormatYaml.
Referenced by initPrinter().
ApiFormatBase::getNeedsRawData | ( | ) |
Whether this formatter needs raw data such as _element tags.
Reimplemented in ApiFormatFeedWrapper, ApiFormatJson, and ApiFormatXml.
Definition at line 69 of file ApiFormatBase.php.
ApiFormatBase::initPrinter | ( | $ | isError | ) |
Initialize the printer function and prepare the output headers, etc.
This method must be the first outputing method during execution. A help screen's header is printed for the HTML-based output
$isError | bool Whether an error message is printed |
Definition at line 110 of file ApiFormatBase.php.
References $script, getIsHtml(), getMimeType(), is(), and wfScript().
ApiFormatBase::printText | ( | $ | text | ) |
The main format printing function.
Call it to output the result string to the user. This function will automatically output HTML when format name ends in 'fm'.
$text | string |
Definition at line 180 of file ApiFormatBase.php.
References $text, formatHTML(), and getIsHtml().
Referenced by ApiFormatYaml::execute(), ApiFormatXml::execute(), ApiFormatWddx::execute(), ApiFormatTxt::execute(), ApiFormatRaw::execute(), ApiFormatPhp::execute(), ApiFormatJson::execute(), ApiFormatDbg::execute(), ApiFormatXml::recXmlPrint(), and ApiFormatWddx::slowWddxPrinter().
ApiFormatBase::setHelp | ( | $ | help = true |
) |
Sets whether the pretty-printer should format *bold* and $italics$.
$help | bool |
Definition at line 201 of file ApiFormatBase.php.
ApiFormatBase::setUnescapeAmps | ( | $ | b | ) |
Specify whether or not sequences like " should be unescaped to " .
This should only be set to true for the help message when rendered in the default (xmlfm) format. This is a temporary special-case fix that should be removed once the help has been reworked to use a fully HTML interface.
$b | bool Whether or not ampersands should be escaped. |
Definition at line 90 of file ApiFormatBase.php.
ApiFormatBase::$mCleared [private] |
Definition at line 38 of file ApiFormatBase.php.
ApiFormatBase::$mFormat [private] |
Definition at line 38 of file ApiFormatBase.php.
ApiFormatBase::$mHelp [private] |
Definition at line 38 of file ApiFormatBase.php.
ApiFormatBase::$mIsHtml [private] |
Definition at line 38 of file ApiFormatBase.php.
ApiFormatBase::$mUnescapeAmps [private] |
Definition at line 38 of file ApiFormatBase.php.