src/Util/U.php
public static function route_get_local_path($dir) {
        $uri = $_SERVER['REQUEST_URI'];     // /tsugi/lti/some/cool/stuff
        $root = $_SERVER['DOCUMENT_ROOT'];  // /Applications/MAMP/htdocs
        $cwd = $dir;                        // /Applications/MAMP/htdocs/tsugi/lti
        if ( strlen($cwd) < strlen($root) + 1 ) return false;
        $lwd = substr($cwd,strlen($root));  // /tsugi/lti
        if ( strlen($uri) < strlen($lwd) + 2 ) return false;
        $local = substr($uri,strlen($lwd)+1); // some/cool/stuff
        return $local;
    }
public static function route_get_local_path($dir) {
        $uri = $_SERVER['REQUEST_URI'];     // /tsugi/lti/some/cool/stuff
        $root = $_SERVER['DOCUMENT_ROOT'];  // /Applications/MAMP/htdocs
        $cwd = $dir;                        // /Applications/MAMP/htdocs/tsugi/lti
        if ( strlen($cwd) < strlen($root) + 1 ) return false;
        $lwd = substr($cwd,strlen($root));  // /tsugi/lti
        if ( strlen($uri) < strlen($lwd) + 2 ) return false;
        $local = substr($uri,strlen($lwd)+1); // some/cool/stuff
        return $local;
    }
public static function route_get_local_path ( $ dir ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; // /tsugi/lti/some/cool/stuff $ root = $ _SERVER [ 'DOCUMENT_ROOT' ] ; // /Applications/MAMP/htdocs $ cwd = $ dir ; // /Applications/MAMP/htdocs/tsugi/lti if ( strlen ( $ cwd ) < strlen ( $ root ) + 1 ) return false ; $ lwd = substr ( $ cwd , strlen ( $ root ) ) ; // /tsugi/lti if ( strlen ( $ uri ) < strlen ( $ lwd ) + 2 ) return false ; $ local = substr ( $ uri , strlen ( $ lwd ) + 1 ) ; // some/cool/stuff return $ local ; }
Convienence method to get the local path if we are doing
Convienence method to get the local path if we are doing