public function __construct() { $wf = WFEditor::getInstance(); // set language $this->language = WFLanguage::getCode(); // set profile $this->profile = $wf->getProfile(); }
/** * Return the curernt language code * * @access public * @return language code */ public static function getTag() { $language = JFactory::getLanguage(); $tag = $language->getTag(); //static $_language; if (!isset(self::$instance)) { if (self::check($tag)) { self::$instance = $tag; } else { self::$instance = 'en-GB'; } } return self::$instance; }
public function execute() { WFToken::checkToken() or die('Access to this resource is restricted'); // JSON request or upload action if ($this->isRequest()) { $request = WFRequest::getInstance(); $request->process(); } else { $wf = WFEditor::getInstance(); $version = $this->getVersion(); $name = $this->getName(); // process javascript languages if (JRequest::getWord('task') == 'loadlanguages') { wfimport('admin.classes.language'); $parser = new WFLanguageParser(array( 'plugins' => array($name), 'sections' => array('dlg', $name . '_dlg', 'colorpicker'), 'mode' => 'plugin' )); $data = $parser->load(); $parser->output($data); } // load core language WFLanguage::load('com_jce', JPATH_ADMINISTRATOR); // Load Plugin language WFLanguage::load('com_jce_' . trim($this->getName())); // set default plugin version $plugin_version = $this->getPluginVersion(); // add plugin version if ($plugin_version && $plugin_version != $version) { $version .= '-' . $plugin_version; } // create the document $document = WFDocument::getInstance(array( 'version' => $version, 'title' => WFText::_('WF_' . strtoupper($this->getName() . '_TITLE')), 'name' => $name, 'language' => WFLanguage::getTag(), 'direction' => WFLanguage::getDir(), 'compress_javascript' => $this->getParam('editor.compress_javascript', 0), 'compress_css' => $this->getParam('editor.compress_css', 0) )); // set standalone mode $document->set('standalone', JRequest::getInt('standalone', 0)); // create display $this->display(); // ini language $document->addScript(array('index.php?option=com_jce&view=editor&' . $document->getQueryString(array('task' => 'loadlanguages', 'lang' => WFLanguage::getCode()))), 'joomla'); // pack assets if required $document->pack(true, $this->getParam('editor.compress_gzip', 0)); // get the view $view = $this->getView(); // set body output $document->setBody($view->loadTemplate()); // render document $document->render(); } }
/** * Display plugin * @access private */ public function display() { jimport('joomla.filesystem.folder'); $document = WFDocument::getInstance(); if ($document->get('standalone') == 0) { $document->addScript(array('tiny_mce_popup'), 'tiny_mce'); $document->addScript(array('tiny_mce_utils'), 'libraries'); } $document->addScript(array('jquery-' . WF_JQUERY . '.min', 'jquery-ui-' . WF_JQUERYUI . '.custom.min', 'jquery.ui.touch-punch.min'), 'jquery'); // add colorpicker if ($this->get('colorpicker')) { wfimport('admin.helpers.tools'); $document->addScript(array('colorpicker'), 'libraries'); $document->addScriptDeclaration('ColorPicker.settings=' . json_encode(array('template_colors' => WFToolsHelper::getTemplateColors(), 'custom_colors' => $this->getParam('editor.custom_colors', ''))) . ';'); } $document->addScript(array('html5', 'select', 'tips', 'plugin'), 'libraries'); // load plugin dialog language file if necessary if ($this->getParam('editor.compress_javascript', 0)) { $file = "/langs/" . WFLanguage::getCode() . "_dlg.js"; if (!JFile::exists(WF_EDITOR_PLUGIN . $file)) { $file = "/langs/en_dlg.js"; } if (JFile::exists(WF_EDITOR_PLUGIN . $file)) { $document->addScript(array('plugins/' . $this->getName() . $file), 'tiny_mce'); } } $document->addStyleSheet(array('plugin'), 'libraries'); // MediaElement in the future perhaps? /*if ($this->get('mediaplayer')) { $document->addScript(array('mediaelement-and-player.min'), 'mediaelement'); $document->addStyleSheet(array('mediaelementplayer.min'), 'mediaelement'); }*/ // add custom plugin.css if exists if (is_file(JPATH_SITE . '/media/jce/css/plugin.css')) { $document->addStyleSheet(array('media/jce/css/plugin.css'), 'joomla'); } }