Go to the documentation of this file.
52 case 'resourceLoaded':
53 case 'requiredRights':
60 $this->{$member} = $option;
63 throw new InvalidArgumentException(
"Unrecognized '$member' parameter" );
77 $prefixGadgetNs =
function (
$page ) {
78 return 'Gadget:' .
$page;
82 'resourceLoaded' =>
true,
83 'requiredRights' => $data[
'settings'][
'rights'],
84 'onByDefault' => $data[
'settings'][
'default'],
85 'hidden' => $data[
'settings'][
'hidden'],
86 'requiredSkins' => $data[
'settings'][
'skins'],
87 'category' => $data[
'settings'][
'category'],
88 'scripts' => array_map( $prefixGadgetNs, $data[
'module'][
'scripts'] ),
89 'styles' => array_map( $prefixGadgetNs, $data[
'module'][
'styles'] ),
90 'dependencies' => $data[
'module'][
'dependencies'],
91 'peers' => $data[
'module'][
'peers'],
92 'messages' => $data[
'module'][
'messages'],
93 'type' => $data[
'module'][
'type'],
96 return new self( $info );
107 return new self( [
'name' => $id ] );
132 return wfMessage(
"gadget-{$this->getName()}" )->parse();
139 return wfMessage(
"gadget-{$this->getName()}" )->plain();
154 return "ext.gadget.{$id}";
164 return (
bool)
$user->getOption(
"gadget-{$this->name}", $this->onByDefault );
174 return count( array_intersect( $this->requiredRights,
$user->getRights() ) ) ==
count( $this->requiredRights )
203 return count( $this->styles )
233 return array_merge( $this->
scripts, $this->styles );
303 if ( $this->
type ===
'styles' || $this->
type ===
'general' ) {
306 if ( $this->styles && !$this->
scripts && !$this->dependencies ) {
static getModuleName( $id)
getRequiredRights()
Returns array of permissions required by 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 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)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
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.
isAllowed( $user)
Checks whether given user has permissions to use this gadget.
getLegacyScripts()
Returns list of scripts that don't support ResourceLoader.
static isValidGadgetID( $id)
Whether the provided gadget id is valid.
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
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
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 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 "<
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
const GADGET_CLASS_VERSION
Increment this when changing class structure.
the array() calling protocol came about after MediaWiki 1.4rc1.
getDependencies()
Returns names of resources this gadget depends on.