[BUGFIX] Even more cleanup
authorPatrick Schriner <patrick.schriner@diemedialen.de>
Mon, 4 Jan 2016 11:59:09 +0000 (12:59 +0100)
committerPatrick Schriner <patrick.schriner@diemedialen.de>
Mon, 4 Jan 2016 11:59:09 +0000 (12:59 +0100)
Change-Id: I77c31849190ff9b572b3d6d9c5c63689c842a5d2

Classes/Utility/PageData.php
Classes/Utility/SitemapRenderer.php
Resources/Private/Partials/Sitemap/Item.html [new file with mode: 0644]
Resources/Private/Partials/Sitemap/page.html [deleted file]
Resources/Private/Templates/Sitemap/List.html

index 736d283..83f6652 100644 (file)
@@ -49,19 +49,26 @@ class PageData {
                $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; }
+               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; }
-               if(isset($gpVars['M']) && $gpVars['M'] !== '') { return; } // Module links
+               $ignoreTypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $confArray['ignorePageType'], TRUE);
+               
+               if(isset($GLOBALS['TSFE']->type) && in_array($GLOBALS['TSFE']->type, $ignoreTypes)) { // Ignored types
+                       return;
+               }
+               if(isset($gpVars['M']) && $gpVars['M'] !== '') { // Module links
+                       return;
+               } 
 
                $pageUid = intval($GLOBALS['TSFE']->page['uid']);
                $doktype = intval($GLOBALS['TSFE']->page['doktype']);
-               $feAuth = intval($GLOBALS['TSFE']->page['fe_group']);
+               $feAuth = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TSFE']->page['fe_group'], TRUE);
                $gpVars['id'] = $pageUid;
-               $contentHash = md5($params['bodyContent']);
+               $contentHash = md5($params['bodyContent']);;
 
                $lang = 0;
                if(isset($gpVars['L'])){
@@ -79,7 +86,9 @@ class PageData {
 
                // Ignore non-standard pages or pages where a login is required.
                // We don't want secured pages to appear on the sitemap.
-               if(empty($pageUid) || $doktype != 1 || $feAuth != 0) {return;}
+               if(empty($pageUid) || $doktype != 1 || count($feAuth) !== 0) {
+                       return;
+               }
 
                $lastChanged = intval($GLOBALS['TSFE']->page['SYS_LASTCHANGED']);
                if($lastChanged == 0) {$lastChanged = time();}
index e7695ed..3023565 100644 (file)
@@ -37,7 +37,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
  */
 class SitemapRenderer {
-       
+
        // mapping the names form extension configuration (sorting) to actual table fields.
        private $field = array('UID' => 's.for_page', 'PageTitle' => 'p.title', 'URL' => 's.request_uri', 'LastChanged' => 's.lastmod');
 
@@ -133,6 +133,7 @@ class SitemapRenderer {
 
                // Initialize Language
                \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage();
+               \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA();
 
                // Initialize FE User.
                $TSFE->initFEuser();
@@ -140,12 +141,11 @@ class SitemapRenderer {
                // Important: no Cache for Ajax stuff
                $TSFE->set_no_cache();
                $TSFE->checkAlternativeIdMethods();
+
                $TSFE->determineId();
                $TSFE->initTemplate();
                $TSFE->getConfigArray();
 
-               // Initialize TCA
-               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca();
                $TSFE->cObj = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
                $TSFE->settingLanguage();
                $TSFE->settingLocale();
diff --git a/Resources/Private/Partials/Sitemap/Item.html b/Resources/Private/Partials/Sitemap/Item.html
new file mode 100644 (file)
index 0000000..a236d01
--- /dev/null
@@ -0,0 +1,76 @@
+<tr class="item{f:if(condition: item.page.noSearch, then: ' nosearch')}">
+       <td class="title">
+               <f:for each="{item.level}" as="level">
+                       <img src="./clear.gif" width="18" height="16" alt="">
+               </f:for>
+               <span title="{item.page.title}" class="t3-icon t3-icon-apps t3-icon-apps-pagetree c-recIcon {item.page.pageCssClass}">
+                       <f:if condition="{item.page.hidden}">
+                               <f:then><span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay">&nbsp;</span></f:then>
+                               <f:else>
+                                       <f:if condition="{item.page.feGroup} != 0">
+                                               <f:then>
+                                                       <span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-access-restricted t3-icon-overlay">&nbsp;</span>
+                                               </f:then>
+                                               <f:else>&nbsp;</f:else>
+                                       </f:if>
+                               </f:else>
+                       </f:if>
+               </span>
+               <span class="value">
+                       {item.page.title}
+               </span>
+       </td>
+       <td class="uid">
+               {item.page.uid}
+       </td>
+       <f:if condition="{item.sitemaps}">
+               <f:then>
+               <f:for each="{item.sitemaps}" as="sitemap" iteration="i">
+                       <f:if condition="{i.isFirst}">
+                               <f:then></f:then>
+                               <f:else>
+                                       <f:if condition="{item.page.noSearch}">
+                                               <f:then><tr class="nosearch"><td colspan="2"><!--  --></td></f:then>
+                                               <f:else><tr><td colspan="2"><!--  --></td></f:else>
+                                       </f:if>
+                               </f:else>
+                       </f:if>
+                       
+                               <td class="lang">
+                                       <f:if condition="{sitemap.sysLanguageUid}">
+                                               <span title="{sitemap.sysLanguageFlag}" class="t3-icon t3-icon-flags t3-icon-flags-{sitemap.sysLanguageFlag} t3-icon-{sitemap.sysLanguageFlag}">&nbsp;</span>
+                                       </f:if>
+                               </td>
+                               <td class="delete">
+                                       <f:link.action action="delete" arguments="{sitemap : sitemap}">
+                                               <img src="./sysext/t3skin/icons/gfx/garbage.gif" width="16" height="16" title="Delete Sitemap Entry" alt="">
+                                       </f:link.action>
+                               </td>
+                               <td class="params" title="{sitemap.urlParams}">
+                                       {sitemap.urlParamsTrimed}
+                               </td>
+                               <td class="url" title="{sitemap.requestUri}">
+                                       {sitemap.requestUriTrimed}
+                               </td>
+                               <td class="priority">
+                                       <f:form action="update" name="sitemap" enctype="post" object="{sitemap}" >
+                                               <f:form.select property="priority"  options="{1:'1', 2:'2', 3:'3', 4:'4', 5:'5', 6:'6', 7:'7', 8:'8', 9:'9', 10:'10' }" value="{sitemap.priority}" />
+                                       </f:form>
+                               </td>
+                               <td class="lastchange" title="{sitemap.lastmod -> f:format.date(format: 'd.m.Y - H:i:s')}">
+                                       <f:format.date format="d.m.Y">{sitemap.lastmod}</f:format.date>
+                               </td>
+                       </tr>
+               </f:for>
+               </f:then>
+               <f:else>
+                       <td colspan="6"><!-- spacer --></td>
+               </f:else>
+       </f:if>
+</tr>
+
+<f:if condition="{item.subpages}">
+       <f:for each="{item.subpages}" as="page" iteration="i">
+               <f:render partial="Sitemap/Item" arguments="{item: page}" />
+       </f:for>
+</f:if>
\ No newline at end of file
diff --git a/Resources/Private/Partials/Sitemap/page.html b/Resources/Private/Partials/Sitemap/page.html
deleted file mode 100644 (file)
index 07d2e56..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<tr class="item{f:if(condition: item.page.noSearch, then: ' nosearch')}">
-       <td class="title">
-               <f:for each="{item.level}" as="level">
-                       <img src="./clear.gif" width="18" height="16" alt="">
-               </f:for>
-               <span title="{item.page.title}" class="t3-icon t3-icon-apps t3-icon-apps-pagetree c-recIcon {item.page.pageCssClass}">
-                       <f:if condition="{item.page.hidden}">
-                               <f:then><span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay">&nbsp;</span></f:then>
-                               <f:else>
-                                       <f:if condition="{item.page.feGroup} != 0">
-                                               <f:then>
-                                                       <span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-access-restricted t3-icon-overlay">&nbsp;</span>
-                                               </f:then>
-                                               <f:else>&nbsp;</f:else>
-                                       </f:if>
-                               </f:else>
-                       </f:if>
-               </span>
-               <span class="value">
-                       {item.page.title}
-               </span>
-       </td>
-       <td class="uid">
-               {item.page.uid}
-       </td>
-       <f:if condition="{item.sitemaps}">
-               <f:then>
-               <f:for each="{item.sitemaps}" as="sitemap" iteration="i">
-                       <f:if condition="{i.isFirst}">
-                               <f:then></f:then>
-                               <f:else>
-                                       <f:if condition="{item.page.noSearch}">
-                                               <f:then><tr class="nosearch"><td colspan="2"><!--  --></td></f:then>
-                                               <f:else><tr><td colspan="2"><!--  --></td></f:else>
-                                       </f:if>
-                               </f:else>
-                       </f:if>
-                       
-                               <td class="lang">
-                                       <f:if condition="{sitemap.sysLanguageUid}">
-                                               <span title="{sitemap.sysLanguageFlag}" class="t3-icon t3-icon-flags t3-icon-flags-{sitemap.sysLanguageFlag} t3-icon-{sitemap.sysLanguageFlag}">&nbsp;</span>
-                                       </f:if>
-                               </td>
-                               <td class="delete">
-                                       <f:link.action action="delete" arguments="{sitemap : sitemap}">
-                                               <img src="./sysext/t3skin/icons/gfx/garbage.gif" width="16" height="16" title="Delete Sitemap Entry" alt="">
-                                       </f:link.action>
-                               </td>
-                               <td class="params" title="{sitemap.urlParams}">
-                                       {sitemap.urlParamsTrimed}
-                               </td>
-                               <td class="url" title="{sitemap.requestUri}">
-                                       {sitemap.requestUriTrimed}
-                               </td>
-                               <td class="priority">
-                                       <f:form action="update" name="sitemap" enctype="post" object="{sitemap}" >
-                                               <f:form.select property="priority"  options="{1:'1', 2:'2', 3:'3', 4:'4', 5:'5', 6:'6', 7:'7', 8:'8', 9:'9', 10:'10' }" value="{sitemap.priority}" />
-                                       </f:form>
-                               </td>
-                               <td class="lastchange" title="{sitemap.lastmod -> f:format.date(format: 'd.m.Y - H:i:s')}">
-                                       <f:format.date format="d.m.Y">{sitemap.lastmod}</f:format.date>
-                               </td>
-                       </tr>
-               </f:for>
-               </f:then>
-               <f:else>
-                       <td colspan="6"><!-- spacer --></td>
-               </f:else>
-       </f:if>
-</tr>
-
-<f:if condition="{item.subpages}">
-       <f:for each="{item.subpages}" as="page" iteration="i">
-               <f:render partial="Sitemap/page" arguments="{item: page}" />
-       </f:for>
-</f:if>
\ No newline at end of file
index a515342..ebd01c6 100644 (file)
@@ -53,7 +53,7 @@ Otherwise your changes will be overwritten the next time you save the extension
                                <td>Priority</td>
                                <td>Last Changed</td>
                        </tr>
-                       <f:render partial="Sitemap/page" arguments="{item: item}" />
+                       <f:render partial="Sitemap/Item" arguments="{item: item}" />
                </table>
        </f:else>
 </f:if>