[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Created on Sep 4, 2006 Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
File Size: | 1478 lines (45 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ApiMain:: (49 methods):
__construct()
isInternalMode()
getResult()
getModule()
getPrinter()
setCacheMaxAge()
setCacheMode()
setCacheControl()
createPrinterByName()
execute()
executeActionWithErrorHandling()
handleException()
handleApiBeforeMainException()
handleCORS()
matchOrigin()
wildcardToRegex()
sendCacheHeaders()
substituteResultWithError()
setupExecuteAction()
setupModule()
checkMaxLag()
checkExecutePermissions()
checkAsserts()
setupExternalResponse()
executeAction()
logRequest()
encodeRequestLogValue()
getParamsUsed()
getVal()
getCheck()
getUpload()
reportUnusedParams()
printResult()
isReadMode()
getAllowedParams()
getParamDescription()
getDescription()
getCredits()
setHelp()
makeHelpMsg()
reallyMakeHelpMsg()
makeHelpMsgHeader()
canApiHighLimits()
getShowVersions()
getModuleManager()
addModule()
addFormat()
getModules()
getFormats()
UsageException:: (4 methods):
__construct()
getCodeString()
getMessageArray()
__toString()
__construct( $context = null, $enableWrite = false ) X-Ref |
Constructs an instance of ApiMain that utilizes the module and format specified by $request. param: IContextSource|WebRequest $context If this is an instance of param: bool $enableWrite Should be set to true if the api may modify data |
isInternalMode() X-Ref |
Return true if the API was started by other PHP code using FauxRequest return: bool |
getResult() X-Ref |
Get the ApiResult object associated with current request return: ApiResult |
getModule() X-Ref |
Get the API module object. Only works after executeAction() return: ApiBase |
getPrinter() X-Ref |
Get the result formatter object. Only works after setupExecuteAction() return: ApiFormatBase |
setCacheMaxAge( $maxage ) X-Ref |
Set how long the response should be cached. param: int $maxage |
setCacheMode( $mode ) X-Ref |
Set the type of caching headers which will be sent. param: string $mode One of: |
setCacheControl( $directives ) X-Ref |
Set directives (key/value pairs) for the Cache-Control header. Boolean values will be formatted as such, by including or omitting without an equals sign. Cache control values set here will only be used if the cache mode is not private, see setCacheMode(). param: array $directives |
createPrinterByName( $format ) X-Ref |
Create an instance of an output formatter by its name param: string $format return: ApiFormatBase |
execute() X-Ref |
Execute api request. Any errors will be handled if the API was called by the remote client. |
executeActionWithErrorHandling() X-Ref |
Execute an action, and in case of an error, erase whatever partial results have been accumulated, and replace it with an error message and a help screen. |
handleException( Exception $e ) X-Ref |
Handle an exception as an API response param: Exception $e |
handleApiBeforeMainException( Exception $e ) X-Ref |
Handle an exception from the ApiBeforeMain hook. This tries to print the exception as an API response, to be more friendly to clients. If it fails, it will rethrow the exception. param: Exception $e |
handleCORS() X-Ref |
Check the &origin= query parameter against the Origin: HTTP header and respond appropriately. If no origin parameter is present, nothing happens. If an origin parameter is present but doesn't match the Origin header, a 403 status code is set and false is returned. If the parameter and the header do match, the header is checked against $wgCrossSiteAJAXdomains and $wgCrossSiteAJAXdomainExceptions, and if the origin qualifies, the appropriate CORS headers are set. return: bool False if the caller should abort (403 case), true otherwise (all other cases) |
matchOrigin( $value, $rules, $exceptions ) X-Ref |
Attempt to match an Origin header against a set of rules and a set of exceptions param: string $value Origin header param: array $rules Set of wildcard rules param: array $exceptions Set of wildcard rules return: bool True if $value matches a rule in $rules and doesn't match |
wildcardToRegex( $wildcard ) X-Ref |
Helper function to convert wildcard string into a regex '*' => '.*?' '?' => '.' param: string $wildcard String with wildcards return: string Regular expression |
sendCacheHeaders() X-Ref |
No description |
substituteResultWithError( $e ) X-Ref |
Replace the result data with the information about an exception. Returns the error code param: Exception $e return: string |
setupExecuteAction() X-Ref |
Set up for the execution. return: array |
setupModule() X-Ref |
Set up the module for response return: ApiBase The module that will handle this action |
checkMaxLag( $module, $params ) X-Ref |
Check the max lag if necessary param: ApiBase $module Api module being used param: array $params Array an array containing the request parameters. return: bool True on success, false should exit immediately |
checkExecutePermissions( $module ) X-Ref |
Check for sufficient permissions to execute param: ApiBase $module An Api module |
checkAsserts( $params ) X-Ref |
Check asserts of the user's rights param: array $params |
setupExternalResponse( $module, $params ) X-Ref |
Check POST for external response and setup result printer param: ApiBase $module An Api module param: array $params An array with the request parameters |
executeAction() X-Ref |
Execute the actual module, without any error handling |
logRequest( $time ) X-Ref |
Log the preceding request param: int $time Time in seconds |
encodeRequestLogValue( $s ) X-Ref |
Encode a value in a format suitable for a space-separated log line. param: string $s return: string |
getParamsUsed() X-Ref |
Get the request parameters used in the course of the preceding execute() request return: array |
getVal( $name, $default = null ) X-Ref |
Get a request value, and register the fact that it was used, for logging. param: string $name param: mixed $default return: mixed |
getCheck( $name ) X-Ref |
Get a boolean request value, and register the fact that the parameter was used, for logging. param: string $name return: bool |
getUpload( $name ) X-Ref |
Get a request upload, and register the fact that it was used, for logging. param: string $name Parameter name return: WebRequestUpload |
reportUnusedParams() X-Ref |
Report unused parameters, so the client gets a hint in case it gave us parameters we don't know, for example in case of spelling mistakes or a missing 'g' prefix for generators. |
printResult( $isError ) X-Ref |
Print results using the current printer param: bool $isError |
isReadMode() X-Ref |
return: bool |
getAllowedParams() X-Ref |
See ApiBase for description. return: array |
getParamDescription() X-Ref |
See ApiBase for description. return: array |
getDescription() X-Ref |
See ApiBase for description. return: array |
getCredits() X-Ref |
Returns an array of strings with credits for the API return: array |
setHelp( $help = true ) X-Ref |
Sets whether the pretty-printer should format *bold* and $italics$ param: bool $help |
makeHelpMsg() X-Ref |
Override the parent to generate help messages for all available modules. return: string |
reallyMakeHelpMsg() X-Ref |
return: mixed|string |
makeHelpMsgHeader( $module, $paramName ) X-Ref |
param: ApiBase $module param: string $paramName What type of request is this? e.g. action, return: string |
canApiHighLimits() X-Ref |
Check whether the current user is allowed to use high limits return: bool |
getShowVersions() X-Ref |
Check whether the user wants us to show version information in the API help return: bool |
getModuleManager() X-Ref |
Overrides to return this instance's module manager. return: ApiModuleManager |
addModule( $name, $class ) X-Ref |
Add or overwrite a module in this ApiMain instance. Intended for use by extending classes who wish to add their own modules to their lexicon or override the behavior of inherent ones. param: string $name The identifier for this module. param: ApiBase $class The class where this module is implemented. |
addFormat( $name, $class ) X-Ref |
Add or overwrite an output format for this ApiMain. Intended for use by extending classes who wish to add to or modify current formatters. param: string $name The identifier for this format. param: ApiFormatBase $class The class implementing this format. |
getModules() X-Ref |
Get the array mapping module names to class names return: array |
getFormats() X-Ref |
Returns the list of supported formats in form ( 'format' => 'ClassName' ) return: array |
Class: UsageException - X-Ref
This exception will be thrown when dieUsage is called to stop module execution.__construct( $message, $codestr, $code = 0, $extradata = null ) X-Ref |
param: string $message param: string $codestr param: int $code param: array|null $extradata |
getCodeString() X-Ref |
return: string |
getMessageArray() X-Ref |
return: array |
__toString() X-Ref |
return: string |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |