本文整理汇总了PHP中Kohana::_paths方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::_paths方法的具体用法?PHP Kohana::_paths怎么用?PHP Kohana::_paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::_paths方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPaths
/**
* 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');
}
示例2: modules
/**
* 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}