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.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Dec 30, 2016
2 parents 0ec1234 + dc1e785 commit 34fbc45
Show file tree
Hide file tree
Showing 29 changed files with 314 additions and 149 deletions.
39 changes: 1 addition & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
# MetaSEO - Changelog

## MetaSEO 2.0.1

- Bugfixes

## MetaSEO 2.0

- Added TYPO3 7.x support
- Implemented Signals
- Implemented blacklist of PAGE typeNum in SetupTS
- Implemented blacklist for index/noindex robots metatag
- Implemented blacklist for canonical url
- Implemented canonical url support for mounted pages, pointing to real page instead of mount path (disabled by default)
- Implemented expiry date for sitemap entries (customizable with SetupTS or Connector)
- Implemented pagetitle caching (if there is any USER_INT on the current page)
- Removed own caching solution, using TYPO3 caching framework now
- Fixed many bugs and issues
- Fixed coding style (added .editorconfig)
- Refactored whole extension
- Added protocol selection for canonical Urls in case protocol is undefined in page properties
(via plugin.metaseo.metaTags.canonicalUrl.fallbackProtocol)

## Beta features

- If you have any issues with cached pagetitle: set `plugin.metaseo.pageTitle.caching = 0` to disable this feature.

### Migrate from 1.x to 2.x

- TypoScript Constant `plugin.metaseo.metaTags.useCanonical` changed to `plugin.metaseo.metaTags.canonicalUrl`
- TypoScript Setup `plugin.metaseo.metaTags.useCanonical` changed to `plugin.metaseo.metaTags.canonicalUrl`
- Names of Hooks changed, now camelCase


## MetaSEO 1.0 (2014-04-20)

- Version 1.0.0
- Fork of metaseo
- Fixed several bugs and improved codebase
- Fixed and improved manual (now reStructuredText)
Latest version of the [changelog](https://github.com/mblaschke/TYPO3-metaseo/blob/develop/Documentation/ChangeLog/Index.rst)
16 changes: 10 additions & 6 deletions Classes/Controller/Ajax/AbstractPageSeoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected function executeUpdate()
}

$pid = (int)$this->postVar['pid'];
$fieldName = strtolower((string)$this->postVar['field']);
$fieldName = (string)$this->postVar['field'];
$fieldValue = (string)$this->postVar['value'];
$sysLanguage = (int)$this->postVar['sysLanguage'];

Expand All @@ -195,6 +195,8 @@ protected function executeUpdate()
// Security checks
// ############################

// generates the excludelist, based on TCA/exclude-flag and non_exclude_fields for the user:
$excludedTablesAndFields = array_flip($this->getDataHandler()->getExcludeListArray());

// check if user is able to modify pages
if (!$this->getBackendUserAuthentication()->check('tables_modify', 'pages')) {
Expand All @@ -221,8 +223,9 @@ protected function executeUpdate()
}

// check if user is able to modify the field of pages
if (!$this->getBackendUserAuthentication()
->check('non_exclude_fields', 'pages:' . $fieldName)
if (isset($excludedTablesAndFields['pages-' . $fieldName])
&& !$this->getBackendUserAuthentication()
->check('non_exclude_fields', 'pages:' . $fieldName)
) {
// No access

Expand All @@ -249,8 +252,9 @@ protected function executeUpdate()
}

// check if user is able to modify the field of pages
if (!$this->getBackendUserAuthentication()
->check('non_exclude_fields', 'pages_language_overlay:' . $fieldName)
if (isset($excludedTablesAndFields['pages_language_overlay-' . $fieldName])
&& !$this->getBackendUserAuthentication()
->check('non_exclude_fields', 'pages_language_overlay:' . $fieldName)
) {
// No access

Expand All @@ -267,7 +271,7 @@ protected function executeUpdate()
// ############################

switch ($fieldName) {
case 'lastupdated':
case 'lastUpdated':
// transform to unix timestamp
$fieldValue = strtotime($fieldValue);
break;
Expand Down
8 changes: 4 additions & 4 deletions Classes/Controller/Ajax/PageSeo/MetaDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function initFieldList()
'abstract',
'author',
'author_email',
'lastupdated',
'lastUpdated',
);
}

Expand All @@ -53,10 +53,10 @@ protected function getIndex(array $page, $depth, $sysLanguage)

unset($row);
foreach ($list as &$row) {
if (!empty($row['lastupdated'])) {
$row['lastupdated'] = date('Y-m-d', $row['lastupdated']);
if (!empty($row['lastUpdated'])) {
$row['lastUpdated'] = date('Y-m-d', $row['lastUpdated']);
} else {
$row['lastupdated'] = '';
$row['lastUpdated'] = '';
}
}
unset($row);
Expand Down
35 changes: 29 additions & 6 deletions Classes/Controller/BackendPageSeoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ protected function handleSubAction($listType)

// Flag (if available)
if (!empty($langRow['flag'])) {
$flag .= '<span class="t3-icon t3-icon-flags t3-icon-flags-' . $langRow['flag']
. ' t3-icon-' . $langRow['flag'] . '"></span>';
$flag .= IconUtility::getSpriteIcon('flags-' . $langRow['flag']);
$flag .= '&nbsp;';
}

Expand Down Expand Up @@ -216,9 +215,9 @@ protected function handleSubAction($listType)
'criteriaFulltext' => '',
'realurlAvailable' => $realUrlAvailable,
'sprite' => array(
'edit' => IconUtility::getSpriteIcon('actions-document-open'),
'info' => IconUtility::getSpriteIcon('actions-document-info'),
'editor' => IconUtility::getSpriteIcon('actions-system-options-view'),
'edit' => $this->getIcon('actions-document-open'),
'info' => $this->getIcon('actions-document-info'),
'editor' => $this->getIcon('actions-system-options-view'),
),
);

Expand All @@ -244,7 +243,7 @@ protected function handleSubAction($listType)
'page_abstract' => 'header.sitemap.page_abstract',
'page_author' => 'header.sitemap.page_author',
'page_author_email' => 'header.sitemap.page_author_email',
'page_lastupdated' => 'header.sitemap.page_lastupdated',
'page_lastUpdated' => 'header.sitemap.page_lastUpdated',
'page_geo_lat' => 'header.sitemap.page_geo_lat',
'page_geo_long' => 'header.sitemap.page_geo_long',
'page_geo_place' => 'header.sitemap.page_geo_place',
Expand Down Expand Up @@ -290,4 +289,28 @@ protected function handleSubAction($listType)
'
);
}

private function getIcon($iconName)
{
$html = IconUtility::getSpriteIcon($iconName);
//Ugly workaround to make icons clickable in TYPO3 7.6.
//It's deprecated anyways, therefore changes in the future when we drop support for 6.2.
if (stripos('svg', $html)) {
//not found
return $html; //Typo3 6.2. That works.
} else {
//found => TYPO3 7 workaround must be applied.
switch ($iconName) {
case 'actions-document-open':
return '<span class="t3-icon t3-icon-actions '
. 't3-icon-actions-document t3-icon-document-open"></span>';
case 'actions-document-info':
return '<span class="t3-icon t3-icon-actions '
. ' t3-icon-actions-document t3-icon-document-info"></span>';
case 'actions-system-options-view':
return '<span class="t3-icon t3-icon-actions '
. 't3-icon-actions-document t3-icon-document-view"></span>';
}
}
}
}
6 changes: 3 additions & 3 deletions Classes/Controller/BackendSitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,12 @@ public function sitemapAction()
$this->translate('empty.search.page_language'),
);

foreach ($languageFullList as $langId => $langRow) {
foreach ($languageFullList as $langId => &$langRow) {
$flag = '';

// Flag (if available)
if (!empty($langRow['flag'])) {
$flag .= '<span class="t3-icon t3-icon-flags t3-icon-flags-' . $langRow['flag']
. ' t3-icon-' . $langRow['flag'] . '"></span>';
$flag.= IconUtility::getSpriteIcon('flags-' . $langRow['flag']);
$flag .= '&nbsp;';
}

Expand All @@ -240,6 +239,7 @@ public function sitemapAction()
$label,
$flag
);
$langRow['flagHtml'] = $flag;
}

// Depth
Expand Down
10 changes: 10 additions & 0 deletions Classes/Hook/SitemapIndexHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ protected static function processLinkUrl($linkUrl)

// remove abs ref prefix
if ($absRefPrefix !== false && strpos($ret, $absRefPrefix) === 0) {
$parsedUrl = parse_url($linkUrl);
if ($parsedUrl !== false
&& $parsedUrl['path'] === $absRefPrefix
&& substr($absRefPrefix, -1) === '/' //sanity check: must end with /
) {
//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--;
}

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

Expand Down
30 changes: 13 additions & 17 deletions Classes/Page/Part/MetatagPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,10 @@ protected function processMetaTags(array &$tags)
foreach ($keyList as $key) {
if (!empty($tags[$key]['attributes'])) {
foreach ($markerList as $marker => $value) {
// only replace markers if they are present
unset($metaTagAttribute);
foreach ($tags[$key]['attributes'] as &$metaTagAttribute) {
if (strpos($metaTagAttribute, $marker)) {
// only replace markers if they are present
if (strpos($metaTagAttribute, $marker) !== false) {
$metaTagAttribute = str_replace($marker, $value, $metaTagAttribute);
}
}
Expand Down Expand Up @@ -811,25 +811,21 @@ protected function collectMetaDataFromConnector()

// Std meta tags
foreach ($storeMeta['meta'] as $metaKey => $metaValue) {
$metaValue = trim($metaValue);

if ($metaValue === null) {
// Remove meta
unset($this->tsSetupSeo[$metaKey]);
} elseif (!empty($metaValue)) {
$this->tsSetupSeo[$metaKey] = $metaValue;
$this->tsSetupSeo[$metaKey] = trim($metaValue);
}
}

// Custom meta tags
foreach ($storeMeta['custom'] as $metaKey => $metaValue) {
$metaValue = trim($metaValue);

if ($metaValue === null) {
// Remove meta
unset($ret[$metaKey]);
} elseif (!empty($metaValue)) {
$ret[$metaKey] = $metaValue;
$ret[$metaKey] = trim($metaValue);
}
}

Expand Down Expand Up @@ -1248,16 +1244,16 @@ protected function generateLinkMetaTags()

$currentIsRootpage = ($currentPage['uid'] === $rootPage['uid']);

// Generate rootpage url
$rootPageUrl = null;
if (!empty($rootPage)) {
$rootPageUrl = $this->generateLink($rootPage['uid']);
}

// Only generate up, prev and next if NOT rootpage
// to prevent linking to other domains
// see https://github.com/mblaschke/TYPO3-metaseo/issues/5
if (!$currentIsRootpage) {
$startPage = $GLOBALS['TSFE']->cObj->HMENU($this->tsSetupSeo['sectionLinks.']['start.']);
$startPageUrl = null;
if (!empty($startPage)) {
$startPageUrl = $this->generateLink($startPage);
}

$prevPage = $GLOBALS['TSFE']->cObj->HMENU($this->tsSetupSeo['sectionLinks.']['prev.']);
$prevPageUrl = null;
if (!empty($prevPage)) {
Expand All @@ -1272,12 +1268,12 @@ protected function generateLinkMetaTags()
}

// Start (first page in rootline -> root page)
if (!empty($rootPageUrl)) {
if (!empty($startPageUrl)) {
$this->metaTagList['link.rel.start'] = array(
'tag' => 'link',
'attributes' => array(
'rel' => 'start',
'href' => $rootPageUrl,
'href' => $startPageUrl,
),
);
}
Expand Down Expand Up @@ -1332,7 +1328,7 @@ protected function generateCanonicalUrl()
{
//User has specified a canonical URL in the page properties
if (!empty($this->pageRecord['tx_metaseo_canonicalurl'])) {
return $this->pageRecord['tx_metaseo_canonicalurl'];
return $this->generateLink($this->pageRecord['tx_metaseo_canonicalurl']);
}

//Fallback to global settings to generate Url
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/GeneralUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static function callHookAndSignal($class, $name, $obj, &$args = null)
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
}
$signalSlotDispatcher->dispatch($class, $name, array($args, $obj));
list($args) = $signalSlotDispatcher->dispatch($class, $name, array($args, $obj));
}


Expand Down
1 change: 1 addition & 0 deletions Classes/Utility/SitemapUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class SitemapUtility
PageRepository::DOKTYPE_SPACER, // Menu separator (TYPO3 CMS)
PageRepository::DOKTYPE_SYSFOLDER, // Folder (TYPO3 CMS)
PageRepository::DOKTYPE_RECYCLER, // Recycler (TYPO3 CMS)
PageRepository::DOKTYPE_LINK, // External Link (TYPO3 CMS)
);

/**
Expand Down
17 changes: 17 additions & 0 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ plugin.metaseo {
# section links (start, up, next, prev)
sectionLinks =
sectionLinks {

start = HMENU
start {
special = browse
special {
items = first
first.fields.title =
}

1 = TMENU
1.NO {
wrapItemAndSub = {field:uid}
wrapItemAndSub.insertData = 1
doNotLinkIt = 1
}
}

prev = HMENU
prev {
special = browse
Expand Down
1 change: 1 addition & 0 deletions Documentation/AdministratorManual/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,4 @@ If you want to activate a “real” sitemap.xml feature (eg. http://example.com
),

);

Loading

0 comments on commit 34fbc45

Please sign in to comment.