mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parent
c02ff14db8
commit
a89dbd29e1
@ -425,7 +425,7 @@ class Director implements TemplateGlobalProvider {
|
||||
}
|
||||
|
||||
if(substr($url,0,4) != "http") {
|
||||
if(strpos($url, '/') !== 0) $url = Director::baseURL() . $url;
|
||||
if($url[0] != "/") $url = Director::baseURL() . $url;
|
||||
// Sometimes baseURL() can return a full URL instead of just a path
|
||||
if(substr($url,0,4) != "http") $url = self::protocolAndHost() . $url;
|
||||
}
|
||||
|
@ -97,9 +97,6 @@ class DirectorTest extends SapphireTest {
|
||||
$_SERVER['REQUEST_URI'] = "$rootURL/mysite/sub-page/";
|
||||
Config::inst()->update('Director', 'alternate_base_url', '/mysite/');
|
||||
|
||||
//test empty URL
|
||||
$this->assertEquals($rootURL, Director::absoluteURL(''));
|
||||
|
||||
// Test already absolute url
|
||||
$this->assertEquals($rootURL, Director::absoluteURL($rootURL));
|
||||
$this->assertEquals($rootURL, Director::absoluteURL($rootURL, true));
|
||||
@ -140,7 +137,6 @@ class DirectorTest extends SapphireTest {
|
||||
Config::inst()->update('Director', 'alternate_base_url', 'http://www.example.org/');
|
||||
$this->assertEquals('http://www.example.org/', Director::baseURL());
|
||||
$this->assertEquals('http://www.example.org/', Director::absoluteBaseURL());
|
||||
$this->assertEquals('http://www.example.org/', Director::absoluteURL(''));
|
||||
$this->assertEquals('http://www.example.org/subfolder/test', Director::absoluteURL('subfolder/test'));
|
||||
|
||||
// Setting it to false restores functionality
|
||||
|
@ -161,12 +161,6 @@ class HTTPTest extends SapphireTest {
|
||||
public function testAbsoluteURLsAttributes() {
|
||||
$this->withBaseURL('http://www.silverstripe.org/', function($test){
|
||||
|
||||
//empty links
|
||||
$test->assertEquals(
|
||||
'<a href="http://www.silverstripe.org/">test</a>',
|
||||
HTTP::absoluteURLs('<a href="">test</a>')
|
||||
);
|
||||
|
||||
// links
|
||||
$test->assertEquals(
|
||||
'<a href=\'http://www.silverstripe.org/blog/\'>SS Blog</a>',
|
||||
|
Loading…
Reference in New Issue
Block a user