2015-08-01 05:17:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class representing a list of resources for one gadget
|
|
|
|
*/
|
|
|
|
class GadgetResourceLoaderModule extends ResourceLoaderWikiModule {
|
2015-08-03 06:34:16 +00:00
|
|
|
private $pages, $dependencies, $messages;
|
2015-08-01 05:17:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an instance of this class
|
|
|
|
*
|
|
|
|
* @param $pages Array: Associative array of pages in ResourceLoaderWikiModule-compatible
|
|
|
|
* format, for example:
|
|
|
|
* array(
|
|
|
|
* 'MediaWiki:Gadget-foo.js' => array( 'type' => 'script' ),
|
|
|
|
* 'MediaWiki:Gadget-foo.css' => array( 'type' => 'style' ),
|
|
|
|
* )
|
|
|
|
* @param $dependencies Array: Names of resources this module depends on
|
|
|
|
* @param $targets Array: List of targets this module support
|
|
|
|
* @param $position String: 'bottom' or 'top'
|
2015-08-03 06:34:16 +00:00
|
|
|
* @param $messages Array
|
2015-08-01 05:17:35 +00:00
|
|
|
*/
|
2015-08-03 06:34:16 +00:00
|
|
|
public function __construct( $pages, $dependencies, $targets, $position, $messages ) {
|
2015-08-01 05:17:35 +00:00
|
|
|
$this->pages = $pages;
|
|
|
|
$this->dependencies = $dependencies;
|
|
|
|
$this->targets = $targets;
|
|
|
|
$this->position = $position;
|
2015-08-03 06:34:16 +00:00
|
|
|
$this->messages = $messages;
|
2015-08-01 05:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overrides the abstract function from ResourceLoaderWikiModule class
|
|
|
|
* @param $context ResourceLoaderContext
|
|
|
|
* @return Array: $pages passed to __construct()
|
|
|
|
*/
|
|
|
|
protected function getPages( ResourceLoaderContext $context ) {
|
|
|
|
return $this->pages;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overrides ResourceLoaderModule::getDependencies()
|
|
|
|
* @param $context ResourceLoaderContext
|
|
|
|
* @return Array: Names of resources this module depends on
|
|
|
|
*/
|
|
|
|
public function getDependencies( ResourceLoaderContext $context = null ) {
|
|
|
|
return $this->dependencies;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overrides ResourceLoaderModule::getPosition()
|
|
|
|
* @return String: 'bottom' or 'top'
|
|
|
|
*/
|
|
|
|
public function getPosition() {
|
|
|
|
return $this->position;
|
|
|
|
}
|
2015-08-03 06:34:16 +00:00
|
|
|
|
|
|
|
public function getMessages() {
|
|
|
|
return $this->messages;
|
|
|
|
}
|
2015-08-01 05:17:35 +00:00
|
|
|
}
|