[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/resourceloader/ -> ResourceLoaderFileModule.php (summary)

Resource loader module based on local JavaScript/CSS files. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Trevor Parscal
Author: Roan Kattouw
File Size: 937 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ResourceLoaderFileModule:: (33 methods):
  __construct()
  extractBasePaths()
  getScript()
  getScriptURLsForDebug()
  supportsURLLoading()
  getLoaderScript()
  getStyles()
  getStyleURLsForDebug()
  getMessages()
  getGroup()
  getPosition()
  getDependencies()
  getSkipFunction()
  isRaw()
  getModifiedTime()
  getDefinitionSummary()
  getLocalPath()
  getRemotePath()
  getStyleSheetLang()
  collateFilePathListByOption()
  tryForKey()
  getScriptFiles()
  getStyleFiles()
  getSkinStyleFiles()
  getAllSkinStyleFiles()
  getAllStyleFiles()
  readScriptFiles()
  readStyleFiles()
  readStyleFile()
  getFlip()
  getTargets()
  compileLessFile()
  getLessCompiler()


Class: ResourceLoaderFileModule  - X-Ref

ResourceLoader module based on local JavaScript/CSS files.

__construct($options = array()   X-Ref
Constructs a new module from an options array.

param: array $options List of options; if not given or empty, an empty module will be
param: string $localBasePath Base path to prepend to all local paths in $options. Defaults
param: string $remoteBasePath Base path to prepend to all remote paths in $options. Defaults

extractBasePaths($options = array()   X-Ref
Extract a pair of local and remote base paths from module definition information.
Implementation note: the amount of global state used in this function is staggering.

param: array $options Module definition
param: string $localBasePath Path to use if not provided in module definition. Defaults
param: string $remoteBasePath Path to use if not provided in module definition. Defaults
return: array Array( localBasePath, remoteBasePath )

getScript( ResourceLoaderContext $context )   X-Ref
Gets all scripts for a given context concatenated together.

param: ResourceLoaderContext $context Context in which to generate script
return: string JavaScript code for $context

getScriptURLsForDebug( ResourceLoaderContext $context )   X-Ref

param: ResourceLoaderContext $context
return: array

supportsURLLoading()   X-Ref

return: bool

getLoaderScript()   X-Ref
Get loader script.

return: string|bool JavaScript code to be added to startup module

getStyles( ResourceLoaderContext $context )   X-Ref
Get all styles for a given context.

param: ResourceLoaderContext $context
return: array CSS code for $context as an associative array mapping media type to CSS text.

getStyleURLsForDebug( ResourceLoaderContext $context )   X-Ref

param: ResourceLoaderContext $context
return: array

getMessages()   X-Ref
Gets list of message keys used by this module.

return: array List of message keys

getGroup()   X-Ref
Gets the name of the group this module should be loaded in.

return: string Group name

getPosition()   X-Ref

return: string

getDependencies()   X-Ref
Gets list of names of modules this module depends on.

return: array List of module names

getSkipFunction()   X-Ref
Get the skip function.

return: string|null

isRaw()   X-Ref

return: bool

getModifiedTime( ResourceLoaderContext $context )   X-Ref
Get the last modified timestamp of this module.

Last modified timestamps are calculated from the highest last modified
timestamp of this module's constituent files as well as the files it
depends on. This function is context-sensitive, only performing
calculations on files relevant to the given language, skin and debug
mode.

param: ResourceLoaderContext $context Context in which to calculate
return: int UNIX timestamp

getDefinitionSummary( ResourceLoaderContext $context )   X-Ref
Get the definition summary for this module.

param: ResourceLoaderContext $context
return: array

getLocalPath( $path )   X-Ref

param: string|ResourceLoaderFilePath $path
return: string

getRemotePath( $path )   X-Ref

param: string|ResourceLoaderFilePath $path
return: string

getStyleSheetLang( $path )   X-Ref
Infer the stylesheet language from a stylesheet file path.

param: string $path
return: string The stylesheet language name

collateFilePathListByOption( array $list, $option, $default )   X-Ref
Collates file paths by option (where provided).

param: array $list List of file paths in any combination of index/path
param: string $option Option name
param: mixed $default Default value if the option isn't set
return: array List of file paths, collated by $option

tryForKey( array $list, $key, $fallback = null )   X-Ref
Get a list of element that match a key, optionally using a fallback key.

param: array $list List of lists to select from
param: string $key Key to look for in $map
param: string $fallback Key to look for in $list if $key doesn't exist
return: array List of elements from $map which matched $key or $fallback,

getScriptFiles( ResourceLoaderContext $context )   X-Ref
Get a list of file paths for all scripts in this module, in order of proper execution.

param: ResourceLoaderContext $context
return: array List of file paths

getStyleFiles( ResourceLoaderContext $context )   X-Ref
Get a list of file paths for all styles in this module, in order of proper inclusion.

param: ResourceLoaderContext $context
return: array List of file paths

getSkinStyleFiles( $skinName )   X-Ref
Gets a list of file paths for all skin styles in the module used by
the skin.

param: string $skinName The name of the skin
return: array A list of file paths collated by media type

getAllSkinStyleFiles()   X-Ref
Gets a list of file paths for all skin style files in the module,
for all available skins.

return: array A list of file paths collated by media type

getAllStyleFiles()   X-Ref
Returns all style files and all skin style files used by this module.

return: array

readScriptFiles( array $scripts )   X-Ref
Gets the contents of a list of JavaScript files.

param: array $scripts List of file paths to scripts to read, remap and concetenate
return: string Concatenated and remapped JavaScript data from $scripts

readStyleFiles( array $styles, $flip, $context = null )   X-Ref
Gets the contents of a list of CSS files.

param: array $styles List of media type/list of file paths pairs, to read, remap and
param: bool $flip
param: ResourceLoaderContext $context (optional)
return: array List of concatenated and remapped CSS data from $styles,

readStyleFile( $path, $flip, $context = null )   X-Ref
Reads a style file.

This method can be used as a callback for array_map()

param: string $path File path of style file to read
param: bool $flip
param: ResourceLoaderContext $context (optional)
return: string CSS data in script file

getFlip( $context )   X-Ref
Get whether CSS for this module should be flipped

param: ResourceLoaderContext $context
return: bool

getTargets()   X-Ref
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']

return: array Array of strings

compileLessFile( $fileName, $compiler = null )   X-Ref
Compile a LESS file into CSS.

Keeps track of all used files and adds them to localFileRefs.

param: string $fileName File path of LESS source
param: lessc $compiler Compiler to use, if not default
return: string CSS source

getLessCompiler( ResourceLoaderContext $context = null )   X-Ref
Get a LESS compiler instance for this module in given context.

Just calls ResourceLoader::getLessCompiler() by default to get a global compiler.

param: ResourceLoaderContext $context
return: lessc



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1