/** * Get the Records * * @param integer $startPage * @param array $basePages * @param SitemapController $obj * * @return array */ public function getRecords($startPage, $basePages, SitemapController $obj) { $nodes = array(); foreach ($basePages as $uid) { // Build URL $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Get Record $record = BackendUtility::getRecord('pages', $uid); // exclude Doctypes if (in_array($record['doktype'], array(3, 4))) { continue; } // Check FE Access if ($record['fe_group'] != 0 || $record['no_search'] != 0) { continue; } $rootLineList = $GLOBALS['TSFE']->sys_page->getRootLine($record['uid']); $addToNode = true; foreach ($rootLineList as $rootPage) { if ($rootPage['extendToSubpages'] == 1 && ($rootPage['fe_group'] != 0 || $record['no_search'] != 0)) { $addToNode = false; break; } } if ($addToNode == false) { continue; } // Build Node $node = new Node(); $node->setLoc($url); $node->setPriority($this->getPriority($startPage, $record)); $node->setChangefreq(SitemapDataService::mapTimeout2Period($record['cache_timeout'])); $node->setLastmod($this->getModifiedDate($record)); #$geo = new Geo(); #$geo->setFormat('kml'); #$node->setGeo($geo); $nodes[] = $node; } return $nodes; }
/** * Get the records * * @param int $startPage * @param array $basePages * @param SitemapController $obj * * @return array */ public function getRecords($startPage, $basePages, SitemapController $obj) { $nodes = array(); foreach ($basePages as $uid) { $images = $this->getImagesByPages(array($uid)); if (!sizeof($images)) { continue; } $imageNodes = array(); foreach ($images as $imageReference) { /** @var $imageReference \TYPO3\CMS\Core\Resource\FileReference */ $url = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $imageReference->getOriginalFile()->getPublicUrl(); // Build Node $nodeImage = new Image(); $nodeImage->setLoc($url); $nodeImage->setTitle($imageReference->getTitle()); $nodeImage->setCaption($imageReference->getDescription()); $imageNodes[] = $nodeImage; } // Build URL $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Get Record $record = BackendUtility::getRecord('pages', $uid); // exclude Doctypes if (in_array($record['doktype'], array(4))) { continue; } // Build Node $node = new Node(); $node->setLoc($url); $node->setPriority($this->getPriority($startPage, $record)); $node->setChangefreq(SitemapDataService::mapTimeout2Period($record['cache_timeout'])); $node->setLastmod($this->getModifiedDate($record)); $node->setImages($imageNodes); $nodes[] = $node; } return $nodes; }
/** * @param int $startPage * @param array $basePages * @param SitemapController $obj * * @return array */ public function getRecords($startPage, $basePages, SitemapController $obj) { $nodes = array(); foreach ($basePages as $uid) { if ($this->currentLanguageUid) { $fields = $this->cObject->enableFields('pages_language_overlay'); $overlay = $this->database->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', ' pid=' . intval($uid) . ' AND sys_language_uid=' . $this->currentLanguageUid . $fields); if (!is_array($overlay)) { continue; } } // Build URL $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Get Record $record = BackendUtility::getRecord('pages', $uid); // exclude Doctypes if (in_array($record['doktype'], array(4))) { continue; } // Check FE Access if ($record['fe_group'] != 0) { continue; } $rootLineList = $GLOBALS['TSFE']->sys_page->getRootLine($record['uid']); $addToNode = true; foreach ($rootLineList as $rootPage) { if ($rootPage['extendToSubpages'] == 1 && $rootPage['fe_group'] != 0) { $addToNode = false; break; } } if ($addToNode == false) { continue; } // Build Node $node = new Node(); $node->setLoc($url); $node->setPriority($this->getPriority($startPage, $record)); $node->setChangefreq(SitemapDataService::mapTimeout2Period($record['cache_timeout'])); $node->setLastmod($this->getModifiedDate($record)); #$geo = new Geo(); #$geo->setFormat('kml'); #$node->setGeo($geo); $nodes[] = $node; } return $nodes; }