2011-06-09 21:50:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to load syntax-highlighting editor for JavaScript and CSS pages
|
|
|
|
* on-wiki.
|
|
|
|
*
|
|
|
|
* Extends and requires WikiEditor extension.
|
|
|
|
*
|
|
|
|
* Extension code is GPLv2 following MediaWiki base.
|
|
|
|
* Ace editor JS code follows its own license, see in the 'ace' subdir.
|
|
|
|
*/
|
|
|
|
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'CodeEditor',
|
2011-12-13 23:49:33 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:CodeEditor',
|
2011-06-09 21:50:45 +00:00
|
|
|
'author' => array( 'Brion Vibber', 'authors of Ace (ajax.org)' ),
|
|
|
|
'descriptionmsg' => 'codeeditor-desc',
|
|
|
|
);
|
|
|
|
|
|
|
|
$dir = dirname( __FILE__ );
|
|
|
|
$wgAutoloadClasses['CodeEditorHooks'] = $dir . '/CodeEditor.hooks.php';
|
|
|
|
$wgExtensionMessagesFiles['CodeEditor'] = $dir . '/CodeEditor.i18n.php';
|
|
|
|
|
|
|
|
$wgHooks['EditPage::showEditForm:initial'][] = 'CodeEditorHooks::editPageShowEditFormInitial';
|
2011-08-04 22:33:59 +00:00
|
|
|
$wgHooks['BeforePageDisplay'][] = 'CodeEditorHooks::onBeforePageDisplay';
|
2012-02-06 21:59:13 +00:00
|
|
|
$wgHooks['MakeGlobalVariablesScript'][] = 'CodeEditorHooks::onMakeGlobalVariablesScript';
|
2011-06-09 21:50:45 +00:00
|
|
|
|
2011-06-09 22:17:00 +00:00
|
|
|
$tpl = array(
|
2011-06-09 21:50:45 +00:00
|
|
|
'localBasePath' => dirname( __FILE__ ) . '/modules',
|
|
|
|
'remoteExtPath' => 'CodeEditor/modules',
|
2011-06-10 01:11:18 +00:00
|
|
|
'group' => 'ext.wikiEditor',
|
2011-06-09 21:50:45 +00:00
|
|
|
);
|
2011-06-09 22:17:00 +00:00
|
|
|
|
|
|
|
$wgResourceModules['ext.codeEditor'] = array(
|
|
|
|
'scripts' => 'ext.codeEditor.js',
|
|
|
|
'dependencies' => array(
|
2012-07-03 03:15:22 +00:00
|
|
|
'ext.wikiEditor.toolbar',
|
2011-06-10 01:11:18 +00:00
|
|
|
'jquery.codeEditor'
|
|
|
|
),
|
|
|
|
) + $tpl;
|
|
|
|
|
|
|
|
$wgResourceModules['jquery.codeEditor'] = array(
|
|
|
|
'scripts' => 'jquery.codeEditor.js',
|
|
|
|
'dependencies' => array(
|
|
|
|
'jquery.wikiEditor',
|
2011-06-09 22:17:00 +00:00
|
|
|
'ext.codeEditor.ace',
|
2012-01-19 00:17:14 +00:00
|
|
|
'jquery.ui.resizable'
|
2011-06-09 22:17:00 +00:00
|
|
|
),
|
2011-06-16 22:30:01 +00:00
|
|
|
'messages' => array(
|
|
|
|
'codeeditor-toolbar-toggle'
|
|
|
|
)
|
2011-06-09 22:17:00 +00:00
|
|
|
) + $tpl;
|
|
|
|
|
|
|
|
// Minimal bundling of a couple bits of Ace
|
|
|
|
$wgResourceModules['ext.codeEditor.ace'] = array(
|
2011-08-04 22:33:59 +00:00
|
|
|
'group' => 'ext.codeEditor.ace',
|
2011-06-09 22:17:00 +00:00
|
|
|
'scripts' => array(
|
2012-07-05 06:37:09 +00:00
|
|
|
'ace/ace.js',
|
|
|
|
'ace/mode-javascript.js',
|
2012-12-01 04:16:19 +00:00
|
|
|
'ace/mode-json.js',
|
2012-07-05 06:37:09 +00:00
|
|
|
'ace/mode-css.js',
|
|
|
|
'ace/mode-lua.js',
|
2011-06-09 22:17:00 +00:00
|
|
|
),
|
|
|
|
) + $tpl;
|
2011-08-04 22:33:59 +00:00
|
|
|
|
2012-02-06 21:59:13 +00:00
|
|
|
// Extra highlighting modes to match some available GeSHi highlighting languages
|
2011-08-04 22:33:59 +00:00
|
|
|
$wgResourceModules['ext.codeEditor.ace.modes'] = array(
|
|
|
|
'group' => 'ext.codeEditor.ace',
|
|
|
|
'scripts' => array(
|
2012-07-05 06:37:09 +00:00
|
|
|
'ace/mode-c_cpp.js',
|
|
|
|
'ace/mode-clojure.js',
|
|
|
|
'ace/mode-csharp.js',
|
|
|
|
'ace/mode-coffee.js',
|
|
|
|
'ace/mode-groovy.js',
|
|
|
|
'ace/mode-html.js',
|
|
|
|
'ace/mode-java.js',
|
|
|
|
'ace/mode-ocaml.js',
|
|
|
|
'ace/mode-perl.js',
|
|
|
|
'ace/mode-php.js',
|
|
|
|
'ace/mode-python.js',
|
|
|
|
'ace/mode-ruby.js',
|
|
|
|
'ace/mode-scala.js',
|
2011-08-04 22:33:59 +00:00
|
|
|
),
|
|
|
|
'dependencies' => 'ext.codeEditor.ace',
|
|
|
|
) + $tpl;
|
|
|
|
|
|
|
|
// Helper to add inline [edit] links to <source> sections
|
|
|
|
$wgResourceModules['ext.codeEditor.geshi'] = array(
|
|
|
|
'scripts' => array(
|
|
|
|
'ext.codeEditor.geshi.js'
|
|
|
|
),
|
|
|
|
'messages' => array(
|
|
|
|
'editsection',
|
|
|
|
'savearticle'
|
|
|
|
)
|
|
|
|
) + $tpl;
|
|
|
|
|
|
|
|
// Experimental feature; not ready yet.
|
|
|
|
$wgCodeEditorGeshiIntegration = false;
|
2012-08-14 05:04:20 +00:00
|
|
|
|
|
|
|
// If this is disabled, CodeEditor will only be available for client-side code
|
|
|
|
// and extensions, it won't be enabled for standard CSS and JS pages.
|
|
|
|
$wgCodeEditorEnableCore = true;
|