MediaWiki  1.23.14
ApiFormatPhp.php
Go to the documentation of this file.
1 <?php
31 class ApiFormatPhp extends ApiFormatBase {
32 
33  public function getMimeType() {
34  return 'application/vnd.php.serialized';
35  }
36 
37  public function execute() {
38  $text = serialize( $this->getResultData() );
39 
40  // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
41  // Flash, but what it does isn't friendly for the API. There's nothing
42  // we can do here that isn't actively broken in some manner, so let's
43  // just be broken in a useful manner.
44  if ( $this->getConfig()->get( 'MangleFlashPolicy' ) &&
45  in_array( 'wfOutputHandler', ob_list_handlers(), true ) &&
46  preg_match( '/<\s*cross-domain-policy(?=\s|>)/i', $text )
47  ) {
48  $this->dieUsage(
49  'This response cannot be represented using format=php. See https://bugzilla.wikimedia.org/show_bug.cgi?id=66776',
50  'internalerror'
51  );
52  }
53 
54  $this->printText( $text );
55  }
56 
57  public function getDescription() {
58  return 'Output data in serialized PHP format' . parent::getDescription();
59  }
60 }
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:67
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ApiFormatBase
This is the abstract base class for API formatters.
Definition: ApiFormatBase.php:32
ApiFormatPhp\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiFormatPhp.php:37
ApiFormatPhp\getMimeType
getMimeType()
Overriding class returns the mime type that should be sent to the client.
Definition: ApiFormatPhp.php:33
ApiFormatPhp\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiFormatPhp.php:57
ApiBase\dieUsage
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
Definition: ApiBase.php:1383
ApiBase\getResultData
getResultData()
Get the result data array (read-only)
Definition: ApiBase.php:219
ApiFormatBase\printText
printText( $text)
The main format printing function.
Definition: ApiFormatBase.php:229
ApiFormatPhp
API Serialized PHP output formatter.
Definition: ApiFormatPhp.php:31