MediaWiki
1.33.0
|
Wrapper for one gadget. More...
Public Member Functions | |
__construct (array $options) | |
getCategory () | |
getDefinition () | |
getDependencies () | |
Returns names of resources this gadget depends on. More... | |
getDescription () | |
getLegacyScripts () | |
Returns list of scripts that don't support ResourceLoader. More... | |
getMessages () | |
getName () | |
getPeers () | |
Get list of extra modules that should be loaded when this gadget is enabled. More... | |
getRawDescription () | |
getRequiredRights () | |
Returns array of permissions required by this gadget. More... | |
getRequiredSkins () | |
Returns array of skins where this gadget works. More... | |
getScripts () | |
getScriptsAndStyles () | |
getStyles () | |
getTargets () | |
getType () | |
Returns the load type of this Gadget's ResourceLoader module. More... | |
hasModule () | |
isAllowed (User $user) | |
Checks whether given user has permissions to use this gadget. More... | |
isEnabled ( $user) | |
Checks whether this gadget is enabled for given user. More... | |
isHidden () | |
isOnByDefault () | |
isSkinSupported (Skin $skin) | |
Check if this gadget is compatible with a skin. More... | |
supportsResourceLoader () | |
Static Public Member Functions | |
static | getModuleName ( $id) |
static | isValidGadgetID ( $id) |
Whether the provided gadget id is valid. More... | |
static | newEmptyGadget ( $id) |
Get a placeholder object to use if a gadget doesn't exist. More... | |
static | newFromDefinitionContent ( $id, GadgetDefinitionContent $content) |
Create a object based on the metadata in a GadgetDefinitionContent object. More... | |
Public Attributes | |
$category | |
$definition | |
$dependencies = [] | |
$hidden = false | |
$messages = [] | |
$name | |
$onByDefault = false | |
$peers = [] | |
$requiredRights = [] | |
$requiredSkins = [] | |
$resourceLoaded = false | |
$styles = [] | |
$targets = [ 'desktop' ] | |
$type = '' | |
const | CACHE_TTL = 86400 |
const | GADGET_CLASS_VERSION = 9 |
Increment this when changing class structure. More... | |
Private Attributes | |
$scripts = [] | |
Wrapper for one gadget.
Definition at line 17 of file Gadget.php.
Gadget::__construct | ( | array | $options | ) |
Definition at line 41 of file Gadget.php.
Gadget::getCategory | ( | ) |
Definition at line 142 of file Gadget.php.
References $category.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getDefinition | ( | ) |
Definition at line 220 of file Gadget.php.
References $definition.
Gadget::getDependencies | ( | ) |
Returns names of resources this gadget depends on.
Definition at line 267 of file Gadget.php.
References $dependencies.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getDescription | ( | ) |
Definition at line 128 of file Gadget.php.
References wfMessage().
Gadget::getLegacyScripts | ( | ) |
Returns list of scripts that don't support ResourceLoader.
Definition at line 256 of file Gadget.php.
References $scripts, and supportsResourceLoader().
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getMessages | ( | ) |
Definition at line 287 of file Gadget.php.
References $messages.
Referenced by ApiQueryGadgets\fakeMetadata().
|
static |
string | $id | Name of gadget |
Definition at line 150 of file Gadget.php.
Referenced by GadgetHooks\beforePageDisplay(), GadgetHooks\registerModules(), and GadgetTest\testSimpleCases().
Gadget::getName | ( | ) |
Definition at line 121 of file Gadget.php.
References $name.
Referenced by ApiQueryGadgets\isNeeded().
Gadget::getPeers | ( | ) |
Get list of extra modules that should be loaded when this gadget is enabled.
Primary use case is to allow a Gadget that includes JavaScript to also load a (usually, hidden) styles-type module to be applied to the page. Dependencies don't work for this use case as those would not be part of page rendering.
Definition at line 280 of file Gadget.php.
References $peers.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getRawDescription | ( | ) |
Definition at line 135 of file Gadget.php.
References wfMessage().
Gadget::getRequiredRights | ( | ) |
Returns array of permissions required by this gadget.
Definition at line 295 of file Gadget.php.
References $requiredRights.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getRequiredSkins | ( | ) |
Returns array of skins where this gadget works.
Definition at line 303 of file Gadget.php.
References $requiredSkins.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::getScripts | ( | ) |
Definition at line 227 of file Gadget.php.
References $scripts.
Referenced by ApiQueryGadgets\fakeMetadata(), and GadgetResourceLoaderModule\getPages().
Gadget::getScriptsAndStyles | ( | ) |
Definition at line 241 of file Gadget.php.
References scripts.
Gadget::getStyles | ( | ) |
Definition at line 234 of file Gadget.php.
References $styles.
Referenced by ApiQueryGadgets\fakeMetadata(), and GadgetResourceLoaderModule\getPages().
Gadget::getTargets | ( | ) |
Gadget::getType | ( | ) |
Gadget::hasModule | ( | ) |
Definition at line 211 of file Gadget.php.
References captcha-old\count, scripts, and supportsResourceLoader().
Gadget::isAllowed | ( | User | $user | ) |
Checks whether given user has permissions to use this gadget.
User | $user | The user to check against |
Definition at line 170 of file Gadget.php.
References $user.
Referenced by ApiQueryGadgets\isNeeded().
Gadget::isEnabled | ( | $user | ) |
Checks whether this gadget is enabled for given user.
User | $user | user to check against |
Definition at line 160 of file Gadget.php.
References $user.
Referenced by ApiQueryGadgets\isNeeded().
Gadget::isHidden | ( | ) |
Definition at line 185 of file Gadget.php.
References $hidden.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::isOnByDefault | ( | ) |
Definition at line 178 of file Gadget.php.
References $onByDefault.
Referenced by ApiQueryGadgets\fakeMetadata().
Gadget::isSkinSupported | ( | Skin | $skin | ) |
Check if this gadget is compatible with a skin.
Skin | $skin | The skin to check against |
Definition at line 195 of file Gadget.php.
References $requiredSkins, $skin, and captcha-old\count.
|
static |
Whether the provided gadget id is valid.
string | $id |
Definition at line 114 of file Gadget.php.
Referenced by MediaWikiGadgetsDefinitionRepo\newFromDefinition().
|
static |
Get a placeholder object to use if a gadget doesn't exist.
string | $id | name |
Definition at line 104 of file Gadget.php.
Referenced by GadgetResourceLoaderModule\getGadget().
|
static |
Create a object based on the metadata in a GadgetDefinitionContent object.
string | $id | |
GadgetDefinitionContent | $content |
Definition at line 74 of file Gadget.php.
References $content, and $data.
Referenced by GadgetDefinitionNamespaceRepo\getGadget().
Gadget::supportsResourceLoader | ( | ) |
Definition at line 204 of file Gadget.php.
References $resourceLoaded.
Referenced by getLegacyScripts(), GadgetResourceLoaderModule\getPages(), and hasModule().
Gadget::$category |
Definition at line 38 of file Gadget.php.
Referenced by getCategory().
Gadget::$definition |
Definition at line 29 of file Gadget.php.
Referenced by getDefinition().
Gadget::$dependencies = [] |
Definition at line 27 of file Gadget.php.
Referenced by getDependencies().
Gadget::$hidden = false |
Definition at line 37 of file Gadget.php.
Referenced by isHidden().
Gadget::$messages = [] |
Definition at line 29 of file Gadget.php.
Referenced by getMessages().
Gadget::$name |
Definition at line 29 of file Gadget.php.
Referenced by getName().
Gadget::$onByDefault = false |
Definition at line 36 of file Gadget.php.
Referenced by isOnByDefault().
Gadget::$peers = [] |
Definition at line 28 of file Gadget.php.
Referenced by getPeers().
Gadget::$requiredRights = [] |
Definition at line 33 of file Gadget.php.
Referenced by getRequiredRights().
Gadget::$requiredSkins = [] |
Definition at line 34 of file Gadget.php.
Referenced by getRequiredSkins(), and isSkinSupported().
Gadget::$resourceLoaded = false |
Definition at line 32 of file Gadget.php.
Referenced by supportsResourceLoader().
|
private |
Definition at line 25 of file Gadget.php.
Referenced by getLegacyScripts(), and getScripts().
Gadget::$styles = [] |
Definition at line 26 of file Gadget.php.
Referenced by getStyles().
Gadget::$targets = [ 'desktop' ] |
Definition at line 35 of file Gadget.php.
Referenced by getTargets().
Gadget::$type = '' |
Definition at line 38 of file Gadget.php.
Referenced by getType().
const Gadget::CACHE_TTL = 86400 |
Definition at line 23 of file Gadget.php.
Referenced by MediaWikiGadgetsDefinitionRepo\loadGadgets().
const Gadget::GADGET_CLASS_VERSION = 9 |
Increment this when changing class structure.
Definition at line 21 of file Gadget.php.
Referenced by MediaWikiGadgetsDefinitionRepo\getDefinitionCacheKey(), and GadgetDefinitionNamespaceRepo\getGadgetCacheKey().