Beispiel #1
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $language = JFactory::getLanguage();
     // create a unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
     $attribs = array('class="parameter-nested-parent"');
     // path to directory
     $path = WF_EDITOR_EXTENSIONS . '/filesystem';
     $filter = '\\.xml$';
     $files = JFolder::files($path, $filter, false, true, array('build.xml'));
     $options = array();
     if ((bool) $node->attributes()->exclude_default === false) {
         $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
             $xml = WFXMLHelper::parseInstallManifest($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     // if a group is specified, setup to be an object
     if ((string) $node->attributes()->group) {
         $name = $control_name . '[filesystem][' . $name . ']';
     } else {
         $name = $control_name . '[filesystem]';
     }
     return JHTML::_('select.genericlist', $options, $name, implode(' ', $attribs), 'value', 'text', $value, $id);
 }
Beispiel #2
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $language = JFactory::getLanguage();
     // create a unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
     // add javascript if element has parameters
     if ((string) $node->attributes()->parameters) {
         $document = JFactory::getDocument();
         $document->addCustomTag('<script type="text/javascript">$jce.Parameter.add("#' . $id . '", "filesystem");</script>');
     }
     // path to directory
     $path = WF_EDITOR_EXTENSIONS . '/filesystem';
     $filter = '\\.xml$';
     $files = JFolder::files($path, $filter, false, true);
     $options = array();
     if (!$node->attributes('exclude_default')) {
         $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
             $xml = WFXMLHelper::parseInstallManifest($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
 }
 /**
  * Get the current version
  * @return Version
  */
 public function getVersion()
 {
     $xml = WFXMLHelper::parseInstallManifest(JPATH_ADMINISTRATOR . '/components/com_jce/jce.xml');
     // return cleaned version number or date
     $version = preg_replace('/[^0-9a-z]/i', '', $xml['version']);
     if (!$version) {
         return date('Y-m-d', strtotime('today'));
     }
     return $version;
 }
Beispiel #4
0
 function checkVersion()
 {
     $file = JPATH_PLUGINS . '/system/jcemediabox.xml';
     if (!is_file($file)) {
         $file = JPATH_PLUGINS . '/system' . 'jcemediabox/jcemediabox.xml';
     }
     $required = $this->get('_requires');
     if ($xml = WFXMLHelper::parseInstallManifest($file)) {
         if (version_compare($xml['version'], (int) $required, '<')) {
             echo '<p class="required">' . WFText::sprintf('WF_POPUPS_JCEMEDIABOX_VERSION_ERROR', $required) . '</p>';
         }
     }
 }
Beispiel #5
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     // path to images directory
     $path = WF_EDITOR . '/extensions/mediaplayer';
     $files = JFolder::files($path, '\\.xml', false, true, array('build.xml'));
     $attribs = array('class="parameter-nested-parent"');
     $language = JFactory::getLanguage();
     // create unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'mediaplayer' . $name);
     $options = array();
     $options[] = JHTML::_('select.option', 'none', WFText::_('WF_OPTION_NONE'));
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_' . $name . '_' . basename($file, '.xml'), JPATH_SITE);
             $xml = WFXMLHelper::parseInstallManifest($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[mediaplayer][' . $name . ']', implode(' ', $attribs), 'value', 'text', $value, $id);
 }
Beispiel #6
0
 /**
  * Get extension versions
  * @return Array
  */
 public function getVersions()
 {
     $db = JFactory::getDBO();
     $versions = array('joomla' => array(), 'jce' => array());
     // Get Component xml
     $com_xml = WFXMLHelper::parseInstallManifest(JPATH_ADMINISTRATOR . '/components/com_jce/jce.xml');
     // set component version
     $versions['joomla']['com_jce'] = $com_xml['version'];
     // get mediabox version
     $mediabox_xml_file = WF_JOOMLA15 ? JPATH_PLUGINS . '/system/jcemediabox.xml' : JPATH_PLUGINS . '/system/jcemediabox/jcemediabox.xml';
     // set mediabox version
     if (file_exists($mediabox_xml_file)) {
         $mediabox_xml = WFXMLHelper::parseInstallManifest($mediabox_xml_file);
         $versions['joomla']['plg_jcemediabox'] = $mediabox_xml['version'];
     }
     wfimport('admin.models.plugins');
     $model = new WFModelPlugins();
     // get all plugins
     $plugins = $model->getPlugins();
     // get all extensions
     $extensions = $model->getExtensions();
     foreach ($plugins as $plugin) {
         if ($plugin->core == 0) {
             $file = WF_EDITOR_PLUGINS . '/' . $plugin->name . '/' . $plugin->name . '.xml';
             $xml = WFXMLHelper::parseInstallManifest($file);
             $versions['jce']['jce_' . $plugin->name] = $xml['version'];
         }
     }
     foreach ($extensions as $extension) {
         if ($extension->core == 0) {
             $file = WF_EDITOR_EXTENSIONS . '/' . $extension->folder . '/' . $extension->extension . '.xml';
             $xml = WFXMLHelper::parseInstallManifest($file);
             $versions['jce']['jce_' . $extension->folder . '_' . $extension->extension] = $xml['version'];
         }
     }
     return $versions;
 }
 public function getLanguages()
 {
     // Get the site languages
     $base = JLanguage::getLanguagePath(JPATH_SITE);
     $dirs = JFolder::folders($base);
     for ($i = 0; $i < count($dirs); $i++) {
         $lang = new stdClass();
         $lang->folder = $dirs[$i];
         $lang->baseDir = $base;
         $languages[] = $lang;
     }
     $rows = array();
     foreach ($languages as $language) {
         $files = JFolder::files($language->baseDir . '/' . $language->folder, '\\.(com_jce)\\.xml$');
         foreach ($files as $file) {
             $data = WFXMLHelper::parseInstallManifest($language->baseDir . '/' . $language->folder . '/' . $file);
             $row = new StdClass();
             $row->language = $language->folder;
             if ($row->language == 'en-GB') {
                 $row->cbd = 'disabled="disabled"';
                 $row->style = ' style="color:#999999;"';
             } else {
                 $row->cbd = '';
                 $row->style = '';
             }
             // If we didn't get valid data from the xml file, move on...
             if (!is_array($data)) {
                 continue;
             }
             // Populate the row from the xml meta file
             foreach ($data as $key => $value) {
                 $row->{$key} = $value;
             }
             $rows[] = $row;
         }
     }
     return $rows;
 }
Beispiel #8
0
 function getVersion()
 {
     $xml = WFXMLHelper::parseInstallManifest(JPATH_ADMINISTRATOR . '/components/com_jce/jce.xml');
     return $xml['version'];
 }
Beispiel #9
0
    protected function getPluginVersion() {
        $manifest = WF_EDITOR_PLUGIN . '/' . $this->get('name') . '.xml';
        
        $version = '';
            
        if (is_file($manifest)) {
            $xml = WFXMLHelper::parseInstallManifest($manifest);

            if ($xml && isset($xml['version'])) {
                $version = $xml['version'];
            }
        }
        
        if ($version) {
            $version = preg_replace('#[^a-z0-9]+#i', '', $version);
        }
        
        return $version;
    }
Beispiel #10
0
 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 = '';
         $manifest = WF_EDITOR_PLUGIN . '/' . $name . '.xml';
         if (is_file($manifest)) {
             $xml = WFXMLHelper::parseInstallManifest($manifest);
             if ($xml && isset($xml['version'])) {
                 $plugin_version = $xml['version'];
             }
         }
         // add plugin version
         if ($plugin_version) {
             $version .= '-' . preg_replace('#[^a-z0-9]+#i', '', $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();
     }
 }
Beispiel #11
0
 public function execute()
 {
     WFToken::checkToken() or die('RESTRICTED ACCESS');
     // JSON request or upload action
     if ($this->isRequest()) {
         $request = WFRequest::getInstance();
         $request->process();
     } else {
         $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'), 'mode' => 'plugin'));
             $data = $parser->load();
             $parser->output($data);
         }
         $this->loadLanguage('com_jce', JPATH_ADMINISTRATOR);
         // Load Plugin language
         $this->loadPluginLanguage();
         $xml = WFXMLHelper::parseInstallManifest(WF_EDITOR_PLUGIN . '/' . $name . '.xml');
         if (isset($xml['version'])) {
             $version = $xml['version'];
         }
         // create the document
         $document = WFDocument::getInstance(array('version' => $version, 'title' => WFText::_('WF_' . strtoupper($this->getName() . '_TITLE')), 'name' => $name, 'language' => $this->getLanguageTag(), 'direction' => $this->getLanguageDir(), '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();
         if (WF_INI_LANG) {
             // ini language
             $document->addScript(array('index.php?option=com_jce&view=editor&' . $document->getQueryString(array('task' => 'loadlanguages'))), '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();
     }
 }