Пример #1
0
	/**
	 * @param       $subject
	 * @param array $config
	 */
	public function __construct(&$subject, $config = array())
	{
		parent::__construct($subject, $config);


		if ($this->loadCommonLib()) {

			if (!defined('ROKCOMMON')) {
				$error_string = 'RokCommon System Plug-in is missing the RokCommon Library.  Please Reinstall.';
			} else if (ROKCOMMON != self::ROKCOMMON_PLUGIN_VERSION) {
				$error_string = sprintf('RokCommon Library Version (%s) does not match the RokCommon System Plug-in Version (%s).  Please Reinstall.', ROKCOMMON, self::ROKCOMMON_PLUGIN_VERSION);
			}
			if (!empty($error_string)) {
				if (JError::$legacy) {
					return JError::raiseWarning(500, $error_string);
				} else {
					throw new Exception($error_string);
				}
			} else {
				RokCommon_ClassLoader::addPath(dirname(__FILE__) . '/lib');
				$conf = JFactory::getConfig();
				RokCommon_Service::setTempFileDir($conf->get('tmp_path'));
				RokCommon_Service::setDevelopmentMode($this->params->get('developmentMode', false));
				$this->contaier   = RokCommon_Service::getContainer();
				$this->logger     = $this->contaier->logger;
				$this->dispatcher = $this->contaier->dispatcher;
				$this->processRegisteredConfigs();
				if (!defined('ROKCOMMON_PLUGIN_LOADED')) define('ROKCOMMON_PLUGIN_LOADED', self::ROKCOMMON_PLUGIN_VERSION);
			}
		}
	}
Пример #2
0
 /**
  * @param       $subject
  * @param array $config
  */
 public function __construct(&$subject, $config = array())
 {
     if ($this->loadCommonLib()) {
         if (!defined('ROKCOMMON')) {
             $error_string = 'RokCommon System Plug-in is missing the RokCommon Library.  Please Reinstall.';
         } elseif (ROKCOMMON != self::ROKCOMMON_PLUGIN_VERSION) {
             $error_string = sprintf('RokCommon Library Version (%s) does not match the RokCommon System Plug-in Version (%s).  Please Reinstall.', ROKCOMMON, self::ROKCOMMON_PLUGIN_VERSION);
         }
         if (!empty($error_string)) {
             JFactory::getApplication()->enqueueMessage($error_string, 'warning');
             return;
         }
         // Only register plugin on success.
         parent::__construct($subject, $config);
         RokCommon_ClassLoader::addPath(dirname(__FILE__) . '/lib');
         $conf = JFactory::getConfig();
         RokCommon_Service::setTempFileDir($conf->get('tmp_path'));
         RokCommon_Service::setDevelopmentMode($this->params->get('developmentMode', false));
         $this->container = RokCommon_Service::getContainer();
         $this->logger = $this->container->logger;
         $this->dispatcher = $this->container->dispatcher;
         $this->processRegisteredConfigs();
         if (!defined('ROKCOMMON_PLUGIN_LOADED')) {
             define('ROKCOMMON_PLUGIN_LOADED', self::ROKCOMMON_PLUGIN_VERSION);
         }
     }
 }