MediaWiki  1.30.0
WikiEditorHooks Class Reference

Static Public Member Functions

static doEventLogging ( $action, $article, $data=[])
 Log stuff to EventLogging's Schema:Edit - see https://meta.wikimedia.org/wiki/Schema:Edit If you don't have EventLogging installed, does nothing. More...
 
static editPageAttemptSave (EditPage $editPage)
 This is attached to the MediaWiki 'EditPage::attemptSave' hook. More...
 
static editPageAttemptSaveAfter (EditPage $editPage, Status $status)
 This is attached to the MediaWiki 'EditPage::attemptSave:after' hook. More...
 
static EditPageBeforeEditToolbar (&$toolbar)
 EditPageBeforeEditToolbar hook. More...
 
static editPageShowEditFormFields (EditPage $editPage, OutputPage $outputPage)
 EditPage::showEditForm:fields hook. More...
 
static editPageShowEditFormInitial (EditPage $editPage, OutputPage $outputPage)
 EditPage::showEditForm:initial hook. More...
 
static getPreferences ( $user, &$defaultPreferences)
 GetPreferences hook. More...
 
static isEnabled ( $name)
 Checks if a certain option is enabled. More...
 
static makeGlobalVariablesScript (&$vars)
 MakeGlobalVariablesScript hook. More...
 
static resourceLoaderGetConfigVars (&$vars)
 
static resourceLoaderTestModules (&$testModules, &$resourceLoader)
 ResourceLoaderTestModules hook. More...
 

Static Protected Attributes

static $features
 

Static Private Member Functions

static getEditingStatsId ()
 Gets a 32 character alphanumeric random string to be used for stats. More...
 
static getMagicWords (&$vars)
 Expose useful magic words which are used by the wikieditor toolbar. More...
 

Static Private Attributes

static $statsId = false
 

Detailed Description

Definition at line 9 of file WikiEditor.hooks.php.

Member Function Documentation

◆ doEventLogging()

static WikiEditorHooks::doEventLogging (   $action,
  $article,
  $data = [] 
)
static

Log stuff to EventLogging's Schema:Edit - see https://meta.wikimedia.org/wiki/Schema:Edit If you don't have EventLogging installed, does nothing.

Parameters
string$action
Article$articleWhich article (with full context, page, title, etc.)
array$dataData to log for this action
Returns
bool Whether the event was logged or not.

Definition at line 121 of file WikiEditor.hooks.php.

References $article, $title, $user, $wgVersion, and global.

◆ editPageAttemptSave()

static WikiEditorHooks::editPageAttemptSave ( EditPage  $editPage)
static

This is attached to the MediaWiki 'EditPage::attemptSave' hook.

Parameters
EditPage$editPage
Returns
bool

Definition at line 386 of file WikiEditor.hooks.php.

References $article, $request, and EditPage::getArticle().

◆ editPageAttemptSaveAfter()

static WikiEditorHooks::editPageAttemptSaveAfter ( EditPage  $editPage,
Status  $status 
)
static

This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.

Parameters
EditPage$editPage
Status$status
Returns
bool

Definition at line 407 of file WikiEditor.hooks.php.

References $article, $request, EditPage::AS_ARTICLE_WAS_DELETED, EditPage::AS_CONFLICT_DETECTED, and EditPage::getArticle().

◆ EditPageBeforeEditToolbar()

static WikiEditorHooks::EditPageBeforeEditToolbar ( $toolbar)
static

EditPageBeforeEditToolbar hook.

Disable the old toolbar if the new one is enabled

Parameters
string&$toolbar
Returns
bool

Definition at line 255 of file WikiEditor.hooks.php.

References Html::rawElement().

◆ editPageShowEditFormFields()

static WikiEditorHooks::editPageShowEditFormFields ( EditPage  $editPage,
OutputPage  $outputPage 
)
static

EditPage::showEditForm:fields hook.

Adds the event fields to the edit form

Parameters
EditPage$editPagethe current EditPage object.
OutputPage$outputPageobject.
Returns
bool

Definition at line 222 of file WikiEditor.hooks.php.

References $req, OutputPage::addHTML(), CONTENT_MODEL_WIKITEXT, Xml::element(), and ContextSource::getRequest().

◆ editPageShowEditFormInitial()

static WikiEditorHooks::editPageShowEditFormInitial ( EditPage  $editPage,
OutputPage  $outputPage 
)
static

EditPage::showEditForm:initial hook.

Adds the modules to the edit form

Parameters
EditPage$editPagethe current EditPage object.
OutputPage$outputPageobject.
Returns
bool

Definition at line 166 of file WikiEditor.hooks.php.

References $article, $name, $request, OutputPage::addModules(), OutputPage::addModuleStyles(), as, CONTENT_MODEL_WIKITEXT, and EditPage::getArticle().

◆ getEditingStatsId()

static WikiEditorHooks::getEditingStatsId ( )
staticprivate

Gets a 32 character alphanumeric random string to be used for stats.

Returns
string

Definition at line 373 of file WikiEditor.hooks.php.

References MWCryptRand::generateHex().

◆ getMagicWords()

static WikiEditorHooks::getMagicWords ( $vars)
staticprivate

Expose useful magic words which are used by the wikieditor toolbar.

Parameters
$varsarray
Returns
bool

Definition at line 351 of file WikiEditor.hooks.php.

References $magicWords, $name, $vars, as, and MagicWord::get().

◆ getPreferences()

static WikiEditorHooks::getPreferences (   $user,
$defaultPreferences 
)
static

GetPreferences hook.

Adds WikiEditor-related items to the preferences

Parameters
User$usercurrent user
array&$defaultPreferenceslist of default user preference controls
Returns
bool

Definition at line 279 of file WikiEditor.hooks.php.

References $name, $options, as, and global.

◆ isEnabled()

static WikiEditorHooks::isEnabled (   $name)
static

Checks if a certain option is enabled.

This method is public to allow other extensions that use WikiEditor to use the same configuration as WikiEditor itself

Parameters
string$nameName of the feature, should be a key of $features
Returns
bool

Definition at line 87 of file WikiEditor.hooks.php.

References $name, $value, $wgUser, as, and global.

◆ makeGlobalVariablesScript()

static WikiEditorHooks::makeGlobalVariablesScript ( $vars)
static

MakeGlobalVariablesScript hook.

Adds enabled/disabled switches for WikiEditor modules

Parameters
$varsarray
Returns
bool

Definition at line 335 of file WikiEditor.hooks.php.

References $name, $vars, and as.

◆ resourceLoaderGetConfigVars()

static WikiEditorHooks::resourceLoaderGetConfigVars ( $vars)
static
Parameters
$varsarray
Returns
bool

Definition at line 299 of file WikiEditor.hooks.php.

References $vars, and wfMessage().

◆ resourceLoaderTestModules()

static WikiEditorHooks::resourceLoaderTestModules ( $testModules,
$resourceLoader 
)
static

ResourceLoaderTestModules hook.

Registers JavaScript test modules

Parameters
$testModulesarray of javascript testing modules. 'qunit' is fed using tests/qunit/QUnitTestResources.php.
$resourceLoaderobject
Returns
bool

Definition at line 318 of file WikiEditor.hooks.php.

Member Data Documentation

◆ $features

WikiEditorHooks::$features
staticprotected

Definition at line 16 of file WikiEditor.hooks.php.

◆ $statsId

WikiEditorHooks::$statsId = false
staticprivate

Definition at line 12 of file WikiEditor.hooks.php.


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