MediaWiki REL1_31
MultimediaViewerHooks Class Reference

Static Public Member Functions

static getBetaPreferences ( $user, &$prefs)
 Add a beta preference to gate the feature.
 
static getModulesForArticle (&$out, &$skin)
 Handler for BeforePageDisplay hook Add JavaScript to the page when an image is on it and the user has enabled the feature if BetaFeatures is installed.
 
static getModulesForCategory (&$catPage)
 Handler for CategoryPageView hook Add JavaScript to the page if there are images in the category.
 
static getPreferences ( $user, &$prefs)
 Adds a default-enabled preference to gate the feature on non-beta sites.
 
static getTestModules (array &$testModules, ResourceLoader &$resourceLoader)
 Get modules for testing our JavaScript.
 
static makeGlobalVariablesScript (&$vars, OutputPage $out)
 Export variables which depend on the current user.
 
static onEventLoggingRegisterSchemas (array &$schemas)
 
static onExtensionFunctions ()
 
static onUserGetDefaultOptions (&$defaultOptions)
 
static resourceLoaderGetConfigVars (&$vars)
 Export variables used in both PHP and JS to keep DRY.
 
static thumbnailBeforeProduceHTML (ThumbnailImage $thumbnail, array &$attribs, &$linkAttribs)
 Modify thumbnail DOM.
 

Static Protected Member Functions

static getModules (&$out)
 Handler for all places where we add the modules Could be on article pages or on Category pages.
 
static shouldHandleClicks ( $user)
 Checks the context for whether to load the viewer.
 

Static Protected Attributes

static $discussionLink
 Link to a page where this module can be discussed.
 
static $helpLink
 Link to help about this module.
 
static $infoLink
 Link to more information about this module.
 

Detailed Description

Definition at line 24 of file MultimediaViewerHooks.php.

Member Function Documentation

◆ getBetaPreferences()

static MultimediaViewerHooks::getBetaPreferences ( $user,
& $prefs )
static

Add a beta preference to gate the feature.

Parameters
User$user
array&$prefs
Returns
true

Definition at line 151 of file MultimediaViewerHooks.php.

References $discussionLink, $helpLink, $infoLink, $wgExtensionAssetsPath, and $wgMediaViewerIsInBeta.

◆ getModules()

static MultimediaViewerHooks::getModules ( & $out)
staticprotected

Handler for all places where we add the modules Could be on article pages or on Category pages.

Parameters
OutputPage&$out
Returns
bool

Definition at line 99 of file MultimediaViewerHooks.php.

References $out.

Referenced by getModulesForArticle(), and getModulesForCategory().

◆ getModulesForArticle()

static MultimediaViewerHooks::getModulesForArticle ( & $out,
& $skin )
static

Handler for BeforePageDisplay hook Add JavaScript to the page when an image is on it and the user has enabled the feature if BetaFeatures is installed.

Parameters
OutputPage&$out
Skin&$skin
Returns
bool

Definition at line 113 of file MultimediaViewerHooks.php.

References $out, getModules(), NS_FILE, and NS_SPECIAL.

◆ getModulesForCategory()

static MultimediaViewerHooks::getModulesForCategory ( & $catPage)
static

Handler for CategoryPageView hook Add JavaScript to the page if there are images in the category.

Parameters
CategoryPage&$catPage
Returns
bool

Definition at line 134 of file MultimediaViewerHooks.php.

References $out, and getModules().

◆ getPreferences()

static MultimediaViewerHooks::getPreferences ( $user,
& $prefs )
static

Adds a default-enabled preference to gate the feature on non-beta sites.

Parameters
User$user
array&$prefs
Returns
true

Definition at line 179 of file MultimediaViewerHooks.php.

References $wgMediaViewerIsInBeta.

◆ getTestModules()

static MultimediaViewerHooks::getTestModules ( array & $testModules,
ResourceLoader & $resourceLoader )
static

Get modules for testing our JavaScript.

Parameters
array&$testModules
ResourceLoader&$resourceLoader
Returns
bool

Definition at line 251 of file MultimediaViewerHooks.php.

◆ makeGlobalVariablesScript()

static MultimediaViewerHooks::makeGlobalVariablesScript ( & $vars,
OutputPage $out )
static

Export variables which depend on the current user.

Parameters
array&$vars
OutputPage$out

Definition at line 235 of file MultimediaViewerHooks.php.

References $out, $vars, User\getDefaultOptions(), and shouldHandleClicks().

◆ onEventLoggingRegisterSchemas()

static MultimediaViewerHooks::onEventLoggingRegisterSchemas ( array & $schemas)
static

Definition at line 57 of file MultimediaViewerHooks.php.

◆ onExtensionFunctions()

static MultimediaViewerHooks::onExtensionFunctions ( )
static

Definition at line 47 of file MultimediaViewerHooks.php.

References $wgResourceModules.

◆ onUserGetDefaultOptions()

static MultimediaViewerHooks::onUserGetDefaultOptions ( & $defaultOptions)
static

Definition at line 37 of file MultimediaViewerHooks.php.

References $wgMediaViewerEnableByDefault.

◆ resourceLoaderGetConfigVars()

◆ shouldHandleClicks()

static MultimediaViewerHooks::shouldHandleClicks ( $user)
staticprotected

Checks the context for whether to load the viewer.

Parameters
User$user
Returns
bool

Definition at line 72 of file MultimediaViewerHooks.php.

References $wgMediaViewerEnableByDefault, $wgMediaViewerEnableByDefaultForAnonymous, and $wgMediaViewerIsInBeta.

Referenced by makeGlobalVariablesScript().

◆ thumbnailBeforeProduceHTML()

static MultimediaViewerHooks::thumbnailBeforeProduceHTML ( ThumbnailImage $thumbnail,
array & $attribs,
& $linkAttribs )
static

Modify thumbnail DOM.

Parameters
ThumbnailImage$thumbnail
array&$attribsAttributes of the element
array | bool&$linkAttribsAttributes of the wrapping element
Returns
true

Definition at line 328 of file MultimediaViewerHooks.php.

References $attribs.

Member Data Documentation

◆ $discussionLink

MultimediaViewerHooks::$discussionLink
staticprotected
Initial value:
=
'https://mediawiki.org/wiki/Special:MyLanguage/Extension_talk:Media_Viewer/About'

Link to a page where this module can be discussed.

Definition at line 30 of file MultimediaViewerHooks.php.

Referenced by getBetaPreferences(), and resourceLoaderGetConfigVars().

◆ $helpLink

MultimediaViewerHooks::$helpLink
staticprotected
Initial value:
=
'https://mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Media_Viewer'

Link to help about this module.

Definition at line 34 of file MultimediaViewerHooks.php.

Referenced by getBetaPreferences(), and resourceLoaderGetConfigVars().

◆ $infoLink

MultimediaViewerHooks::$infoLink
staticprotected
Initial value:
=
'https://mediawiki.org/wiki/Special:MyLanguage/Extension:Media_Viewer/About'

Link to more information about this module.

Definition at line 26 of file MultimediaViewerHooks.php.

Referenced by getBetaPreferences(), and resourceLoaderGetConfigVars().


The documentation for this class was generated from the following file: