[FEATURE] Migrate to TYPO3 9 LTS 38/58638/2 v6.5.0
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 15 Oct 2018 16:08:32 +0000 (12:08 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 15 Oct 2018 16:48:58 +0000 (18:48 +0200)
Resolves: #86660
Change-Id: I0fb6283d1d292632784fa996e17084fa909962ca
Reviewed-on: https://review.typo3.org/58638
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
15 files changed:
ChangeLog
Classes/Controller/MenuController.php
Classes/Domain/Model/Page.php
Classes/Domain/Model/PageLanguageOverlay.php [deleted file]
Classes/Domain/Repository/PageLanguageOverlayRepository.php [deleted file]
Classes/Domain/Repository/PageRepository.php
Classes/Utility/LocalizationUtility.php [deleted file]
Classes/ViewHelpers/Widget/MenuViewHelper.php
Configuration/FlexForms/form.xml
Configuration/TypoScript/PluginSetup/setup.txt
class.ext_update.php [deleted file]
composer.json
doc/manual.sxw
ext_emconf.php
ext_typoscript_setup.typoscript [new file with mode: 0644]

index b7da7d4..01e6f35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-15  Stanislas Rolland  <typo3(arobas)sjbr.ca>\r
+\r
+       * Resolves #86660: Migrate to TYPO3 9 LTS\r
+       * Update version to 6.5.0\r
+\r
 2018-02-10  Stanislas Rolland  <typo3(arobas)sjbr.ca>\r
 \r
        * Resolves #83562: Use standard SQL table definition\r
index 12d15bf..98b07a4 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\SrLanguageMenu\Controller;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013-2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  (c) 2013-2018 Stanislas Rolland <typo3(arobas)sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -27,20 +27,23 @@ namespace SJBR\SrLanguageMenu\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Core\Utility\ClientUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 use TYPO3\CMS\Extbase\Mvc\Request;
 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
 use TYPO3\CMS\Extbase\Utility\ArrayUtility;
+use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Fluid\Core\Widget\WidgetRequest;
+use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
 use SJBR\SrLanguageMenu\Domain\Model\Page;
-use SJBR\SrLanguageMenu\Domain\Model\PageLanguageOverlay;
 use SJBR\SrLanguageMenu\Domain\Model\SystemLanguage;
-use SJBR\SrLanguageMenu\Utility\LocalizationUtility;
+use SJBR\SrLanguageMenu\Domain\Repository\PageRepository;
+use SJBR\SrLanguageMenu\Domain\Repository\SystemLanguageRepository;
+use SJBR\StaticInfoTables\Domain\Repository\LanguageRepository;
 
 /**
  * Controls the rendering of the language menu as a normal content element or as a Fluid widget
@@ -66,28 +69,52 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
        protected $extensionKey = 'sr_language_menu';
 
        /**
-        * @var \SJBR\SrLanguageMenu\Domain\Repository\SystemLanguageRepository
-        * @inject
+        * @var SystemLanguageRepository
         */
        protected $systemLanguageRepository;
 
+       /**
+        * Dependency injection of the System Language Repository
+        *
+        * @param SystemLanguageRepository $systemLanguageRepository
+        * @return void
+        */
+       public function injectSystemLanguageRepository(SystemLanguageRepository $systemLanguageRepository)
+       {
+               $this->systemLanguageRepository = $systemLanguageRepository;
+       }
+
        /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository
-        * @inject
+        * @var LanguageRepository
         */
        protected $languageRepository;
 
+       /**
+        * Dependency injection of the Language Repository
+        *
+        * @param LanguageRepository $languageRepository
+        * @return void
+        */
+       public function injectLanguageRepository(LanguageRepository $languageRepository)
+       {
+               $this->languageRepository = $languageRepository;
+       }
+
        /**
-        * @var \SJBR\SrLanguageMenu\Domain\Repository\PageRepository
-        * @inject
+        * @var PageRepository
         */
        protected $pageRepository;
 
-       /**
-        * @var \SJBR\SrLanguageMenu\Domain\Repository\PageLanguageOverlayRepository
-        * @inject
+       /**
+        * Dependency injection of the Page Repository
+        *
+        * @param PageRepository $pageRepository
+        * @return void
         */
-       protected $pageLanguageOverlayRepository;
+       public function injectPageRepository(PageRepository $pageRepository)
+       {
+               $this->pageRepository = $pageRepository;
+       }
 
        /**
         * Initialize the action when rendering as a widget
@@ -161,8 +188,7 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
                                // Add default language
                                $availableOverlays[] = 0;
                        }
-                       /** @var PageLanguageOverlay[] $pageLanguageOverlays */
-                       $pageLanguageOverlays = $this->pageLanguageOverlayRepository->findByPage($page)->toArray();
+                       $pageLanguageOverlays = $this->pageRepository->findByParent($page->getUid())->toArray();
                        foreach ($pageLanguageOverlays as $pageLanguageOverlay) {
                                // The overlay may refer to a deleted Website language
                                if (is_object($pageLanguageOverlay->getLanguage())) {
@@ -177,14 +203,14 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
                // Build language options
                $options = array();
                // If $this->settings['languages'] is not empty, the languages will be sorted in the order it specifies
-               $languages = GeneralUtility::trimExplode(',', $this->settings['languages'], TRUE);
+               $languages = GeneralUtility::trimExplode(',', $this->settings['languages'], true);
                if (!empty($languages) && !in_array(0, $languages)) {
                        array_unshift($languages, 0);
                }
                $index = 0;
                foreach ($systemLanguages as $systemLanguage) {
                        $option = array(
-                               'uid' => $systemLanguage->getUid() ? $systemLanguage->getUid() : 0,
+                               'uid' => $systemLanguage->getUid() ?: 0,
                                'isoCodeA2' => is_object($systemLanguage->getIsoLanguage()) ? $systemLanguage->getIsoLanguage()->getIsoCodeA2() : '',
                                'countryIsoCodeA2' => is_object($systemLanguage->getIsoLanguage()) ? $systemLanguage->getIsoLanguage()->getCountryIsoCodeA2(): ''
                        );
@@ -219,11 +245,7 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
                        $option['isAvailable'] = in_array($option['uid'], $availableOverlays);
                        $option['notAvailableTitle'] = $option['title'];
                        if (!$option['isAvailable']) {
-                               // Switch localization target language
-                               LocalizationUtility::setAlternateLanguage($option['combinedIsoCode'], $this->extensionName);
-                               $option['notAvailableTitle'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('translationNotAvailable', $this->extensionName, array($systemLanguage->getIsoLanguage() ? $systemLanguage->getIsoLanguage()->getLocalName() : $option['title']));
-                               // Restore configured localization target language
-                               LocalizationUtility::restoreConfiguredLanguage($this->extensionName);
+                               $option['notAvailableTitle'] = LocalizationUtility::translate('translationNotAvailable', $this->extensionName, array($systemLanguage->getIsoLanguage() ? $systemLanguage->getIsoLanguage()->getLocalName() : $option['title']), $option['combinedIsoCode']);
                        }
 
                        // Add configured external url for missing overlay record
@@ -321,10 +343,10 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
                }
 
                // Flags directory
-               $this->settings['flagsDirectory'] = ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/Images/Flags/';
+               $this->settings['flagsDirectory'] = PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath($this->extensionKey)) . 'Resources/Public/Images/Flags/';
                $this->settings['flagsExtension'] = 'png';
                if ($this->settings['englishFlagFile']) {
-                       $this->settings['flagsDirectory'] = dirname($this->getFrontendObject()->tmpl->getFileName(trim($this->settings['englishFlagFile']))) . '/';
+                       $this->settings['flagsDirectory'] = dirname(GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize(trim($this->settings['englishFlagFile']))) . '/';
                        $this->settings['flagsExtension'] = pathinfo(trim($this->settings['englishFlagFile']), PATHINFO_EXTENSION);             
                }
 
@@ -355,8 +377,12 @@ class MenuController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetControll
                }
 
                // Identify IE > 9
-               $browserInfo = ClientUtility::getBrowserInfo(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
-               $this->settings['isIeGreaterThan9'] =  $browserInfo['browser'] == 'msie' && intval($browserInfo['version']) > 9 ? 1 : 0;
+               $browserInfo = GeneralUtility::getIndpEnv('HTTP_USER_AGENT');
+               $browserIsIE = strpos($browserInfo, 'MSIE');
+               if ($browserIsIE !== false) {
+                       $browserVersion = intval(substr($browserInfo, $browserIsIE+5, 1));
+        }
+               $this->settings['isIeGreaterThan9'] =  $browserIsIE !== false && $browserVersion < 2 ? 1 : 0;
        }
 
        /**
index cb8bfe5..a182b2b 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\SrLanguageMenu\Domain\Model;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013-2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  (c) 2013-2018 Stanislas Rolland <typo3(arobas)sjbr.ca>
  *
  *  All rights reserved
  *
@@ -33,6 +33,20 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
 class Page extends AbstractEntity
 {
        /**
+        * Parent
+        *
+        * @var integer
+        */
+       protected $parent;      
+
+       /**
+        * Language
+        *
+        * @var \SJBR\SrLanguageMenu\Domain\Model\SystemLanguage
+        */
+       protected $language;
+       
+       /**
         * l18n_cfg ("Hide default translation of page" and "Hide page if no translation for current language exists")
         *
         * @var integer
@@ -40,6 +54,37 @@ class Page extends AbstractEntity
        protected $l18nCfg = 0;
 
        /**
+        * Returns the parent
+        *
+        * @return integer
+        */
+       public function getParent()
+       {
+               return $this->parent;
+       }
+
+       /**
+        * Sets the language
+        *
+        * @param \SJBR\SrLanguageMenu\Domain\Model\SystemLanguage $language
+        * @return void
+        */
+       public function setLanguage(\SJBR\SrLanguageMenu\Domain\Model\SystemLanguage $language)
+       {
+               $this->language = $language;
+       }
+
+       /**
+        * Returns the language
+        *
+        * @return \SJBR\SrLanguageMenu\Domain\Model\SystemLanguage
+        */
+       public function getLanguage()
+       {
+               return $this->language;
+       }
+
+       /**
         * Returns the l18nCfg value
         *
         * @return integer
diff --git a/Classes/Domain/Model/PageLanguageOverlay.php b/Classes/Domain/Model/PageLanguageOverlay.php
deleted file mode 100644 (file)
index 16ae3f6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-namespace SJBR\SrLanguageMenu\Domain\Model;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2013-2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-use SJBR\SrLanguageMenu\Domain\Model\Page;
-use SJBR\SrLanguageMenu\Domain\Model\SystemLanguage;
-use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
-
-/**
- * The Page Language Overlay model
- */
-class PageLanguageOverlay extends AbstractEntity
-{
-       /**
-        * Page
-        *
-        * @var \SJBR\SrLanguageMenu\Domain\Model\Page
-        */
-       protected $page;        
-
-       /**
-        * Language
-        *
-        * @var \SJBR\SrLanguageMenu\Domain\Model\SystemLanguage
-        */
-       protected $language;
-
-       /**
-        * Sets the page
-        *
-        * @param Page $page
-        * @return void
-        */
-       public function setPage(Page $page)
-       {
-               $this->page = $page;
-       }
-
-       /**
-        * Returns the page
-        *
-        * @return Page
-        */
-       public function getPage()
-       {
-               return $this->page;
-       }
-
-       /**
-        * Sets the language
-        *
-        * @param SystemLanguage $language
-        * @return void
-        */
-       public function setLanguage(SystemLanguage $language)
-       {
-               $this->language = $language;
-       }
-
-       /**
-        * Returns the language
-        *
-        * @return SystemLanguage
-        */
-       public function getLanguage()
-       {
-               return $this->language;
-       }
-}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/PageLanguageOverlayRepository.php b/Classes/Domain/Repository/PageLanguageOverlayRepository.php
deleted file mode 100644 (file)
index 821c8d9..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-namespace SJBR\SrLanguageMenu\Domain\Repository;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2013-2017 Stanislas Rolland <typo3@sjbr.ca>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-use SJBR\SrLanguageMenu\Domain\Model\Page;
-use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
-use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
-use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
-use TYPO3\CMS\Extbase\Persistence\Repository;
-
-/**
- * The page language overlay repository
- */
-class PageLanguageOverlayRepository extends Repository
-{
-       /**
-        * Initialize the repository for unrestricted access to page language overlays
-        *
-        * @param ObjectManagerInterface $objectManager
-        * @return void
-        */
-       public function __construct(ObjectManagerInterface $objectManager)
-       {
-               parent::__construct($objectManager);
-               $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
-               $querySettings->setRespectStoragePage(false);
-               $querySettings->setRespectSysLanguage(false);
-               $this->setDefaultQuerySettings($querySettings);
-       }
-
-       /**
-        *
-        *
-        * @param Page $page
-        * @return QueryResultInterface|array
-        */
-       public function findByPage(Page $page)
-       {
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->equals('pid', $page->getUid())
-               );
-               return $query->execute();
-       }
-}
\ No newline at end of file
index 8145885..e8a9b12 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\SrLanguageMenu\Domain\Repository;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013-2017 Stanislas Rolland <typo3@sjbr.ca>
+ *  (c) 2013-2018 Stanislas Rolland <typo3@sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -27,9 +27,27 @@ namespace SJBR\SrLanguageMenu\Domain\Repository;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
 use TYPO3\CMS\Extbase\Persistence\Repository;
 
 /**
  * The page repository
  */
-class PageRepository extends Repository {}
\ No newline at end of file
+class PageRepository extends Repository
+{
+       /**
+        * Initialize the repository for unrestricted access to page
+        *
+        * @param ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function __construct(ObjectManagerInterface $objectManager)
+       {
+               parent::__construct($objectManager);
+               $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
+               $querySettings->setRespectStoragePage(false);
+               $querySettings->setRespectSysLanguage(false);
+               $this->setDefaultQuerySettings($querySettings);
+       }
+}
\ No newline at end of file
diff --git a/Classes/Utility/LocalizationUtility.php b/Classes/Utility/LocalizationUtility.php
deleted file mode 100644 (file)
index 9ada94d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-namespace SJBR\SrLanguageMenu\Utility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  (c) 2013-2014 Stanislas Rolland <typo3(arobas)sjbr.ca>
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Localization helper used to fetch localized labels in a language other than the current language
- *
- * @api
- */
-class LocalizationUtility extends \TYPO3\CMS\Extbase\Utility\LocalizationUtility {
-
-       /**
-        * Configured language
-        *
-        * @var string
-        */
-       static protected $configuredLanguage = '';
-
-       /**
-        * Sets an alternate localization language
-        *
-        * @param string $extensionName
-        * @return void
-        */
-       static public function setAlternateLanguage($language, $extensionName) {
-               if (self::$configuredLanguage) {
-                       self::restoreConfiguredLanguage($extensionName);
-               }
-               self::$configuredLanguage = self::getFrontendObject()->config['config']['language'];
-               self::getFrontendObject()->config['config']['language'] = $language;
-               unset(parent::$LOCAL_LANG[$extensionName]);
-       }
-
-       /**
-        * Restores the configured localization language
-        *
-        * @param string $extensionName
-        * @return void
-        */
-       static public function restoreConfiguredLanguage($extensionName) {
-               if (self::$configuredLanguage) {
-                       self::getFrontendObject()->config['config']['language'] = self::$configuredLanguage;
-                       unset(parent::$LOCAL_LANG[$extensionName]);
-                       parent::initializeLocalization($extensionName);
-                       self::$configuredLanguage = '';
-               }
-       }
-
-       /**
-        * Returns an instance of the Frontend object.
-        *
-        * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
-        */
-       static protected function getFrontendObject() {
-               return $GLOBALS['TSFE'];
-       }
-}
\ No newline at end of file
index 923e371..3b0b6a8 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\SrLanguageMenu\ViewHelpers\Widget;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013-2017 Stanislas Rolland <typo3@sjbr.ca>
+ *  (c) 2013-2018 Stanislas Rolland <typo3@sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -72,10 +72,12 @@ class MenuViewHelper extends AbstractWidgetViewHelper
                $this->controller = $controller;
        }
 
-       public function initialize()
+       public function initializeArguments()
        {
-               $this->backupExtensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
-               $this->controllerContext->getRequest()->setControllerExtensionName('SrLanguageMenu');
+               parent::initializeArguments();
+               $this->registerArgument('languages', 'string', 'A list of site languages uids');
+               $this->registerArgument('layout', 'string', 'The requested layout: Flags, Select or Links');
+               $this->registerArgument('languageTitle', 'integer', 'The type of language title to use');
        }
 
        /**
@@ -87,7 +89,6 @@ class MenuViewHelper extends AbstractWidgetViewHelper
        public function render($languages = null, $layout = null, $languageTitle = null)
        {
                $result = $this->initiateSubRequest();
-               $this->controllerContext->getRequest()->setControllerExtensionName($this->backupExtensionName);
                return $result;
        }
 }
\ No newline at end of file
index ba1b471..b023cbc 100644 (file)
@@ -43,7 +43,6 @@
                                                                <allowed>sys_language</allowed>
                                                                <size>5</size>
                                                                <maxitems>50</maxitems>
-                                                               <show_thumbs>1</show_thumbs>
                                                        </config>
                                                </TCEforms>
                                        </settings.languages>
index 193912a..ed32084 100644 (file)
@@ -86,37 +86,4 @@ plugin.tx_srlanguagemenu {
                    view =< plugin.tx_srlanguagemenu.view
                }
        }
-}
-
-config.tx_extbase {
-       persistence {
-               classes {
-                       SJBR\SrLanguageMenu\Domain\Model\Page {
-                               mapping {
-                                       tableName = pages
-                                       columns {
-                                               l18n_cfg.mapOnProperty = l18nCfg
-                                       }
-                               }
-                       }
-                       SJBR\SrLanguageMenu\Domain\Model\PageLanguageOverlay {
-                               mapping {
-                                       tableName = pages_language_overlay
-                                       columns {
-                                               pid.mapOnProperty = page
-                                               sys_language_uid.mapOnProperty = language
-                                       }
-                               }
-                       }
-                       SJBR\SrLanguageMenu\Domain\Model\SystemLanguage {
-                               mapping {
-                                       tableName = sys_language
-                                       columns {
-                                               title.mapOnProperty = title
-                                               static_lang_isocode.mapOnProperty = isoLanguage
-                                       }
-                               }
-                       }
-               }
-       }
 }
\ No newline at end of file
diff --git a/class.ext_update.php b/class.ext_update.php
deleted file mode 100644 (file)
index b8db3e5..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-namespace SJBR\SrLanguageMenu;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2013-2017 Stanislas Rolland <typo3@sjbr.ca>
- *  All rights reserved
- *
- *  This script is part of the Typo3 project. The Typo3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\VersionNumberUtility;
-use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
-
-/**
-* Class for updating the language menu flexform
-*/
-class ext_update
-{
-       /**
-        * Main function, returning the HTML content of the module
-        *
-        * @return string  HTML
-        */
-       public function main()
-       {
-               $content = array();
-               $content[] = '<h3>' . LocalizationUtility::translate('update.upgradeTo6', 'SrLanguageMenu') . '</h3>';
-               if (GeneralUtility::_GP('proceed')) {
-                       $content[] = $this->updatePluginInstances();
-                       $content[] = $this->updateTsTemplates();
-                       $content[] = '<p>' . LocalizationUtility::translate('update.pleaseRead', 'SrLanguageMenu') . '</p>';
-               } else {
-                       $linkThisScript = GeneralUtility::linkThisScript();
-                       $content[] = '<form name="sr_language_menu_ext_update_form" action="' . $linkThisScript . '" method="post">';
-                       $content[] = '<p><strong>' . LocalizationUtility::translate('update.warning', 'SrLanguageMenu') . '</strong><br />' . LocalizationUtility::translate('update.changesToDatabase', 'SrLanguageMenu') . '</p>';
-                       $content[] = '<input type="submit" name="proceed" value="' . LocalizationUtility::translate('update.update', 'SrLanguageMenu') . '"  onclick="this.form.action=\'' . GeneralUtility::slashJS($linkThisScript) . '\';submit();" />';
-                       $content[]= '</form>';
-               }
-               return implode(LF, $content);
-       }
-
-       /**
-        * Updates the instances of the plugin in table tt_content
-        *
-        * @return string  HTML
-        */
-       protected function updatePluginInstances()
-       {
-               if (class_exists(\TYPO3\CMS\Core\Database\ConnectionPool::class)) {
-                       $queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getQueryBuilderForTable('tt_content');
-                       $queryBuilder->getRestrictions()->removeAll();
-                       $pluginInstances = $queryBuilder
-                               ->select('*')
-                               ->from('tt_content')
-                               ->where(
-                                       $queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter('sr_language_menu_pi1'))
-                               )
-                               ->execute()
-                               ->fetchAll();
-               } else {
-                       $pluginInstances = $this->getDatabaseConnection()->exec_SELECTgetRows(
-                               '*',
-                               'tt_content',
-                               'CType = ' . $this->getDatabaseConnection()->fullQuoteStr('sr_language_menu_pi1', 'tt_content')
-                       );
-               }
-
-               foreach ($pluginInstances as $row) {
-                       $update = array(
-                               'CType' => 'srlanguagemenu_languagemenu',
-                               'list_type' => '',
-                               'pi_flexform' => '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3FlexForms>
-    <data>
-        <sheet index="sDEF">
-            <language index="lDEF">
-                <field index="settings.layout">
-                    <value index="vDEF">' . $row['tx_srlanguagemenu_type'] . '</value>
-                </field>
-                <field index="settings.languages">
-                    <value index="vDEF">' . $row['tx_srlanguagemenu_languages'] . '</value>
-                </field>
-                <field index="settings.positionOfDefaultLanguage">
-                    <value index="vDEF">0</value>
-                </field>
-                <field index="settings.languageTitle">
-                    <value index="vDEF">0</value>
-                </field>
-            </language>
-        </sheet>
-        <sheet index="sTemplate">
-            <language index="lDEF">
-                <field index="view.templateRootPath">
-                    <value index="vDEF">EXT:sr_language_menu/Resources/Private/Templates/</value>
-                </field>
-                <field index="view.partialRootPath">
-                    <value index="vDEF">EXT:sr_language_menu/Resources/Private/Partials/</value>
-                </field>
-                <field index="view.layoutRootPath">
-                    <value index="vDEF">EXT:sr_language_menu/Resources/Private/Layouts/</value>
-                </field>
-            </language>
-        </sheet>
-    </data>
-</T3FlexForms>'
-                       );
-                       if (class_exists(\TYPO3\CMS\Core\Database\ConnectionPool::class)) {
-                               $queryBuilder
-                                  ->update('tt_content')
-                                  ->where(
-                                         $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter((int)$row['uid'], \PDO::PARAM_INT))
-                                  )
-                                  ->set('CType', $update['CType'])
-                                  ->set('list_type', $update['list_type'])
-                                  ->set('pi_flexform', $update['pi_flexform'])
-                                  ->execute();
-                       } else {
-                               $this->getDatabaseConnection()->exec_UPDATEquery('tt_content', 'uid=' . (int)$row['uid'], $update);
-                       }
-               }
-               $message = LocalizationUtility::translate('update.elementsUpdated', 'SrLanguageMenu', array(count($pluginInstances)));
-               return '<p>' . $message . '</p>';
-       }
-
-       /**
-        * Updates the TypoScript templates replacing tx_srlanguagemenu_pi1 by tx_srlanguagemenu
-        *
-        * @return string  HTML
-        */
-       protected function updateTsTemplates()
-       {
-               if (class_exists(\TYPO3\CMS\Core\Database\ConnectionPool::class)) {
-                       $queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getQueryBuilderForTable('sys_template');
-                       $queryBuilder->getRestrictions()->removeAll();
-                       $tsTemplates = $queryBuilder
-                               ->select('*')
-                               ->from('sys_template')
-                               ->execute()
-                               ->fetchAll();
-               } else {
-                       $tsTemplates = $this->getDatabaseConnection()->exec_SELECTgetRows(
-                               '*',
-                               'sys_template',
-                               '1=1'
-                       );
-               }
-               $count = 0;
-               foreach ($tsTemplates as $row) {
-                       if (strstr($row['constants'], 'tx_srlanguagemenu_pi1') !== false || strstr($row['config'], 'tx_srlanguagemenu_pi1') !== false) {
-                               $update = array();
-                               $update['constants'] = str_replace('tx_srlanguagemenu_pi1', 'tx_srlanguagemenu', $row['constants']);
-                               $update['config'] = str_replace('$plugin.tx_srlanguagemenu_pi1', '$plugin.tx_srlanguagemenu', $row['config']);
-                               $update['config'] = str_replace('plugin.tx_srlanguagemenu_pi1', 'plugin.tx_srlanguagemenu.settings', $update['config']);
-                               if (class_exists(\TYPO3\CMS\Core\Database\ConnectionPool::class)) {
-                                       $queryBuilder
-                                          ->update('sys_template')
-                                          ->where(
-                                                 $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter((int)$row['uid'], \PDO::PARAM_INT))
-                                          )
-                                          ->set('constants', $update['constants'])
-                                          ->set('config', $update['config'])
-                                          ->execute();
-                               } else {
-                                       $this->getDatabaseConnection()->exec_UPDATEquery('sys_template', 'uid=' . (int)$row['uid'], $update);
-                               }
-                               $count++;
-                       }
-               }
-               $message = LocalizationUtility::translate('update.templatesUpdated', 'SrLanguageMenu', array($count));
-               return '<p>' . $message . '</p>';
-       }
-
-       public function access()
-       {
-               return true;
-       }
-
-       /**
-        * Returns an instance of the Database Connection object
-        *
-        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-        */
-       protected function getDatabaseConnection()
-       {
-               return $GLOBALS['TYPO3_DB'];
-       }
-}
\ No newline at end of file
index 6758870..dab2e0e 100644 (file)
@@ -1,12 +1,14 @@
 {
   "name": "sjbr/sr-language-menu",
   "description": "A plugin to display a list of languages to select from. Clicking on a language links to the corresponding version of the page.",
-  "version": "6.4.3",
+  "version": "6.5.0",
   "type": "typo3-cms-extension",
   "license": "GPL-2.0+",
+  "keywords": "language,menu",
   "authors": [
     {
       "name": "Stanislas Rolland",
+      "homepage": "http://www.sjbr.ca",
       "role": "Developer"
     }
   ],
@@ -19,8 +21,8 @@
        "typo3-ter/sr-language-menu": "self.version"
   },
   "require": {
-       "typo3/cms-core": ">=7.6,<9.0",
-       "sjbr/static-info-tables": ">=6.4.2,<6.6"
+       "typo3/cms-core": ">=9.5,<10.0",
+       "sjbr/static-info-tables": ">=6.7.0,<6.8"
   },
   "autoload": {
     "psr-4": {
index 2bd00a1..d9ef36a 100644 (file)
Binary files a/doc/manual.sxw and b/doc/manual.sxw differ
index ba794ec..5631009 100644 (file)
@@ -7,7 +7,7 @@ $EM_CONF[$_EXTKEY] = array(
        'title' => 'Language Selection',
        'description' => 'A plugin to display a list of languages to select from. Clicking on a language links to the corresponding version of the page.',
        'category' => 'plugin',
-       'version' => '6.4.3',
+       'version' => '6.5.0',
        'state' => 'stable',
        'uploadfolder' => 0,
        'createDirs' => '',
@@ -17,8 +17,8 @@ $EM_CONF[$_EXTKEY] = array(
        'author_company' => 'SJBR',
        'constraints' => array(
                'depends' => array(
-                       'typo3' => '7.6.0-8.7.99',
-                       'static_info_tables' => '6.4.2-6.5.99'
+                       'typo3' => '9.5.0-9.5.99',
+                       'static_info_tables' => '6.7.0-6.7.99'
                ),
                'conflicts' => array(),
                'suggests' => array()
diff --git a/ext_typoscript_setup.typoscript b/ext_typoscript_setup.typoscript
new file mode 100644 (file)
index 0000000..2f28b55
--- /dev/null
@@ -0,0 +1,25 @@
+config.tx_extbase {
+       persistence {
+               classes {
+                       SJBR\SrLanguageMenu\Domain\Model\Page {
+                               mapping {
+                                       tableName = pages
+                                       columns {
+                                               l18n_cfg.mapOnProperty = l18nCfg
+                                               l10n_parent.mapOnProperty = parent
+                                               sys_language_uid.mapOnProperty = language
+                                       }
+                               }
+                       }
+                       SJBR\SrLanguageMenu\Domain\Model\SystemLanguage {
+                               mapping {
+                                       tableName = sys_language
+                                       columns {
+                                               title.mapOnProperty = title
+                                               static_lang_isocode.mapOnProperty = isoLanguage
+                                       }
+                               }
+                       }
+               }
+       }
+}
\ No newline at end of file