mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-15 02:04:02 +00:00
65ffeacf9e
* fix brackets color Change-Id: I1cd057287d5ae142ed240e4ea9012790716f888c
31 lines
751 B
PHP
31 lines
751 B
PHP
<?php
|
|
|
|
|
|
class CodeMirrorHooks {
|
|
|
|
static $globalVariableScript = array();
|
|
|
|
/**
|
|
*
|
|
* @global Parser $wgParser
|
|
* @param EditPage $editPage
|
|
* @param OutputPage $output
|
|
* @return boolean
|
|
*/
|
|
public static function onEditPageShowEditFormInitial( EditPage $editPage, OutputPage $output ) {
|
|
global $wgParser;
|
|
if ( false === isset( $wgParser->mFunctionSynonyms ) ) {
|
|
$wgParser->firstCallInit();
|
|
}
|
|
self::$globalVariableScript['FunctionSynonyms'] = $wgParser->mFunctionSynonyms;
|
|
$output->addModules( 'ext.CodeMirror' );
|
|
return true;
|
|
}
|
|
|
|
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
|
foreach ( self::$globalVariableScript as $key=> $value ) {
|
|
$vars["extCodeMirror$key"] = $value;
|
|
}
|
|
}
|
|
}
|