Skip to content
This repository has been archived by the owner on Aug 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Apr 15, 2017
2 parents 7c749b5 + 54892cd commit c53aa4b
Show file tree
Hide file tree
Showing 35 changed files with 444 additions and 144 deletions.
6 changes: 0 additions & 6 deletions Classes/Command/MetaseoCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class MetaseoCommandController extends CommandController

/**
* Get whole list of sitemap entries
*
* @return string
*/
public function garbageCollectorCommand()
{
Expand All @@ -55,8 +53,6 @@ public function garbageCollectorCommand()
* Clear sitemap for one root page
*
* @param string $rootPageId Site root page id or domain
*
* @return string
*/
public function clearSitemapCommand($rootPageId)
{
Expand All @@ -79,8 +75,6 @@ public function clearSitemapCommand($rootPageId)
* Get whole list of sitemap entries
*
* @param string $rootPageId Site root page id or domain
*
* @return string
*/
public function sitemapCommand($rootPageId)
{
Expand Down
6 changes: 3 additions & 3 deletions Classes/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public static function setPageTitle($value, $updateTsfe = true)
{
$value = (string)$value;

if ($updateTsfe && !empty($GLOBAL['TSFE'])) {
$GLOBAL['TSFE']->page['title'] = $value;
$GLOBAL['TSFE']->indexedDocTitle = $value;
if ($updateTsfe && !empty($GLOBALS['TSFE'])) {
$GLOBALS['TSFE']->page['title'] = $value;
$GLOBALS['TSFE']->indexedDocTitle = $value;
}

self::$store['pagetitle']['pagetitle.title'] = $value;
Expand Down
20 changes: 18 additions & 2 deletions Classes/Controller/Ajax/AbstractPageSeoSimController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function simulateAction($params = array(), AjaxRequestHandler &$ajaxObj =
{
try {
$this->init();
$ajaxObj->setContent($this->executeSimulate());
$ajaxObj->setContent($this->executeSimulate($this->getLanguage()));
} catch (\Exception $exception) {
$this->ajaxExceptionHandler($exception, $ajaxObj);
}
Expand All @@ -47,9 +47,25 @@ public function simulateAction($params = array(), AjaxRequestHandler &$ajaxObj =
}

/**
* @param integer $sysLanguage System language
*
* @return array
*
* @throws \Metaseo\Metaseo\Exception\Ajax\AjaxException
*/
abstract protected function executeSimulate();
abstract protected function executeSimulate($sysLanguage);

/**
* @return int language from Ajax request parameters
*/
protected function getLanguage()
{
$sysLanguage = (int)$this->postVar['sysLanguage'];

// Store last selected language
$this->getBackendUserAuthentication()
->setAndSaveSessionData('MetaSEO.sysLanguage', $sysLanguage);

return $sysLanguage;
}
}
13 changes: 9 additions & 4 deletions Classes/Controller/Ajax/PageSeo/PageTitleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function initFieldList()
/**
* @inheritDoc
*/
protected function executeSimulate()
protected function executeSimulate($sysLanguage)
{
$pid = (int)$this->postVar['pid'];

Expand All @@ -75,15 +75,20 @@ protected function executeSimulate()
);
}

// Load TYPO3 classes
$this->getFrontendUtility()->initTsfe($page, null, $page, null);
$simulator = Typo3GeneralUtility::makeInstance(
'Metaseo\Metaseo\Controller\Ajax\PageSeo\PageTitleSimController'
);
$simulator->setObjectManager($this->objectManager);

$simulationPageList = $simulator->getIndex($page, 1, $sysLanguage);
$simulatedPage = $simulationPageList[$pid];

$pagetitle = Typo3GeneralUtility::makeInstance(
'Metaseo\\Metaseo\\Page\\Part\\PagetitlePart'
);

return array(
'title' => $pagetitle->main($page['title']),
'title' => $pagetitle->main($simulatedPage['title_simulated']),
);
}
}
2 changes: 1 addition & 1 deletion Classes/Controller/Ajax/PageSeo/PageTitleSimController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function initFieldList()
/**
* @inheritDoc
*/
protected function getIndex(array $page, $depth, $sysLanguage)
public function getIndex(array $page, $depth, $sysLanguage)
{
$list = $this->getPageSeoDao()->index($page, $depth, $sysLanguage, $this->fieldList);

Expand Down
15 changes: 12 additions & 3 deletions Classes/Controller/Ajax/PageSeo/UrlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function initFieldList()
/**
* @inheritDoc
*/
protected function executeSimulate()
protected function executeSimulate($sysLanguage)
{
$pid = (int)$this->postVar['pid'];

Expand Down Expand Up @@ -88,9 +88,18 @@ protected function executeSimulate()
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT']['disablePathCache'] = 1;
}

$this->getFrontendUtility()->initTsfe($page, null, $page, null);
$feUtility = $this->getFrontendUtility();
$feUtility->initTsfe($page, null, $page, null, $sysLanguage);

$ret = $this->getFrontendUtility()->getTypoLinkUrl(array('parameter' => $page['uid']));
$typoLink = array(
'parameter' => $page['uid']
);
if ($sysLanguage > 0) {
//translate speaking URL
$typoLink['additionalParams'] = '&L='.$sysLanguage;
}

$ret = $feUtility->getTypoLinkUrl($typoLink);

if (!empty($ret)) {
$ret = GeneralUtility::fullUrl($ret);
Expand Down
1 change: 1 addition & 0 deletions Classes/Dao/PageSeoDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function index(array $page, $depth, $sysLanguage, $fieldList = array())
implode(',', $queryFieldList),
'pages_language_overlay',
'pid IN(' . implode(',', $pageIdList) . ') AND sys_language_uid = ' . (int)$sysLanguage
. ' AND deleted = 0'
);

// update all overlay status field to "from base"
Expand Down
4 changes: 2 additions & 2 deletions Classes/DependencyInjection/Utility/FrontendUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function initTsfe(
);
}

MetaseoFrontendUtility::init($page['uid'], $rootLine, $pageData, $rootlineFull, $sysLanguage);
MetaseoFrontendUtility::init($pageUid, $rootLine, $pageData, $rootlineFull, $sysLanguage);
}

/**
Expand All @@ -96,7 +96,7 @@ public function initTsfe(
*/
public function getTypoLinkUrl(array $conf)
{
return $this->getTSFE()->cObj->typolink_URL($conf);
return $this->getTSFE()->cObj->typoLink_URL($conf);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions Classes/Hook/SitemapIndexHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ protected static function processLinkUrl($linkUrl)
}
}

$absRefPrefixLengthTmp = $absRefPrefixLength; //makes sure we do not write back to static variable

// remove abs ref prefix
if ($absRefPrefix !== false && strpos($ret, $absRefPrefix) === 0) {
$parsedUrl = parse_url($linkUrl);
Expand All @@ -193,10 +195,10 @@ protected static function processLinkUrl($linkUrl)
) {
//for root pages: treat '/' like a suffix, not like a prefix => don't remove last '/' in that case!
//This ensures that for an absRefPrefix = '/abc/' or '/' we return '/' instead of empty strings
$absRefPrefixLength--;
$absRefPrefixLengthTmp--;
}

$ret = substr($ret, $absRefPrefixLength);
$ret = substr($ret, $absRefPrefixLengthTmp);
}

return $ret;
Expand Down
5 changes: 5 additions & 0 deletions Classes/Page/Part/PagetitlePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ protected function checkIfPageTitleCachingEnabled()
{
$cachingEnabled = !empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['pageTitle.']['caching']);

// Ajax: disable pagetitle caching when in backend mode
if (defined('TYPO3_MODE') && TYPO3_MODE == 'BE') {
$cachingEnabled = false;
}

// Enable caching only if caching is enabled in SetupTS
// And if there is any USER_INT on the current page
//
Expand Down
4 changes: 1 addition & 3 deletions Classes/Page/RobotsTxtPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function applyMarker($robotsTxt)
'parameter' => $path
);

$markerList['%sitemap%'] = $this->cObj->typolink_URL($conf);
$markerList['%sitemap%'] = $this->cObj->typoLink_URL($conf);
}

// Fix sitemap-marker url (add prefix if needed)
Expand All @@ -216,8 +216,6 @@ protected function applyMarker($robotsTxt)
// Apply marker list
if (!empty($markerList)) {
$ret = strtr($ret, $markerList);

return $ret;
}

return $ret;
Expand Down
10 changes: 3 additions & 7 deletions Classes/Page/SitemapTxtPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,19 @@ public function main()
$this->showError('Sitemap is not available, please check your configuration [control-center]');
}

$ret = $this->build();

return $ret;
return $this->build();
}

/**
* Build sitemap index or specific page
*
* @return mixed
* @return string
*/
protected function build()
{
/** @var \Metaseo\Metaseo\Sitemap\Generator\TxtGenerator $generator */
$generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\TxtGenerator');

$ret = $generator->sitemap();

return $ret;
return $generator->sitemap();
}
}
12 changes: 4 additions & 8 deletions Classes/Page/SitemapXmlPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ public function main()
$this->showError('Sitemap is not available, please check your configuration [control-center]');
}

$ret = $this->build();

return $ret;
return $this->build();
}

/**
* Build sitemap index or specific page
*
* @return mixed
* @return string
*/
protected function build()
{
Expand All @@ -77,11 +75,9 @@ protected function build()
$generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator');

if (empty($page) || $page === 'index') {
$ret = $generator->sitemapIndex();
return $generator->sitemapIndex();
} else {
$ret = $generator->sitemap($page);
return $generator->sitemap($page);
}

return $ret;
}
}
9 changes: 7 additions & 2 deletions Classes/Sitemap/Generator/XmlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,18 @@ protected function createSitemapPage()
// #####################################
$ret .= '<url>';
$ret .= '<loc>' . htmlspecialchars($pageUrl) . '</loc>';
$ret .= '<lastmod>' . $pageModificationDate . '</lastmod>';

if ($this->tsSetup['enableLastMod']) {
$ret .= '<lastmod>' . $pageModificationDate . '</lastmod>';
}

if (!empty($pageChangeFrequency)) {
$ret .= '<changefreq>' . htmlspecialchars($pageChangeFrequency) . '</changefreq>';
}

$ret .= '<priority>' . $pagePriority . '</priority>';
if ($this->tsSetup['enablePriority']) {
$ret .= '<priority>' . $pagePriority . '</priority>';
}

$ret .= '</url>';
}
Expand Down
2 changes: 0 additions & 2 deletions Classes/Utility/GeneralUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ public static function getExtConf($name, $default = null)
* @param mixed $obj Reference to be passed along (typically "$this"
* - being a reference to the calling object) (REFERENCE!)
* @param mixed|NULL $args Args
*
* @return mixed
*/
public static function callHookAndSignal($class, $name, $obj, &$args = null)
{
Expand Down
2 changes: 2 additions & 0 deletions Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'label' => 'LLL:EXT:metaseo/Resources/Private/Language/TCA/locallang.xlf:pages.tx_metaseo_inheritance',
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'items' => array(
array(
'LLL:EXT:metaseo/Resources/Private/Language/TCA/locallang.xlf:pages.tx_metaseo_inheritance.I.0',
Expand Down Expand Up @@ -118,6 +119,7 @@
'label' => 'LLL:EXT:metaseo/Resources/Private/Language/TCA/locallang.xlf:pages.tx_metaseo_change_frequency',
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'items' => array(
array(
'LLL:EXT:metaseo/Resources/Private/Language/TCA/locallang.xlf:'
Expand Down
9 changes: 9 additions & 0 deletions Configuration/TypoScript/constants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ plugin.metaseo {
# cat=plugin.metaseo.pageTitle/enable/07; type=string; label= Sitetitle : Overwrite the template sitetitle with a custom one
pageTitle.sitetitle =

# cat=plugin.metaseo.pageTitle/enable/08; type=boolean; label= Enable pagetitle caching (for debugging)
pageTitle.caching = 1

# cat=plugin.metaseo.sitemap/page/02; type=int+; label= Default page priority (0-100)
sitemap.pagePriority =

Expand All @@ -172,4 +175,10 @@ plugin.metaseo {

# cat=plugin.metaseo.sitemap/index/01; type=boolean; label= Index no_cache pages: Allow to index no_cache pages
sitemap.index.allowNoCache = 0

# cat=plugin.metaseo.sitemap/index/01; type=boolean; label= Priority tag in sitemap: Include priority tag in sitemap
sitemap.enablePriority = 1

# cat=plugin.metaseo.sitemap/index/01; type=boolean; label= Lastmod tag in sitemap: Include lastmod tag in sitemap
sitemap.enableLastMod = 1
}
8 changes: 5 additions & 3 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ plugin.metaseo {
# Page title generator
pageTitle =
pageTitle {
# Caching of page title
caching = 1

applySitetitleToPagetitle = {$plugin.metaseo.pageTitle.applySitetitleToPagetitle}
applySitetitleToPrefixSuffix = {$plugin.metaseo.pageTitle.applySitetitleToPrefixSuffix}
sitetitleGlue = {$plugin.metaseo.pageTitle.sitetitleGlue}
Expand All @@ -39,6 +36,9 @@ plugin.metaseo {
sitetitlePosition = {$plugin.metaseo.pageTitle.sitetitlePosition}
sitetitle = {$plugin.metaseo.pageTitle.sitetitle}

# Caching of page title
caching = {$plugin.metaseo.pageTitle.caching}

# list of stdWraps for advanced page title manipulations
stdWrap =
stdWrap {
Expand Down Expand Up @@ -413,6 +413,8 @@ plugin.metaseo {
pagePriority = {$plugin.metaseo.sitemap.pagePriority}
changeFrequency = {$plugin.metaseo.sitemap.changeFrequency}
expiration = {$plugin.metaseo.sitemap.expiration}
enablePriority = {$plugin.metaseo.sitemap.enablePriority}
enableLastMod = {$plugin.metaseo.sitemap.enableLastMod}

# indexer settings
index {
Expand Down
Loading

0 comments on commit c53aa4b

Please sign in to comment.