get('tmp_path', sys_get_temp_dir()); } // Set up the language path if (empty($values['languagePath'])) { $values['languagePath'] = (Helper::isBackend() ? JPATH_ADMINISTRATOR : JPATH_ROOT) . '/language'; } // Set up the SQL files path if (empty($values['sqlPath'])) { $values['sqlPath'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($values['application_name']) . '/sql/xml'; } // Application service if (!isset($this['application'])) { $this['application'] = function (Container $c) { return Application::getInstance($c->application_name, $c); }; } // Session Manager service if (!isset($this['session'])) { $this['session'] = function () { return new \Awf\Platform\Joomla\Session\Manager( new \Awf\Platform\Joomla\Session\SegmentFactory, new \Awf\Platform\Joomla\Session\CsrfTokenFactory() ); }; } // Application Session Segment service if (!isset($this['segment'])) { $this['segment'] = function (Container $c) { if (empty($c->session_segment_name)) { $c->session_segment_name = $c->application_name; } return $c->session->newSegment($c->session_segment_name); }; } // Database Driver service if (!isset($this['db'])) { $this['db'] = function (Container $c) { $db = \JFactory::getDbo(); $options = array( 'connection' => $db->getConnection(), 'prefix' => $db->getPrefix(), 'driver' => 'mysqli', ); switch ($db->name) { case 'mysql': $options['driver'] = 'Mysql'; break; default: case 'mysqli': $options['driver'] = 'Mysqli'; break; case 'sqlsrv': case 'mssql': case 'sqlazure': $options['driver'] = 'Sqlsrv'; break; case 'postgresql': $options['driver'] = 'Postgresql'; break; case 'pdo': $options['driver'] = 'Pdo'; break; case 'sqlite': $options['driver'] = 'Sqlite'; break; } return Driver::getInstance($options); }; } // Application Event Dispatcher service if (!isset($this['eventDispatcher'])) { $this['eventDispatcher'] = function (Container $c) { return new Dispatcher($c); }; } // Application Configuration service if (!isset($values['appConfig'])) { $values['appConfig'] = function (Container $c) { return new Configuration($c); }; } // Application Router service if (!isset($values['router'])) { $values['router'] = function (Container $c) { return new Router($c); }; } // User Manager service if (!isset($values['userManager'])) { $values['userManager'] = function (Container $c) { return new Manager($c); }; } parent::__construct($values); // Mailer Object service – returns a Joomla! JMail object // IMPORTANT! It has to appear AFTER the parent __construct method $this['mailer'] = $this->factory(function (Container $c) { return \JFactory::getMailer(); }); } }