예제 #1
0
        $resultData = false;
        if (preg_match('#^(https?:)?//.+\\.(gif|jpeg|jpg|png)\\??.*$#i', $url)) {
            $resultData = true;
        }
        return $resultData;
    }
    public static function isUrlSameHost($url, $host)
    {
        $resultData = false;
        if (preg_match('#^(https?:)?//' . preg_quote($host, '#') . '/?#i', $url)) {
            $resultData = true;
        }
        return $resultData;
    }
    public static function isUrlSameDomain($url, $domain, $strict_status = true)
    {
        $resultData = false;
        if (true === $strict_status) {
            if (preg_match('#^(https?:)?//' . preg_quote($domain, '#') . '/?#i', $url)) {
                $resultData = true;
            }
        } else {
            if (preg_match('#^(https?:)?//[^/\\?]*' . preg_quote($domain, '#') . '/?#i', $url)) {
                $resultData = true;
            }
        }
        return $resultData;
    }
}
Utils::setDefaultParams();