PiwikTracker::getCurrentScriptName PHP Method

getCurrentScriptName() protected static method

If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "/dir1/dir2/index.php"
protected static getCurrentScriptName ( ) : string
return string
    protected static function getCurrentScriptName()
    {
        $url = '';
        if (!empty($_SERVER['PATH_INFO'])) {
            $url = $_SERVER['PATH_INFO'];
        } else {
            if (!empty($_SERVER['REQUEST_URI'])) {
                if (($pos = strpos($_SERVER['REQUEST_URI'], '?')) !== false) {
                    $url = substr($_SERVER['REQUEST_URI'], 0, $pos);
                } else {
                    $url = $_SERVER['REQUEST_URI'];
                }
            }
        }
        if (empty($url)) {
            $url = $_SERVER['SCRIPT_NAME'];
        }
        if ($url[0] !== '/') {
            $url = '/' . $url;
        }
        return $url;
    }