Example #1
0
 public static function exists($view)
 {
     $path = INPHINIT_PATH . 'application/View/' . strtr($view, '.', '/') . '.php';
     return is_file($path) && \UtilsCaseSensitivePath($path);
 }
Example #2
0
function UtilsAutoload()
{
    static $initiate;
    if ($initiate) {
        return null;
    }
    $initiate = true;
    spl_autoload_register(function ($classname) {
        static $prefixes;
        if (isset($prefixes) === false) {
            $path = INPHINIT_PATH . 'boot/namespaces.php';
            $prefixes = is_file($path) ? include $path : array();
        }
        $classname = ltrim($classname, '\\');
        $cp = array();
        if (is_array($prefixes) === false) {
            return NULL;
        }
        $isfile = false;
        $base = false;
        if (empty($prefixes) === false) {
            if (isset($prefixes[$classname]) && preg_match('#\\.[a-z0-9]+$#', $prefixes[$classname]) !== 0) {
                $isfile = true;
                $base = $prefixes[$classname];
            } else {
                foreach ($prefixes as $prefix => $path) {
                    if (stripos($classname, $prefix) === 0) {
                        $classname = substr($classname, strlen($prefix));
                        $base = trim($path, '/') . '/' . str_replace(substr($prefix, -1), '/', $classname);
                        break;
                    }
                }
            }
        }
        if ($base === false) {
            return NULL;
        }
        $path = INPHINIT_PATH;
        $files = $isfile ? array($path . $base) : array($path . $base . '.php', $path . $base . '.hh');
        $files = array_values(array_filter($files, 'is_file'));
        if (isset($files[0]) && UtilsCaseSensitivePath($files[0])) {
            include_once $files[0];
        }
    });
}
Example #3
0
 public static function existsCaseSensitive($path)
 {
     return file_exists($path) && \UtilsCaseSensitivePath($path);
 }