function onAfterInitialise() { jimport('joomla.filesystem.file'); if (!version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.5 code here if (JFile::exists(JPATH_SITE . '/plugins/system/citruscart/citruscart.php')) { $this->attemptInstallation(); } } // Determine Joomla! version if (version_compare(JVERSION, '3.0', 'ge')) { define('DSC_JVERSION', '30'); } else { if (version_compare(JVERSION, '2.5', 'ge')) { define('DSC_JVERSION', '25'); } else { define('DSC_JVERSION', '15'); } } //TODO Clear out all DS in components, Define the DS constant under Joomla! 3.0 if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } // Import Joomla! classes jimport('joomla.application.component.controller'); jimport('joomla.application.component.model'); jimport('joomla.application.component.view'); // Get application $mainframe = JFactory::getApplication(); // Load the Base classes JLoader::register('DSCTableBase', JPATH_SITE . '/libraries/citruscart/library/compatibility/table.php'); JLoader::register('DSCControllerBase', JPATH_SITE . '/libraries/citruscart/library/compatibility/controller.php'); JLoader::register('DSCModelBase', JPATH_SITE . '/libraries/citruscart/library/compatibility/model.php'); JLoader::register('DSCViewBase', JPATH_SITE . '/libraries/citruscart/library/compatibility/view.php'); if (!class_exists('DSC')) { if (!JFile::exists(JPATH_SITE . '/libraries/citruscart/citruscart.php')) { return false; } require_once JPATH_SITE . '/libraries/citruscart/citruscart.php'; } return DSC::loadLibrary(); }
/** * Load the library -- installing it if necessary * * @return boolean result of install & load */ public function getLibrary() { if (!$this->checkPHPVersion()) { $this->setError("You do not meet the minimum system requirements. You must have at least PHP version: " . $this->min_php_required . " but you are using " . PHP_VERSION); return false; } jimport('joomla.filesystem.file'); if (!class_exists('DSC')) { if (!JFile::exists(JPATH_SITE . '/libraries/dioscouri/dioscouri.php')) { JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_installer/models'); if ($this->install('library')) { // if j15, move files if (!version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.5 code here if (JFile::exists(JPATH_SITE . '/plugins/system/dioscouri/dioscouri.php')) { $this->manuallyInstallLibrary(); } } else { if (!$this->install('plugin')) { $this->setError("Could not install Dioscouri System Plugin"); } } if (!$this->enablePlugin()) { $this->setError("Could not enable the Dioscouri System Plugin"); } if (JFile::exists(JPATH_SITE . '/libraries/dioscouri/dioscouri.php')) { require_once JPATH_SITE . '/libraries/dioscouri/dioscouri.php'; if (!DSC::loadLibrary()) { $this->setError("Could not load Dioscouri Library after installing it"); return false; } return true; } } else { $this->setError("Could not install Dioscouri Library"); return false; } } else { require_once JPATH_SITE . '/libraries/dioscouri/dioscouri.php'; if (!DSC::loadLibrary()) { $this->setError("Could not load Dioscouri Library"); return false; } return true; } } return true; }