library/Helper/Controller.php
public static function locateController($controller)
    {
        preg_match_all('/^(single|archive)-/i', $controller, $matches);

        $controllers = array(
            str_replace('.blade.php', '', self::camelCase(basename($controller, '.php')))
        );

        if (isset($matches[1][0])) {
            $controllers[] = self::camelCase($matches[1][0]);
        }

        $searchPaths = array(
            get_stylesheet_directory() . '/library/Controller',
            get_template_directory() . '/library/Controller',
        );

        /**
         * Apply filter to $searchPaths
         * @since 0.1.0
         * @var   array
         */
        $searchPaths = apply_filters('Municipio/blade/controllers_search_paths', $searchPaths);

        foreach ($searchPaths as $path) {
            foreach ($controllers as $controller) {
                $file = $path . '/' . $controller . '.php';

                if (!file_exists($file)) {
                    continue;
                }

                return $file;
            }
        }

        return false;
    }
public static function locateController($controller)
    {
        preg_match_all('/^(single|archive)-/i', $controller, $matches);

        $controllers = array(
            str_replace('.blade.php', '', self::camelCase(basename($controller, '.php')))
        );

        if (isset($matches[1][0])) {
            $controllers[] = self::camelCase($matches[1][0]);
        }

        $searchPaths = array(
            get_stylesheet_directory() . '/library/Controller',
            get_template_directory() . '/library/Controller',
        );

        /**
         * Apply filter to $searchPaths
         * @since 0.1.0
         * @var   array
         */
        $searchPaths = apply_filters('Municipio/blade/controllers_search_paths', $searchPaths);

        foreach ($searchPaths as $path) {
            foreach ($controllers as $controller) {
                $file = $path . '/' . $controller . '.php';

                if (!file_exists($file)) {
                    continue;
                }

                return $file;
            }
        }

        return false;
    }
public static function locateController ( $ controller ) { preg_match_all ( '/^(single|archive)-/i' , $ controller , $ matches ) ; $ controllers = array ( str_replace ( '.blade.php' , '' , self :: camelCase ( basename ( $ controller , '.php' ) ) ) ) ; if ( isset ( $ matches [ 1 ] [ 0 ] ) ) { $ controllers [ ] = self :: camelCase ( $ matches [ 1 ] [ 0 ] ) ; } $ searchPaths = array ( get_stylesheet_directory ( ) . '/library/Controller' , get_template_directory ( ) . '/library/Controller' , ) ; /**
         * Apply filter to $searchPaths
         * @since 0.1.0
         * @var   array
         */ $ searchPaths = apply_filters ( 'Municipio/blade/controllers_search_paths' , $ searchPaths ) ; foreach ( $ searchPaths as $ path ) { foreach ( $ controllers as $ controller ) { $ file = $ path . '/' . $ controller . '.php' ; if ( ! file_exists ( $ file ) ) { continue ; } return $ file ; } } return false ; }
Tries to locate a controller
@param  string $controller Controller name
@return string             Controller path
Tries to locate a controller