MediaWiki  1.34.0
ScribuntoHooks Class Reference

Hooks for the Scribunto extension. More...

Static Public Member Functions

static beforeEditButtons (EditPage &$editor, array &$buttons, &$tabindex)
 EditPageBeforeEditButtons hook. More...
 
static clearState (Parser &$parser)
 Called when the interpreter is to be reset. More...
 
static contentHandlerDefaultModelFor (Title $title, &$model)
 Set the Scribunto content handler for modules. More...
 
static formatLimitData ( $key, &$value, &$report, $isHTML, $localize)
 Formats the limit report data. More...
 
static getCodeLanguage (Title $title, &$languageCode)
 
static getSoftwareInfo (array &$software)
 Get software information for Special:Version. More...
 
static invokeHook (Parser &$parser, PPFrame $frame, array $args)
 Hook function for {{#invoke:module|func}}. More...
 
static onRegistration ()
 Define content handler constant upon extension registration. More...
 
static parserCloned (Parser $parser)
 Called when the parser is cloned. More...
 
static reportLimitData (Parser $parser, ParserOutput $output)
 Adds report of number of evaluations by the single wikitext page. More...
 
static reportTiming ( $moduleName, $functionName, $timing)
 Record stats on slow function calls. More...
 
static setupParserHook (Parser &$parser)
 Register parser hooks. More...
 
static showDocPageHeader (Article &$article, &$outputDone, &$pcache)
 
static showReadOnlyFormInitial (EditPage $editor, OutputPage $output)
 EditPage::showReadOnlyForm:initial hook. More...
 
static showStandardInputsOptions (EditPage $editor, OutputPage $output, &$tab)
 EditPage::showStandardInputs:options hook. More...
 
static validateScript (IContextSource $context, Content $content, Status $status)
 

Detailed Description

Hooks for the Scribunto extension.

Definition at line 30 of file Hooks.php.

Member Function Documentation

◆ beforeEditButtons()

static ScribuntoHooks::beforeEditButtons ( EditPage $editor,
array &  $buttons,
$tabindex 
)
static

EditPageBeforeEditButtons hook.

Parameters
EditPage&$editor
array&$buttonsButton array
int&$tabindexCurrent tabindex
Returns
bool

Definition at line 344 of file Hooks.php.

References EditPage\getTitle().

◆ clearState()

static ScribuntoHooks::clearState ( Parser &  $parser)
static

Called when the interpreter is to be reset.

Parameters
Parser&$parser
Returns
bool

Definition at line 69 of file Hooks.php.

References Scribunto\resetParserEngine().

◆ contentHandlerDefaultModelFor()

static ScribuntoHooks::contentHandlerDefaultModelFor ( Title  $title,
$model 
)
static

Set the Scribunto content handler for modules.

Parameters
Title$title
string&$model
Returns
bool

Definition at line 263 of file Hooks.php.

References $title, Scribunto\isDocPage(), and NS_MODULE.

Referenced by ScribuntoHooksTest\testContentHandlerDefaultModelFor().

◆ formatLimitData()

static ScribuntoHooks::formatLimitData (   $key,
$value,
$report,
  $isHTML,
  $localize 
)
static

Formats the limit report data.

Parameters
string$key
mixed&$value
string&$report
bool$isHTML
bool$localize
Returns
bool

Definition at line 300 of file Hooks.php.

References Scribunto\newDefaultEngine().

◆ getCodeLanguage()

static ScribuntoHooks::getCodeLanguage ( Title  $title,
$languageCode 
)
static
Parameters
Title$title
string&$languageCode
Returns
bool

Definition at line 242 of file Hooks.php.

References $title, and Scribunto\newDefaultEngine().

◆ getSoftwareInfo()

static ScribuntoHooks::getSoftwareInfo ( array &  $software)
static

Get software information for Special:Version.

Parameters
array&$software
Returns
bool

Definition at line 45 of file Hooks.php.

References Title\makeTitle(), Scribunto\newDefaultEngine(), and NS_SPECIAL.

◆ invokeHook()

static ScribuntoHooks::invokeHook ( Parser &  $parser,
PPFrame  $frame,
array  $args 
)
static

Hook function for {{#invoke:module|func}}.

Parameters
Parser&$parser
PPFrame$frame
array$args
Exceptions
MWException
ScribuntoException
Returns
string

Definition at line 95 of file Hooks.php.

References $args, $title, PPFrame\expand(), Scribunto\getParserEngine(), ScribuntoException\getScriptTraceHtml(), Title\makeTitleSafe(), PPFrame\newChild(), NS_MODULE, reportTiming(), and wfMessage().

◆ onRegistration()

static ScribuntoHooks::onRegistration ( )
static

Define content handler constant upon extension registration.

Definition at line 35 of file Hooks.php.

◆ parserCloned()

static ScribuntoHooks::parserCloned ( Parser  $parser)
static

Called when the parser is cloned.

Parameters
Parser$parser
Returns
bool

Definition at line 80 of file Hooks.php.

◆ reportLimitData()

static ScribuntoHooks::reportLimitData ( Parser  $parser,
ParserOutput  $output 
)
static

Adds report of number of evaluations by the single wikitext page.

Parameters
Parser$parser
ParserOutput$output
Returns
bool

Definition at line 282 of file Hooks.php.

References $output, Scribunto\getParserEngine(), and Scribunto\isParserEnginePresent().

◆ reportTiming()

static ScribuntoHooks::reportTiming (   $moduleName,
  $functionName,
  $timing 
)
static

Record stats on slow function calls.

Parameters
string$moduleName
string$functionName
int$timingFunction execution time in milliseconds.

Definition at line 185 of file Hooks.php.

References $cache, CACHE_NONE, and ObjectCache\getLocalServerInstance().

Referenced by invokeHook().

◆ setupParserHook()

static ScribuntoHooks::setupParserHook ( Parser &  $parser)
static

Register parser hooks.

Parameters
Parser&$parser
Returns
bool

Definition at line 58 of file Hooks.php.

References SFH_OBJECT_ARGS.

◆ showDocPageHeader()

static ScribuntoHooks::showDocPageHeader ( Article $article,
$outputDone,
$pcache 
)
static
Parameters
Article&$article
bool&$outputDone
bool&$pcache
Returns
bool

Definition at line 391 of file Hooks.php.

References $title, Article\getContext(), Article\getTitle(), Scribunto\isDocPage(), and wfMessage().

◆ showReadOnlyFormInitial()

static ScribuntoHooks::showReadOnlyFormInitial ( EditPage  $editor,
OutputPage  $output 
)
static

EditPage::showReadOnlyForm:initial hook.

Parameters
EditPage$editor
OutputPage$output
Returns
bool

Definition at line 328 of file Hooks.php.

References $output, and EditPage\getTitle().

◆ showStandardInputsOptions()

static ScribuntoHooks::showStandardInputsOptions ( EditPage  $editor,
OutputPage  $output,
$tab 
)
static

EditPage::showStandardInputs:options hook.

Parameters
EditPage$editor
OutputPage$output
int&$tabCurrent tabindex
Returns
bool

Definition at line 313 of file Hooks.php.

References $output, and EditPage\getTitle().

◆ validateScript()

static ScribuntoHooks::validateScript ( IContextSource  $context,
Content  $content,
Status  $status 
)
static
Parameters
IContextSource$context
Content$content
Status$status
Returns
bool

Definition at line 357 of file Hooks.php.

References $content, $context, $line, $status, $title, and Xml\encodeJsVar().


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