本文整理汇总了PHP中I2CE::getfileSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::getfileSearch方法的具体用法?PHP I2CE::getfileSearch怎么用?PHP I2CE::getfileSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE
的用法示例。
在下文中一共展示了I2CE::getfileSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: i2ce_class_autoload
/**
* The autoload function is used to load class files when needed
*
* This function will be used to load any class files when they
* are required instead of in every file.
*
* It searchs the configuration array for the common class directory
* as well as the class directory specifically for this project.
* @global array
* @param string $class_name The name of the class being loaded
*/
function i2ce_class_autoload($class_name)
{
$class_file = I2CE::getfileSearch()->search('CLASSES', $class_name . '.php');
$class_found = false;
if ($class_file) {
require_once $class_file;
if (class_exists($class_name, false) || interface_exists($class_name, false)) {
$class_found = true;
} else {
I2CE::raiseError("Defintion for class {$class_name} is not contained in {$class_file}", E_USER_WARNING);
}
}
if (!$class_found) {
$classes = I2CE_ModuleFactory::callHooks('autoload_search_for_class', $class_name);
$count = count($classes);
foreach ($classes as $class) {
if (!is_string($class) || strlen($class) == 0) {
continue;
}
if (false === eval($class)) {
I2CE::raiseError("While looking for {$class_name}, could not parse: {$class}");
}
if (class_exists($class_name, false)) {
$class_found = true;
break;
}
}
}
if (!$class_found) {
$debug = debug_backtrace();
$msg = "Cannot find the defintion for class ({$class_name})";
if (array_key_exists(1, $debug) && array_key_exists('line', $debug[1])) {
$msg .= "called from line " . $debug[1]['line'] . ' of file ' . $debug[1]['file'];
}
$msg .= "\nSearch Path is:\n" . print_r(I2CE::getFileSearch()->getSearchPath('CLASSES'), true);
// I2CE::raiseError( $msg, E_USER_NOTICE);
}
}