/**
* Load the editor
*
* @param array $config Associative array of editor config parameters
*
* @return mixed
*
* @since 1.5
*/
protected function _loadEditor($config = array())
{
// Check whether editor is already loaded
if ($this->_editor !== null) {
return false;
}
// Build the path to the needed editor plugin
$name = InputFilter::getInstance()->clean($this->_name, 'cmd');
$path = JPATH_PLUGINS . '/editors/' . $name . '/' . $name . '.php';
if (!is_file($path)) {
Log::add(Text::_('JLIB_HTML_EDITOR_CANNOT_LOAD'), Log::WARNING, 'jerror');
return false;
}
// Require plugin file
require_once $path;
// Get the plugin
$plugin = PluginHelper::getPlugin('editors', $this->_name);
// If no plugin is published we get an empty array and there not so much to do with it
if (empty($plugin)) {
return false;
}
$params = new Registry($plugin->params);
$params->loadArray($config);
$plugin->params = $params;
// Build editor plugin classname
$name = 'PlgEditor' . $this->_name;
$dispatcher = $this->getDispatcher();
if ($this->_editor = new $name($dispatcher, (array) $plugin)) {
// Load plugin parameters
$this->initialise();
PluginHelper::importPlugin('editors-xtd');
}
}