Addressing a few change requests form TYPO3 FORGE.
authorJavor Issapov <javor.issapov@diemedialen.de>
Wed, 12 Nov 2014 09:18:49 +0000 (10:18 +0100)
committerJavor Issapov <javor.issapov@diemedialen.de>
Wed, 12 Nov 2014 09:18:49 +0000 (10:18 +0100)
For Detailed information on what has changed, please review the ChangeLog.

Change-Id: I75d828cfac79d4e397eb0c869cbea013f926c512

Classes/Utility/PageData.php
Classes/Utility/SitemapRenderer.php
Documentation/ChangeLog/Index.rst
Resources/Private/Language/de.locallang.xlf
Resources/Private/Language/locallang.xlf
ext_conf_template.txt
ext_emconf.php
ext_tables.sql

index 72ea605..09f1e6d 100644 (file)
@@ -20,6 +20,14 @@ class PageData {
                $tsConfig = $GLOBALS['TSFE']->tmpl->setup['config.'];
                $gpVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
                
+               // Exit early if page is viewed in preview mode from TYPO3
+               if($GLOBALS['TSFE']->fePreview || isset($gpVars['ADMCMD_view']) && isset($gpVars['ADMCMD_editIcons'])) { return; }
+               
+               // Exit early if page type is exluded from sitemap.
+               $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dynamicgooglesitemap']);
+               $ignoreTypes = explode(',', $confArray['ignorePageType']);
+               if(isset($GLOBALS['TSFE']->type) && in_array($GLOBALS['TSFE']->type, $ignoreTypes)) { return; }
+               
                $pageUid = intval($GLOBALS['TSFE']->page['uid']);
                $doktype = intval($GLOBALS['TSFE']->page['doktype']);
                $feAuth = intval($GLOBALS['TSFE']->page['fe_group']);
@@ -47,8 +55,10 @@ class PageData {
                $lastChanged = intval($GLOBALS['TSFE']->page['SYS_LASTCHANGED']);
                if($lastChanged == 0) {$lastChanged = time();}
                
-               $httpHost = $_SERVER['HTTP_HOST'];
-               $requestUri = $_SERVER['REQUEST_URI'];
+               $httpHost = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
+               $requestUri = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
+               $https = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL');
+               
                $urlParams = $this->getGetParams($gpVars);
 
                $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow ('*', $this->table, 'http_host = \'' .  $httpHost . '\' AND for_page = ' . $pageUid . ' AND url_params = \'' . $urlParams . '\' AND sys_language_uid = \'' . $lang . '\' ');
@@ -61,7 +71,8 @@ class PageData {
                                        'content_hash' => $contentHash,
                                        'lastmod' => $lastChanged,
                                        'sys_language_uid' => $lang,
-                                       'lang_key' => $tsConfig['language']
+                                       'lang_key' => $tsConfig['language'],
+                                       'https' => $https
                        );
                        $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery($this->table, $insertArray);
                } else if($row['content_hash'] != $contentHash || $row['request_uri'] != $requestUri ) {
@@ -69,7 +80,8 @@ class PageData {
                        $where_clause = 'for_page = ' . $pageUid. ' AND url_params = \'' . $urlParams . '\' AND sys_language_uid = ' . $tsConfig['sys_language_uid'];
                        $field_values = array(
                                'request_uri' => $requestUri,
-                               'lastmod' => $lastChanged
+                               'lastmod' => $lastChanged,
+                               'https' => $https
                        );
                        $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( $this->table, $where_clause, $field_values);
                }
index 7bddc9d..111d30a 100644 (file)
@@ -55,11 +55,15 @@ class SitemapRenderer {
                                foreach($page as $lang) {
                                        $date->setTimestamp($lang['SYS_LASTCHANGED']);
                                        $prio = sprintf('%0.1F', intval($lang['priority']) / 10);
+                                       $protocol = 'http';
+                                       if($lang['https']){ $protocol .= 's'; }
                                        
                                        echo "\t" . '<url>' . "\n";
-                                               echo "\t\t" . '<loc><![CDATA[http://' . $lang['http_host'] . $lang['request_uri'] . ']]></loc>' . "\n";
+                                               echo "\t\t" . '<loc>' . $protocol . '://' . $lang['http_host'] . htmlentities($lang['request_uri']) . '</loc>' . "\n";
                                                foreach($page as $ref) {
-                                                       echo "\t\t" . '<xhtml:link rel="alternate" hreflang="' . $ref['lang_key'] . '" href="http://' . $ref['http_host'] . str_replace('&', '&amp;', str_replace('&amp;', '&', $ref['request_uri'])) . '" />' . "\n";
+                                                       $protocolRef = 'http';
+                                                       if($ref['https']){ $protocolRef .= 's'; }
+                                                       echo "\t\t" . '<xhtml:link rel="alternate" hreflang="' . $ref['lang_key'] . '" href="' . $protocolRef . '://' . $ref['http_host'] . str_replace('&', '&amp;', str_replace('&amp;', '&', $ref['request_uri'])) . '" />' . "\n";
                                                }
                                                echo "\t\t" . '<lastmod>' . $date->format('Y-m-d') . '</lastmod>' . "\n";
                                                echo "\t\t" . '<changefreq>monthly</changefreq>' . "\n";
@@ -71,8 +75,11 @@ class SitemapRenderer {
                                foreach($page as $lang) {
                                        $date->setTimestamp($lang['SYS_LASTCHANGED']);
                                        $prio = sprintf('%0.1F', intval($lang['priority']) / 10);
+                                       $protocol = 'http';
+                                       if($lang['https']){ $protocol .= 's'; }
+                                       
                                        echo "\t" . '<url>' . "\n";
-                                               echo "\t\t" . '<loc><![CDATA[http://' . $lang['http_host'] . $lang['request_uri'] . ']]></loc>' . "\n";
+                                               echo "\t\t" . '<loc>' . $protocol . '://' . $lang['http_host'] . htmlentities($lang['request_uri']) . '</loc>' . "\n";
                                                echo "\t\t" . '<lastmod>' . $date->format('Y-m-d') . '</lastmod>' . "\n";
                                                echo "\t\t" . '<changefreq>monthly</changefreq>' . "\n";
                                                echo "\t\t" . '<priority>' . $prio . '</priority>' . "\n";
@@ -104,8 +111,8 @@ class SitemapRenderer {
                $TSFE->initTemplate();
                $TSFE->getConfigArray();
                
-               // not instancieated??
-               //\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca();
+               // Initialize TCA
+               \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA();
                $TSFE->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
                $TSFE->settingLanguage();
                $TSFE->settingLocale();
index 4a83ca5..dca09cb 100644 (file)
 ChangeLog
 =========
 
-+----------------+----------+-----------------------------------------------+
-| Date           | Version  | Description                                   |
-+================+==========+===============================================+
-| 2014-05-27     | 0.1.6    | Adding a Language flag to the Backend Module  |
-+----------------+----------+-----------------------------------------------+
-| 2014-05-27     | 0.1.5    | Completition of the Documentation             |
-+----------------+----------+-----------------------------------------------+
-| 2014-05-16     | 0.1.0    | Completition of the alpha version             |
-+----------------+----------+-----------------------------------------------+
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| Date           | Version  | Description                                                                                                                                   |
++================+==========+===============================================================================================================================================+
+| 2014-11-05     | 0.9.2    | * Removing CDATA wrapper form <loc> tag.                                                                                                      |
+|                |          | * Respect https protocol.                                                                                                                     |
+|                |          | * Ignoring Pages that are opened by Preview.                                                                                                  |
+|                |          | * Adding Setting field to exclude Page Types.                                                                                                 |
+|                |          | * TCA is now properly initialised in the eID procedure.                                                                                       |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| 2014-10-01     | 0.9.1    | * It is now possible to exclude Sites from being displaying in the sitemap by setting the 'Include in Search' Field from the page properties. |
+|                |          | * There is also a field in the extension configuration to Enable/Disable this feature globally.                                               |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| 2014-08-01     | 0.9.0    | Going live to TYPO3 Extension Repository                                                                                                      |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| 2014-05-27     | 0.1.6    | Adding a Language flag to the Backend Module                                                                                                  |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| 2014-05-27     | 0.1.5    | Completition of the Documentation                                                                                                             |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
+| 2014-05-16     | 0.1.0    | Completition of the alpha version                                                                                                             |
++----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------+
index 5f3c8a9..b2a28e9 100644 (file)
                                <source>Ignor Parameters (Comma separated List)</source>
                                <target>Ignoriere Parameter (Kommata getrennte Liste)</target>
                        </trans-unit>
+                       <trans-unit id="config.ignorePageType">
+                               <source>Ignore page types e.g. 98 for print (Comma seperated list)</source>
+                               <target>Ignoriere Sitentyp z.B 98 für Druckvariante (Kommata getrennte Liste)</target>
+                       </trans-unit>
                        <trans-unit id="config.sorting">
                                <source>Sort Sitemap by Field</source>
                                <target>Sortiere Sitemap by Feld</target>
index face61c..42e9c6b 100644 (file)
                        </trans-unit>
                        
                        <trans-unit id="config.ignoreParams">
-                               <source>Ignore Parameters (Comma seperated List)</source>
+                               <source>Ignore parameters (Comma seperated list)</source>
+                       </trans-unit>
+                       <trans-unit id="config.ignorePageType">
+                               <source>Ignore page types e.g. 98 for print (Comma seperated list)</source>
                        </trans-unit>
                        <trans-unit id="config.sorting">
                                <source>Sort Sitemap by Field</source>
index 1c747a1..ec4f413 100644 (file)
@@ -1,8 +1,11 @@
   # cat=Basic//10; type=input; label=LLL:EXT:dynamicgooglesitemap/Resources/Private/Language/locallang.xlf:config.ignoreParams
 ignoreParams = cHash
 
+  # cat=Basic//10; type=input; label=LLL:EXT:dynamicgooglesitemap/Resources/Private/Language/locallang.xlf:config.ignorePageType
+ignorePageType = 98
+
   # cat=Basic//20; type=options[UID,PageTitle,URL,LastChanged]; label=LLL:EXT:dynamicgooglesitemap/Resources/Private/Language/locallang.xlf:config.sorting
 sorting = uid
 
   # cat=Basic//30; type=boolean; label=LLL:EXT:dynamicgooglesitemap/Resources/Private/Language/locallang.xlf:config.nosearch
-respectNoSearch = 1
\ No newline at end of file
+respectNoSearch = 1
index aec5d3e..27ad5dd 100644 (file)
@@ -27,7 +27,7 @@ $EM_CONF[$_EXTKEY] = array(
        'modify_tables' => '',
        'clearCacheOnLoad' => 0,
        'lockType' => '',
-       'version' => '0.9.1',
+       'version' => '0.9.2',
        'constraints' => array(
                'depends' => array(
                        'extbase' => '6.0',
index 3c71ebc..3d38316 100644 (file)
@@ -14,6 +14,7 @@ CREATE TABLE tx_dynamicgooglesitemap_domain_model_sitemap (
        priority int(11) DEFAULT '5' NOT NULL,
        lastmod int(11) DEFAULT '0' NOT NULL,
        lang_key varchar(10) DEFAULT '' NOT NULL,
+       https tinyint(4) unsigned DEFAULT '0' NOT NULL,
 
        t3_origuid int(11) DEFAULT '0' NOT NULL,
        sys_language_uid int(11) DEFAULT '0' NOT NULL,