42 foreach (
$options as $member => $option ) {
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 ] );
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
197 || in_array( $skin->getSkinName(), $this->requiredSkins )
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 ) {
const GADGET_CLASS_VERSION
Increment this when changing class structure.
getType()
Returns the load type of this Gadget's ResourceLoader module.
__construct(array $options)
static isValidGadgetID( $id)
Whether the provided gadget id is valid.
static getModuleName( $id)
static newFromDefinitionContent( $id, GadgetDefinitionContent $content)
Create a object based on the metadata in a GadgetDefinitionContent object.
static newEmptyGadget( $id)
Get a placeholder object to use if a gadget doesn't exist.
getPeers()
Get list of extra modules that should be loaded when this gadget is enabled.
getLegacyScripts()
Returns list of scripts that don't support ResourceLoader.
getRequiredSkins()
Returns array of skins where this gadget works.
isAllowed(User $user)
Checks whether given user has permissions to use this gadget.
isSkinSupported(Skin $skin)
Check if this gadget is compatible with a skin.
getDependencies()
Returns names of resources this gadget depends on.
isEnabled( $user)
Checks whether this gadget is enabled for given user.
getRequiredRights()
Returns array of permissions required by this gadget.
static isValidModuleName( $moduleName)
Check a module name for validity.
The main skin class which provides methods and properties for all other skins.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
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
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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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))
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