Inheritance: extends Gc\Core\Object
Beispiel #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testGenerateWithEmptyBasePath()
 {
     $request = Registry::get('Application')->getRequest();
     $basePath = $request->getBasePath();
     $request->setBasePath('');
     $this->assertInternalType('string', $this->object->generate($request));
     $request->setBasePath($basePath);
 }
Beispiel #2
0
 /**
  * Test
  *
  * @return void
  */
 public function testInstallAndUninstall()
 {
     $this->assertTrue($this->object->install());
     $sitemap = new Model\Sitemap();
     file_put_contents($sitemap->getFilePath(), $sitemap->generate(Registry::get('Application')->getRequest()));
     $this->assertTrue($this->object->uninstall());
 }
Beispiel #3
0
 /**
  * Generate xml action
  *
  * @return \Zend\Http\Response
  */
 public function generateAction()
 {
     $sitemap = new Model\Sitemap();
     file_put_contents($sitemap->getFilePath(), $sitemap->generate($this->getRequest()));
     return $this->redirect()->toRoute('module/sitemap');
 }
Beispiel #4
0
 /**
  * Get xml
  *
  * @param Sitemap $sitemap Sitemap model
  *
  * @return SimpleXMLElement|null
  */
 protected function getXml(Sitemap $sitemap)
 {
     if (file_exists($sitemap->getFilePath())) {
         $content = file_get_contents($sitemap->getFilePath());
         $xml = simplexml_load_string($content);
         $xml->registerXPathNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9');
         return $xml;
     }
 }