mediawiki-extensions-CodeMi.../CodeMirror.hooks.php
Pavel Astakhov 65ffeacf9e add highlighting the magic word that does not begin with '#' (v 1.9.0)
* fix brackets color

Change-Id: I1cd057287d5ae142ed240e4ea9012790716f888c
2014-08-29 10:05:50 +06:00

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;
}
}
}