From 5f14e4e9fcae3ea6fe4c69f9e2e977cbc4c27eff Mon Sep 17 00:00:00 2001 From: sfsmfc <9bpJ8hzTa8dkb3nmfn> Date: Sat, 3 Sep 2016 00:17:12 +0200 Subject: [PATCH] update for TYPO3 7.6 --- .travis.yml | 50 +++++ Classes/Domain/Model/Country.php | 201 +++++++++--------- Classes/Domain/Model/CountryTest.php | 18 ++ Classes/Domain/Model/CountryZone.php | 109 +++++----- Classes/Domain/Model/Currency.php | 151 ++++++------- Classes/Domain/Model/Language.php | 103 ++++----- Classes/Domain/Model/Territory.php | 103 ++++----- .../TCA/Overrides/static_countries.php | 27 +++ .../TCA/Overrides/static_country_zones.php | 25 +++ .../TCA/Overrides/static_currencies.php | 26 +++ .../TCA/Overrides/static_languages.php | 25 +++ .../TCA/Overrides/static_territories.php | 25 +++ Configuration/TypoScript/Extbase/setup.txt | 90 ++++---- Configuration/TypoScript/Static/setup.txt | 8 +- README.md | 12 ++ README.txt | 8 - Resources/Private/Language/locallang_db.xlf | 3 + class.ext_update.php | 193 ++++++----------- composer.json | 20 ++ ext_conf_template.txt | 3 - ext_emconf.php | 51 +++-- ext_localconf.php | 10 +- ext_tables.php | 42 ---- ...ic_update.sql => ext_tables_static+adt.sql | 0 24 files changed, 721 insertions(+), 582 deletions(-) create mode 100644 .travis.yml create mode 100644 Classes/Domain/Model/CountryTest.php create mode 100644 Configuration/TCA/Overrides/static_countries.php create mode 100644 Configuration/TCA/Overrides/static_country_zones.php create mode 100644 Configuration/TCA/Overrides/static_currencies.php create mode 100644 Configuration/TCA/Overrides/static_languages.php create mode 100644 Configuration/TCA/Overrides/static_territories.php create mode 100644 README.md delete mode 100644 README.txt create mode 100644 composer.json delete mode 100644 ext_conf_template.txt delete mode 100644 ext_tables.php rename ext_tables_static_update.sql => ext_tables_static+adt.sql (100%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bcea583 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,50 @@ + +language: php + +matrix: + include: + - php: 5.5 + env: TYPO3_VERSION=^7.6 + - php: 5.6 + env: TYPO3_VERSION=^7.6 + - php: 7 + env: TYPO3_VERSION=^7.6 + - php: 7 + env: TYPO3_VERSION=dev-master + allow_failures: + - env: TYPO3_VERSION=dev-master + +cache: + directories: + - $HOME/.composer/cache + +before_install: + - phpenv config-rm xdebug.ini + - composer self-update + - composer --version + +before_script: + - > + if [ -n "$TRAVIS_TAG" ]; then + composer set-version $TRAVIS_TAG + # If this fails, we forgot to update version numbers before tagging the release + test -z "$(git diff --shortstat 2> /dev/null | tail -n1)"; + fi + - composer require typo3/cms=$TYPO3_VERSION + - export TYPO3_PATH_WEB="$PWD/.Build/Web" + +script: + - > + echo; + echo "Running unit tests"; + .Build/bin/phpunit -c .Build/vendor/typo3/cms/typo3/sysext/core/Build/UnitTests.xml Tests/Unit/ + - > + echo; + echo "Executing PHP code sniffer"; + .Build/bin/phpcs --runtime-set ignore_warnings_on_exit true --standard=PSR2 Classes/ + +after_script: + - > + echo; + echo "Everything done"; + diff --git a/Classes/Domain/Model/Country.php b/Classes/Domain/Model/Country.php index 5acedfe..257d748 100644 --- a/Classes/Domain/Model/Country.php +++ b/Classes/Domain/Model/Country.php @@ -1,113 +1,120 @@ -* (c) 2013 Stanislas Rolland -* (c) 2015 Tomasz Krawczyk -* -* 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! -***************************************************************/ + + /*************************************************************** + * Copyright notice + * + * (c) 2011-2012 Armin Rüdiger Vieweg + * (c) 2013 Stanislas Rolland + * (c) 2015 Tomasz Krawczyk + * + * 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! + ***************************************************************/ /** * The Country model * * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ -class Country extends AbstractEntity { - /** - * The Polish short name - * @var string - */ - protected $shortNamePl = ''; +class Country extends AbstractEntity +{ + /** + * The Polish short name + * @var string + */ + protected $shortNamePl = ''; + + /** + * The Polish official name + * @var string + */ + protected $officialNamePl = ''; - /** - * The Polish official name - * @var string - */ - protected $officialNamePl = ''; + /** + * The Polish capital name + * @var string + */ + protected $capitalPl = ''; - /** - * The Polish capital name - * @var string - */ - protected $capitalPl = ''; - - /** - * Sets the Polish short name. - * - * @param string $shortNamePl - * - * @return void - */ - public function setShortNamePl($shortNamePl) { - $this->shortNamePl = $shortNamePl; - } + /** + * Sets the Polish short name. + * + * @param string $shortNamePl + * + * @return void + */ + public function setShortNamePl($shortNamePl) + { + $this->shortNamePl = $shortNamePl; + } - /** - * Gets the Polish short name. - * - * @return string - */ - public function getShortNamePl() { - return $this->shortNamePl; - } + /** + * Gets the Polish short name. + * + * @return string + */ + public function getShortNamePl() + { + return $this->shortNamePl; + } - /** - * Sets the Polish short name. - * - * @param string $officialNamePl - * - * @return void - */ - public function setOfficialtNamePl($officialNamePl) { - $this->officialNamePl = $officialNamePl; - } + /** + * Sets the Polish short name. + * + * @param string $officialNamePl + * + * @return void + */ + public function setOfficialtNamePl($officialNamePl) + { + $this->officialNamePl = $officialNamePl; + } - /** - * Gets the Polish short name. - * - * @return string - */ - public function getOfficialNamePl() { - return $this->officialNamePl; - } + /** + * Gets the Polish short name. + * + * @return string + */ + public function getOfficialNamePl() + { + return $this->officialNamePl; + } - /** - * Sets the Polish short name. - * - * @param string $capitalPl - * - * @return void - */ - public function setCapitalPl($capitalPl) { - $this->capitalPl = $capitalPl; - } + /** + * Sets the Polish short name. + * + * @param string $capitalPl + * + * @return void + */ + public function setCapitalPl($capitalPl) + { + $this->capitalPl = $capitalPl; + } - /** - * Gets the Polish short name. - * - * @return string - */ - public function getCapitalPl() { - return $this->capitalPl; - } - + /** + * Gets the Polish short name. + * + * @return string + */ + public function getCapitalPl() + { + return $this->capitalPl; + } } diff --git a/Classes/Domain/Model/CountryTest.php b/Classes/Domain/Model/CountryTest.php new file mode 100644 index 0000000..58d66e2 --- /dev/null +++ b/Classes/Domain/Model/CountryTest.php @@ -0,0 +1,18 @@ + -* (c) 2013 Stanislas Rolland -* -* 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! -***************************************************************/ + + /*************************************************************** + * Copyright notice + * + * (c) 2011-2012 Armin Rüdiger Vieweg + * (c) 2013 Stanislas Rolland + * + * 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! + ***************************************************************/ /** * The Country Zone model * * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ -class CountryZone extends AbstractEntity { - /** - * Polish name of the country zone - * @var string - */ - protected $namePl = ''; +class CountryZone extends AbstractEntity +{ + /** + * Polish name of the country zone + * @var string + */ + protected $namePl = ''; - /** - * Sets the Polish name. - * - * @param string $namePl - * - * @return void - */ - public function setNamePl($namePl) { - $this->namePl = $namePl; - } + /** + * Sets the Polish name. + * + * @param string $namePl + * + * @return void + */ + public function setNamePl($namePl) + { + $this->namePl = $namePl; + } - /** - * Returns Polish name. If empty returns the localName. - * - * @return string - */ - public function getNamePl() { - if ($this->namePl === '') { - return $this->getLocalName(); - } - return $this->namePl; - } -} -?> \ No newline at end of file + /** + * Returns Polish name. If empty returns the localName. + * + * @return string + */ + public function getNamePl() + { + if ($this->namePl === '') { + return $this->getLocalName(); + } + return $this->namePl; + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Currency.php b/Classes/Domain/Model/Currency.php index d8eb8e8..11555b0 100644 --- a/Classes/Domain/Model/Currency.php +++ b/Classes/Domain/Model/Currency.php @@ -1,86 +1,91 @@ -* (c) 2013 Stanislas Rolland -* -* 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! -***************************************************************/ + + /*************************************************************** + * Copyright notice + * + * (c) 2011-2012 Armin Rüdiger Vieweg + * (c) 2013 Stanislas Rolland + * + * 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! + ***************************************************************/ /** * The Currency model * * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ -class Currency extends AbstractEntity { - /** - * Polish name of the currency - * @var string - */ - protected $namePl = ''; +class Currency extends AbstractEntity +{ + /** + * Polish name of the currency + * @var string + */ + protected $namePl = ''; - /** - * Polish name of the currency subdivision unit - * @var string - */ - protected $subdivisionNamePl = ''; + /** + * Polish name of the currency subdivision unit + * @var string + */ + protected $subdivisionNamePl = ''; - /** - * Sets the Polish name of the currency - * - * @param string $namePl - * - * @return void - */ - public function setNamePl($namePl) { - $this->namePl = $namePl; - } + /** + * Sets the Polish name of the currency + * + * @param string $namePl + * + * @return void + */ + public function setNamePl($namePl) + { + $this->namePl = $namePl; + } - /** - * Gets the Polish name of the currency - * - * @return string - */ - public function getNamePl() { - return $this->namePl; - } + /** + * Gets the Polish name of the currency + * + * @return string + */ + public function getNamePl() + { + return $this->namePl; + } - /** - * Sets the Polish name of the currency subdivision - * - * @param string $subdivisionNamePl - * - * @return void - */ - public function setSubdivisionNamePl($subdivisionNamePl) { - $this->subdivisionNamePl = $subdivisionNamePl; - } + /** + * Sets the Polish name of the currency subdivision + * + * @param string $subdivisionNamePl + * + * @return void + */ + public function setSubdivisionNamePl($subdivisionNamePl) + { + $this->subdivisionNamePl = $subdivisionNamePl; + } - /** - * Gets the Polish name of the currency subdivision - * - * @return string - */ - public function getSubdivisionNamePl() { - return $this->subdivisionNamePl; - } -} -?> \ No newline at end of file + /** + * Gets the Polish name of the currency subdivision + * + * @return string + */ + public function getSubdivisionNamePl() + { + return $this->subdivisionNamePl; + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Language.php b/Classes/Domain/Model/Language.php index 9a0ca40..a3a00df 100644 --- a/Classes/Domain/Model/Language.php +++ b/Classes/Domain/Model/Language.php @@ -1,29 +1,30 @@ -* (c) 2013 Stanislas Rolland -* -* 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! -***************************************************************/ + + /*************************************************************** + * Copyright notice + * + * (c) 2011-2012 Armin Rüdiger Vieweg + * (c) 2013 Stanislas Rolland + * + * 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! + ***************************************************************/ /** * The Language model @@ -31,31 +32,33 @@ * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ -class Language extends AbstractEntity { - /** - * Polish name of the language - * @var string - */ - protected $namePl = ''; +class Language extends AbstractEntity +{ + /** + * Polish name of the language + * @var string + */ + protected $namePl = ''; - /** - * Sets the Polish name of the language - * - * @param string $namePolish - * - * @return void - */ - public function setNamePl($namePl) { - $this->namePl = $namePl; - } + /** + * Sets the Polish name of the language + * + * @param string $namePl + * + * @return void + */ + public function setNamePl($namePl) + { + $this->namePl = $namePl; + } - /** - * Gets the Polish name of the language - * - * @return string - */ - public function getNamePl() { - return $this->namePl; - } -} -?> \ No newline at end of file + /** + * Gets the Polish name of the language + * + * @return string + */ + public function getNamePl() + { + return $this->namePl; + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Territory.php b/Classes/Domain/Model/Territory.php index 5f737c0..8bc12a9 100644 --- a/Classes/Domain/Model/Territory.php +++ b/Classes/Domain/Model/Territory.php @@ -1,60 +1,63 @@ -* (c) 2013 Stanislas Rolland -* -* 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! -***************************************************************/ + + /*************************************************************** + * Copyright notice + * + * (c) 2011-2012 Armin Rüdiger Vieweg + * (c) 2013 Stanislas Rolland + * + * 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! + ***************************************************************/ /** * The Territory model * * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ -class Territory extends AbstractEntity { - /** - * Polish name of the territory - * @var string - */ - protected $namePl = ''; +class Territory extends AbstractEntity +{ + /** + * Polish name of the territory + * @var string + */ + protected $namePl = ''; - /** - * Sets the Polish name of the territory - * - * @param string $namePl - * - * @return void - */ - public function setNamePl($namePl) { - $this->namePl = $namePl; - } + /** + * Sets the Polish name of the territory + * + * @param string $namePl + * + * @return void + */ + public function setNamePl($namePl) + { + $this->namePl = $namePl; + } - /** - * Returns the Polish name of the territory - * - * @return string - */ - public function getNamePl() { - return $this->namePl; - } -} -?> \ No newline at end of file + /** + * Returns the Polish name of the territory + * + * @return string + */ + public function getNamePl() + { + return $this->namePl; + } +} \ No newline at end of file diff --git a/Configuration/TCA/Overrides/static_countries.php b/Configuration/TCA/Overrides/static_countries.php new file mode 100644 index 0000000..8380f8f --- /dev/null +++ b/Configuration/TCA/Overrides/static_countries.php @@ -0,0 +1,27 @@ + 'cn_short_pl', + 'cn_official_name_en' => 'cn_official_name_pl', + 'cn_capital' => 'cn_capital_pl', +]; + +$LL = 'LLL:EXT:static_info_tables_pl/Resources/Private/Language/locallang_db.xlf:static_countries_item.'; + +foreach ($additionalFields as $sourceField => $destField) { + $additionalColumns = []; + $additionalColumns[$destField] = $GLOBALS['TCA']['static_countries']['columns'][$sourceField]; + $additionalColumns[$destField]['label'] = $LL . $destField; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('static_countries', $additionalColumns); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'static_countries', + $destField, + '', + 'after:' . $sourceField + ); + // Add as search field + $GLOBALS['TCA']['static_countries']['ctrl']['searchFields'] .= ',' . $destField; +} +unset($additionalColumns); +unset($additionalFields); diff --git a/Configuration/TCA/Overrides/static_country_zones.php b/Configuration/TCA/Overrides/static_country_zones.php new file mode 100644 index 0000000..08b5edb --- /dev/null +++ b/Configuration/TCA/Overrides/static_country_zones.php @@ -0,0 +1,25 @@ + 'zn_name_pl' +]; + +$LL = 'LLL:EXT:static_info_tables_pl/Resources/Private/Language/locallang_db.xlf:static_country_zones_item.'; + +foreach ($additionalFields as $sourceField => $destField) { + $additionalColumns = []; + $additionalColumns[$destField] = $GLOBALS['TCA']['static_country_zones']['columns'][$sourceField]; + $additionalColumns[$destField]['label'] = $LL . $destField; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('static_country_zones', $additionalColumns); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'static_country_zones', + $destField, + '', + 'after:' . $sourceField + ); + // Add as search field + $GLOBALS['TCA']['static_country_zones']['ctrl']['searchFields'] .= ',' . $destField; +} +unset($additionalColumns); +unset($additionalFields); diff --git a/Configuration/TCA/Overrides/static_currencies.php b/Configuration/TCA/Overrides/static_currencies.php new file mode 100644 index 0000000..35240fa --- /dev/null +++ b/Configuration/TCA/Overrides/static_currencies.php @@ -0,0 +1,26 @@ + 'cu_name_pl', + 'cu_sub_name_en' => 'cu_sub_name_pl' +]; + +$LL = 'LLL:EXT:static_info_tables_pl/Resources/Private/Language/locallang_db.xlf:static_currencies_item.'; + +foreach ($additionalFields as $sourceField => $destField) { + $additionalColumns = []; + $additionalColumns[$destField] = $GLOBALS['TCA']['static_currencies']['columns'][$sourceField]; + $additionalColumns[$destField]['label'] = $LL . $destField; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('static_currencies', $additionalColumns); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'static_currencies', + $destField, + '', + 'after:' . $sourceField + ); + // Add as search field + $GLOBALS['TCA']['static_currencies']['ctrl']['searchFields'] .= ',' . $destField; +} +unset($additionalColumns); +unset($additionalFields); diff --git a/Configuration/TCA/Overrides/static_languages.php b/Configuration/TCA/Overrides/static_languages.php new file mode 100644 index 0000000..d5ab217 --- /dev/null +++ b/Configuration/TCA/Overrides/static_languages.php @@ -0,0 +1,25 @@ + 'lg_name_pl' +]; + +$LL = 'LLL:EXT:static_info_tables_pl/Resources/Private/Language/locallang_db.xlf:static_languages_item.'; + +foreach ($additionalFields as $sourceField => $destField) { + $additionalColumns = []; + $additionalColumns[$destField] = $GLOBALS['TCA']['static_languages']['columns'][$sourceField]; + $additionalColumns[$destField]['label'] = $LL . $destField; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('static_languages', $additionalColumns); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'static_languages', + $destField, + '', + 'after:' . $sourceField + ); + // Add as search field + $GLOBALS['TCA']['static_languages']['ctrl']['searchFields'] .= ',' . $destField; +} +unset($additionalColumns); +unset($additionalFields); diff --git a/Configuration/TCA/Overrides/static_territories.php b/Configuration/TCA/Overrides/static_territories.php new file mode 100644 index 0000000..f9170bf --- /dev/null +++ b/Configuration/TCA/Overrides/static_territories.php @@ -0,0 +1,25 @@ + 'tr_name_pl' +]; + +$LL = 'LLL:EXT:static_info_tables_pl/Resources/Private/Language/locallang_db.xlf:static_territories_item.'; + +foreach ($additionalFields as $sourceField => $destField) { + $additionalColumns = []; + $additionalColumns[$destField] = $GLOBALS['TCA']['static_territories']['columns'][$sourceField]; + $additionalColumns[$destField]['label'] = $LL . $destField; + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('static_territories', $additionalColumns); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'static_territories', + $destField, + '', + 'after:' . $sourceField + ); + // Add as search field + $GLOBALS['TCA']['static_territories']['ctrl']['searchFields'] .= ',' . $destField; +} +unset($additionalColumns); +unset($additionalFields); diff --git a/Configuration/TypoScript/Extbase/setup.txt b/Configuration/TypoScript/Extbase/setup.txt index f06f057..bc02d99 100644 --- a/Configuration/TypoScript/Extbase/setup.txt +++ b/Configuration/TypoScript/Extbase/setup.txt @@ -1,44 +1,48 @@ config.tx_extbase { - persistence { - classes { - SJBR\StaticInfoTables\Domain\Model\Country { - mapping { - columns { - cn_short_pl.mapOnProperty = shortNamePl - cn_official_name_pl.mapOnProperty = officialNamePl - cn_capital_pl.mapOnProperty = capitalPl - } - } - } - SJBR\StaticInfoTables\Domain\Model\CountryZone { - mapping { - columns { - zn_name_pl.mapOnProperty = namePl - } - } - } - SJBR\StaticInfoTables\Domain\Model\Currency { - mapping { - columns { - cu_name_pl.mapOnProperty = namePl - cu_sub_name_pl.mapOnProperty = subdivisionNamePl - } - } - } - SJBR\StaticInfoTables\Domain\Model\Language { - mapping { - columns { - lg_name_pl.mapOnProperty = namePl - } - } - } - SJBR\StaticInfoTables\Domain\Model\Territory { - mapping { - columns { - tr_name_pl.mapOnProperty = namePl - } - } - } - } - } -} \ No newline at end of file + persistence { + classes { + SJBR\StaticInfoTables\Domain\Model\Country { + mapping { + columns { + cn_short_pl.mapOnProperty = shortNamePl + cn_official_name_pl.mapOnProperty = officialNamePl + cn_capital_pl.mapOnProperty = capitalPl + } + } + } + + SJBR\StaticInfoTables\Domain\Model\CountryZone { + mapping { + columns { + zn_name_pl.mapOnProperty = namePl + } + } + } + + SJBR\StaticInfoTables\Domain\Model\Currency { + mapping { + columns { + cu_name_pl.mapOnProperty = namePl + cu_sub_name_pl.mapOnProperty = subdivisionNamePl + } + } + } + + SJBR\StaticInfoTables\Domain\Model\Language { + mapping { + columns { + lg_name_pl.mapOnProperty = namePl + } + } + } + + SJBR\StaticInfoTables\Domain\Model\Territory { + mapping { + columns { + tr_name_pl.mapOnProperty = namePl + } + } + } + } + } +} diff --git a/Configuration/TypoScript/Static/setup.txt b/Configuration/TypoScript/Static/setup.txt index b6aa09e..4fb7eb8 100644 --- a/Configuration/TypoScript/Static/setup.txt +++ b/Configuration/TypoScript/Static/setup.txt @@ -1,6 +1,6 @@ plugin.tx_staticinfotables_pi1 { - currencyCode = PLN - countryCode = POL - countryZoneCode = WP - languageCode = PL + currencyCode = PLN + countryCode = POL + countryZoneCode = WP + languageCode = PL } diff --git a/README.md b/README.md new file mode 100644 index 0000000..c893512 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Static Info Tables (pl) + +**master** [![Build Status](https://travis-ci.org/manuelselbach/static_info_tables_pl.svg?branch=master)](https://travis-ci.org/manuelselbach/static_info_tables_pl) + +**develop** [![Build Status](https://travis-ci.org/manuelselbach/static_info_tables_pl.svg?branch=develop)](https://travis-ci.org/manuelselbach/static_info_tables_pl) + +This extension provides Polish language pack for the Static Info Tables +providing localized names for countries, zones, currencies and so on. + +Homepage: [https://github.com/manuelselbach/static_info_tables_pl](https://github.com/manuelselbach/static_info_tables_pl) + +Bugtracker: [https://github.com/manuelselbach/static_info_tables_pl/issues](https://github.com/manuelselbach/static_info_tables_pl/issues) diff --git a/README.txt b/README.txt deleted file mode 100644 index 2594b05..0000000 --- a/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -Static Info Tables (pl) - -This extension provides Polish language pack for the Static Info Tables -providing localized names for countries, zones, currencies and so on. - -Homepage: http://forge.typo3.org/projects/extension-static_info_tables_pl -Support: http://forge.typo3.org/projects/extension-static_info_tables_pl/wiki -Bugtracker: http://forge.typo3.org/projects/extension-static_info_tables_pl/issues diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 6e3c9a9..b911647 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -24,6 +24,9 @@ Sub name (PL): + + Capital (PL): + diff --git a/class.ext_update.php b/class.ext_update.php index b86c67d..fb3a23b 100644 --- a/class.ext_update.php +++ b/class.ext_update.php @@ -1,133 +1,72 @@ + * 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. * - * @author René Fritz - * @co-author Simon Schmidt - * @co-author Tomasz Krawczyk + * This copyright notice MUST APPEAR in all copies of the script! */ -class ext_update { - - /** - * Main function, returning the HTML content of the module - * - * @return string HTML - */ - function main() { - - $content = ''; - - $content.= '
Update the Static Info Tables with new language labels.'; - $content .= '
'; - $import = GeneralUtility::_GP('import'); - - if ($import == 'Import') { - - $destEncoding = GeneralUtility::_GP('dest_encoding'); - $extPath = ExtensionManagementUtility::extPath('static_info_tables_pl'); - - // Update polish labels - $fileContent = explode("\n", GeneralUtility::getURL($extPath . 'ext_tables_static_update.sql')); - - foreach($fileContent as $line) { - $line = trim($line); - if ($line && preg_match('#^UPDATE#i', $line) ) { - $query = $this->getUpdateEncoded($line, $destEncoding); - if (TYPO3_DLOG) - GeneralUtility::devLog('SQL Query', 'static_info_tables_pl', 0, array('query:' => $query)); - $res = $GLOBALS['TYPO3_DB']->admin_query($query); - } - } - $content .= '
'; - $content .= '

Encoding: ' . htmlspecialchars($destEncoding) . '

'; - $content .= '

Done.

'; - } elseif (ExtensionManagementUtility::isLoaded('static_info_tables')) { - $content .= ''; - $content .= '
'; - $content .= '
Destination character encoding:'; - $content .= '
' . tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', 'utf-8'); - $content .= '
(The character encoding must match the encoding of the existing tables data. By default this is UTF-8.)'; - $content .= '

'; - $content .= ''; - $content .= '
'; - } else { - $content .= '
The extension static_info_tables needs to be installed first!'; - } +use SJBR\StaticInfoTables\Cache\ClassCacheManager; +use SJBR\StaticInfoTables\Utility\DatabaseUpdateUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; - return $content; - } - - - - /** - * Convert the values of a SQL update statement to a different encoding than UTF-8. - * - * @param string $query Update statement like: UPDATE static_countries SET cn_short_pl='XXX' WHERE cn_iso_2='PL'; - * @param string $destEncoding Destination encoding - * @return string Converted update statement - */ - function getUpdateEncoded($query, $destEncoding) { - static $csconv; - - if (!($destEncoding==='utf-8')) { - if(!is_object($csconv)) { - $csconv = GeneralUtility::makeInstance('t3lib_cs'); - } - - $queryElements = explode('WHERE', $query); - $where = preg_replace('#;$#', '', trim($queryElements[1])); - - $queryElements = explode('SET', $queryElements[0]); - $queryFields = $queryElements[1]; - - $queryElements = GeneralUtility::trimExplode('UPDATE', $queryElements[0], 1); - $table = $queryElements[0]; - - $fields_values = array(); - $queryFieldsArray = preg_split('/[,]/', $queryFields, 1); - foreach ($queryFieldsArray as $fieldsSet) { - $col = GeneralUtility::trimExplode('=', $fieldsSet, 1); - $value = stripslashes(substr($col[1], 1, strlen($col[1])-2)); - $value = $csconv->conv($value, 'utf-8', $destEncoding); - $fields_values[$col[0]] = $value; - } - - $query = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,$where,$fields_values); - } - return $query; - } - - - function access() { - return TRUE; - } - -} +/** + * Class for updating the db + */ +class ext_update +{ + const EXTENSION_KEY = 'static_info_tables_pl'; + + /** + * Main function, returning the HTML content + * + * @return string HTML + */ + public function main() + { + $content = ''; + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); + + // Clear the class cache + /** @var ClassCacheManager $classCacheManager */ + $classCacheManager = $objectManager->get(ClassCacheManager::class); + $classCacheManager->reBuild(); + + // Update the database + /** @var DatabaseUpdateUtility $databaseUpdateUtility */ + $databaseUpdateUtility = $objectManager->get(DatabaseUpdateUtility::class); + $databaseUpdateUtility->doUpdate(self::EXTENSION_KEY); + + $updateLanguageLabels = LocalizationUtility::translate('updateLanguageLabels', 'StaticInfoTables'); + $content.= '

' . $updateLanguageLabels . ' '. self::EXTENSION_KEY . '

'; + return $content; + } + + /** + * @return bool + */ + public function access() + { + return true; + } +} \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b65930e --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "sjbr/static_info_tables_pl", + "description": "Polish (PL) language pack for the Static Info Tables providing localized names for countries, currencies and so on.", + "version": "6.3.0", + "type": "typo3-cms-extension", + "license": "GPL-2.0+", + "authors": [ + { + "name": "Simon Schmidt", + "role": "Developer" + } + ], + "replace": { + "sjbr/static_info_tables_pl": "*" + }, + "require": { + "typo3/cms-core": "6.2.0-7.6.99", + "sjbr/static_info_tables": "^6.3.1" + } +} diff --git a/ext_conf_template.txt b/ext_conf_template.txt deleted file mode 100644 index a6e41f7..0000000 --- a/ext_conf_template.txt +++ /dev/null @@ -1,3 +0,0 @@ - - # cat=basic; type=string; label=charset: Specify the charset of the tables in the database. Enter here the same charset you have used with the UPDATE! import function. -charset = utf-8 diff --git a/ext_emconf.php b/ext_emconf.php index 970272c..c9ef55a 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,4 @@ 'Static Info Tables (pl)', - 'description' => '(pl) language pack for the Static Info Tables providing localized names for countries.', - 'category' => 'misc', - 'version' => '1.2.1', - 'state' => 'stable', - 'uploadfolder' => 0, - 'createDirs' => '', - 'clearcacheonload' => 0, - 'author' => 'Simon Schmidt', - 'author_email' => 'sfs@marketing-factory.de', - 'author_company' => 'Marketing Factory Consulting GmbH', - 'constraints' => array( - 'depends' => array( - 'static_info_tables' => '6.0.0-6.2.99', - 'php' => '5.3.0-5.6.99', - 'typo3' => '6.2.0-6.2.99', - ), - 'conflicts' => array( - ), - 'suggests' => array( - ), - ), -); - +$EM_CONF[$_EXTKEY] = [ + 'title' => 'Static Info Tables (pl)', + 'description' => '(pl) language pack for the Static Info Tables providing localized names for countries.', + 'category' => 'misc', + 'version' => '6.3.1', + 'state' => 'stable', + 'uploadfolder' => 0, + 'createDirs' => '', + 'clearcacheonload' => 0, + 'author' => 'Simon Schmidt', + 'author_email' => 'sfs@marketing-factory.de', + 'author_company' => 'Marketing Factory Consulting GmbH', + 'constraints' => [ + 'depends' => [ + 'static_info_tables' => '6.3.0-6.3.99', + 'php' => '5.5.0-7.0.99', + 'typo3' => '7.6.0-7.6.99', + ], + 'conflicts' => [ + ], + 'suggests' => [ + ], + ], +]; diff --git a/ext_localconf.php b/ext_localconf.php index 0dcd4b5..769c1d2 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,10 +1,10 @@ '); - -?> \ No newline at end of file +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup( + '' +); diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100644 index 6542892..0000000 --- a/ext_tables.php +++ /dev/null @@ -1,42 +0,0 @@ - array ( - 'cn_short_en' => 'cn_short_pl', - 'cn_official_name_en' => 'cn_official_name_pl', - 'cn_capital' => 'cn_capital_pl', - ), - 'static_country_zones' => array ( - 'zn_name_en' => 'zn_name_pl', - ), - 'static_currencies' => array ( - 'cu_name_en' => 'cu_name_pl', - 'cu_sub_name_en' => 'cu_sub_name_pl', - ), - 'static_languages' => array ( - 'lg_name_en' => 'lg_name_pl', - ), - 'static_territories' => array ( - 'tr_name_en' => 'tr_name_pl', - ), -); - -$extensionResourcesLanguagePath = 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xlf:'; - -foreach ($tablesAdditionalFields as $table => $additionalFields) { - if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 6001000) { - \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table); - } - foreach ($additionalFields as $sourceField => $destField) { - $additionalColumns = array(); - $additionalColumns[$destField] = $GLOBALS['TCA'][$table]['columns'][$sourceField]; - $additionalColumns[$destField]['label'] = $extensionResourcesLanguagePath . ':' . $table . '_item.' . $destField; - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($table, $additionalColumns); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes($table, $destField, '', 'after:' . $sourceField); - } -} -unset($additionalColumns); -unset($tablesAdditionalFields); -?> \ No newline at end of file diff --git a/ext_tables_static_update.sql b/ext_tables_static+adt.sql similarity index 100% rename from ext_tables_static_update.sql rename to ext_tables_static+adt.sql