Ejemplo n.º 1
0
 /**
  *
  */
 protected function saveSiteMap()
 {
     $siteMapEntity = $this->dumpEntity->getSiteMapEntity();
     $siteMapIndexEntity = $this->dumpEntity->getSiteMapIndexEntity();
     if (!empty($siteMapEntity)) {
         $location = $siteMapEntity->getLoc();
         if (empty($location)) {
             $this->dumpEntity->saveFile($this->dumpEntity->getWebDir() . '/' . ($this->dumpEntity->getPath() !== '' ? '/' . $this->dumpEntity->getPath() . '/' : '/') . 'sitemap.xml', $siteMapEntity->getXml());
         } else {
             $location = explode($this->dumpEntity->getDomain() . '/', $location);
             $location = $this->dumpEntity->getWebDir() . '/' . $location[1];
             $this->dumpEntity->saveFile($location, $siteMapEntity->getXml());
         }
     } elseif (!empty($siteMapIndexEntity)) {
         foreach ($siteMapIndexEntity->getSiteMapCollection() as $siteMapEntity) {
             $location = explode($this->dumpEntity->getDomain() . '/', $siteMapEntity->getLoc());
             $location = $this->dumpEntity->getWebDir() . '/' . $location[1];
             $this->dumpEntity->saveFile($location, $siteMapEntity->getXml());
         }
     }
 }