/** * Get the Records * * @param integer $startPage * @param array $basePages * @param SitemapController $obj * * @throws \Exception * @return array */ public function getRecords($startPage, $basePages, SitemapController $obj) { $nodes = array(); if (!ExtensionManagementUtility::isLoaded('tt_news')) { return $nodes; } if (!MathUtility::canBeInterpretedAsInteger($GLOBALS['TSFE']->tmpl->setup['plugin.']['tt_news.']['singlePid'])) { throw new \Exception('You have to set tt_news singlePid.'); } $singlePid = intval($GLOBALS['TSFE']->tmpl->setup['plugin.']['tt_news.']['singlePid']); $news = $this->getRecordsByField('tt_news', 'pid', implode(',', $basePages)); foreach ($news as $record) { // Alternative Single PID $alternativeSinglePid = $this->alternativeSinglePid($record['uid']); $linkPid = $alternativeSinglePid ? $alternativeSinglePid : $singlePid; // Build URL $url = $obj->getUriBuilder()->setArguments(array('tx_ttnews' => array('tt_news' => $record['uid'])))->setTargetPageUid($linkPid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Build Node $node = new Node(); $node->setLoc($url); $node->setPriority($this->getPriority($record)); $node->setChangefreq('monthly'); $node->setLastmod($this->getModifiedDate($record)); $nodes[] = $node; } return $nodes; }
/** * 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 integer $startPage * @param array $basePages * @param SitemapController $obj * * @return array */ public function getRecords($startPage, $basePages, SitemapController $obj) { $nodes = array(); $database = $this->getDatabaseConnection(); $rows = $database->exec_SELECTgetRows('*', 'tt_content', 'CType=' . $database->fullQuoteStr('list', 'tt_content') . ' AND list_type=' . $database->fullQuoteStr('googleservices_pisitemap', 'tt_content') . ' AND hidden=0 AND deleted=0'); foreach ($rows as $row) { $uid = $row['pid']; if ($uid == $GLOBALS['TSFE']->id) { 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); // 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->setLastmod($this->getModifiedDate($record)); $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; }