FIX: missing owner call

This commit is contained in:
Thomas Speak 2013-08-24 09:34:11 +12:00 committed by Will Rossiter
parent 8403cb5773
commit 9dcc00bafd
2 changed files with 14 additions and 14 deletions

View File

@ -7,17 +7,17 @@
* @package googlesitemaps
*/
class GoogleSitemapExtension extends DataExtension {
/**
* @return boolean
*/
public function canIncludeInGoogleSitemap() {
$can = true;
if(method_exists($this, 'AbsoluteLink')) {
$objHttp = parse_url($this->AbsoluteLink(), PHP_URL_HOST);
$hostHttp = parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST);
/**
* @return boolean
*/
public function canIncludeInGoogleSitemap() {
$can = true;
if($this->owner->hasMethod('AbsoluteLink')) {
$hostHttp = parse_url(Director::protocolAndHost(), PHP_URL_HOST);
$objHttp = parse_url($this->owner->AbsoluteLink(), PHP_URL_HOST);
if($objHttp != $hostHttp) {
$can = false;
}
@ -34,7 +34,7 @@ class GoogleSitemapExtension extends DataExtension {
$this->owner->extend('alterCanIncludeInGoogleSitemap', $can);
return $can;
}
}
/**

View File

@ -249,7 +249,7 @@ class GoogleSitemapTest_DataObject extends DataObject implements TestOnly {
}
public function AbsoluteLink() {
return Director::baseURL();
return Director::absoluteBaseURL();
}
}
@ -268,7 +268,7 @@ class GoogleSitemapTest_OtherDataObject extends DataObject implements TestOnly {
}
public function AbsoluteLink() {
return Director::baseURL();
return Director::absoluteBaseURL();
}
}
@ -287,6 +287,6 @@ class GoogleSitemapTest_UnviewableDataObject extends DataObject implements TestO
}
public function AbsoluteLink() {
return Director::baseURL();
return Director::absoluteBaseURL();
}
}