BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
ApiFormatBase Class Reference
Inheritance diagram for ApiFormatBase:
Collaboration diagram for ApiFormatBase:

Public Member Functions

 __construct (ApiMain $main, $format)
 
 getMimeType ()
 
 getFilename ()
 
 getFormat ()
 
 getIsHtml ()
 
 disable ()
 
 isDisabled ()
 
 canPrintErrors ()
 
 forceDefaultParams ()
 
 initPrinter ($unused=false)
 
 closePrinter ()
 
 printText ($text)
 
 getBuffer ()
 
 getAllowedParams ()
 
 getHelpUrls ()
 
- Public Member Functions inherited from ApiBase
 __construct (ApiMain $mainModule, $moduleName, $modulePrefix= '')
 
 execute ()
 
 getModuleManager ()
 
 getCustomPrinter ()
 
 getHelpUrls ()
 
 shouldCheckMaxlag ()
 
 isReadMode ()
 
 isWriteMode ()
 
 mustBePosted ()
 
 isDeprecated ()
 
 isInternal ()
 
 needsToken ()
 
 getConditionalRequestData ($condition)
 
 getModuleName ()
 
 getModulePrefix ()
 
 getMain ()
 
 isMain ()
 
 getParent ()
 
 lacksSameOriginSecurity ()
 
 getModulePath ()
 
 getModuleFromPath ($path)
 
 getResult ()
 
 getErrorFormatter ()
 
 getContinuationManager ()
 
 setContinuationManager ($manager)
 
 dynamicParameterDocumentation ()
 
 encodeParamName ($paramName)
 
 extractRequestParams ($parseLimit=true)
 
 requireOnlyOneParameter ($params, $required)
 
 requireMaxOneParameter ($params, $required)
 
 requireAtLeastOneParameter ($params, $required)
 
 requirePostedParameters ($params, $prefix= 'prefix')
 
 getTitleOrPageId ($params, $load=false)
 
 validateToken ($token, array $params)
 
 getWatchlistUser ($params)
 
 setWarning ($warning)
 
 dieUsage ($description, $errorCode, $httpRespCode=0, $extradata=null)
 
 dieBlocked (Block $block)
 
 getErrorFromStatus ($status, &$extraData=null)
 
 dieStatus ($status)
 
static dieReadOnly ()
 
 dieUsageMsg ($error)
 
 dieUsageMsgOrDebug ($error)
 
 parseMsg ($error)
 
 logFeatureUsage ($feature)
 
 getFinalDescription ()
 
 getFinalParams ($flags=0)
 
 getFinalParamDescription ()
 
 modifyHelp (array &$help, array $options, array &$tocData)
 
 makeHelpMsg ()
 
 makeHelpMsgParameters ()
 
 getModuleProfileName ($db=false)
 
 profileIn ()
 
 profileOut ()
 
 safeProfileOut ()
 
 getProfileTime ()
 
 profileDBIn ()
 
 profileDBOut ()
 
 getProfileDBTime ()
 
 getResultData ()
 
- Public Member Functions inherited from ContextSource
 getContext ()
 
 setContext (IContextSource $context)
 
 getConfig ()
 
 getRequest ()
 
 getTitle ()
 
 canUseWikiPage ()
 
 getWikiPage ()
 
 getOutput ()
 
 getUser ()
 
 getLanguage ()
 
 getSkin ()
 
 getTiming ()
 
 getStats ()
 
 msg ()
 
 exportSession ()
 

Public Attributes

 $mFormat
 
 $mUnescapeAmps
 
 $mHelp
 
 $mDisabled = false
 
- Public Attributes inherited from ApiBase
const LIMIT_BIG1 = 500
 
const LIMIT_BIG2 = 5000
 
const LIMIT_SML1 = 50
 
const LIMIT_SML2 = 500
 
const GET_VALUES_FOR_HELP = 1
 
 $mModulePrefix
 
const PARAM_DFLT = 0
 
const PARAM_ISMULTI = 1
 
const PARAM_TYPE = 2
 
const PARAM_MAX = 3
 
const PARAM_MAX2 = 4
 
const PARAM_MIN = 5
 
const PARAM_ALLOW_DUPLICATES = 6
 
const PARAM_DEPRECATED = 7
 
const PARAM_REQUIRED = 8
 
const PARAM_RANGE_ENFORCE = 9
 
const PARAM_HELP_MSG = 10
 
const PARAM_HELP_MSG_APPEND = 11
 
const PARAM_HELP_MSG_INFO = 12
 
const PARAM_VALUE_LINKS = 13
 
const PARAM_HELP_MSG_PER_VALUE = 14
 
const PARAM_SUBMODULE_MAP = 15
 
const PARAM_SUBMODULE_PARAM_PREFIX = 16
 
const PARAM_SENSITIVE = 17
 

Protected Member Functions

 getIsWrappedHtml ()
 
 getParameterFromSettings ($paramName, $paramSettings, $parseLimit)
 
 getExamplesMessages ()
 
- Protected Member Functions inherited from ApiBase
 getExamplesMessages ()
 
 getAllowedParams ()
 
 getWebUITokenSalt (array $params)
 
 getDB ()
 
 getParameter ($paramName, $parseLimit=true)
 
 getWatchlistValue ($watchlist, $titleObj, $userOption=null)
 
 getParameterFromSettings ($paramName, $paramSettings, $parseLimit)
 
 parseMultiValue ($valueName, $value, $allowMultiple, $allowedValues)
 
 validateLimit ($paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
 
 validateTimestamp ($value, $encParamName)
 
 setWatch ($watch, $titleObj, $userOption=null)
 
 dieContinueUsageIf ($condition)
 
 getDescriptionMessage ()
 
 getHelpFlags ()
 
 getModuleSourceInfo ()
 
 getDescription ()
 
 getParamDescription ()
 
 getExamples ()
 
 makeHelpArrayToString ($prefix, $title, $input)
 
 useTransactionalTimeLimit ()
 

Protected Attributes

 $mForceDefaultParams = false
 

Deprecated

 setUnescapeAmps ($b)
 
 getWantsHelp ()
 
 setHelp ($help=true)
 
 getDescription ()
 
 setBufferResult ($value)
 
 getNeedsRawData ()
 
 formatHTML ($text)
 

Detailed Description

This is the abstract base class for API formatters.

Constructor & Destructor Documentation

ApiFormatBase::__construct ( ApiMain  $main,
  $format 
)

If $format ends with 'fm', pretty-print the output in HTML.

Parameters
ApiMain$main
string$formatFormat name

Member Function Documentation

ApiFormatBase::canPrintErrors ( )

Whether this formatter can handle printing API errors.

If this returns false, then on API errors the default printer will be instantiated.

Since
1.23
Returns
bool
ApiFormatBase::closePrinter ( )

Finish printing and output buffered data.

ApiFormatBase::disable ( )

Disable the formatter.

This causes calls to initPrinter() and closePrinter() to be ignored.

ApiFormatBase::forceDefaultParams ( )

Ignore request parameters, force a default.

Used as a fallback if errors are being thrown.

Since
1.26
ApiFormatBase::formatHTML (   $text)
protected

Pretty-print various elements in HTML format, such as xml tags and URLs. This method also escapes characters like <

Deprecated:
since 1.25
Parameters
string$text
Returns
string

Temporary fix for bad links in help messages. As a special case, XML-escaped metachars are de-escaped one level in the help message for legibility. Should be removed once we have completed a fully-HTML version of the help message.

ApiFormatBase::getBuffer ( )

Get the contents of the buffer.

Returns
string
ApiFormatBase::getDescription ( )
ApiFormatBase::getFilename ( )

Return a filename for this module's output.

Note
If $this->getIsWrappedHtml() || $this->getIsHtml(), you'll very likely want to fall back to this class's version.
Since
1.27
Returns
string Generally this should be "api-result.$ext", and must be encoded for inclusion in a Content-Disposition header's filename parameter.
ApiFormatBase::getFormat ( )

Get the internal format name

Returns
string
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.

Returns
bool
ApiFormatBase::getIsWrappedHtml ( )
protected

Returns true when the special wrapped mode is enabled.

Since
1.27
Returns
bool
ApiFormatBase::getMimeType ( )
abstract

Overriding class returns the MIME type that should be sent to the client.

When getIsHtml() returns true, the return value here is used for syntax highlighting but the client sees text/html.

Returns
string
ApiFormatBase::getNeedsRawData ( )

Formerly indicated whether the formatter needed metadata from ApiResult.

ApiResult previously (indirectly) used this to decide whether to add metadata or to ignore calls to metadata-setting methods, which unfortunately made several methods that should have been static have to be dynamic instead. Now ApiResult always stores metadata and formatters are required to ignore it or filter it out.

Deprecated:
since 1.25
Returns
bool Always true
ApiFormatBase::getParameterFromSettings (   $paramName,
  $paramSettings,
  $parseLimit 
)
protected

Overridden to honor $this->forceDefaultParams(), if applicable

Since
1.26
ApiFormatBase::getWantsHelp ( )

Whether this formatter can format the help message in a nice way. By default, this returns the same as getIsHtml(). When action=help is set explicitly, the help will always be shown

Deprecated:
since 1.25
Returns
bool
ApiFormatBase::initPrinter (   $unused = false)

Initialize the printer function and prepare the output headers.

Parameters
bool$unusedAlways false since 1.25
ApiFormatBase::isDisabled ( )

Whether the printer is disabled

Returns
bool
ApiFormatBase::printText (   $text)

Append text to the output buffer.

Parameters
string$text
ApiFormatBase::setBufferResult (   $value)

Set the flag to buffer the result instead of printing it.

Deprecated:
since 1.25, output is always buffered
Parameters
bool$value
ApiFormatBase::setHelp (   $help = true)

Sets whether the pretty-printer should format bold

Deprecated:
since 1.25
Parameters
bool$help
ApiFormatBase::setUnescapeAmps (   $b)

Specify whether or not sequences like &quot; 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.

Deprecated:
since 1.25
Parameters
bool$bWhether or not ampersands should be escaped.

The documentation for this class was generated from the following file: