当前位置: 首页>>代码示例>>PHP>>正文


PHP WFXMLHelper::getXML方法代码示例

本文整理汇总了PHP中WFXMLHelper::getXML方法的典型用法代码示例。如果您正苦于以下问题:PHP WFXMLHelper::getXML方法的具体用法?PHP WFXMLHelper::getXML怎么用?PHP WFXMLHelper::getXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WFXMLHelper的用法示例。


在下文中一共展示了WFXMLHelper::getXML方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uninstall

 /**
  * Uninstall method
  *
  * @access	public
  * @param	string	$tag		The tag of the language to uninstall
  * @return	mixed	Return value for uninstall method in component uninstall file
  */
 function uninstall($tag)
 {
     // Set defaults
     $this->parent->set('name', $tag);
     $this->parent->set('version', '');
     // Clean tag
     $tag = trim($tag);
     $path = JPATH_SITE . '/language/' . $tag;
     if (!JFolder::exists($path)) {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_LANGUAGE_PATH_EMPTY'));
         return false;
     }
     // Because JCE languages don't have their own folders we cannot use the standard method of finding an installation manifest
     $manifest = $path . '/' . $tag . '.com_jce.xml';
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$xml) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->setManifest($xml);
         // Set the installation target paths
         $this->parent->setPath('extension_site', $path);
         $this->parent->setPath('extension_administrator', JPATH_ADMINISTRATOR . "/language/" . $tag);
         if (!$this->parent->removeFiles($this->get('site'))) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALL_DELETE_FILES_ERROR'));
             return false;
         }
         if (!$this->parent->removeFiles($this->get('administration'), 1)) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALL_DELETE_FILES_ERROR'));
             return false;
         }
         $this->parent->setPath('extension_site', JPATH_COMPONENT_SITE . '/editor/tiny_mce');
         if (!$this->parent->removeFiles($this->get('tinymce'))) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALL_DELETE_FILES_ERROR'));
             return false;
         }
         JFile::delete($manifest);
     } else {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_LANGUAGE_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_ERROR'));
         return false;
     }
     return true;
 }
开发者ID:spikart,项目名称:spikart.com.ua,代码行数:50,代码来源:language.php

示例2: uninstall

 /**
  * Uninstall method
  *
  * @access  public
  * @param int   $id  The id of the extension to uninstall
  * @return  boolean True on success
  */
 public function uninstall($id)
 {
     // Initialize variables
     $retval = true;
     $id = explode('.', $id);
     if (count($id) < 2) {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_EXTENSION_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_EXTENSION_FIELD_EMPTY'));
         return false;
     }
     $folder = '';
     $extension = '';
     if (count($id) > 2) {
         $plugin = $id[0];
         $folder = $id[1];
         $extension = $id[2];
     } else {
         $plugin = null;
         $folder = $id[0];
         $extension = $id[1];
     }
     $this->parent->set('name', $extension);
     // Get the extension folder so we can properly build the plugin path
     if (trim($extension) == '') {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_EXTENSION_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_EXTENSION_FIELD_EMPTY'));
         return false;
     }
     if ($plugin) {
         // Set the plugin root path
         $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'tiny_mce' . DS . 'plugins' . DS . $plugin . DS . 'extensions' . DS . $folder);
     } else {
         $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'extensions' . DS . $folder);
     }
     $manifest = $this->parent->getPath('extension_root') . DS . $extension . '.xml';
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$this->setManifest($xml)) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_EXTENSION_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->parent->set('name', WFText::_($this->get('name')));
         $this->parent->set('version', $this->get('version'));
         $this->parent->set('message', $this->get('description'));
         // can't remove a core plugin
         if ($this->get('core') == 1) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_EXTENSION_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_WARNCOREEXTENSION', WFText::_($this->get('name'))));
             return false;
         }
         // Remove the extension files
         $this->parent->removeFiles($this->get('files'), -1);
         // Remove all media and languages as well
         $this->parent->removeFiles($this->get('languages'), 0);
         $this->parent->removeFiles($this->get('media'), 0);
         JFile::delete($manifest);
     } else {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_EXTENSION_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_UNINSTALL_ERROR'));
         return false;
     }
     return $retval;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:65,代码来源:extension.php

示例3: uninstall

 /**
  * Uninstall method
  *
  * @access  public
  * @param 	string   $name  The name of the plugin to uninstall
  * @return  boolean True on success
  */
 public function uninstall($name)
 {
     // Initialize variables
     $row = null;
     $retval = true;
     $db = $this->parent->getDBO();
     $this->parent->set('name', $name);
     // Set the plugin root path
     $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'tiny_mce' . DS . 'plugins' . DS . $name);
     $manifest = $this->parent->getPath('extension_root') . DS . $name . '.xml';
     // Load the language file
     $language = JFactory::getLanguage();
     $language->load('com_jce_' . trim($name), JPATH_SITE);
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$this->setManifest($xml)) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->parent->set('name', $this->get('name'));
         $this->parent->set('version', $this->get('version'));
         $this->parent->set('message', $this->get('description'));
         // can't remove a core plugin
         if ($this->get('core') == 1) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_WARNCOREPLUGIN', WFText::_($this->get('name'))));
             return false;
         }
         // Remove all media and languages as well
         $this->parent->removeFiles($this->get('languages'), 0);
         $this->parent->removeFiles($this->get('media'), 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstall = $this->get('uninstall.script');
         if ($uninstall) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . DS . $uninstall)) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . DS . $uninstall;
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_UNINSTALL_ERROR'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
         // Remove from Groups
         JTable::addIncludePath(WF_ADMINISTRATOR . DS . 'groups');
         $rows = JTable::getInstance('profiles', 'WFTable');
         $query = 'SELECT id, name, plugins, rows' . ' FROM #__wf_profiles';
         $db->setQuery($query);
         $profiles = $db->loadObjectList();
         foreach ($profiles as $profile) {
             $plugins = explode(',', $profile->plugins);
             // Existence check
             if (in_array($this->get('plugin'), $plugins)) {
                 // Load tables
                 $rows->load($profile->id);
                 // Remove from plugins list
                 foreach ($plugins as $k => $v) {
                     if ($this->get('plugin') == $v) {
                         unset($plugins[$k]);
                     }
                 }
                 $rows->plugins = implode(',', $plugins);
                 // Remove from rows
                 if ($this->get('icon')) {
                     $lists = array();
                     foreach (explode(';', $profile->rows) as $list) {
                         $icons = explode(',', $list);
                         foreach ($icons as $k => $v) {
                             if ($this->get('plugin') == $v) {
                                 unset($icons[$k]);
                             }
                         }
                         $lists[] = implode(',', $icons);
                     }
                     $rows->rows = implode(';', $lists);
                 }
                 if (!$rows->store()) {
                     JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_REMOVE_FROM_GROUP_ERROR', $prows->name));
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:plugin.php

示例4: uninstall

 /**
  * Uninstall method
  *
  * @access  public
  * @param 	string   $name  The name of the plugin to uninstall
  * @return  boolean True on success
  */
 public function uninstall($name)
 {
     // Initialize variables
     $row = null;
     $retval = true;
     $db = $this->parent->getDBO();
     $parts = explode('.', $name);
     // get name
     $name = array_pop($parts);
     // get type eg: plugin or extension
     $type = array_shift($parts);
     $this->parent->set('name', $name);
     // Load the language file
     $language = JFactory::getLanguage();
     switch ($type) {
         case 'plugin':
             // create $path
             $path = JPATH_COMPONENT_SITE . '/editor/tiny_mce/plugins/' . $name;
             // load language file
             $language->load('com_jce_' . $name, JPATH_SITE);
             break;
         case 'extension':
             $parts[] = $name;
             $path = dirname(JPATH_COMPONENT_SITE . '/editor/extensions/' . implode('/', $parts));
             // load language file
             $language->load('com_jce_' . trim(implode('_', $parts)), JPATH_SITE);
             break;
     }
     // Set the plugin root path
     $this->parent->setPath('extension_root', $path);
     // set manifest path
     $manifest = $this->parent->getPath('extension_root') . '/' . $name . '.xml';
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$xml) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->parent->set('name', (string) $xml->name);
         $this->parent->set('version', (string) $xml->version);
         $this->parent->set('message', (string) $xml->description);
         // can't remove a core plugin
         if ((int) $xml->attributes()->core == 1) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_WARNCOREPLUGIN', WFText::_((string) $xml->name)));
             return false;
         }
         if ($type == 'extension') {
             $this->parent->removeFiles($xml->files, -1);
             JFile::delete($manifest);
         }
         // Remove all media and languages as well
         $this->parent->removeFiles($xml->languages, 0);
         $this->parent->removeFiles($xml->media, 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstall = (string) $xml->children('uninstall.script');
         if ($uninstall) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . '/' . $uninstall)) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . '/' . $uninstall;
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_UNINSTALL_ERROR'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
         // remove form profile
         if ($xml->icon) {
             $plugin = new StdClass();
             $plugin->name = (string) $xml->plugin;
             $plugin->icon = (string) $xml->icon;
             $plugin->path = $this->parent->getPath('extension_root');
             wfimport('admin.models.plugins');
             $model = new WFModelPlugins();
             $model->postInstall('uninstall', $plugin, $this);
         }
     } else {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_ERROR'));
         $retval = false;
     }
     // set plugin path
//.........这里部分代码省略.........
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:101,代码来源:plugin.php

示例5: checkLanguage

 protected function checkLanguage($tag)
 {
     $file = JPATH_SITE . DS . 'language' . DS . $tag . DS . $tag . '.com_jce.xml';
     if (file_exists($file)) {
         wfimport('admin.helpers.xml');
         $xml = WFXMLHelper::getXML($file);
         if ($xml) {
             $version = WFXMLHelper::getAttribute($xml, 'version');
             if ($version == '2.0') {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:15,代码来源:editor.php


注:本文中的WFXMLHelper::getXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。