public function initialise() { // Put a small marker to indicate that we run inside another CMS $this->container->segment->set('insideCMS', true); // Load the configuration $this->container->appConfig->loadConfiguration(); // Attach the Joomla!-specific observer for Controller ACL checks $this->container->eventDispatcher->attach(new ControllerAcl($this->container->eventDispatcher)); // Attach the Joomla!-specific observer for template override support $this->container->eventDispatcher->attach(new ViewAlternatePaths($this->container->eventDispatcher)); // Set up the template (theme) to use – different for front-end and back-end if (empty($this->template) || $this->template == $this->container->application_name) { $template = Helper::isBackend() ? 'backend' : 'frontend'; $this->setTemplate($template); } // Load the extra language files $appName = $this->container->application_name; if (Helper::isBackend() && substr($appName, -5) == 'Admin') { $appName = substr($appName, 0, -5); } $appNameLower = strtolower($appName); $languageTag = \JFactory::getLanguage()->getTag(); Text::loadLanguage('en-GB', $appName, '.com_' . $appNameLower . '.ini', false, $this->container->languagePath); Text::loadLanguage($languageTag, $appName, '.com_' . $appNameLower . '.ini', true, $this->container->languagePath); // Load the framework's language file Text::loadLanguage('en-GB', 'lib_awf', '.ini', false, $this->container->languagePath); Text::loadLanguage($languageTag, 'lib_awf', '.ini', false, $this->container->languagePath); // In the back-end, also load front-end languages if (Helper::isBackend()) { Text::loadLanguage('en-GB', $appName, '.com_' . $appNameLower . '.ini', true, JPATH_SITE . '/language'); Text::loadLanguage($languageTag, $appName, '.com_' . $appNameLower . '.ini', true, JPATH_SITE . '/language'); Text::loadLanguage('en-GB', 'lib_awf', '.ini', true, JPATH_SITE . '/language'); Text::loadLanguage($languageTag, 'lib_awf', '.ini', false, JPATH_SITE . '/language'); } }
/** * Public constructor * * @param Container $container Configuration parameters * * @return Application */ public function __construct(Container $container = null) { // Start keeping time $this->startTime = microtime(true); // Create or attach the DI container if (!is_object($container) || !$container instanceof Container) { $container = new Container(); } $this->container = $container; // Set the application name if (empty($container['application_name'])) { $container->application_name = $this->getName(); } $this->name = $container->application_name; // Set up the filesystem path if (empty($container['filesystemBase'])) { $container->filesystemBase = APATH_BASE; } // Set up the base path if (empty($container['basePath'])) { $container->basePath = (defined('APATH_BASE') ? APATH_BASE : $container->filesystemBase) . '/' . ucfirst($this->name); } // Set up the template path if (empty($container['templatePath'])) { $container->templatePath = defined('APATH_THEMES') ? APATH_THEMES : $container->filesystemBase . '/templates'; } // Set up the temporary path if (empty($container['temporaryPath'])) { $container->temporaryPath = defined('APATH_TMP') ? APATH_TMP . '/tmp' : $container->filesystemBase . '/tmp'; } // Set up the language path if (empty($container['languagePath'])) { $container->languagePath = defined('APATH_TRANSLATION') ? APATH_TRANSLATION : $container->filesystemBase . '/languages'; } // Set up the language path if (empty($container['sqlPath'])) { $container->sqlPath = defined('APATH_ROOT') ? APATH_ROOT . '/installation/sql' : $container->filesystemBase . '/installation/sql'; } // Start the session $this->container->session->start(); // Forcibly create the session segment $segment = $this->container->segment; // Set up the template $this->setTemplate(); // Load the translation strings Text::addIniProcessCallback(array($this, 'processLanguageIniFile')); $languagePath = $container->languagePath; Text::loadLanguage(null, $this->name, '.ini', true, $languagePath); Text::loadLanguage('en-GB', $this->name, '.ini', false, $languagePath); }