39 protected $origin = self::ORIGIN_CORE_SITEWIDE;
123 $dataPath = $this->localBasePath .
'/' .
$options[
'data'];
124 $data = json_decode( file_get_contents( $dataPath ),
true );
138 &&
$options[
'selectorWithoutVariant'];
144 "Given 'selectorWithoutVariant' but no 'selectorWithVariant'."
149 "Given 'selectorWithVariant' but no 'selectorWithoutVariant'."
154 "Incompatible 'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given."
159 "None of 'prefix', 'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given."
167 if ( !is_array( $option ) ) {
169 "Invalid list error. '$option' given, array expected."
172 if ( !isset( $option[
'default'] ) ) {
174 $option = [
'default' => $option ];
176 foreach ( $option
as $skin => $data ) {
177 if ( !is_array( $option ) ) {
179 "Invalid list error. '$option' given, array expected."
183 $this->{$member} = $option;
188 case 'selectorWithoutVariant':
189 case 'selectorWithVariant':
190 $this->{$member} = (
string)$option;
194 $this->selectorWithoutVariant = $this->selectorWithVariant = (
string)$option;
239 if ( !isset( $this->imageObjects ) ) {
241 $this->imageObjects = [];
243 if ( !isset( $this->imageObjects[
$skin] ) ) {
244 $this->imageObjects[
$skin] = [];
245 if ( !isset( $this->images[$skin] ) ) {
246 $this->images[
$skin] = isset( $this->images[
'default'] ) ?
247 $this->images[
'default'] :
253 $allowedVariants = array_merge(
257 if ( isset( $this->variants[$skin] ) ) {
258 $variantConfig = array_intersect_key(
259 $this->variants[$skin],
260 array_fill_keys( $allowedVariants,
true )
270 $this->localBasePath,
277 return $this->imageObjects[
$skin];
288 if ( !isset( $this->globalVariants ) ) {
290 $this->globalVariants = [];
292 if ( !isset( $this->globalVariants[
$skin] ) ) {
293 $this->globalVariants[
$skin] = [];
294 if ( !isset( $this->variants[$skin] ) ) {
295 $this->variants[
$skin] = isset( $this->variants[
'default'] ) ?
296 $this->variants[
'default'] :
306 return $this->globalVariants[
$skin];
323 $image->getDataUri( $context, null,
'original' ),
324 $image->getUrl( $context, $script, null,
'rasterized' )
326 $declarations = implode(
"\n\t", $declarations );
328 $selectors[
'selectorWithoutVariant'],
335 $rules[] =
"$selector {\n\t$declarations\n}";
337 foreach (
$image->getVariants()
as $variant ) {
339 $image->getDataUri( $context, $variant,
'original' ),
340 $image->getUrl( $context, $script, $variant,
'rasterized' )
342 $declarations = implode(
"\n\t", $declarations );
344 $selectors[
'selectorWithVariant'],
348 '{variant}' => $variant,
351 $rules[] =
"$selector {\n\t$declarations\n}";
355 $style = implode(
"\n", $rules );
356 return [
'all' => $style ];
373 "background-image: url($fallback);",
374 "background-image: linear-gradient(transparent, transparent), url($primary);",
376 "background-image: -o-linear-gradient(transparent, transparent), url($fallback);",
395 $summary = parent::getDefinitionSummary( $context );
403 'selectorWithoutVariant',
404 'selectorWithVariant',
406 $options[$member] = $this->{$member};
426 return array_map( [ __CLASS__,
'safeFileHash' ],
$files );
444 if ( array_key_exists(
'localBasePath',
$options ) ) {
463 return self::LOAD_STYLES;
getImages(ResourceLoaderContext $context)
Get ResourceLoaderImage objects for all images.
Class encapsulating an image used in a ResourceLoaderImageModule.
ResourceLoader module for generated and embedded images.
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
getImage($name, ResourceLoaderContext $context)
Get a ResourceLoaderImage object for given image.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
getCssDeclarations($primary, $fallback)
SVG support using a transparent gradient to guarantee cross-browser compatibility (browsers able to u...
when a variable name is used in a it is silently declared as a new local masking the global
getFileHashes(ResourceLoaderContext $context)
Helper method for getDefinitionSummary.
getGlobalVariants(ResourceLoaderContext $context)
Get list of variants in this module that are 'global', i.e., available for every image regardless of ...
getSource()
Get the origin of this module.
getDefinitionSummary(ResourceLoaderContext $context)
Get the definition summary for this module.
getStyles(ResourceLoaderContext $context)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
getPrefix()
Get CSS class prefix used by this module.
string $localBasePath
Local base path, see __construct()
getSelectors()
Get CSS selector templates used by this module.
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
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
__construct($options=[], $localBasePath=null)
Constructs a new module from an options array.
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this definition
static extractLocalBasePath($options, $localBasePath=null)
Extract a local base path from module definition information.
string $position
Position on the page to load this module at.
getName()
Get this module's name.
loadFromDefinition()
Parse definition and external JSON data, if referenced.
Object passed around to modules which contains information about the state of a specific loader reque...