[BUGFIX] class.tx_staticinfotables_encoding.php, failed to open stream 73/51373/2
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 20 Jan 2017 16:03:39 +0000 (11:03 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 23 Jan 2017 05:45:18 +0000 (06:45 +0100)
Change-Id: I603171680c98ed0778293782c3cb25c8ca18c741
Resolves: #79396
Reviewed-on: https://review.typo3.org/51373
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
class.tx_staticinfotables_encoding.php [new file with mode: 0644]

index 76065c5..b2fbc4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-20  Stanislas Rolland  <typo3(arobas)sjbr.ca>
+
+       * Resolves #79396: class.tx_staticinfotables_encoding.php, failed to open stream: No such file or directory
+
 2017-01-18  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
        * Resolves #79384: Issues in TYPO3 CMS 7 after migration to Doctrine
diff --git a/class.tx_staticinfotables_encoding.php b/class.tx_staticinfotables_encoding.php
new file mode 100644 (file)
index 0000000..2230d0e
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2004-2007 RenĂ© Fritz (r.fritz@colorcube.de)
+ *  (c) 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 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\Utility\GeneralUtility;
+
+/**
+ * Functions to convert the character encoding of the static info tables
+ * * DEPRECATED * Used by language packs prior to Static Info Tables version 6
+ *
+ */
+class tx_staticinfotables_encoding
+{
+       /**
+        * Returns a selector box with charset encodings
+        *
+        * @deprecated since 6.0, will be removed two versions later - Language pack should be re-created
+        *
+        * @param string $elementName it the form elements name, probably something like "SET[...]"
+        * @param string $currentKey is the key to be selected currently.
+        * @param string $firstEntry is the key to be placed on top as first (default) entry.
+        * @param string $unsetEntries List of keys that should be removed (comma list).
+        * @return string HTML code for selector box
+        */
+       public function getEncodingSelect($elementName, $currentKey, $firstEntry='', $unsetEntries='')
+       {
+               GeneralUtility::logDeprecatedFunction();
+               $menuItems = array(
+                       'utf-8' => 'UTF-8',
+               );
+
+               if ($firstEntry && $menuItems[$firstEntry]) {
+                       $entry = array($firstEntry => $menuItems[$firstEntry]);
+                       unset($menuItems[$firstEntry]);
+                       $menuItems = array_merge($entry, $menuItems);
+               }
+
+               $unsetEntries = explode(',', $unsetEntries);
+               foreach($unsetEntries as $entry) {
+                       unset($menuItems[$entry]);
+               }
+
+               $options = array();
+               foreach ($menuItems as $value => $label)        {
+                       $options[] = '<option value="' . htmlspecialchars($value) . '"' . (!strcmp($currentKey,$value) ? ' selected="selected"' : '') . '>'
+                                                       . htmlspecialchars($label, ENT_COMPAT, 'UTF-8', false)
+                                                       . '</option>';
+               }
+               if (count($options)) {
+                       return '
+                                       <strong>This language pack is obsolete. It should be uninstalled and re-created using the Static Info Tables Manager.</strong><br />
+                                       <!-- charset encoding menu -->
+                                       <select name="'.$elementName.'">
+                                               '.implode('
+                                               ',$options).'
+                                       </select>
+                                               ';
+               } else {
+                       return '
+                                       <strong>This language pack is obsolete. It should be uninstalled and re-created using the Static Info Tables Manager.</strong><br />';
+               }
+       }
+}
\ No newline at end of file