mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
FIX: missing owner call
This commit is contained in:
parent
8403cb5773
commit
9dcc00bafd
@ -7,17 +7,17 @@
|
|||||||
* @package googlesitemaps
|
* @package googlesitemaps
|
||||||
*/
|
*/
|
||||||
class GoogleSitemapExtension extends DataExtension {
|
class GoogleSitemapExtension extends DataExtension {
|
||||||
|
|
||||||
/**
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function canIncludeInGoogleSitemap() {
|
|
||||||
$can = true;
|
|
||||||
|
|
||||||
if(method_exists($this, 'AbsoluteLink')) {
|
/**
|
||||||
$objHttp = parse_url($this->AbsoluteLink(), PHP_URL_HOST);
|
* @return boolean
|
||||||
$hostHttp = parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST);
|
*/
|
||||||
|
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) {
|
if($objHttp != $hostHttp) {
|
||||||
$can = false;
|
$can = false;
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ class GoogleSitemapExtension extends DataExtension {
|
|||||||
$this->owner->extend('alterCanIncludeInGoogleSitemap', $can);
|
$this->owner->extend('alterCanIncludeInGoogleSitemap', $can);
|
||||||
|
|
||||||
return $can;
|
return $can;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ class GoogleSitemapTest_DataObject extends DataObject implements TestOnly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function AbsoluteLink() {
|
public function AbsoluteLink() {
|
||||||
return Director::baseURL();
|
return Director::absoluteBaseURL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ class GoogleSitemapTest_OtherDataObject extends DataObject implements TestOnly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function AbsoluteLink() {
|
public function AbsoluteLink() {
|
||||||
return Director::baseURL();
|
return Director::absoluteBaseURL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +287,6 @@ class GoogleSitemapTest_UnviewableDataObject extends DataObject implements TestO
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function AbsoluteLink() {
|
public function AbsoluteLink() {
|
||||||
return Director::baseURL();
|
return Director::absoluteBaseURL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user