function test_isRelativeURL() { $this->assertTrue(HtmlUtils::isRelativeURL('test/relative.html')); $this->assertFalse(HtmlUtils::isRelativeURL('http://com.exe/test/relative.html')); }
/** * Checks if the given URL is a Sitecake resource URL. * * @param string $url a URL to be tested * @return boolean true if the URL is a Sitecake resource URL */ public static function isResourceUrl($url) { $re = '/^.*(files|images)\\/.*\\-sc[0-9a-f]{13}[^\\.]*\\..+$/'; return HtmlUtils::isRelativeURL($url) && preg_match($re, $url) && strpos($url, 'javascript:') !== 0 && strpos($url, '#') !== 0; }