Go to the documentation of this file.
51 case 'resourceLoaded':
52 case 'requiredRights':
59 $this->{$member} = $option;
62 throw new InvalidArgumentException(
"Unrecognized '$member' parameter" );
76 $prefixGadgetNs =
function ( $page ) {
77 return 'Gadget:' . $page;
81 'resourceLoaded' =>
true,
82 'requiredRights' => $data[
'settings'][
'rights'],
83 'onByDefault' => $data[
'settings'][
'default'],
84 'hidden' => $data[
'settings'][
'hidden'],
85 'requiredSkins' => $data[
'settings'][
'skins'],
86 'category' => $data[
'settings'][
'category'],
87 'scripts' => array_map( $prefixGadgetNs, $data[
'module'][
'scripts'] ),
88 'styles' => array_map( $prefixGadgetNs, $data[
'module'][
'styles'] ),
89 'dependencies' => $data[
'module'][
'dependencies'],
90 'peers' => $data[
'module'][
'peers'],
91 'messages' => $data[
'module'][
'messages'],
92 'type' => $data[
'module'][
'type'],
95 return new self( $info );
105 return new self( [
'name' => $id ] );
115 return strlen( $id ) > 0 && ResourceLoader::isValidModuleName( self::getModuleName( $id ) );
129 return wfMessage(
"gadget-{$this->getName()}" )->parse();
136 return wfMessage(
"gadget-{$this->getName()}" )->plain();
151 return "ext.gadget.{$id}";
161 return (
bool)
$user->getOption(
"gadget-{$this->name}", $this->onByDefault );
171 return $user->isAllowedAll( ...$this->requiredRights );
196 return (
count( $this->requiredSkins ) === 0
212 return count( $this->styles )
242 return array_merge( $this->
scripts, $this->styles );
312 if ( $this->
type ===
'styles' || $this->
type ===
'general' ) {
316 if ( $this->styles && !$this->
scripts && !$this->dependencies ) {
isAllowed(User $user)
Checks whether given user has permissions to use this gadget.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
static getModuleName( $id)
isSkinSupported(Skin $skin)
Check if this gadget is compatible with a skin.
getRequiredRights()
Returns array of permissions required by this gadget.
static newFromDefinitionContent( $id, GadgetDefinitionContent $content)
Create a object based on the metadata in a GadgetDefinitionContent object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getPeers()
Get list of extra modules that should be loaded when this gadget is enabled.
__construct(array $options)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
getRequiredSkins()
Returns array of skins where this gadget works.
static newEmptyGadget( $id)
Get a placeholder object to use if a gadget doesn't exist.
getType()
Returns the load type of this Gadget's ResourceLoader module.
getLegacyScripts()
Returns list of scripts that don't support ResourceLoader.
static isValidGadgetID( $id)
Whether the provided gadget id is valid.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
isEnabled( $user)
Checks whether this gadget is enabled for given user.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
The main skin class which provides methods and properties for all other skins.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
const GADGET_CLASS_VERSION
Increment this when changing class structure.
getDependencies()
Returns names of resources this gadget depends on.