MediaWiki REL1_32
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.
 
static editPageAttemptSave (EditPage $editPage)
 This is attached to the MediaWiki 'EditPage::attemptSave' hook.
 
static editPageAttemptSaveAfter (EditPage $editPage, Status $status)
 This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.
 
static EditPageBeforeEditToolbar (&$toolbar)
 EditPageBeforeEditToolbar hook.
 
static editPageShowEditFormFields (EditPage $editPage, OutputPage $outputPage)
 EditPage::showEditForm:fields hook.
 
static editPageShowEditFormInitial (EditPage $editPage, OutputPage $outputPage)
 EditPage::showEditForm:initial hook.
 
static getPreferences ( $user, &$defaultPreferences)
 GetPreferences hook.
 
static makeGlobalVariablesScript (&$vars)
 MakeGlobalVariablesScript hook.
 
static resourceLoaderGetConfigVars (&$vars)
 
static resourceLoaderTestModules (&$testModules, &$resourceLoader)
 ResourceLoaderTestModules hook.
 

Static Private Member Functions

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

Static Private Attributes

static $statsId = false
 

Detailed Description

Definition at line 11 of file WikiEditorHooks.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 27 of file WikiEditorHooks.php.

References $wgVersion, and ExtensionRegistry\getInstance().

Referenced by editPageAttemptSave(), editPageAttemptSaveAfter(), and editPageShowEditFormInitial().

◆ editPageAttemptSave()

static WikiEditorHooks::editPageAttemptSave ( EditPage $editPage)
static

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

Parameters
EditPage$editPage
Returns
bool

Definition at line 281 of file WikiEditorHooks.php.

References $request, and doEventLogging().

◆ 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 302 of file WikiEditorHooks.php.

References $request, EditPage\AS_ARTICLE_WAS_DELETED, EditPage\AS_CONFLICT_DETECTED, and doEventLogging().

◆ 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 156 of file WikiEditorHooks.php.

◆ 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 123 of file WikiEditorHooks.php.

References $req, CONTENT_MODEL_WIKITEXT, and getEditingStatsId().

◆ 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 72 of file WikiEditorHooks.php.

References $request, CONTENT_MODEL_WIKITEXT, doEventLogging(), getEditingStatsId(), and ExtensionRegistry\getInstance().

◆ getEditingStatsId()

static WikiEditorHooks::getEditingStatsId ( )
staticprivate

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

Returns
string

Definition at line 268 of file WikiEditorHooks.php.

References $statsId, and MWCryptRand\generateHex().

Referenced by editPageShowEditFormFields(), and editPageShowEditFormInitial().

◆ getMagicWords()

static WikiEditorHooks::getMagicWords ( & $vars)
staticprivate

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

Parameters
array&$vars
Returns
bool

Definition at line 238 of file WikiEditorHooks.php.

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

Referenced by resourceLoaderGetConfigVars().

◆ 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 176 of file WikiEditorHooks.php.

◆ makeGlobalVariablesScript()

static WikiEditorHooks::makeGlobalVariablesScript ( & $vars)
static

MakeGlobalVariablesScript hook.

Adds enabled/disabled switches for WikiEditor modules

Parameters
array&$vars
Returns
bool

Definition at line 227 of file WikiEditorHooks.php.

References $vars.

◆ resourceLoaderGetConfigVars()

static WikiEditorHooks::resourceLoaderGetConfigVars ( & $vars)
static
Parameters
array&$vars
Returns
bool

Definition at line 191 of file WikiEditorHooks.php.

References $vars, getMagicWords(), and wfMessage().

◆ resourceLoaderTestModules()

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

ResourceLoaderTestModules hook.

Registers JavaScript test modules

Parameters
array&$testModulesarray of javascript testing modules. 'qunit' is fed using tests/qunit/QUnitTestResources.php.
ResourceLoader&$resourceLoader
Returns
bool

Definition at line 210 of file WikiEditorHooks.php.

Member Data Documentation

◆ $statsId

WikiEditorHooks::$statsId = false
staticprivate

Definition at line 14 of file WikiEditorHooks.php.

Referenced by getEditingStatsId().


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