diff --git a/.gitignore b/.gitignore index 6798cb0..d3b5adc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.buildpath /.project +/.idea diff --git a/Classes/Generator/AbstractSitemapGenerator.php b/Classes/Generator/AbstractSitemapGenerator.php index b4f8ae8..15bd0e0 100644 --- a/Classes/Generator/AbstractSitemapGenerator.php +++ b/Classes/Generator/AbstractSitemapGenerator.php @@ -117,4 +117,14 @@ protected function createRenderer() { * @return void */ abstract protected function generateSitemapContent(); + + /** + * @return array + * @throws \InvalidArgumentException + */ + protected function getAlternateSysLanguageIds() { + /** @var \DmitryDulepov\DdGooglesitemap\Helper\SysLanguageHelper $instance */ + $instance = GeneralUtility::makeInstance('DmitryDulepov\\DdGooglesitemap\\Helper\\SysLanguageHelper'); + return $instance->getSysLanguages(); + } } diff --git a/Classes/Generator/PagesSitemapGenerator.php b/Classes/Generator/PagesSitemapGenerator.php index 05c1779..995ad69 100644 --- a/Classes/Generator/PagesSitemapGenerator.php +++ b/Classes/Generator/PagesSitemapGenerator.php @@ -24,7 +24,7 @@ namespace DmitryDulepov\DdGooglesitemap\Generator; -use DmitryDulepov\DdGooglesitemap\Renderers\AbstractSitemapRenderer; +use DmitryDulepov\DdGooglesitemap\Renderers\AbstractExtendedSitemapRenderer; use \TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\VersionNumberUtility; @@ -55,7 +55,7 @@ class PagesSitemapGenerator extends AbstractSitemapGenerator { /** * A sitemap renderer * - * @var AbstractSitemapRenderer + * @var AbstractExtendedSitemapRenderer */ protected $renderer; @@ -70,7 +70,7 @@ class PagesSitemapGenerator extends AbstractSitemapGenerator { protected $hookObjects; /** - * Initializes the instance of this class. This constructir sets starting + * Initializes the instance of this class. This constructor sets starting * point for the sitemap to the current page id */ public function __construct() { @@ -120,7 +120,8 @@ public function __construct() { /** * Generates sitemap for pages ( entries in the sitemap) * - * @return void + * @return void + * @throws \InvalidArgumentException */ protected function generateSitemapContent() { // Workaround: we want the sysfolders back into the menu list! @@ -154,7 +155,7 @@ protected function generateSitemapContent() { // Notice: no sorting (for speed)! $GLOBALS['TSFE']->sys_page->sys_language_uid = $GLOBALS['TSFE']->config['config']['sys_language_uid']; $morePages = $GLOBALS['TSFE']->sys_page->getMenu($pageInfo['uid'], '*', '', '', false); - $this->removeNonTranslatedPages($morePages); + $morePages = $this->filterNonTranslatedPages($morePages); $this->pageList = array_merge($this->pageList, array_values($morePages)); unset($morePages); } @@ -178,21 +179,49 @@ protected function getLastMod(array $pageInfo) { /** * Exclude pages from given list * + * @deprecated use filterNonTranslatedPages + * * @param array $pages * @return void */ protected function removeNonTranslatedPages(array &$pages) { - $language = (int)$GLOBALS['TSFE']->config['config']['sys_language_uid']; - foreach ($pages as $pageUid => $page) { - // Hide page in default language - if ($language === 0 && GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg'])) { - unset($pages[$pageUid]); + $pages = $this->filterNonTranslatedPages($pages); + } + + /** + * Get only translated pages + * + * @param array $pages + * @param int|null $languageUid + * @return array + */ + protected function filterNonTranslatedPages(array $pages, $languageUid = null) { + if($languageUid === null) { + $languageUid = (int)$GLOBALS['TSFE']->config['config']['sys_language_uid']; + } + + $filterFunction = function ($page) use($languageUid) { + if ($languageUid === 0 && GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg'])) { + return false; } - elseif ($language !== 0 && !isset($page['_PAGES_OVERLAY']) && GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) { - // Hide page if no translation is set - unset($pages[$pageUid]); + + if ($languageUid !== 0 && !isset($page['_PAGES_OVERLAY']) && GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) { + return false; } + + return true; + }; + + // requested language === current language + if ($languageUid === (int)$GLOBALS['TSFE']->config['config']['sys_language_uid']) { + return array_filter($pages, $filterFunction); } + + // other language: load overlay information + $overlayPages = $GLOBALS['TSFE']->sys_page->getPagesOverlay($pages, $languageUid); + $overlayPages = array_filter($overlayPages, $filterFunction); + + return array_intersect_key($pages, $overlayPages); } /** @@ -208,14 +237,18 @@ protected function shouldIncludePageInSitemap(array $pageInfo) { /** * Outputs information about single page * - * @param array $pageInfo Page information (needs 'uid' and 'SYS_LASTCHANGED' columns) - * @return void + * @param array $pageInfo Page information (needs 'uid' and 'SYS_LASTCHANGED' columns) + * @return void + * @throws \InvalidArgumentException */ protected function writeSingleUrl(array $pageInfo) { if ($this->shouldIncludePageInSitemap($pageInfo) && ($url = $this->getPageLink($pageInfo['uid']))) { echo $this->renderer->renderEntry($url, $pageInfo['title'], $this->getLastMod($pageInfo), - $this->getChangeFrequency($pageInfo), '', $pageInfo['tx_ddgooglesitemap_priority']); + $this->getChangeFrequency($pageInfo), '', $pageInfo['tx_ddgooglesitemap_priority'], + array( + 'hreflangs' => $this->getAlternateLinks($pageInfo) + )); // Post-process current page and possibly append data // @see http://forge.typo3.org/issues/45637 @@ -280,18 +313,52 @@ protected function calculateChangeFrequency(array $pageInfo) { ($average <= 14*24*60*60 ? 'weekly' : 'monthly')))); } + /** + * @param array $pageInfo + * @return array + * @throws \InvalidArgumentException + */ + protected function getAlternateLinks($pageInfo) { + $links = array(); + $pageUid = $pageInfo['uid']; + $alternativeLanguages = $this->getAlternateSysLanguageIds(); + if (!empty($alternativeLanguages)) { + foreach ($alternativeLanguages as $languageUid => $locale) { + $translatedPage = $this->filterNonTranslatedPages(array($pageInfo), $languageUid); + if(empty($translatedPage)) { + continue; + } + + // can generate url and it different to target url + if (($url = $this->getPageLink($pageUid, $languageUid))) { + $links[$locale] = $url; + } + } + } + + return $links; + } + /** * Creates a link to a single page * - * @param array $pageId Page ID + * @param int $pageId Page ID + * @param int $languageId Language Id * @return string Full URL of the page including host name (escaped) */ - protected function getPageLink($pageId) { + protected function getPageLink($pageId, $languageId = null) { $conf = array( 'parameter' => $pageId, 'returnLast' => 'url', + 'forceAbsoluteUrl' => 1 ); - $link = htmlspecialchars($this->cObj->typoLink('', $conf)); - return GeneralUtility::locationHeaderUrl($link); + + if ($languageId !== null) { + $conf['additionalParams'] = '&L=' . $languageId; + // cHash is important for e.g. realUrl + $conf['useCacheHash'] = true; + } + + return htmlspecialchars($this->cObj->typoLink('', $conf)); } } diff --git a/Classes/Helper/SysLanguageHelper.php b/Classes/Helper/SysLanguageHelper.php new file mode 100644 index 0000000..b244919 --- /dev/null +++ b/Classes/Helper/SysLanguageHelper.php @@ -0,0 +1,139 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +namespace DmitryDulepov\DdGooglesitemap\Helper; + +use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Class SysLanguageHelper + * + * @package DmitryDulepov\DdGooglesitemap\Helper + */ +class SysLanguageHelper implements SingletonInterface { + + /** + * @var array of sys languages [uid => languageCode] + */ + protected $sysLanguages = null; + + /** + * @var \TYPO3\CMS\Extbase\Object\ObjectManager + * @inject + */ + protected $objectManager; + + /** + * @return \TYPO3\CMS\Frontend\Page\PageRepository + * @throws \InvalidArgumentException + */ + protected function getPageRepository() { + if(TYPO3_MODE === 'BE') { + \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); + if (!is_object($GLOBALS['TT'])) { + $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker; + $GLOBALS['TT']->start(); + } + + $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], GeneralUtility::_GP('id'), ''); + $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); + $GLOBALS['TSFE']->sys_page->init(TRUE); + $GLOBALS['TSFE']->connectToDB(); + $GLOBALS['TSFE']->initFEuser(); + $GLOBALS['TSFE']->determineId(); + $GLOBALS['TSFE']->initTemplate(); + $GLOBALS['TSFE']->getConfigArray(); + } + + return $GLOBALS['TSFE']->sys_page; + } + + /** + * @return array + * @throws \InvalidArgumentException + */ + public function getSysLanguages() { + if ($this->sysLanguages === null) { + $this->sysLanguages = array(); + $sys_languages = $this->getPageRepository()->getRecordsByField('sys_language', 'hidden', 0); + + // empty table + if (!is_array($sys_languages)) { + $sys_languages = array(); + } + + // default language not in table, so add manually + array_unshift($sys_languages, array('language_isocode' => 'x-default', 'uid' => 0)); + + foreach ($sys_languages as $language) { + // use iso code as default + $setLocale = $language['language_isocode']; + + // check typoscript config + /** @var \TYPO3\CMS\Core\TypoScript\TemplateService $templateService */ + $templateService = GeneralUtility::makeInstance( + 'TYPO3\\CMS\\Core\\TypoScript\\TemplateService' + ); + $templateService->matchAlternative[] = '[globalVar = GP:L = ' . $language['uid'] . ']'; + $templateService->init(); + if(TYPO3_MODE === 'FE') { + $templateService->start($GLOBALS['TSFE']->rootLine); + } + // apply language condition + $templateService->generateConfig(); + + // allow custom modifications. We not change TSFE->config array and this could be important. + // Add possibility, that extension could add their modification on setup-array + if (is_array( + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dd_google_sitemap/sys_language_helper']['alternateSysLanguageIdsPostProc'] + )) { + $params = array('templateService' => $templateService); + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dd_google_sitemap/sys_language_helper']['alternateSysLanguageIdsPostProc'] as $funcRef) { + GeneralUtility::callUserFunction($funcRef, $params, $this); + } + } + + if (isset($templateService->setup['config.']['locale_all'])) { + // could contain charset + list($locale_all) = explode('.', $templateService->setup['config.']['locale_all'], 2); + + if (\strpos($locale_all, '_') === 2) { + list($lang, $region) = explode('_', $locale_all, 3); + $setLocale = strtolower($lang . '-' . $region); + } else { + $setLocale = $locale_all; + } + } elseif (isset($templateService->setup['config.']['language'])) { + $setLocale = $templateService->setup['config.']['language']; + } + + $this->sysLanguages[(int)$language['uid']] = $setLocale; + } + + } + + return $this->sysLanguages; + } +} diff --git a/Classes/Renderers/AbstractExtendedSitemapRenderer.php b/Classes/Renderers/AbstractExtendedSitemapRenderer.php new file mode 100644 index 0000000..be76862 --- /dev/null +++ b/Classes/Renderers/AbstractExtendedSitemapRenderer.php @@ -0,0 +1,78 @@ + +* All rights reserved +* +* This script is part of the TYPO3 project. The TYPO3 project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + +namespace DmitryDulepov\DdGooglesitemap\Renderers; + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + +/** + * This class contains an abstract renderer for sitemaps. + * + * NOTE: interface is internal and it is not stable. Any XCLASS is not guarantied + * to work! + * + * @author Dmitry Dulepov + * @package TYPO3 + * @subpackage tx_ddgooglesitemap + */ +abstract class AbstractExtendedSitemapRenderer extends AbstractEntity { + + /** + * Renders one single entry according to the format of this sitemap. + * + * @param string $url URL of the entry + * @param string $title Title of the entry + * @param int $lastModification News publication time (Unix timestamp) + * @param string $changeFrequency Unused for news + * @param string $keywords Keywords for this entry + * @param mixed $priority Priority (numeric, 1-10, if passed) + * @param array|null $additionalParams Additional data + * @return string Generated entry content + * @see tx_ddgooglesitemap_abstract_renderer::renderEntry() + */ + abstract public function renderEntry($url, $title, $lastModification = 0, $changeFrequency = '', $keywords = '', $priority = '', $additionalParams = null); + + /** + * Renders alternative alternate href links + * + * @param array $linkItems + * @return string + */ + public function renderAlternateHrefLinks($linkItems) { + $hrefLangEntries = array(); + if (!empty($linkItems)) { + foreach($linkItems as $languageCode => $targetUrl) { + $hrefLangEntries[] = ''; + } + } + + return join('', $hrefLangEntries); + } +} + +/** @noinspection PhpUndefinedVariableInspection */ +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dd_googlesitemap/renderers/class.tx_ddgooglesitemap_abstract_extended_renderer.php']) { + /** @noinspection PhpIncludeInspection */ + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dd_googlesitemap/renderers/class.tx_ddgooglesitemap_abstract_extended_renderer.php']); +} diff --git a/Classes/Renderers/StandardSitemapRenderer.php b/Classes/Renderers/StandardSitemapRenderer.php index 2895db0..966795a 100644 --- a/Classes/Renderers/StandardSitemapRenderer.php +++ b/Classes/Renderers/StandardSitemapRenderer.php @@ -31,7 +31,7 @@ * @package TYPO3 * @subpackage tx_ddgooglesitemap */ -class StandardSitemapRenderer extends AbstractSitemapRenderer { +class StandardSitemapRenderer extends AbstractExtendedSitemapRenderer { /** * Creates end tags for this sitemap. @@ -51,7 +51,8 @@ public function getEndTags() { */ public function getStartTags() { return '' . chr(10) . - '' . chr(10); + '' . chr(10); } /** @@ -63,10 +64,11 @@ public function getStartTags() { * @param string $changeFrequency Unused for news * @param string $keywords Keywords for this entry * @param mixed $priority Priority (numeric, 1-10, if passed) + * @param array|null $additionalParams * @return string Generated entry content * @see tx_ddgooglesitemap_abstract_renderer::renderEntry() */ - public function renderEntry($url, $title, $lastModification = 0, $changeFrequency = '', $keywords = '', $priority = '') { + public function renderEntry($url, $title, $lastModification = 0, $changeFrequency = '', $keywords = '', $priority = '', $additionalParams = null) { $content = ''; $content .= '' . $url . ''; if ($lastModification) { @@ -78,6 +80,11 @@ public function renderEntry($url, $title, $lastModification = 0, $changeFrequenc if ($priority != '') { $content .= '' . sprintf('%0.1F', $priority/10) . ''; } + + if (isset($additionalParams['hreflangs'])) { + $content .= $this->renderAlternateHrefLinks($additionalParams['hreflangs']); + } + $content .= ''; return $content; diff --git a/Classes/Scheduler/AdditionalFieldsProvider.php b/Classes/Scheduler/AdditionalFieldsProvider.php index 3ebee20..a502802 100644 --- a/Classes/Scheduler/AdditionalFieldsProvider.php +++ b/Classes/Scheduler/AdditionalFieldsProvider.php @@ -62,21 +62,37 @@ public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Schedule } $indexFilePath = $task->getIndexFilePath(); $maxUrlsPerSitemap = $task->getMaxUrlsPerSitemap(); + $isRenderAllLanguages = $task->isRenderAllLanguages(); + + // try to get description + /** @noinspection PhpUndefinedMethodInspection */ + $renderLangHint = $GLOBALS['LANG']->sL('LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.renderAllLanguages.notice'); $additionalFields['eIdUrl'] = array( - 'code' => '', + 'code' => '', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.eIDFieldLabel', 'cshKey' => '', 'cshLabel' => '' ); + $additionalFields['renderAllLanguages'] = array( + 'code' => '' + . '' . $renderLangHint, + 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.renderAllLanguages', + 'cshKey' => '', + 'cshLabel' => '' + ); + $additionalFields['indexFilePath'] = array( - 'code' => '', + 'code' => '', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.indexFieldLabel', 'cshKey' => '', 'cshLabel' => '' ); $additionalFields['maxUrlsPerSitemap'] = array( - 'code' => '', + 'code' => '', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.maxUrlsPerSitemapLabel', 'cshKey' => '', 'cshLabel' => '' @@ -96,6 +112,7 @@ public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Sched $errors = array(); $this->validateEIdUrl($submittedData, $errors); + $this->validateRenderAllLanguages($submittedData, $errors); $this->validateMaxUrlsPerSitemap($submittedData, $errors); $this->validateIndexFilePath($submittedData, $errors); @@ -118,6 +135,7 @@ public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Sched public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) { /** @var \DmitryDulepov\DdGooglesitemap\Scheduler\Task $task */ $task->setEIdScriptUrl($submittedData['eIdUrl']); + $task->setRenderAllLanguages($submittedData['renderAllLanguages']); $task->setMaxUrlsPerSitemap($submittedData['maxUrlsPerSitemap']); $task->setIndexFilePath($submittedData['indexFilePath']); } @@ -152,6 +170,20 @@ protected function validateMaxUrlsPerSitemap(array &$submittedData, array &$erro } } + /** + * Validates checkbox for render all languages + * + * @param array $submittedData + * @param array $errors + * @return void + */ + protected function validateRenderAllLanguages(array &$submittedData, array &$errors) { + $submittedData['renderAllLanguages'] = (string)$submittedData['renderAllLanguages']; + if (!in_array($submittedData['renderAllLanguages'], array('0','1'), true)) { + $errors[] = 'scheduler.renderAllLanguages.notice'; + } + } + /** * Validates index file path. * diff --git a/Classes/Scheduler/Task.php b/Classes/Scheduler/Task.php index eece219..54b7716 100644 --- a/Classes/Scheduler/Task.php +++ b/Classes/Scheduler/Task.php @@ -51,6 +51,9 @@ class Task extends \TYPO3\CMS\Scheduler\Task\AbstractTask { /** @var int */ protected $maxUrlsPerSitemap = 50000; + /** @var bool */ + protected $renderAllLanguages = false; + /** @var string */ private $sitemapFileFormat; @@ -88,6 +91,7 @@ public function __wakeup() { * Should return true on successful execution, false on error. * * @return boolean Returns true on successful execution, false on error + * @throws \InvalidArgumentException */ public function execute() { $indexFilePathTemp = PATH_site . $this->indexFilePath . '.tmp'; @@ -96,6 +100,7 @@ public function execute() { fwrite($indexFile, '' . chr(10)); $eIDscripts = GeneralUtility::trimExplode(chr(10), $this->eIdScriptUrl); + $eIDscripts = $this->expandEidUriWithLanguages($eIDscripts); $eIdIndex = 1; foreach ($eIDscripts as $eIdScriptUrl) { $this->offset = 0; @@ -209,6 +214,87 @@ public function setMaxUrlsPerSitemap($maxUrlsPerSitemap) { $this->maxUrlsPerSitemap = $maxUrlsPerSitemap; } + /** + * Should rendering all languages + * + * @return bool + */ + public function isRenderAllLanguages() { + return $this->renderAllLanguages; + } + + /** + * Enabling rendering all languages + * + * @param bool $renderAllLanguages + */ + public function setRenderAllLanguages($renderAllLanguages) { + $this->renderAllLanguages = (bool)$renderAllLanguages; + } + + /** + * Removes language parameters from url and unique url's + * + * @param array $eIdUris + * @return array + */ + protected function stripLanguage(array $eIdUris) { + if ($this->isRenderAllLanguages() && !empty($eIdUris)) { + foreach ($eIdUris as $key => $eIdScript) { + if (strpos($eIdScript, '?') === false) { + continue; + } + + list($path, $query) = explode('?', $eIdScript, 2); + $query = array_filter( + explode('&', $query), + function ($paramSegment) { + return strpos($paramSegment, 'L=') !== 0; + } + ); + + // sort parameters + sort($query); + + $eIdUris[$key] = $path . '?' . implode('&', $query); + } + + $eIdUris = array_unique($eIdUris); + } + + return $eIdUris; + } + + /** + * @param array $eIdUris + * @return array + * @throws \InvalidArgumentException + */ + protected function expandEidUriWithLanguages(array $eIdUris) { + if ($this->isRenderAllLanguages() && !empty($eIdUris)) { + $eIdUris = $this->stripLanguage($eIdUris); + + /** @var \DmitryDulepov\DdGooglesitemap\Helper\SysLanguageHelper $instance */ + $instance = GeneralUtility::makeInstance('DmitryDulepov\\DdGooglesitemap\\Helper\\SysLanguageHelper'); + $languageUids = array_keys($instance->getSysLanguages()); + + $uris = array(); + if (!empty($languageUids)) { + foreach ($languageUids as $language) { + foreach ($eIdUris as $eIdScript) { + // remove possible anchor, which make no sense + $anchorFree = explode('#', $eIdScript, 2); + $uris[] = rtrim($anchorFree[0], '&') . '&L=' . $language; + } + } + + $eIdUris = $uris; + } + } + + return $eIdUris; + } + /** * Creates a base url for sitemaps. * @@ -271,7 +357,8 @@ protected function buildSitemap($eIdScriptUrl, $sitemapFileName) { */ protected function buildSitemapFileFormat() { $fileParts = pathinfo($this->indexFilePath); - $this->sitemapFileFormat = $fileParts['dirname'] . '/' . $fileParts['filename'] . '_sitemap_%05d_%05d.xml'; + $directoryPrefix = ($fileParts['dirname'] === '.'? '' : $fileParts['dirname'] . '/'); + $this->sitemapFileFormat = $directoryPrefix . $fileParts['filename'] . '_sitemap_%05d_%05d.xml'; } /** diff --git a/composer.json b/composer.json index 1f14b7b..ac478b9 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ ], "require": { "typo3/cms-core": ">=6.2.0,<9.0.0", + "typo3/cms-scheduler": ">=6.2.0,<9.0.0", "php": ">=5.3.2" }, "autoload": { diff --git a/locallang.xml b/locallang.xml index 4f2a73c..828d719 100644 --- a/locallang.xml +++ b/locallang.xml @@ -21,6 +21,8 @@ + +