mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 09:05:48 +00:00
Changed is_registered to check both the current case and lower case version of the class
Fixed test failure resulting from GoogleSitemapRoute
This commit is contained in:
parent
26838c70d0
commit
cc0c20b3a8
@ -118,7 +118,13 @@ class GoogleSitemap extends Object
|
|||||||
*/
|
*/
|
||||||
public static function is_registered($className)
|
public static function is_registered($className)
|
||||||
{
|
{
|
||||||
return isset(self::$dataobjects[$className]);
|
if (!isset(self::$dataobjects[$className])) {
|
||||||
|
$lowerKeys = array_change_key_case(self::$dataobjects);
|
||||||
|
|
||||||
|
return isset($lowerKeys[$className]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,7 @@ class GoogleSitemapController extends Controller
|
|||||||
$class = $this->unsanitiseClassName($this->request->param('ID'));
|
$class = $this->unsanitiseClassName($this->request->param('ID'));
|
||||||
$page = $this->request->param('OtherID');
|
$page = $this->request->param('OtherID');
|
||||||
|
|
||||||
if (GoogleSitemap::enabled() && $class && $page && ($class=='SiteTree' || GoogleSitemap::is_registered($class))) {
|
if (GoogleSitemap::enabled() && $class && $page && ($class == 'SiteTree' || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))) {
|
||||||
Config::inst()->update('SSViewer', 'set_source_file_comments', false);
|
Config::inst()->update('SSViewer', 'set_source_file_comments', false);
|
||||||
|
|
||||||
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
|
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user