MobileFrontend
Mobile optimised frontend for MediaWiki
|
Hook handlers for MobileFrontend extension. More...
Public Member Functions | |
__construct (HookContainer $hookContainer, Config $config, SkinFactory $skinFactory, UserOptionsLookup $userOptionsLookup, WatchlistManager $watchlistManager, MobileContext $mobileContext, FeaturesManager $featuresManager, ?GadgetRepo $gadgetRepo) | |
onRequestContextCreateSkin ( $context, &$skin) | |
RequestContextCreateSkin hook handler. | |
onSkinAddFooterLinks (Skin $skin, string $key, array &$footerLinks) | |
Update the footer. | |
onSkinAfterBottomScripts ( $skin, &$html) | |
SkinAfterBottomScripts hook handler. | |
onBeforeDisplayNoArticleText ( $article) | |
BeforeDisplayNoArticleText hook handler. | |
onOutputPageBeforeHTML ( $out, &$text) | |
OutputPageBeforeHTML hook handler. | |
onBeforePageRedirect ( $out, &$redirect, &$code) | |
BeforePageRedirect hook handler. | |
onMediaWikiPerformAction ( $output, $article, $title, $user, $request, $entryPoint) | |
MediaWikiPerformActionHook hook handler. | |
onResourceLoaderSiteStylesModulePages ( $skin, array &$pages) | |
ResourceLoaderSiteStylesModulePages hook handler. | |
onResourceLoaderSiteModulePages ( $skin, array &$pages) | |
ResourceLoaderSiteModulePages hook handler. | |
onGetCacheVaryCookies ( $out, &$cookies) | |
GetCacheVaryCookies hook handler. | |
shouldMobileFormatSpecialPages ( $user) | |
Should special pages be replaced with mobile formatted equivalents? | |
onSpecialPage_initList (&$list) | |
Hook for SpecialPage_initList in SpecialPageFactory. | |
onListDefinedTags (&$tags) | |
ListDefinedTags hook handler. | |
onChangeTagsListActive (&$tags) | |
ChangeTagsListActive hook handler. | |
addDefinedTags (&$tags) | |
onRecentChange_save ( $recentChange) | |
RecentChange_save hook handler that tags mobile changes. | |
onManualLogEntryBeforePublish ( $logEntry) | |
ManualLogEntryBeforePublish hook handler that tags actions logged when user uses mobile mode. | |
onSpecialPageBeforeExecute ( $special, $subpage) | |
Invocation of hook SpecialPageBeforeExecute. | |
onPostLoginRedirect (&$returnTo, &$returnToQuery, &$type) | |
PostLoginRedirect hook handler. | |
onAfterBuildFeedLinks (&$tags) | |
AfterBuildFeedLinks hook handler. | |
onUserGetDefaultOptions (&$defaultUserOptions) | |
Register default preferences for MobileFrontend. | |
onGetPreferences ( $user, &$preferences) | |
GetPreferences hook handler. | |
onOutputPageParserOutput ( $outputPage, $po) | |
OutputPageParserOutput hook handler. | |
onArticleParserOptions (Article $article, ParserOptions $parserOptions) | |
ArticleParserOptions hook handler. | |
onHTMLFileCache__useFileCache ( $context) | |
HTMLFileCache::useFileCache hook handler Disables file caching for mobile pageviews. | |
onLoginFormValidErrorMessages (array &$messages) | |
LoginFormValidErrorMessages hook handler to promote MF specific error message be valid. | |
onTitleSquidURLs ( $title, &$urls) | |
Handler for TitleSquidURLs hook to add copies of the cache purge URLs which are transformed according to the wgMobileUrlCallback, so that both mobile and non-mobile URL variants get purged. | |
onAuthChangeFormFields ( $requests, $fieldInfo, &$formDescriptor, $action) | |
Handler for the AuthChangeFormFields hook to add a logo on top of the login screen. | |
onAPIQuerySiteInfoGeneralInfo ( $module, &$result) | |
Add the base mobile site URL to the siteinfo API output. | |
Static Public Member Functions | |
static | getResourceLoaderMFConfigVars () |
Generate config for usage inside MobileFrontend This should be used for variables which: | |
static | onAbuseFilterBuilder (&$builder) |
AbuseFilter-builder hook handler that adds user_mobile variable to list of valid vars. | |
static | onCentralAuthSilentLoginRedirect ( $centralUser, &$url, $info) |
CentralAuthSilentLoginRedirect hook handler Points redirects from CentralAuth wiki to mobile domain if user has logged in from it. | |
static | findTagline (ParserOutput $po, $fallbackWikibaseDescriptionFunc) |
Finds the wikidata tagline associated with the page. | |
Protected Member Functions | |
getDefaultMobileSkin () | |
Obtain the default mobile skin. | |
Hook handlers for MobileFrontend extension.
If your hook changes the behaviour of the Minerva skin, you are in the wrong place. Any changes relating to Minerva should go into Minerva.hooks.php
MobileFrontendHooks::addDefinedTags | ( | & | $tags | ) |
array | &$tags |
|
static |
Finds the wikidata tagline associated with the page.
ParserOutput | $po | |
callable | $fallbackWikibaseDescriptionFunc | A fallback to provide Wikibase description. Function takes wikibase_item as a first and only argument |
|
protected |
Obtain the default mobile skin.
SkinException | If a factory function isn't registered for the skin name |
|
static |
Generate config for usage inside MobileFrontend This should be used for variables which:
|
static |
AbuseFilter-builder hook handler that adds user_mobile variable to list of valid vars.
array | &$builder | Array in AbuseFilter::getBuilderValues to add to. |
MobileFrontendHooks::onAfterBuildFeedLinks | ( | & | $tags | ) |
AfterBuildFeedLinks hook handler.
Remove all feed links in mobile view.
array | &$tags | Added feed links |
MobileFrontendHooks::onAPIQuerySiteInfoGeneralInfo | ( | $module, | |
& | $result ) |
Add the base mobile site URL to the siteinfo API output.
ApiQuerySiteinfo | $module | |
array | &$result | Api result array |
MobileFrontendHooks::onArticleParserOptions | ( | Article | $article, |
ParserOptions | $parserOptions ) |
ArticleParserOptions hook handler.
Article | $article | |
ParserOptions | $parserOptions |
MobileFrontendHooks::onAuthChangeFormFields | ( | $requests, | |
$fieldInfo, | |||
& | $formDescriptor, | ||
$action ) |
Handler for the AuthChangeFormFields hook to add a logo on top of the login screen.
This is the AuthManager equivalent of changeUserLoginCreateForm.
AuthenticationRequest[] | $requests | AuthenticationRequest objects array |
array | $fieldInfo | Field description as given by AuthenticationRequest::mergeFieldInfo |
array | &$formDescriptor | A form descriptor suitable for the HTMLForm constructor |
string | $action | One of the AuthManager::ACTION_* constants |
MobileFrontendHooks::onBeforeDisplayNoArticleText | ( | $article | ) |
BeforeDisplayNoArticleText hook handler.
Article | $article | The (empty) article |
MobileFrontendHooks::onBeforePageRedirect | ( | $out, | |
& | $redirect, | ||
& | $code ) |
BeforePageRedirect hook handler.
Ensures URLs are handled properly for select special pages.
OutputPage | $out | |
string | &$redirect | URL string, modifiable |
string | &$code | HTTP code (eg '301' or '302'), modifiable |
|
static |
CentralAuthSilentLoginRedirect hook handler Points redirects from CentralAuth wiki to mobile domain if user has logged in from it.
\MediaWiki\Extension\CentralAuth\User\CentralAuthUser | $centralUser | |
string | &$url | to redirect to |
array | $info | token information |
MobileFrontendHooks::onChangeTagsListActive | ( | & | $tags | ) |
ChangeTagsListActive hook handler.
array | &$tags | The list of tags. Add your extension's tags to this array. |
MobileFrontendHooks::onGetCacheVaryCookies | ( | $out, | |
& | $cookies ) |
GetCacheVaryCookies hook handler.
OutputPage | $out | |
array | &$cookies | array of cookies name, add a value to it if you want to add a cookie that have to vary cache options |
MobileFrontendHooks::onGetPreferences | ( | $user, | |
& | $preferences ) |
GetPreferences hook handler.
User | $user | User whose preferences are being modified |
array | &$preferences | Preferences description array, to be fed to an HTMLForm object |
MobileFrontendHooks::onHTMLFileCache__useFileCache | ( | $context | ) |
HTMLFileCache::useFileCache hook handler Disables file caching for mobile pageviews.
IContextSource | $context |
MobileFrontendHooks::onListDefinedTags | ( | & | $tags | ) |
ListDefinedTags hook handler.
array | &$tags | The list of tags. Add your extension's tags to this array. |
MobileFrontendHooks::onLoginFormValidErrorMessages | ( | array & | $messages | ) |
LoginFormValidErrorMessages hook handler to promote MF specific error message be valid.
array | &$messages | Array of already added messages |
MobileFrontendHooks::onManualLogEntryBeforePublish | ( | $logEntry | ) |
ManualLogEntryBeforePublish hook handler that tags actions logged when user uses mobile mode.
ManualLogEntry | $logEntry |
MobileFrontendHooks::onMediaWikiPerformAction | ( | $output, | |
$article, | |||
$title, | |||
$user, | |||
$request, | |||
$entryPoint ) |
MediaWikiPerformActionHook hook handler.
Set Diff page to diff-only mode for mobile view
OutputPage | $output | Context output |
Article | $article | Article on which the action will be performed |
Title | $title | Title on which the action will be performed |
User | $user | Context user |
WebRequest | $request | Context request |
ActionEntryPoint | $entryPoint |
MobileFrontendHooks::onOutputPageBeforeHTML | ( | $out, | |
& | $text ) |
OutputPageBeforeHTML hook handler.
Applies MobileFormatter to mobile viewed content
OutputPage | $out | the OutputPage object to which wikitext is added |
string | &$text | the HTML to be wrapped inside the #mw-content-text element |
MobileFrontendHooks::onOutputPageParserOutput | ( | $outputPage, | |
$po ) |
OutputPageParserOutput hook handler.
OutputPage | $outputPage | the OutputPage object to which wikitext is added |
ParserOutput | $po |
MobileFrontendHooks::onPostLoginRedirect | ( | & | $returnTo, |
& | $returnToQuery, | ||
& | $type ) |
PostLoginRedirect hook handler.
Used here to handle watchlist actions made by anons to be handled after login or account creation redirect.
@inheritDoc
MobileFrontendHooks::onRecentChange_save | ( | $recentChange | ) |
RecentChange_save hook handler that tags mobile changes.
RecentChange | $recentChange |
MobileFrontendHooks::onRequestContextCreateSkin | ( | $context, | |
& | $skin ) |
RequestContextCreateSkin hook handler.
IContextSource | $context | The RequestContext object the skin is being created for. |
Skin | null | string | &$skin | A variable reference you may set a Skin instance or string key on to override the skin that will be used for the context. |
MobileFrontendHooks::onResourceLoaderSiteModulePages | ( | $skin, | |
array & | $pages ) |
ResourceLoaderSiteModulePages hook handler.
string | $skin | |
array | &$pages | to sort modules from. |
MobileFrontendHooks::onResourceLoaderSiteStylesModulePages | ( | $skin, | |
array & | $pages ) |
ResourceLoaderSiteStylesModulePages hook handler.
string | $skin | |
array | &$pages | to sort modules from. |
MobileFrontendHooks::onSkinAddFooterLinks | ( | Skin | $skin, |
string | $key, | ||
array & | $footerLinks ) |
Update the footer.
Skin | $skin | |
string | $key | the current key for the current group (row) of footer links. e.g. info or places . |
array | &$footerLinks | an empty array that can be populated with new links. keys should be strings and will be used for generating the ID of the footer item and value should be an HTML string. |
MobileFrontendHooks::onSkinAfterBottomScripts | ( | $skin, | |
& | $html ) |
SkinAfterBottomScripts hook handler.
Adds an inline script for lazy loading the images in Grade C browsers.
Skin | $skin | |
string | &$html | bottomScripts text. Append to $text to add additional text/scripts after the stock bottom scripts. |
MobileFrontendHooks::onSpecialPage_initList | ( | & | $list | ) |
Hook for SpecialPage_initList in SpecialPageFactory.
array | &$list | list of special page classes |
MobileFrontendHooks::onSpecialPageBeforeExecute | ( | $special, | |
$subpage ) |
Invocation of hook SpecialPageBeforeExecute.
We use this hook to ensure that login/account creation pages are redirected to HTTPS if they are not accessed via HTTPS and $wgSecureLogin == true - but only when using the mobile site.
SpecialPage | $special | |
string | $subpage | subpage name |
MobileFrontendHooks::onTitleSquidURLs | ( | $title, | |
& | $urls ) |
Handler for TitleSquidURLs hook to add copies of the cache purge URLs which are transformed according to the wgMobileUrlCallback, so that both mobile and non-mobile URL variants get purged.
Title | $title | the article title |
array | &$urls | the set of URLs to purge |
MobileFrontendHooks::onUserGetDefaultOptions | ( | & | $defaultUserOptions | ) |
Register default preferences for MobileFrontend.
array | &$defaultUserOptions | Reference to default options array |