/** Load a module helper **/ public function helper($helper) { if (is_array($helper)) { return $this->helpers($helper); } if (isset($this->_ci_helpers[$helper])) { return; } list($path, $_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/'); if ($path === FALSE) { return parent::helper($helper); } Modules::load_file($_helper, $path); $this->_ci_helpers[$_helper] = TRUE; }
/** * Helper Loader * Overridden to allow O_helpers to load after user helpers * * @param string|string[] $helpers Helper name(s) * @return object */ public function helper($helpers = array()) { /* load the helper(s) as normal */ parent::helper($helpers); /* then try to load the orange helper */ foreach ((array) $helpers as $helper) { /* Let's not waste time trying to load orange helpers we know don't exist. Since we created them we know if they exist or not */ $helper = str_replace('_helper', '', basename($helper, '.php')); if (in_array($helper, $this->orange_extended_helpers)) { /* the orange helpers are always in the orange/helpers folder. Where else would they be? */ $o_helper_file = __DIR__ . '/../helpers/o_' . $helper . '_helper.php'; /* if real path returns the path and it's not already loaded */ if (!$this->_ci_helpers[$o_helper_file]) { /* mark it as loaded */ $this->_ci_helpers[$o_helper_file] = true; /* and load it */ include $o_helper_file; } } } }
function BE_Controller() { $this->page_path = false; global $active_controller; global $active_show; $active_controller = $this; parent::__construct(); $this->load->helper("url"); if (!$this->is_installed() && $this->uri->segment(2) != "install" && $this->uri->segment(1) != "api") { redirect('/admin/install/index', 'location'); } if ($this->is_installed()) { $this->load->database(); @$this->load->library('datamapper'); } if (!$active_show) { $this->show = new Show($this); } else { $this->show =& $active_show; } $this->load->model('BuilderEngine'); $this->load->model('users'); if ($this->is_installed()) { $this->load->model('user'); global $cache; $this->load->model("cache"); $cache = $this->cache; $this->BuilderEngine->load_settings(); if (!EventManager::is_initialized() && !EventManager::is_initializing()) { EventManager::set_initializing(true); $this->load->model('module'); $modules = $this->module; // $modules = new Module(); foreach ($modules->get() as $module) { if ($module->folder == "module_system") { continue; } Modules::run($module->folder . "/register_events"); } EventManager::set_initialized(true); } if (self::$s_user == null) { self::$s_user = new User(); $session = $this->session; self::$s_user->_init($session); } $user_model = $this->users; global $user; $user = self::$s_user; $this->user =& self::$s_user; $CI =& get_instance(); $this->load->model('links'); $this->links_array = $this->links->get(); foreach ($this->links_array as $link) { $link->target = str_replace("%site_root%", home_url('/'), $link->target); } } $this->BuilderEngine->set_option("active_backend_theme", "dashboard", false); $this->load->library('module_parser'); $this->load->library('parser'); //$this->BuilderEngine->activate_theme("default"); //echo $this->get_page_path(); $this->load->module("layout_system"); $this->layout_system->load->model("blocks"); $this->layout_system->load->model('versions'); $this->versions =& $this->layout_system->versions; if ($this->is_installed()) { $this->load->model('Module'); $this->load->model('Group'); $this->load->model('Group_module_permission'); } }
/** Load a module helper **/ public function helper($helper = array()) { if (is_array($helper)) { return $this->helpers($helper); } // Modified by Ivan Tcholakov, 12-DEC-2013. // See https://github.com/EllisLab/CodeIgniter/issues/2165 //if (isset($this->_ci_helpers[$helper])) return; if (isset($this->_ci_helpers[$helper])) { return $this; } // list($path, $_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/'); // Modified by Ivan Tcholakov, 12-DEC-2013. // See https://github.com/EllisLab/CodeIgniter/issues/2165 //if ($path === FALSE) return parent::helper($helper); if ($path === FALSE) { parent::helper($helper); return $this; } // Modules::load_file($_helper, $path); $this->_ci_helpers[$_helper] = TRUE; // Added by Ivan Tcholakov, 12-DEC-2013. // See https://github.com/EllisLab/CodeIgniter/issues/2165 return $this; // }
/** * Load Helper * * This function loads the specified helper file. * * @param mixed * @return void */ public function helper($helper = array()) { if (is_array($helper)) { foreach ($helper as $help) { $this->helper($help); } return; } // Detect module if (list($module, $class) = $this->detect_module($helper)) { // Module already loaded if (in_array($module, $this->_ci_modules)) { return parent::helper($class); } // Add module $this->add_module($module); // Let parent do the heavy work $void = parent::helper($class); // Remove module $this->remove_module(); return $void; } else { return parent::helper($helper); } }
/** Load a module helper **/ public function helper($helpers = array()) { if (is_array($helpers)) { return $this->helpers($helpers); } if (isset($this->_ci_helpers[$helpers])) { return; } list($path, $_helper) = Modules::find($helpers . '_helper', $this->_module, 'helpers/'); if ($path === false) { return parent::helper($helpers); } Modules::load_file($_helper, $path); $this->_ci_helpers[$_helper] = true; }
/** Load a module helper **/ public function helper($helper = array()) { if (is_array($helper)) { return $this->helpers($helper); } if (isset($this->_ci_helpers[$helper])) { return; } list($path, $_helper, $ext_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/', $this->_module_location); // Are we simply loading an extended helper? if ($ext_helper) { Modules::load_file(config_item('subclass_prefix') . $_helper, $path); // Force the helper we are extending to load as well $segments = explode('/', $helper); $helper = isset($segments[1]) ? $segments[1] : $helper; $path = FALSE; } if ($path === FALSE) { return parent::helper($helper); } Modules::load_file($_helper, $path); $this->_ci_helpers[$_helper] = TRUE; }
/** * {inheritdoc} */ public function helper($helper = []) { if (is_array($helper)) { foreach ($helper as $file) { $this->helper($file); } return; } // Detect helper from system $extension = '_helper.php'; if (file_exists(BASEPATH . 'helpers/' . $helper . $extension && ($modules = $this->module->getList('module')))) { foreach ($modules as $module) { $mod_path = $this->module->getPath($module->name); if (file_exists($mod_path . 'helpers/' . $helper . $extension)) { $this->helper($module->name . '/' . $helper); } } } // Detect helpers from module if (list($module, $file) = $this->module->detect($helper)) { // Module already loaded if (!$this->module->loaded($module)) { // Add module $this->module->add($this, $module); } // Let parent do the heavy work $void = parent::helper($file); // Remove module $this->module->remove($this); return $void; } return parent::helper($helper); }