public static function locate($filename)
    {
        if (@file_exists($filename)) return $filename;

        $_f = CarteBlanche::getPath('carte_blanche_core').$filename;
        if (!empty($_f) && @file_exists($_f)) return $_f;

        $include_paths = explode(PATH_SEPARATOR,get_include_path());
        foreach($include_paths as $_inc) {
            $_f = DirectoryHelper::slashDirname($_inc).$filename;
            if (@file_exists($_f)) return $_f;
        }

        if (class_exists('\CarteBlanche\CarteBlanche')) {
            $bundles = CarteBlanche::getContainer()->get('bundles');
            if (!empty($bundles)) {
                foreach($bundles as $_bundle) {
                    $_f = DirectoryHelper::slashDirname($_bundle->getDirectory()).$filename;
                    if (@file_exists($_f)) return $_f;
                }
            }
        }

        return false;
    }
public static function locate($filename)
    {
        if (@file_exists($filename)) return $filename;

        $_f = CarteBlanche::getPath('carte_blanche_core').$filename;
        if (!empty($_f) && @file_exists($_f)) return $_f;

        $include_paths = explode(PATH_SEPARATOR,get_include_path());
        foreach($include_paths as $_inc) {
            $_f = DirectoryHelper::slashDirname($_inc).$filename;
            if (@file_exists($_f)) return $_f;
        }

        if (class_exists('\CarteBlanche\CarteBlanche')) {
            $bundles = CarteBlanche::getContainer()->get('bundles');
            if (!empty($bundles)) {
                foreach($bundles as $_bundle) {
                    $_f = DirectoryHelper::slashDirname($_bundle->getDirectory()).$filename;
                    if (@file_exists($_f)) return $_f;
                }
            }
        }

        return false;
    }
public static function locate ( $ filename ) { if ( @ file_exists ( $ filename ) ) return $ filename ; $ _f = CarteBlanche :: getPath ( 'carte_blanche_core' ) . $ filename ; if ( ! empty ( $ _f ) && @ file_exists ( $ _f ) ) return $ _f ; $ include_paths = explode ( PATH_SEPARATOR , get_include_path ( ) ) ; foreach ( $ include_paths as $ _inc ) { $ _f = DirectoryHelper :: slashDirname ( $ _inc ) . $ filename ; if ( @ file_exists ( $ _f ) ) return $ _f ; } if ( class_exists ( '\CarteBlanche\CarteBlanche' ) ) { $ bundles = CarteBlanche :: getContainer ( ) -> get ( 'bundles' ) ; if ( ! empty ( $ bundles ) ) { foreach ( $ bundles as $ _bundle ) { $ _f = DirectoryHelper :: slashDirname ( $ _bundle -> getDirectory ( ) ) . $ filename ; if ( @ file_exists ( $ _f ) ) return $ _f ; } } } return false ; }
Hack to let the 'file_exists' function search in 'include_path'

@param   string  $filename   The filename to find
@return  bool/string         The valid file path if found, false otherwise
Hack to let the file_exists function search in include_path