/** * Get whole list of sitemap entries * * @return string */ public function garbageCollectorCommand() { // Expire sitemap entries \Metaseo\Metaseo\Utility\SitemapUtility::expire(); // Expire cache entries \Metaseo\Metaseo\Utility\CacheUtility::expire(); }
/** * Execute task * * @return boolean */ public function execute() { // Expire sitemap entries \Metaseo\Metaseo\Utility\SitemapUtility::expire(); // Expire cache entries \Metaseo\Metaseo\Utility\CacheUtility::expire(); return TRUE; }
/** * Hook: Link Parser * * @param object $pObj Object * @return boolean|null */ public static function hook_linkParse(&$pObj) { // check if sitemap is enabled in root if (!\Metaseo\Metaseo\Utility\GeneralUtility::getRootSettingValue('is_sitemap', TRUE) || !\Metaseo\Metaseo\Utility\GeneralUtility::getRootSettingValue('is_sitemap_typolink_indexer', TRUE)) { return TRUE; } // check current page if (!self::_checkIfCurrentPageIsIndexable()) { return; } // Check if (empty($pObj['finalTagParts']) || empty($pObj['conf']) || empty($pObj['finalTagParts']['url'])) { // no valid link return; } // Init link informations $linkConf = $pObj['conf']; $linkUrl = $pObj['finalTagParts']['url']; $linkUrl = self::_processLinkUrl($linkUrl); if (!is_numeric($linkConf['parameter'])) { // not valid internal link return; } if (empty($linkUrl)) { // invalid url? should be never empty! return; } // #################################### // Init // #################################### $uid = $linkConf['parameter']; $addParameters = array(); if (!empty($linkConf['additionalParams'])) { parse_str($linkConf['additionalParams'], $addParameters); } // ##################################### // Check if link is cacheable // ##################################### $isValid = FALSE; // check if conf is valid if (!empty($linkConf['useCacheHash'])) { $isValid = TRUE; } // check for typical typo3 params $addParamsCache = $addParameters; unset($addParamsCache['L']); unset($addParamsCache['type']); if (empty($addParamsCache)) { $isValid = TRUE; } if (!$isValid) { // page is not cacheable, skip it return; } // ##################################### // Rootline // ##################################### $rootline = \Metaseo\Metaseo\Utility\GeneralUtility::getRootLine($uid); if (empty($rootline)) { return; } $page = reset($rootline); // ##################################### // Build relative url // ##################################### $linkParts = parse_url($linkUrl); // Remove left / (but only if not root page) if ($linkParts['path'] === '/') { // Link points to root page $pageUrl = '/'; } else { // Link points to another page, strip left / $pageUrl = ltrim($linkParts['path'], '/'); } // Add query if (!empty($linkParts['query'])) { $pageUrl .= '?' . $linkParts['query']; } // ##################################### // Page settings // ##################################### // Fetch page changeFrequency $pageChangeFrequency = 0; if (!empty($page['tx_metaseo_change_frequency'])) { $pageChangeFrequency = (int) $page['tx_metaseo_change_frequency']; } elseif (!empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.']['changeFrequency'])) { $pageChangeFrequency = (int) $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.']['changeFrequency']; } // Fetch sysLanguage $pageLanguage = 0; if (isset($addParameters['L'])) { $pageLanguage = (int) $addParameters['L']; } elseif (!empty($GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'])) { $pageLanguage = (int) $GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']; } // ##################################### // Indexing // ##################################### $tstamp = $_SERVER['REQUEST_TIME']; $pageData = array('tstamp' => $tstamp, 'crdate' => $tstamp, 'page_rootpid' => $rootline[0]['uid'], 'page_uid' => $linkConf['parameter'], 'page_language' => $pageLanguage, 'page_url' => $pageUrl, 'page_depth' => count($rootline), 'page_change_frequency' => $pageChangeFrequency); // Call hook \Metaseo\Metaseo\Utility\GeneralUtility::callHook('sitemap-index-link', NULL, $pageData); if (!empty($pageData)) { \Metaseo\Metaseo\Utility\SitemapUtility::index($pageData, 'link'); } return TRUE; }
/** * Fetch sitemap information and generate sitemap */ public function __construct() { // INIT $this->rootPid = \Metaseo\Metaseo\Utility\GeneralUtility::getRootPid(); $sysLanguageId = NULL; $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.']; // Language limit via setupTS if (\Metaseo\Metaseo\Utility\GeneralUtility::getRootSettingValue('is_sitemap_language_lock', FALSE)) { $sysLanguageId = \Metaseo\Metaseo\Utility\GeneralUtility::getLanguageId(); } // Fetch sitemap list/pages $list = \Metaseo\Metaseo\Utility\SitemapUtility::getList($this->rootPid, $sysLanguageId); $this->sitemapPages = $list['tx_metaseo_sitemap']; $this->pages = $list['pages']; // Call hook \Metaseo\Metaseo\Utility\GeneralUtility::callHook('sitemap-setup', $this); }