Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 public function getPlugins()
 {
     wfimport('admin.models.plugins');
     $model = new WFModelPlugins();
     // get an array of all installed plugins in plugins folder
     $plugins = $model->getPlugins();
     $rows = array();
     $language = JFactory::getLanguage();
     foreach ($plugins as $plugin) {
         if ($plugin->core == 0) {
             $rows[] = $plugin;
             $language->load('com_jce_' . trim($plugin->name), JPATH_SITE);
         }
     }
     return $rows;
 }
Exemplo n.º 3
0
 /**
  * Return a list of icons for each JCE editor row
  *
  * @access public
  * @param string  The number of rows
  * @return The row array
  */
 private function getToolbar()
 {
     wfimport('admin.models.plugins');
     $model = new WFModelPlugins();
     $wf = WFEditor::getInstance();
     $rows = array('theme_advanced_buttons1' => '', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => '');
     // we need a profile object and some defined rows
     if (!is_object($this->profile) || empty($this->profile->rows)) {
         return $rows;
     }
     // get plugins
     $plugins = $model->getPlugins();
     // get core commands
     $commands = $model->getCommands();
     // merge plugins and commands
     $icons = array_merge($commands, $plugins);
     // create an array of rows
     $lists = explode(';', $this->profile->rows);
     // backwards compatability map
     $map = array('paste' => 'clipboard', 'spacer' => '|', 'forecolor' => 'fontcolor', 'backcolor' => 'backcolor');
     $x = 0;
     for ($i = 1; $i <= count($lists); $i++) {
         $buttons = array();
         $items = explode(',', $lists[$x]);
         foreach ($items as $item) {
             // set the plugin/command name
             $name = $item;
             // map legacy values etc.
             if (array_key_exists($item, $map)) {
                 $item = $map[$item];
             }
             // check if button should be in toolbar
             if ($item !== "|") {
                 if (array_key_exists($item, $icons) === false) {
                     continue;
                 }
                 // assign icon
                 $item = $icons[$item]->icon;
             }
             // check for custom plugin buttons
             if (array_key_exists($name, $plugins)) {
                 $custom = $wf->getParam($name . '.buttons');
                 if (!empty($custom)) {
                     $custom = array_filter((array) $custom);
                     if (empty($custom)) {
                         $item = "";
                     } else {
                         $a = array();
                         foreach (explode(',', $item) as $s) {
                             if (in_array($s, $custom) || $s == "|") {
                                 $a[] = $s;
                             }
                         }
                         $item = implode(',', $a);
                         // remove leading or trailing |
                         $item = trim($item, '|');
                     }
                 }
             }
             if (!empty($item)) {
                 // remove double |
                 $item = preg_replace('#(\\|,)+#', '|,', $item);
                 $buttons[] = $item;
             }
         }
         if (!empty($buttons)) {
             $rows['theme_advanced_buttons' . $i] = implode(',', $buttons);
         }
         $x++;
     }
     return $rows;
 }