/** * This function will add JxCMS module paths to the $_paths array. * * @static * @param $paths * @return void */ public static function addPaths($paths) { $p = Kohana::$_paths; //Jx_Debug::dump($p, 'starting paths'); //Jx_Debug::dump($paths, 'paths passed in'); //this should actually insert after JxCore and before anything else.... $newPath = array(); foreach ($p as $path) { $newPath[] = $path; if (strpos($path, 'jxcore')) { $newPath = array_merge($newPath, $paths); } } Kohana::$_paths = $newPath; //Jx_Debug::dump(Kohana::$_paths,'ending paths'); }
/** * Set enabled modules for NegoCore platform. * * @param array $modules * @return array * @throws Kohana_Exception */ public static function modules(array $modules = null) { if ($modules === NULL) { // Not changing modules, just return the current set return Kohana::$_modules; } // Compose modules array $_modules = $modules; $modules = array(); foreach ($_modules as $provider => $module_list) { $modules += $module_list; } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = $modules[$name] = realpath($path) . DIRECTORY_SEPARATOR; } else { // This module is invalid, remove it throw new NegoCore_Exception('Attempted to load an invalid or missing module \':module\' at \':path\'', array(':module' => $name, ':path' => Debug::path($path))); } } // Finish the include paths by adding system paths $paths[] = NC_SYSPATH; $paths[] = KH_SYSPATH; // Set the new include paths Kohana::$_paths = $paths; // Set the current module list Kohana::$_modules = $modules; foreach (Kohana::$_modules as $path) { $init = $path . 'init' . EXT; if (is_file($init)) { // Include the module initialization file once require_once $init; } } return Kohana::$_modules; }
/** * Changes the currently enabled modules. Module paths may be relative * or absolute, but must point to a directory: * * Kohana::modules(array('modules/foo', MODPATH.'bar')); * * @param array list of module paths * @return array enabled modules */ public static function modules(array $modules = NULL) { if ($modules === NULL) { return Kohana::$_modules; } if (Kohana::$profiling === TRUE) { // Start a new benchmark $benchmark = Profiler::start('Kohana', __FUNCTION__); } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = $modules[$name] = realpath($path) . DIRECTORY_SEPARATOR; } else { // This module is invalid, remove it unset($modules[$name]); } } // Finish the include paths by adding SYSPATH $paths[] = SYSPATH; // Set the new include paths Kohana::$_paths = $paths; // Set the current module list Kohana::$_modules = $modules; foreach (Kohana::$_modules as $path) { $init = $path . 'init' . EXT; if (is_file($init)) { // Include the module initialization file once require_once $init; } } if (isset($benchmark)) { // Stop the benchmark Profiler::stop($benchmark); } return Kohana::$_modules; }
/** * Changes the currently enabled modules. Module paths may be relative * or absolute, but must point to a directory: * * Kohana::modules(array('modules/foo', MODPATH.'bar')); * * @param array list of module paths * @return array enabled modules */ public static function modules(array $modules = NULL) { if ($modules === NULL) { return self::$_modules; } if (self::$profile === TRUE) { // Start a new benchmark $benchmark = Profiler::start(__CLASS__, __FUNCTION__); } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = realpath($path) . DIRECTORY_SEPARATOR; } else { // This module is invalid, remove it unset($modules[$name]); } } // Finish the include paths by adding SYSPATH $paths[] = SYSPATH; if (isset($benchmark)) { // Stop the benchmark Profiler::stop($benchmark); } // Set the new include paths self::$_paths = $paths; // Set the current module list return self::$_modules = $modules; }
/** * Changes the currently enabled modules. Module paths may be relative * or absolute, but must point to a directory: * * Kohana::modules(array('modules/foo', MODPATH.'bar')); * * @param array list of module paths * @return array enabled modules */ public static function modules(array $modules = NULL) { if ($modules === NULL) { // Not changing modules, just return the current set return Kohana::$_modules; } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = $modules[$name] = realpath($path) . DIRECTORY_SEPARATOR; } else { // This module is invalid, remove it unset($modules[$name]); } } // Finish the include paths by adding SYSPATH $paths[] = SYSPATH; // Set the new include paths Kohana::$_paths = $paths; // Set the current module list Kohana::$_modules = $modules; foreach (Kohana::$_modules as $path) { $init = $path . 'init' . EXT; if (is_file($init)) { // Include the module initialization file once require_once $init; } } return Kohana::$_modules; }
public static function modules(array $modules = NULL) { if ($modules === NULL) { return Kohana::$_modules; } $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { $paths[] = realpath($path) . DIRECTORY_SEPARATOR; } else { unset($modules[$name]); } } $paths[] = SYSPATH; Kohana::$_paths = $paths; Kohana::$_modules = $modules; foreach (Kohana::$_modules as $path) { $init = $path . '/init.php'; if (is_file($init)) { include $init; } } return Kohana::$_modules; }
/** * Changes the currently enabled modules. Module paths may be relative * or absolute, but must point to a directory: * * Kohana::modules(array('modules/foo', MODPATH.'bar')); * * @param array $modules list of module paths * @return array enabled modules * @throws \InvalidArgumentException */ public static function modules(array $modules = NULL) { if ($modules === NULL) { // Not changing modules, just return the current set return Kohana::$_modules; } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = $modules[$name] = realpath($path) . DS; } else { // This module is invalid, remove it throw new \InvalidArgumentException(sprintf('Attempted to load an invalid or missing module %s at %s', $name, realpath($path))); } } // Include GLZPATH before system for CFS $paths[] = GLZPATH; // Finish the include paths by adding SYSPATH $paths[] = SYSPATH; // Set the new include paths Kohana::$_paths = $paths; // Set the current module list Kohana::$_modules = $modules; /** Run Gleez Components */ Gleez::ready(); foreach (Kohana::$_modules as $path) { $init = $path . 'init' . EXT; if (is_file($init)) { // Include the module initialization file once require_once $init; } } if (is_file(GLZPATH . 'init' . EXT)) { //@todo better handling instead of init require_once GLZPATH . 'init' . EXT; } return Kohana::$_modules; }