/** * Load Modules Events * */ private static function _load_modules_events() { // Add path to installed modules $installed_modules = Modules()->get_installed_modules(); if (is_null($installed_modules)) { return FALSE; } // Be sure Events classes will be found but also will be able to load module libraries foreach ($installed_modules as $module) { if (isset($module['folder'])) { Finder::add_path(MODPATH . $module['folder'] . '/'); } } foreach ($installed_modules as $module) { if (!($details_class = self::_start_events_class($module['path']))) { continue; } } return TRUE; }
public function __construct() { // If the CI object is needed : self::$ci =& get_instance(); // Config Events $config = Modules()->get_module_config('Sfs'); $events = explode(',', $config['events']); // ionize < 1.0.4 hack : Be able to load module libraries $installed_modules = Modules()->get_installed_modules(); foreach ($installed_modules as $module) { if (isset($module['folder'])) { Finder::add_path(MODPATH . $module['folder'] . '/'); } } // Stop Forum Spam lib // @TODO : Enhance here to handle more services: // 1. Create one lib / service // 2. Rewrite the config system, which should have one key / service self::$ci->load->library('Sfs_Sfs'); foreach ($events as $event) { $event = trim($event); Event::register($event, array('Sfs_Sfs', 'on_post_check_before')); } }
/** * Constructor * */ public function __construct() { parent::__construct(); // $this->output->enable_profiler(true); // Unlock filtering if admin or editor users is logged in // $this->load->library('connect'); $this->connect = Connect::get_instance(); // Libraries $this->load->library('structure'); $this->load->library('widget'); // FTL parser // require_once APPPATH.'libraries/ftl/parser.php'; // Models // $this->load->model('structure_model', '', true); $this->load->model('menu_model', '', true); // Modules config $this->get_modules_config(); /* * Installed modules * */ require APPPATH . 'config/modules.php'; $installed_modules = $modules; foreach ($installed_modules as $module) { // Path to Module Finder::add_path(MODPATH . $module . '/'); } /* * Theme * */ // Set the current theme Theme::set_theme(Settings::get('theme')); // Theme config file // Overwrite Ionize standard config. if (is_file($file = Theme::get_theme_path() . 'config/config.php')) { include $file; if (!empty($config)) { foreach ($config as $k => $v) { $this->config->set_item($k, $v); } unset($config); } } /* * Menus * */ Settings::set('menus', $this->menu_model->get_list()); /* * Language * */ // Get all the website languages from DB and store them into config file "languages" key $languages = $this->settings_model->get_languages(); // Put all DB languages array to Settings Settings::set_languages($languages); // Set all languages online if conected as editor or more if (Connect()->is('editors', true)) { Settings::set_all_languages_online(); } // Simple languages code array, used to detect if Routers found language is in DB languages $online_lang_codes = array(); foreach (Settings::get_online_languages() as $language) { $online_lang_codes[] = $language['lang']; } // If Router detected that the lang code is not in DB languages, set it to the DB default one if (!in_array(config_item('language_abbr'), $online_lang_codes)) { // Settings::get_lang('default') returns the DB default lang code Settings::set('current_lang', Settings::get_lang('default')); $this->config->set_item('language_abbr', Settings::get_lang('default')); } else { // Store the current lang code (found by Router) to Settings Settings::set('current_lang', config_item('language_abbr')); } // Lang dependant settings for the current language : Meta, etc. Settings::set_settings_from_list($this->settings_model->get_lang_settings(config_item('language_abbr')), 'name', 'content'); /* * Static language * */ $lang_folder = Theme::get_theme_path() . 'language/' . Settings::get_lang() . '/'; $lang_files = array(); // Core languages files : Including except "admin_lang.php" if (is_dir(APPPATH . 'language/' . Settings::get_lang())) { $lang_files = glob(APPPATH . 'language/' . Settings::get_lang() . '/*_lang.php', GLOB_BRACE); foreach ($lang_files as $key => $lang_file) { if ($lang_file == APPPATH . 'language/' . Settings::get_lang() . '/admin_lang.php') { unset($lang_files[$key]); } } } // Theme languages files : Including. Can be empty $lf = glob(FCPATH . Theme::get_theme_path() . 'language/' . Settings::get_lang() . '/*_lang.php'); if (!empty($lf)) { $lang_files = array_merge($lf, (array) $lang_files); } // Modules foreach ($installed_modules as $module) { // Languages files : Including. Can be empty $lang_file = MODPATH . $module . '/language/' . Settings::get_lang() . '/' . strtolower($module) . '_lang.php'; array_push($lang_files, $lang_file); } // Widgets languages translations loading // Now done by the Widget library // Load all modules lang files if (!empty($lang_files)) { foreach ($lang_files as $l) { if (is_file($l) && '.' . end(explode('.', $l)) == EXT) { include $l; if (!empty($lang)) { foreach ($lang as $key => $translation) { // If the term doesn't exists if (!isset($this->lang->language[$key])) { $this->lang->language[$key] = $translation; } else { // Only replace by default (theme vs. module) if the translation is empty if (empty($this->lang->language[$key])) { $this->lang->language[$key] = $translation; } } } unset($lang); } } } } require_once APPPATH . 'libraries/Tagmanager.php'; }
/** * Sets the theme * * @access public * @param string The theme folder */ public static function set_theme($t) { self::$theme = $t; // Add current theme path to Finder searching path Finder::add_path(self::get_theme_path()); }
/** * Constructor * */ public function __construct() { parent::__construct(); $this->load->helper('module_helper'); // Redirect the not authorized user to the login panel. See /application/config/user.php User()->restrict_type_redirect = array('uri' => config_item('admin_url') . '/auth/login', 'flash_msg' => 'You have been denied access to %s', 'flash_use_lang' => FALSE, 'flash_var' => 'error'); $this->output->enable_profiler(FALSE); // Load Theme Events library $user_theme = Settings::get('theme'); if (is_file($file = FCPATH . 'themes/' . $user_theme . '/libraries/theme_events.php')) { Event::load_event_library($file); } // Set the admin theme as current theme Theme::set_theme('admin'); Settings::set('admin_url', config_item('admin_url')); // Set admin lang codes array Settings::set('admin_languages', $this->settings_model->get_admin_langs()); Settings::set('displayed_admin_languages', explode(',', Settings::get('displayed_admin_languages'))); // Set Router's found language code as current language Settings::set('current_lang', config_item('detected_lang_code')); // Load the current language translations file $this->lang->load('admin', Settings::get_lang()); // $this->lang->load('filemanager', Settings::get_lang()); // Modules translation files $modules = array(); require APPPATH . 'config/modules.php'; $this->modules = $modules; foreach ($this->modules as $module) { $lang_file = MODPATH . $module . '/language/' . Settings::get_lang() . '/' . strtolower($module) . '_lang.php'; // Add the module path to the Finder Finder::add_path(MODPATH . $module . '/'); if (is_file($lang_file)) { $lang = array(); include $lang_file; $this->lang->language = array_merge($this->lang->language, $lang); unset($lang); } } // @TODO : Remove this thing from the global CMS. Not more mandatory, but necessary for compatibility with historical version // Available menus // Each menu was a root node in which you can put several pages, which are composing a menu. // Was never really implemented in ionize historical version, but already used as : menus[0]... Settings::set('menus', config_item('menus')); // No cache for backend $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate'); $this->output->set_header('Cache-Control: post-check=0, pre-check=0', FALSE); $this->output->set_header('Pragma: no-cache'); }