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.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Dec 31, 2016
2 parents 34fbc45 + df5361d commit 7c749b5
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 25 deletions.
17 changes: 17 additions & 0 deletions Classes/Backend/Module/AbstractStandardModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,21 @@
*/
abstract class AbstractStandardModule extends AbstractModule
{
/**
* default size for pagination
*/
const METASEO_UI_DEFAULT_PAGING_SIZE = 50;

/**
* @return int
*/
protected function getUiPagingSize()
{
$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['metaseo']);
if (empty($confArr['pagingSize'])) {
return self::METASEO_UI_DEFAULT_PAGING_SIZE;
}

return (int)$confArr['pagingSize'];
}
}
4 changes: 3 additions & 1 deletion Classes/Controller/Ajax/AbstractPageSeoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ protected function getFrontendUtility()
*/
protected function getPageRepository()
{
return $this->objectManager->get('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$pageRepository = $this->objectManager->get('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$pageRepository->versioningPreview = true; //enable preview mode
return $pageRepository;
}

/**
Expand Down
11 changes: 7 additions & 4 deletions Classes/Controller/Ajax/PageSeo/UrlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ class UrlController extends AbstractPageSeoSimController
*/
protected function initFieldList()
{
$this->fieldList = array(
$fieldList = array(
'title',
'url_scheme',
'alias',
'tx_realurl_pathsegment',
'tx_realurl_pathoverride',
'tx_realurl_exclude',
);
if (ExtensionManagementUtility::isLoaded('realurl')) {
$fieldList[] = 'tx_realurl_pathsegment';
$fieldList[] = 'tx_realurl_pathoverride';
$fieldList[] = 'tx_realurl_exclude';
}
$this->fieldList = $fieldList;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/BackendPageSeoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected function handleSubAction($listType)
'ajaxController' => $ajaxController,
'pid' => (int)$pageId,
'renderTo' => 'tx-metaseo-sitemap-grid',
'pagingSize' => 50,
'pagingSize' => $this->getUiPagingSize(),
'depth' => 2,
'sortField' => 'crdate',
'sortDir' => 'DESC',
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/BackendSitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function sitemapAction()
'ajaxController' => SitemapController::AJAX_PREFIX,
'pid' => (int)$rootPid,
'renderTo' => 'tx-metaseo-sitemap-grid',
'pagingSize' => 50,
'pagingSize' => $this->getUiPagingSize(),
'sortField' => 'crdate',
'sortDir' => 'DESC',
'filterIcon' => IconUtility::getSpriteIcon(
Expand Down
33 changes: 27 additions & 6 deletions Classes/Hook/SitemapIndexHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Metaseo\Metaseo\Utility\SitemapUtility;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility as Typo3GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Sitemap Indexer
Expand Down Expand Up @@ -122,9 +123,11 @@ public function __construct()
*/
protected function initConfiguration()
{
$tsfe = self::getTsfe();

// Get configuration
if (!empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.'])) {
$this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.'];
if (!empty($tsfe->tmpl->setup['plugin.']['metaseo.'])) {
$this->conf = $tsfe->tmpl->setup['plugin.']['metaseo.'];
}

// Store blacklist configuration
Expand Down Expand Up @@ -168,11 +171,13 @@ protected static function processLinkUrl($linkUrl)
static $absRefPrefix = null;
static $absRefPrefixLength = 0;
$ret = $linkUrl;
$tsfe = self::getTsfe();


// Fetch abs ref prefix if available/set
if ($absRefPrefix === null) {
if (!empty($GLOBALS['TSFE']->tmpl->setup['config.']['absRefPrefix'])) {
$absRefPrefix = $GLOBALS['TSFE']->tmpl->setup['config.']['absRefPrefix'];
if (!empty($tsfe->tmpl->setup['config.']['absRefPrefix'])) {
$absRefPrefix = $tsfe->tmpl->setup['config.']['absRefPrefix'];
$absRefPrefixLength = strlen($absRefPrefix);
} else {
$absRefPrefix = false;
Expand Down Expand Up @@ -252,6 +257,7 @@ protected function checkIfSitemapIndexingIsEnabled($indexingType)
* - REQUEST_METHOD (must be GET)
* - If there is a feuser session
* - Page type blacklisting
* - Exclusion from search engines
* - If page is static cacheable
* - If no_cache is not set
*
Expand Down Expand Up @@ -283,13 +289,20 @@ protected function checkIfCurrentPageIsIndexable()
return false;
}

$tsfe = self::getTsfe();

// Check for type blacklisting (from typoscript PAGE object)
if (in_array($GLOBALS['TSFE']->type, $this->pageTypeBlacklist)) {
if (in_array($tsfe->type, $this->pageTypeBlacklist)) {
return false;
}

// Check if page is excluded from search engines
if (!empty($tsfe->page['tx_metaseo_is_exclude'])) {
return false;
}

// Check for doktype blacklisting (from current page record)
if (in_array((int)$GLOBALS['TSFE']->page['doktype'], $this->doktypeBlacklist)) {
if (in_array((int)$tsfe->page['doktype'], $this->doktypeBlacklist)) {
return false;
}

Expand All @@ -298,4 +311,12 @@ protected function checkIfCurrentPageIsIndexable()

return true;
}

/**
* @return TypoScriptFrontendController
*/
protected static function getTsfe()
{
return $GLOBALS['TSFE'];
}
}
26 changes: 26 additions & 0 deletions Classes/Hook/SitemapIndexLinkHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Metaseo\Metaseo\Utility\GeneralUtility;
use Metaseo\Metaseo\Utility\SitemapUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;

/**
* Sitemap Indexer
Expand Down Expand Up @@ -128,13 +129,38 @@ public function hook_linkParse(array &$pObj)
$pageLanguage = (int)GeneralUtility::getLanguageId();
}

if (!$this->checkIfTranslationExists($linkPageUid, $pageLanguage)) {
//translation does not exist => don't index
return;
}

// Index link
$pageData = $this->generateSitemapPageData($linkUrl, $linkPageUid, $rootline, $pageLanguage, $linkType);
if (!empty($pageData)) {
SitemapUtility::index($pageData);
}
}

/**
* Returns True if translation exists for a chosen language (L=) parameter
* Returns False if no translation exists
*
* @return bool
*/
protected function checkIfTranslationExists($linkPageUid, $requestLanguage)
{
if ($requestLanguage === 0) {
//default language always exists
return true;
}
$translated = BackendUtility::getRecordLocalization('pages', $linkPageUid, $requestLanguage);
if ($translated === false || $translated === null) {
//translation does not exist
return false;
}
return true;
}

// ########################################################################
// Methods
// ########################################################################
Expand Down
21 changes: 21 additions & 0 deletions Classes/Hook/SitemapIndexPageHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public function addPageToSitemapIndex()
return;
}

if (!$this->checkIfNoLanguageFallback()) {
// got content in fallback language => don't index
return;
}

$pageUrl = $this->getPageUrl();

// check blacklisting
Expand All @@ -105,6 +110,22 @@ public function addPageToSitemapIndex()
}
}

/**
* Returns True if language chosen by L= parameter matches language of content
* Returns False if content is in fallback language
*
* @return bool
*/
protected function checkIfNoLanguageFallback()
{
$tsfe = self::getTsfe();
// Check if we have fallen back to a default language
if (GeneralUtility::getLanguageId() !== $tsfe->sys_language_uid) {
return false; //don't index untranslated page
}
return true;
}

/**
* Generate sitemap page data
*
Expand Down
5 changes: 5 additions & 0 deletions Classes/Page/Part/MetatagPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class MetatagPart extends AbstractPart
protected function initialize()
{
$this->cObj = $GLOBALS['TSFE']->cObj;
if (ExtensionManagementUtility::isLoaded('fluidpages')) {
// works around missing language overlay when fluidpages extension is used
$this->cObj->start($GLOBALS['TSFE']->page, 'pages');
}

$this->tsSetup = $GLOBALS['TSFE']->tmpl->setup;
$this->pageRecord = $GLOBALS['TSFE']->page;
$this->pageMeta = array();
Expand Down
25 changes: 25 additions & 0 deletions Documentation/AdministratorManual/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,28 @@ If you want to activate a “real” sitemap.xml feature (eg. http://example.com

);



Configuration via Extension Manager
-----------------------------------

In TYPO3's extension manager go to the configuration symbol besides the entry for metaseo:

.. figure:: ../Images/AdministatorManual/ConfigurationExtensionManager.png
:scale: 80%
:alt: Configuration via Extension Manager

============================== ==========================================================
Configuration variable Description
============================== ==========================================================
general.pagingSize Pagination: Maximum number of entries displayed per page
in tables of backend sections Sitemap and SEO/Metatags.
Defaults to 50 entries per page.

general.enableBeta Enable or disable beta features.

general.enableIntegrationTTNews Enable or disable tt_news integration.

general.sitemap_ to be documented.
clearCachePossibility
============================== ==========================================================
7 changes: 7 additions & 0 deletions Documentation/ChangeLog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Changelog
+-------------+----------------------------------------------------------------------------------------------------+
| Version | Changes |
+=============+====================================================================================================+
| **2.0.3** | **New feature and Bugfix release** |
| | |
| | - Number of entries shown in sitemap now can be changed via extension manager |
| | |
| | `Milestone 2.0.3 <https://github.com/mblaschke/TYPO3-metaseo/milestone/16?closed=1>`_ |
| | `Changes in 2.0.3 <https://github.com/mblaschke/TYPO3-metaseo/compare/2.0.2...2.0.3>`_ |
+-------------+----------------------------------------------------------------------------------------------------+
| **2.0.2** | **Bugfix release** |
| | |
| | **Migration to 2.0.2:** |
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- To avoid feedback loops, please provide us the following information: -->
<!-- To avoid feedback loops, we suggest to provide the following information: -->

**MetaSEO version**: 0.0.0

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MetaSEO - Search Engine Optimization for TYPO3

![stable v2.0.2](https://img.shields.io/badge/stable-v2.0.3-green.svg?style=flat)
![development v2.0.2](https://img.shields.io/badge/development-v2.0.2-red.svg?style=flat)
![stable v2.0.3](https://img.shields.io/badge/stable-v2.0.3-green.svg?style=flat)
![development v2.0.4](https://img.shields.io/badge/development-v2.0.4-red.svg?style=flat)
![License GPL3](https://img.shields.io/badge/license-GPL3-blue.svg?style=flat)


Expand All @@ -22,13 +22,13 @@ It's a replacement for the "metatag" extension and the successor of the disconti

## Version status

* Version **2.0.2**:
* Version **2.0.3**:

+ Branch **master**
+ TYPO3 Version: 6.2.x - 7.6.x
+ Composer: dev-master

* Version **2.0.2-dev**:
* Version **2.0.4-dev**:

+ Branch **develop**
+ TYPO3 Version: 6.2.x - 7.6.x
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": ["GPL-3.0+"],
"keywords": ["TYPO3 CMS"],
"version": "2.0.2",
"version": "2.0.3",
"autoload": {
"psr-4": {
"Metaseo\\Metaseo\\": "Classes/"
Expand Down
3 changes: 3 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# cat=General; type=int+; label=Pagination: Maximum number of entries displayed in tables of backend sections Sitemap and SEO/Metatags. Defaults to 50 entries.
pagingSize =

# cat=General; type=boolean; label=Beta: Enable beta-features, see manual for details (default is disabled)
enableBeta =

Expand Down
12 changes: 6 additions & 6 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
'description' => 'Search Engine Optimization (SEO), Indexed Google-Sitemap (TXT- and XML-Sitemap) for all Extensions (pibase, extbase), Metatags, Canonical-URL, Pagetitle manipulations, Crawler verification, Piwik and Google Analytics support and some more... multi-language- and multi-tree-support',
'category' => 'misc',
'shy' => 0,
'version' => '2.0.2',
'version' => '2.0.3',
'dependencies' => '',
'conflicts' => '',
'priority' => '',
'loadOrder' => '',
'module' => '',
'state' => 'beta',
'state' => 'stable',
'uploadfolder' => 1,
'createDirs' => '',
'modify_tables' => 'pages,pages_language_overlay',
Expand All @@ -29,10 +29,10 @@
),
'conflicts' => array(),
'suggests' => array(),
'autoload' => array(
'psr-4' => array(
'Metaseo\\Metaseo\\' => 'Classes',
),
),
'autoload' => array(
'psr-4' => array(
'Metaseo\\Metaseo\\' => 'Classes',
),
),
'_md5_values_when_last_written' => 'a:31:{s:9:"ChangeLog";s:4:"95d7";s:10:"README.txt";s:4:"878d";s:16:"ext_autoload.php";s:4:"550a";s:21:"ext_conf_template.txt";s:4:"09c3";s:12:"ext_icon.gif";s:4:"6ce1";s:17:"ext_localconf.php";s:4:"4f36";s:14:"ext_tables.php";s:4:"6b22";s:14:"ext_tables.sql";s:4:"31cb";s:16:"locallang_db.xml";s:4:"a7ed";s:17:"locallang_tca.xml";s:4:"6623";s:7:"tca.php";s:4:"95ea";s:14:"doc/manual.pdf";s:4:"6b9f";s:14:"doc/manual.sxw";s:4:"0385";s:40:"hooks/sitemap/class.cache_controller.php";s:4:"b6d4";s:45:"hooks/sitemap/class.cache_controller_hook.php";s:4:"5b2d";s:27:"hooks/sitemap/locallang.xlf";s:4:"0c9f";s:19:"lib/class.cache.php";s:4:"2659";s:18:"lib/class.http.php";s:4:"5366";s:24:"lib/class.linkparser.php";s:4:"a2e1";s:22:"lib/class.metatags.php";s:4:"0067";s:24:"lib/class.pagefooter.php";s:4:"35b6";s:23:"lib/class.pagetitle.php";s:4:"1709";s:24:"lib/class.robots_txt.php";s:4:"e839";s:19:"lib/class.tools.php";s:4:"b67d";s:34:"lib/sitemap/class.sitemap_base.php";s:4:"0e0a";s:37:"lib/sitemap/class.sitemap_indexer.php";s:4:"3162";s:33:"lib/sitemap/class.sitemap_txt.php";s:4:"fcc3";s:33:"lib/sitemap/class.sitemap_xml.php";s:4:"10bc";s:24:"res/ga-track-download.js";s:4:"e80d";s:28:"static/default/constants.txt";s:4:"60b5";s:24:"static/default/setup.txt";s:4:"e6ff";}',
Expand Down

0 comments on commit 7c749b5

Please sign in to comment.