Example #1
0
 function getLicense()
 {
     $file = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce' . DS . 'jce.xml';
     $license = 'GNU / GPL 2 or later';
     $xml = WFXMLElement::getXML($file);
     if ($xml) {
         $licence = $xml->licence->data();
     }
     return $license;
 }
Example #2
0
 public static function parseInstallManifest($file)
 {
     $xml = WFXMLElement::load($file);
     if (!$xml) {
         return false;
     }
     if ($xml->getName() != 'install' && $xml->getName() != 'extension') {
         return false;
     }
     $data = array('version' => (string) $xml->version, 'name' => (string) $xml->name, 'copyright' => (string) $xml->copyright, 'authorEmail' => (string) $xml->authorEmail, 'authorUrl' => (string) $xml->authorUrl, 'description' => (string) $xml->description, 'author' => (string) $xml->author);
     return $data;
 }
Example #3
0
 public static function getXML($file)
 {
     // use JSimpleXML
     if (!method_exists('JFactory', 'getXML')) {
         $xml = JFactory::getXMLParser('Simple');
         if (!$xml->loadFile($file)) {
             unset($xml);
             return false;
         }
     } else {
         $xml = WFXMLElement::getXML($file);
     }
     return $xml;
 }
Example #4
0
 function getTopics($file)
 {
     $result = '';
     if (file_exists($file)) {
         // load xml
         $xml = WFXMLElement::load($file);
         if ($xml) {
             foreach ($xml->help->children() as $topic) {
                 $subtopics = $topic->subtopic;
                 $class = count($subtopics) ? ' class="subtopics"' : '';
                 $key = (string) $topic->attributes()->key;
                 $title = (string) $topic->attributes()->title;
                 $file = (string) $topic->attributes()->file;
                 // if file attribute load file
                 if ($file) {
                     $result .= $this->getTopics(WF_EDITOR . '/' . $file);
                 } else {
                     $result .= '<dd' . $class . ' id="' . $key . '">' . trim(WFText::_($title)) . '</dd>';
                 }
                 if (count($subtopics)) {
                     $result .= '<dl class="hidden">';
                     foreach ($subtopics as $subtopic) {
                         $sub_subtopics = $subtopic->subtopic;
                         // if a file is set load it as sub-subtopics
                         if ($file = (string) $subtopic->attributes()->file) {
                             $result .= '<dd class="subtopics">' . trim(WFText::_((string) $subtopic->attributes()->title)) . '</dd>';
                             $result .= '<dl class="hidden">';
                             $result .= $this->getTopics(WF_EDITOR . '/' . $file);
                             $result .= '</dl>';
                         } else {
                             $id = $subtopic->attributes()->key ? ' id="' . (string) $subtopic->attributes()->key . '"' : '';
                             $class = count($sub_subtopics) ? ' class="subtopics"' : '';
                             $result .= '<dd' . $class . $id . '>' . trim(WFText::_((string) $subtopic->attributes()->title)) . '</dd>';
                             if (count($sub_subtopics)) {
                                 $result .= '<dl class="hidden">';
                                 foreach ($sub_subtopics as $sub_subtopic) {
                                     $result .= '<dd id="' . (string) $sub_subtopic->attributes()->key . '">' . trim(WFText::_((string) $sub_subtopic->attributes()->title)) . '</dd>';
                                 }
                                 $result .= '</dl>';
                             }
                         }
                     }
                     $result .= '</dl>';
                 }
             }
         }
     }
     return $result;
 }
Example #5
0
 protected static function check($tag)
 {
     $file = JPATH_SITE . '/language/' . $tag . '/' . $tag . '.com_jce.xml';
     if (file_exists($file)) {
         wfimport('admin.classes.xml');
         $xml = WFXMLElement::load($file);
         if ($xml) {
             $version = (string) $xml->attributes()->version;
             if ($version == '2.0') {
                 return true;
             }
         }
     }
     return false;
 }
 /**
  * Get Actions from access.xml file
  */
 protected function getActions()
 {
     $file = JPATH_COMPONENT_ADMINISTRATOR . '/access.xml';
     $xml = WFXMLElement::load($file);
     $actions = array();
     if ($xml) {
         // Iterate over the children and add to the actions.
         foreach ($xml->section->children() as $element) {
             if ($element->getName() == 'action') {
                 $actions[] = (object) array('name' => (string) $element['name'], 'title' => (string) $element['title'], 'description' => (string) $element['description']);
             }
         }
     }
     return $actions;
 }
 /**
  * Get a plugin's extensions
  * @param object $plugin
  * @return
  */
 public function getExtensions()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $extensions = array();
     // recursively get all extension files
     $files = JFolder::files(WF_EDITOR_EXTENSIONS, '\\.xml$', true, true);
     foreach ($files as $file) {
         $object = new StdClass();
         $object->folder = basename(dirname($file));
         $object->manifest = $file;
         $object->plugins = array();
         $name = basename($file, '.xml');
         $object->name = $name;
         $object->description = '';
         $object->id = $object->folder . '.' . $object->name;
         $xml = WFXMLElement::load($file);
         if ($xml) {
             $plugins = (string) $xml->plugins;
             if ($plugins) {
                 $object->plugins = explode(',', $plugins);
             }
             $object->name = (string) $xml->name;
             $object->title = (string) $xml->name;
             $object->description = (string) $xml->description;
             $object->creationdate = (string) $xml->creationDate;
             $object->author = (string) $xml->author;
             $object->version = (string) $xml->version;
             $object->type = (string) $xml->attributes()->folder;
             $object->authorUrl = (string) $xml->authorUrl;
             $object->folder = (string) $xml->attributes()->folder;
             $object->core = (int) $xml->attributes()->core ? 1 : 0;
             if ($object->core == 0) {
                 // load language
                 $language = JFactory::getLanguage();
                 $language->load('com_jce_' . $object->folder . '_' . $name, JPATH_SITE);
             }
         }
         $object->extension = $name;
         $extensions[] = $object;
     }
     return $extensions;
 }
 /**
  * Get additional plugins such as JCE MediaBox etc.
  * @return 
  */
 public function getRelated()
 {
     // Get a database connector
     $db = JFactory::getDBO();
     $params = JComponentHelper::getParams('com_jce');
     // pre-defined array of other plugins
     $related = preg_replace('#(\\w+)#', "'\$1'", $params->get('related_extensions', 'jcemediabox,jceutilities,mediaobject,wfmediabox,wfmediaelement'));
     $query = $db->getQuery(true);
     // Joomla! 2.5
     if (is_object($query)) {
         $query->select(array('extension_id', 'name', 'element', 'folder'))->from('#__extensions')->where(array('type = ' . $db->Quote('plugin'), 'element IN (' . $related . ')'))->order('name');
         // Joomla! 1.5
     } else {
         $query = 'SELECT id, name, element, folder FROM #__plugins WHERE element IN (' . $related . ') ORDER BY name';
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $language = JFactory::getLanguage();
     $num = count($rows);
     for ($i = 0; $i < $num; $i++) {
         $row = $rows[$i];
         if (defined('JPATH_PLATFORM')) {
             $file = JPATH_PLUGINS . '/' . $row->folder . '/' . $row->element . '/' . $row->element . ".xml";
         } else {
             $file = JPATH_PLUGINS . '/' . $row->folder . '/' . $row->element . ".xml";
         }
         if (isset($row->extension_id)) {
             $row->id = $row->extension_id;
         }
         if (is_file($file)) {
             $xml = WFXMLElement::load($file);
             if ($xml) {
                 $row->title = (string) $xml->name;
                 $row->author = (string) $xml->author;
                 $row->version = (string) $xml->version;
                 $row->creationdate = (string) $xml->creationDate;
                 $row->description = (string) $xml->description;
                 $row->authorUrl = (string) $xml->authorUrl;
             }
         }
         $language->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_ADMINISTRATOR);
         $language->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_SITE);
     }
     //return array_values($rows);
     return $rows;
 }
Example #9
0
 /**
  * Get default profile data
  * @return $row  Profile table object
  */
 function getDefaultProfile()
 {
     $mainframe = JFactory::getApplication();
     $file = JPATH_COMPONENT . '/models/profiles.xml';
     $xml = WFXMLElement::load($file);
     if ($xml) {
         foreach ($xml->profiles->children() as $profile) {
             if ($profile->attributes()->default) {
                 $row = JTable::getInstance('profiles', 'WFTable');
                 foreach ($profile->children() as $item) {
                     switch ($item->getName()) {
                         case 'rows':
                             $row->rows = (string) $item;
                             break;
                         case 'plugins':
                             $row->plugins = (string) $item;
                             break;
                         default:
                             $key = $item->getName();
                             $row->{$key} = (string) $item;
                             break;
                     }
                 }
                 // reset name and description
                 $row->name = '';
                 $row->description = '';
                 return $row;
             }
         }
     }
     return null;
 }
Example #10
0
 /**
  * Loads an XML setup file and parses it.
  *
  * @param   string  $path  A path to the XML setup file.
  *
  * @return  object
  * @since   2.2.5
  */
 public function loadSetupFile($path)
 {
     $result = false;
     if ($path) {
         $controls = explode(':', $this->control);
         if ($xml = WFXMLElement::load($path)) {
             $params = $xml;
             // move through tree
             foreach ($controls as $control) {
                 $params = $params->{$control};
             }
             foreach ($params as $param) {
                 $this->setXML($param);
                 $result = true;
             }
         }
     } else {
         $result = true;
     }
     return $result;
 }
 /**
  * Get additional plugins such as JCE MediaBox etc.
  * @return 
  */
 function getRelated()
 {
     // Get a database connector
     $db = JFactory::getDBO();
     $params = JComponentHelper::getParams('com_jce');
     // pre-defined array of other plugins
     $related = explode(',', $params->get('related_extensions', 'jcemediabox,jceutilities,mediaobject,wfmediabox'));
     $where = '';
     if (WF_JOOMLA15) {
         $query = 'SELECT id, name, element, folder FROM #__plugins';
     } else {
         $query = 'SELECT extension_id as id, name, element, folder FROM #__extensions';
         $where .= ' AND type = ' . $db->Quote('plugin');
     }
     $query .= ' WHERE element IN (' . preg_replace('/([a-z0-9-_\\.]+)/i', "'\$1'", implode(',', $related)) . ')' . $where . ' ORDER BY name';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $language = JFactory::getLanguage();
     $numRows = count($rows);
     for ($i = 0; $i < $numRows; $i++) {
         $row = $rows[$i];
         // Get the plugin xml file
         $file = JPATH_PLUGINS . DS . $row->folder . DS . $row->element . ".xml";
         if (is_file($file)) {
             $xml = WFXMLElement::getXML($file);
             if ($xml) {
                 $row->title = (string) $xml->name;
                 $row->author = (string) $xml->author;
                 $row->version = (string) $xml->version;
                 $row->creationdate = (string) $xml->creationDate;
                 $row->description = (string) $xml->description;
             }
         }
         $language->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_ADMINISTRATOR);
         $language->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_SITE);
     }
     return $rows;
 }
Example #12
0
 /**
  * Upgrade database tables and remove legacy folders
  * @return Boolean
  */
 private static function upgrade($version)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $admin = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce';
     $site = JPATH_SITE . DS . 'components' . DS . 'com_jce';
     require_once $admin . DS . 'helpers' . DS . 'parameter.php';
     // add tables path
     JTable::addIncludePath($admin . DS . 'tables');
     // upgrade from 1.5.x to 2.0.0 (only in Joomla! 1.5)
     if (version_compare($version, '2.0.0', '<') && !defined('JPATH_PLATFORM')) {
         // check for groups table / data
         if (self::checkTable('#__jce_groups') && self::checkTableContents('#__jce_groups')) {
             jimport('joomla.plugin.helper');
             // get plugin
             $plugin = JPluginHelper::getPlugin('editors', 'jce');
             // get JCE component
             $table = JTable::getInstance('component');
             $table->loadByOption('com_jce');
             // process params to JSON string
             $params = WFParameterHelper::toObject($table->params);
             // set params
             $table->params = json_encode(array('editor' => $params));
             // store
             $table->store();
             // get all groups data
             $query = 'SELECT * FROM #__jce_groups';
             $db->setQuery($query);
             $groups = $db->loadObjectList();
             // get all plugin data
             $query = 'SELECT id, name, icon FROM #__jce_plugins';
             $db->setQuery($query);
             $plugins = $db->loadAssocList('id');
             $map = array('advlink' => 'link', 'advcode' => 'source', 'tablecontrols' => 'table', 'styleprops' => 'style');
             if (self::createProfilesTable()) {
                 foreach ($groups as $group) {
                     $row = JTable::getInstance('profiles', 'WFTable');
                     $rows = array();
                     // transfer row ids to names
                     foreach (explode(';', $group->rows) as $item) {
                         $icons = array();
                         foreach (explode(',', $item) as $id) {
                             // spacer
                             if ($id == '00') {
                                 $icon = 'spacer';
                             } else {
                                 if (isset($plugins[$id])) {
                                     $icon = $plugins[$id]['icon'];
                                     // map old icon names to new
                                     if (isset($map[$icon])) {
                                         $icon = $map[$icon];
                                     }
                                 }
                             }
                             $icons[] = $icon;
                         }
                         $rows[] = str_replace(array('cite,abbr,acronym,del,ins,attribs', 'search,replace', 'ltr,rtl', 'readmore,pagebreak', 'cut,copy,paste'), array('xhtmlxtras', 'searchreplace', 'directionality', 'article', 'paste'), implode(',', $icons));
                     }
                     // re-assign rows
                     $row->rows = implode(';', $rows);
                     $names = array('anchor');
                     // transfer plugin ids to names
                     foreach (explode(',', $group->plugins) as $id) {
                         if (isset($plugins[$id])) {
                             $name = $plugins[$id]['name'];
                             // map old icon names to new
                             if (isset($map[$name])) {
                                 $name = $map[$name];
                             }
                             $names[] = $name;
                         }
                     }
                     // re-assign plugins
                     $row->plugins = implode(',', $names);
                     // convert params to JSON
                     $params = WFParameterHelper::toObject($group->params);
                     $data = new StdClass();
                     foreach ($params as $key => $value) {
                         $parts = explode('_', $key);
                         $node = array_shift($parts);
                         // special consideration for imgmanager_ext!!
                         if (strpos($key, 'imgmanager_ext_') !== false) {
                             $node = $node . '_' . array_shift($parts);
                         }
                         // convert some nodes
                         if (isset($map[$node])) {
                             $node = $map[$node];
                         }
                         $key = implode('_', $parts);
                         if ($value !== '') {
                             if (!isset($data->{$node}) || !is_object($data->{$node})) {
                                 $data->{$node} = new StdClass();
                             }
                             // convert Link parameters
                             if ($node == 'link' && $key != 'target') {
                                 $sub = $key;
                                 $key = 'links';
                                 if (!isset($data->{$node}->{$key})) {
                                     $data->{$node}->{$key} = new StdClass();
                                 }
                                 if (preg_match('#^(content|contacts|static|weblinks|menu)$#', $sub)) {
                                     if (!isset($data->{$node}->{$key}->joomlalinks)) {
                                         $data->{$node}->{$key}->joomlalinks = new StdClass();
                                         $data->{$node}->{$key}->joomlalinks->enable = 1;
                                     }
                                     $data->{$node}->{$key}->joomlalinks->{$sub} = $value;
                                 } else {
                                     $data->{$node}->{$key}->{$sub} = new StdClass();
                                     $data->{$node}->{$key}->{$sub}->enable = 1;
                                 }
                             } else {
                                 $data->{$node}->{$key} = $value;
                             }
                         }
                     }
                     // re-assign params
                     $row->params = json_encode($data);
                     // re-assign other values
                     $row->name = $group->name;
                     $row->description = $group->description;
                     $row->users = $group->users;
                     $row->types = $group->types;
                     $row->components = $group->components;
                     $row->published = $group->published;
                     $row->ordering = $group->ordering;
                     // add area data
                     if ($row->name == 'Default') {
                         $row->area = 0;
                     }
                     if ($row->name == 'Front End') {
                         $row->area = 1;
                     }
                     if (self::checkTable('#__wf_profiles')) {
                         $name = $row->name;
                         // check for existing profile
                         $query = 'SELECT id FROM #__wf_profiles' . ' WHERE name = ' . $db->Quote($name);
                         $db->setQuery($query);
                         // create name copy if exists
                         while ($db->loadResult()) {
                             $name = JText::sprintf('WF_PROFILES_COPY_OF', $name);
                             $query = 'SELECT id FROM #__wf_profiles' . ' WHERE name = ' . $db->Quote($name);
                             $db->setQuery($query);
                         }
                         // set name
                         $row->name = $name;
                     }
                     if (!$row->store()) {
                         $app->enqueueMessage('Conversion of group data failed : ' . $row->name, 'error');
                     } else {
                         $app->enqueueMessage('Conversion of group data successful : ' . $row->name);
                     }
                     unset($row);
                 }
                 // Drop tables
                 $query = 'DROP TABLE IF EXISTS #__jce_groups';
                 $db->setQuery($query);
                 $db->query();
                 // If profiles table empty due to error, install profiles data
                 if (!self::checkTableContents('#__wf_profiles')) {
                     self::installProfiles();
                 }
             } else {
                 return false;
             }
             // Install profiles
         } else {
             self::installProfiles();
         }
         // Drop tables
         $query = 'DROP TABLE IF EXISTS #__jce_plugins';
         $db->setQuery($query);
         $db->query();
         // Drop tables
         $query = 'DROP TABLE IF EXISTS #__jce_extensions';
         $db->setQuery($query);
         $db->query();
         // Remove Plugins menu item
         $query = 'DELETE FROM #__components' . ' WHERE admin_menu_link = ' . $db->Quote('option=com_jce&type=plugins');
         $db->setQuery($query);
         $db->query();
         // Update Component Name
         $query = 'UPDATE #__components' . ' SET name = ' . $db->Quote('COM_JCE') . ' WHERE ' . $db->Quote('option') . '=' . $db->Quote('com_jce') . ' AND parent = 0';
         $db->setQuery($query);
         $db->query();
         // Fix links for other views and edit names
         $menus = array('install' => 'installer', 'group' => 'profiles', 'groups' => 'profiles', 'config' => 'config');
         $row = JTable::getInstance('component');
         foreach ($menus as $k => $v) {
             $query = 'SELECT id FROM #__components' . ' WHERE admin_menu_link = ' . $db->Quote('option=com_jce&type=' . $k);
             $db->setQuery($query);
             $id = $db->loadObject();
             if ($id) {
                 $row->load($id);
                 $row->name = $v;
                 $row->admin_menu_link = 'option=com_jce&view=' . $v;
                 if (!$row->store()) {
                     $mainframe->enqueueMessage('Unable to update Component Links for view : ' . strtoupper($v), 'error');
                 }
             }
         }
         // remove old admin language files
         $folders = JFolder::folders(JPATH_ADMINISTRATOR . DS . 'language', '.', false, true, array('.svn', 'CVS', 'en-GB'));
         foreach ($folders as $folder) {
             $name = basename($folder);
             $files = array($name . '.com_jce.ini', $name . '.com_jce.menu.ini', $name . '.com_jce.xml');
             foreach ($files as $file) {
                 if (is_file($folder . DS . $file)) {
                     @JFile::delete($folder . DS . $file);
                 }
             }
         }
         // remove old site language files
         $folders = JFolder::folders(JPATH_SITE . DS . 'language', '.', false, true, array('.svn', 'CVS', 'en-GB'));
         foreach ($folders as $folder) {
             $files = JFolder::files($folder, '^' . basename($folder) . '\\.com_jce([_a-z0-9]+)?\\.(ini|xml)$', false, true);
             @JFile::delete($files);
         }
         // remove legacy admin folders
         $folders = array('cpanel', 'config', 'css', 'groups', 'plugins', 'img', 'installer', 'js');
         foreach ($folders as $folder) {
             if (is_dir($admin . DS . $folder)) {
                 @JFolder::delete($admin . DS . $folder);
             }
         }
         // remove legacy admin files
         $files = array('editor.php', 'helper.php', 'updater.php');
         foreach ($files as $file) {
             if (is_file($admin . DS . $file)) {
                 @JFile::delete($admin . DS . $file);
             }
         }
         // remove legacy admin folders
         $folders = array('controller', 'css', 'js');
         foreach ($folders as $folder) {
             if (is_dir($site . DS . $folder)) {
                 @JFolder::delete($site . DS . $folder);
             }
         }
         // remove legacy admin files
         $files = array('popup.php');
         foreach ($files as $file) {
             if (is_file($site . DS . $file)) {
                 @JFile::delete($site . DS . $file);
             }
         }
         if (!defined('JPATH_PLATFORM')) {
             // remove old plugin folder
             $path = JPATH_PLUGINS . DS . 'editors';
             if (is_dir($path . DS . 'jce')) {
                 @JFolder::delete($path . DS . 'jce');
             }
         }
         return true;
     }
     // end JCE 1.5 upgrade
     // cleanup javascript and css files moved to site
     if (version_compare($version, '2.0.10', '<')) {
         $path = $admin . DS . 'media';
         $scripts = array('colorpicker.js', 'help.js', 'html5.js', 'select.js', 'tips.js');
         foreach ($scripts as $script) {
             if (is_file($path . DS . 'js' . DS . $script)) {
                 @JFile::delete($path . DS . 'js' . DS . $script);
             }
         }
         if (is_dir($path . DS . 'js' . DS . 'jquery')) {
             @JFolder::delete($path . DS . 'js' . DS . 'jquery');
         }
         $styles = array('help.css', 'select.css', 'tips.css');
         foreach ($styles as $style) {
             if (is_file($path . DS . 'css' . DS . $style)) {
                 @JFile::delete($path . DS . 'css' . DS . $style);
             }
         }
         // delete jquery
         if (is_dir($path . DS . 'css' . DS . 'jquery')) {
             @JFolder::delete($path . DS . 'css' . DS . 'jquery');
         }
         // remove popup controller
         if (is_dir($site . DS . 'controller')) {
             @JFolder::delete($site . DS . 'controller');
         }
     }
     // delete error.php file
     if (version_compare($version, '2.0.12', '<')) {
         if (is_file($site . DS . 'editor' . DS . 'libraries' . DS . 'classes' . DS . 'error.php')) {
             @JFile::delete($site . DS . 'editor' . DS . 'libraries' . DS . 'classes' . DS . 'error.php');
         }
     }
     // remove old jQuery and jQuery UI versions
     if (version_compare($version, '2.0.20', '<')) {
         $path = $site . DS . 'editor' . DS . 'libraries' . DS . 'js' . DS . 'jquery';
         $files = array('jquery-1.7.1.min.js', 'jquery-ui-1.8.17.custom.min.js', 'jquery-ui-layout.js');
         foreach ($files as $file) {
             if (is_file($path . DS . $file)) {
                 @JFile::delete($path . DS . $file);
             }
         }
     }
     if (version_compare($version, '2.1', '<')) {
         if (is_dir($admin . DS . 'plugin')) {
             @JFolder::delete($admin . DS . 'plugin');
         }
         // Add Visualblocks plugin
         $query = 'SELECT id FROM #__wf_profiles';
         $db->setQuery($query);
         $profiles = $db->loadObjectList();
         $profile = JTable::getInstance('Profiles', 'WFTable');
         if (!empty($profiles)) {
             foreach ($profiles as $item) {
                 $profile->load($item->id);
                 if (strpos($profile->rows, 'visualblocks') === false) {
                     $profile->rows = str_replace('visualchars', 'visualchars,visualblocks', $profile->rows);
                 }
                 if (strpos($profile->plugins, 'visualblocks') === false) {
                     $profile->plugins = str_replace('visualchars', 'visualchars,visualblocks', $profile->plugins);
                 }
                 $profile->store();
             }
         }
     }
     if (version_compare($version, '2.1.1', '<')) {
         @JFile::delete($admin . DS . 'classes' . DS . 'installer.php');
         // Add Visualblocks plugin
         $query = 'SELECT id FROM #__wf_profiles';
         $db->setQuery($query);
         $profiles = $db->loadObjectList();
         $profile = JTable::getInstance('Profiles', 'WFTable');
         if (!empty($profiles)) {
             foreach ($profiles as $item) {
                 $profile->load($item->id);
                 // add anchor to end of plugins list
                 if (strpos($profile->rows, 'anchor') !== false) {
                     $profile->plugins .= ',anchor';
                 }
                 $profile->store();
             }
         }
         // delete old anchor stuff
         $theme = $site . DS . 'editor' . DS . 'tiny_mce' . DS . 'themes' . DS . 'advanced';
         foreach (array('css/anchor.css', 'js/anchor.js', 'tmpl/anchor.php', 'skins/default/img/items.gif') as $item) {
             if (JFile::exists($theme . DS . $item)) {
                 @JFile::delete($theme . DS . $item);
             }
         }
         // delete popup.php
         if (is_file($site . DS . 'popup.php')) {
             @JFile::delete($site . DS . 'popup.php');
         }
     }
     // remove old jQuery and jQuery UI versions
     if (version_compare($version, '2.2.0', '<')) {
         $path = $site . DS . 'editor' . DS . 'libraries' . DS . 'js' . DS . 'jquery';
         $file = 'jquery-ui-1.8.20.custom.min.js';
         if (is_file($path . DS . $file)) {
             @JFile::delete($path . DS . $file);
         }
     }
     // Add "Blogger" profile and selete some stuff
     if (version_compare($version, '2.2.1', '<')) {
         $path = $site . DS . 'editor' . DS . 'extensions' . DS . 'browser';
         $files = array('css/search.css', 'js/search.js', 'search.php');
         foreach ($files as $file) {
             if (is_file($path . DS . $file)) {
                 @JFile::delete($path . DS . $file);
             }
         }
         // Blogger
         $file = $admin . DS . 'models' . DS . 'profiles.xml';
         $xml = WFXMLElement::getXML($file);
         if ($xml) {
             foreach ($xml->profiles->children() as $profile) {
                 if ($profile->attributes()->name == 'Blogger') {
                     $row = JTable::getInstance('profiles', 'WFTable');
                     foreach ($profile->children() as $item) {
                         switch ($item->name()) {
                             case 'rows':
                                 $row->rows = $item->data();
                                 break;
                             case 'plugins':
                                 $row->plugins = $item->data();
                                 break;
                             default:
                                 $key = $item->name();
                                 $row->{$key} = $item->data();
                                 break;
                         }
                     }
                     $row->store();
                 }
             }
         }
     }
     return true;
 }