public static function get_matching_tourdata(\moodle_url $targetmatch) {
        $tours = self::get_enabled_tourdata();

        // Attempt to determine whether this is the front page.
        // This is a special case because the frontpage uses a shortened page path making it difficult to detect exactly.
        $isfrontpage = $targetmatch->compare(new \moodle_url('/'), URL_MATCH_BASE);
        $target = $targetmatch->out_as_local_url();
        return array_filter($tours, function($tour) use ($isfrontpage, $target) {
            if ($isfrontpage && $tour->pathmatch === 'FRONTPAGE') {
                return true;
            }
            $pattern = preg_quote($tour->pathmatch, '@');
            $pattern = str_replace('%', '.*', $pattern);
            return !!preg_match("@{$pattern}@", $target);
        });
    }
public static function get_matching_tourdata(\moodle_url $targetmatch) {
        $tours = self::get_enabled_tourdata();

        // Attempt to determine whether this is the front page.
        // This is a special case because the frontpage uses a shortened page path making it difficult to detect exactly.
        $isfrontpage = $targetmatch->compare(new \moodle_url('/'), URL_MATCH_BASE);
        $target = $targetmatch->out_as_local_url();
        return array_filter($tours, function($tour) use ($isfrontpage, $target) {
            if ($isfrontpage && $tour->pathmatch === 'FRONTPAGE') {
                return true;
            }
            $pattern = preg_quote($tour->pathmatch, '@');
            $pattern = str_replace('%', '.*', $pattern);
            return !!preg_match("@{$pattern}@", $target);
        });
    }
public static function get_matching_tourdata ( \ moodle_url $ targetmatch ) { $ tours = self :: get_enabled_tourdata ( ) ; // Attempt to determine whether this is the front page. // This is a special case because the frontpage uses a shortened page path making it difficult to detect exactly. $ isfrontpage = $ targetmatch -> compare ( new \ moodle_url ( '/' ) , URL_MATCH_BASE ) ; $ target = $ targetmatch -> out_as_local_url ( ) ; return array_filter ( $ tours , function ( $ tour ) use ( $ isfrontpage , $ target ) { if ( $ isfrontpage && $ tour -> pathmatch === 'FRONTPAGE' ) { return true ; } $ pattern = preg_quote ( $ tour -> pathmatch , '@' ) ; $ pattern = str_replace ( '%' , '.*' , $ pattern ) ; return ! ! preg_match ( "@{$pattern}@" , $ target ) ; } ) ; }
Fetch all enabled tours matching the specified target.

@param   moodle_url  $targetmatch    The URL to match.
Fetch all enabled tours matching the specified target .