/**
  * Specific controller action for displaying a particular list of links 
  * for a class
  * 
  * @return mixed
  */
 public function sitemap()
 {
     $class = $this->request->param('ID');
     $page = $this->request->param('OtherID');
     if (GoogleSitemap::enabled() && $class && $page) {
         Config::inst()->update('SSViewer', 'set_source_file_comments', false);
         $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
         $this->getResponse()->addHeader('X-Robots-Tag', 'noindex');
         $items = GoogleSitemap::get_items($class, $page);
         $this->extend('updateGoogleSitemapItems', $items, $class, $page);
         return array('Items' => $items);
     } else {
         return new SS_HTTPResponse('Page not found', 404);
     }
 }
 public function testGetItemsWithPages()
 {
     if (!class_exists('Page')) {
         $this->markTestIncomplete('No cms module installed, page related test skipped');
     }
     $page = $this->objFromFixture('Page', 'Page1');
     $page->publish('Stage', 'Live');
     $page->flushCache();
     $page2 = $this->objFromFixture('Page', 'Page2');
     $page2->publish('Stage', 'Live');
     $page2->flushCache();
     $this->assertDOSContains(array(array('Title' => 'Testpage1'), array('Title' => 'Testpage2')), GoogleSitemap::get_items('SiteTree'), "There should be 2 pages in the sitemap after publishing");
     // check if we make a page readonly that it is hidden
     $page2->CanViewType = 'LoggedInUsers';
     $page2->write();
     $page2->publish('Stage', 'Live');
     $this->session()->inst_set('loggedInAs', null);
     $this->assertDOSEquals(array(array('Title' => 'Testpage1')), GoogleSitemap::get_items('SiteTree'), "There should be only 1 page, other is logged in only");
 }