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


PHP JInstaller::get方法代码示例

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


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

示例1: postflight

 function postflight($type, $parent)
 {
     $url = "http://www.jhackguard.com/downloads/com_jhackguard.zip";
     // Download the package at the URL given
     $p_file = JInstallerHelper::downloadPackage($url);
     // Was the package downloaded?
     if (!$p_file) {
         JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'));
         return false;
     }
     $config = JFactory::getConfig();
     $tmp_dest = $config->get('tmp_path');
     // Unpack the downloaded package file
     $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file, true);
     // Was the package unpacked?
     if (!$package || !$package['type']) {
         if (in_array($installType, array('upload', 'url'))) {
             JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
         }
         $app->setUserState('com_installer.message', JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'));
         return false;
     }
     // Get an installer instance
     $installer = new JInstaller();
     // Install the package
     if (!$installer->install($package['dir'])) {
         // There was an error installing the package
         $msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
         $result = false;
     } else {
         // Package installed sucessfully
         $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
         $result = true;
     }
     // Set some model state values
     $app = JFactory::getApplication();
     $app->enqueueMessage($msg);
     $app->setUserState('com_installer.message', $installer->message);
     $app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
     $app->setUserState('com_installer.redirect_url', $installer->get('redirect_url'));
     // Cleanup the install files
     if (!is_file($package['packagefile'])) {
         $config = JFactory::getConfig();
         $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
     }
     JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
     $app->enqueueMessage("The default installation of jHackGuard has no filters included. Please download the latest filters by going to the '<b>Filter Maintenance</b>' page in the component menu.", "error");
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:48,代码来源:installer.php

示例2: getManifest

 /**
  * Shit happens. Patched function to bypass bug in package uninstaller
  *
  * @param   JInstaller  $parent  Parent object
  *
  * @return  SimpleXMLElement
  */
 protected function getManifest($parent)
 {
     $element = strtolower(str_replace('InstallerScript', '', __CLASS__));
     $elementParts = explode('_', $element);
     if (count($elementParts) == 2) {
         $extType = $elementParts[0];
         $extName = $elementParts[1];
         if ($extType == 'pkg') {
             $rootPath = $parent->getParent()->getPath('extension_root');
             $manifestPath = dirname($rootPath);
             $manifestFile = $manifestPath . '/' . $element . '.xml';
             if (file_exists($manifestFile)) {
                 return JFactory::getXML($manifestFile);
             }
         }
     }
     return $parent->get('manifest');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:25,代码来源:install.php

示例3: uninstall

 /**
  * Performs the actual deinstallation of all extensions in the
  * <subinstall> section of the manifest.
  *
  * @return boolean true on success, false otherwise.
  */
 function uninstall()
 {
     $this->_mode = 0;
     if (is_a($this->_mysection, 'JSimpleXMLElement')) {
         $nodes = $this->_mysection->children();
         if (count($nodes) == 0) {
             return true;
         }
         foreach ($nodes as $n) {
             $ext = $this->_parseAttributes($n);
             if (!is_object($ext)) {
                 return $this->_abort();
             }
             $id = $this->_getExtID($ext, $ext->core);
             if ($id != null) {
                 // If the sub extension was locked (core), then it
                 // has to be unlocked first.
                 if ($ext->core) {
                     $this->_setcore($id, $ext->type, 0);
                 }
                 $subInstaller = new JInstaller();
                 $result = $subInstaller->uninstall($ext->type, $id, 0);
                 $msg = $subInstaller->get('message');
                 $this->_msg($msg, $result ? 'message' : 'warning');
                 $msg = $subInstaller->get('extension.message');
                 if (!empty($msg)) {
                     echo $msg;
                 }
                 if ($result) {
                     $this->_msg('Successfully removed ' . $ext->type . ' "' . $ext->dname . '".');
                 }
             }
         }
         $this->deleteFolderThumbImage();
     }
     return true;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:43,代码来源:subinstall.php

示例4: discover_install

 /**
  * Installs a discovered extension.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function discover_install()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $eid = $input->get('cid', 0, 'array');
     if (is_array($eid) || $eid) {
         if (!is_array($eid)) {
             $eid = array($eid);
         }
         $eid = ArrayHelper::toInteger($eid);
         $failed = false;
         foreach ($eid as $id) {
             $installer = new JInstaller();
             $result = $installer->discover_install($id);
             if (!$result) {
                 $failed = true;
                 $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_INSTALLFAILED') . ': ' . $id);
             }
         }
         // TODO - We are only receiving the message for the last JInstaller instance
         $this->setState('action', 'remove');
         $this->setState('name', $installer->get('name'));
         $app->setUserState('com_installer.message', $installer->message);
         $app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
         if (!$failed) {
             $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_INSTALLSUCCESSFUL'));
         }
     } else {
         $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_NOEXTENSIONSELECTED'));
     }
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:38,代码来源:discover.php

示例5: _checkCompatible

 /**
  * Method for checking compatibility installation environment
  *
  * @param  JInstaller   $parent Parent object
  *
  * @return bool         True if the installation environment is compatible
  */
 private function _checkCompatible($type, $parent)
 {
     // Get the application.
     $app = JFactory::getApplication();
     $this->_release = (string) $parent->get('manifest')->version;
     $min_version = (string) $parent->get('manifest')->attributes()->version;
     $jversion = new JVersion();
     if (version_compare($jversion->getShortVersion(), $min_version, 'lt')) {
         $app->enqueueMessage(JText::sprintf('MOD_SLIDESHOW_VERSION_UNSUPPORTED', $this->_release, $min_version), 'error');
         return false;
     }
     // Storing old release number for process in postflight.
     if ($type == 'update') {
         $oldRelease = $this->getParam('version');
         if (version_compare($this->_release, $oldRelease, 'le')) {
             $app->enqueueMessage(JText::sprintf('MOD_SLIDESHOW_UPDATE_UNSUPPORTED', $this->oldRelease, $this->_release), 'error');
             return false;
         }
     }
 }
开发者ID:beingsane,项目名称:mod_slideshow,代码行数:27,代码来源:script.php

示例6: preflight

 /**
  * Joomla! pre-flight event
  *
  * @param   string      $type    Installation type (install, update, discover_install)
  * @param   JInstaller  $parent  Parent object
  *
  * @return boolean
  */
 public function preflight($type, $parent)
 {
     $message = array();
     if (!version_compare(JVERSION, $this->minJVersion, 'ge')) {
         $msg = "<p>You need Joomla! {$this->minJVersion} or later to install this component</p>";
         JError::raiseWarning(100, $msg);
         return false;
     }
     // Only allow to install on min[J|Php]Version or later
     if (defined('PHP_VERSION')) {
         $version = PHP_VERSION;
     } elseif (function_exists('phpversion')) {
         $version = phpversion();
     } else {
         // Pfff, ok then we take the risk but we'll send a message about not getting the info
         $message[] = "<p>We couldn't get information about the PHP Version we assume that you have {$this->minPhpVersion} or later</p>";
         $version = $this->minPhpVersion;
     }
     if (!version_compare($version, $this->minPhpVersion, 'ge')) {
         $message[] = "<p>You need PHP {$this->minPhpVersion} or later to install this component</p>";
         $msg = implode('', $message);
         if (version_compare(JVERSION, '3.0', 'gt')) {
             JLog::add($msg, JLog::WARNING, 'jerror');
         } else {
             JError::raiseWarning(100, $msg);
         }
         return false;
     }
     // Only install on mysql
     $dbTargets = array('mysql', 'mysqli');
     $dbDriver = strtolower(JFactory::getDBO()->name);
     if (!in_array($dbDriver, $dbTargets)) {
         $msg = "<p>You need a mysql Database to install this component</p>";
         if (version_compare(JVERSION, '3.0', 'gt')) {
             JLog::add($msg, JLog::WARNING, 'jerror');
         } else {
             JError::raiseWarning(100, $msg);
         }
         return false;
     }
     if (strtolower($type) == 'update') {
         $toVersion = $parent->get("manifest")->version;
     }
     // Bugfix for certain installer features
     if (in_array($type, array('install'))) {
         BabioonInstallHelper::bugfixDBFunctionReturnedNoError($this->babioon_extension);
     } else {
         BabioonInstallHelper::bugfixCantBuildAdminMenus($this->babioon_extension);
         BabioonInstallHelper::fixSchemaVersion($this->babioon_extension);
         BabioonInstallHelper::fixBrokenSQLUpdates($this->babioon_extension, $parent);
     }
     return true;
 }
开发者ID:rdeutz,项目名称:babioon-event,代码行数:61,代码来源:script.babioonevent.php

示例7: _fix_createAdminMenus

 /**
  * _fix_createAdminMenus
  *
  * @param   JInstaller  $parent  Parent object
  *
  * @return void
  */
 private function _fix_createAdminMenus($parent)
 {
     $db = $parent->getParent()->getDbo();
     $query = $db->getQuery(true);
     $option = $parent->get('element');
     $query->clear()->select('id')->from('#__menu')->where('menutype = ' . $db->quote('main'))->where('client_id = 1')->where('(link = ' . $db->quote('index.php?option=' . $option) . ' OR ' . 'link like ' . $db->quote('index.php?option=' . $option . '&%') . ')')->where('type = ' . $db->quote('component'))->where('home = 0');
     $db->setQuery($query);
     $menu_ids = $db->loadColumn();
     if (!empty($menu_ids)) {
         $ids = implode(',', $menu_ids);
         // Remove the old menu item
         $query->clear()->delete('#__menu')->where('id in (' . $ids . ')');
         $db->setQuery($query);
         $db->query();
     }
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:23,代码来源:script.autotweet.php


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