2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
7 * @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
\r
8 * manage plugins registration and loading.
\r
12 * Manages plugins registration and loading.
\r
14 * @augments CKEDITOR.resourceManager
\r
17 CKEDITOR.plugins = new CKEDITOR.resourceManager(
\r
18 '_source/' + // @Packager.RemoveLine
\r
19 'plugins/', 'plugin' );
\r
21 // PACKAGER_RENAME( CKEDITOR.plugins )
\r
23 CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
\r
25 return function( name, callback, scope )
\r
27 var allPlugins = {};
\r
29 var loadPlugins = function( names )
\r
31 originalLoad.call( this, names, function( plugins )
\r
33 CKEDITOR.tools.extend( allPlugins, plugins );
\r
35 var requiredPlugins = [];
\r
36 for ( var pluginName in plugins )
\r
38 var plugin = plugins[ pluginName ],
\r
39 requires = plugin && plugin.requires;
\r
43 for ( var i = 0 ; i < requires.length ; i++ )
\r
45 if ( !allPlugins[ requires[ i ] ] )
\r
46 requiredPlugins.push( requires[ i ] );
\r
51 if ( requiredPlugins.length )
\r
52 loadPlugins.call( this, requiredPlugins );
\r
55 // Call the "onLoad" function for all plugins.
\r
56 for ( pluginName in allPlugins )
\r
58 plugin = allPlugins[ pluginName ];
\r
59 if ( plugin.onLoad && !plugin.onLoad._called )
\r
62 plugin.onLoad._called = 1;
\r
66 // Call the callback.
\r
68 callback.call( scope || window, allPlugins );
\r
75 loadPlugins.call( this, name );
\r
79 CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
\r
81 var plugin = this.get( pluginName ),
\r
82 pluginLang = plugin.lang || ( plugin.lang = {} );
\r
84 pluginLang[ languageCode ] = languageEntries;
\r