[BUGFIX] Deprecate t3lib_install
authorMarkus Klein <klein.t3@mfc-linz.at>
Sat, 22 Sep 2012 10:44:50 +0000 (12:44 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 22 Sep 2012 11:48:27 +0000 (13:48 +0200)
t3lib_install contained two logical parts in the past: A group of methods
to handle localconf.php and another group to parse ext_tables.sql files
and friends. The latter was already extracted to t3lib_install_sql in the
past. The localconf handling is obsolete with the new
LocalConfiguration.php and its new API method.

The patch handles:
 * Deprecate t3lib_install and change the code in a way that does not
   harm if still called.
 * Move some methods and properties to TYPO3\CMS\Install\Installer, make
   the class standalone and do not extend t3lib_install anymore.

Fixes: #41245
Releases: 6.0

Change-Id: Iafd856ecdc9e158fdc1b31d1f7be97064234ba6c
Reviewed-on: http://review.typo3.org/14908
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_install.php
typo3/install/index.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/install/Classes/Installer.php

index 67b3a66..75451ce 100644 (file)
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
+ * @deprecated since 6.0, will be removed by 7.0
  */
 class t3lib_install {
 
        // External, Static
        // Set to string which identifies the script using this class.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $updateIdentity = '';
 
        // Prefix for checkbox fields when updating database.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $dbUpdateCheckboxPrefix = 'TYPO3_INSTALL[database_update]';
 
        // If this is set, modifications to localconf.php is done by adding new lines to the array only. If unset, existing values are recognized and changed.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $localconf_addLinesOnly = 0;
 
@@ -64,32 +65,32 @@ class t3lib_install {
 
        // If TRUE, this class will allow the user to update the localconf.php file. Is set TRUE in the init.php file.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $allowUpdateLocalConf = 0;
 
        // Backpath (used for icons etc.)
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $backPath = '../';
 
        // Internal, dynamic:
        // Used to indicate that a value is change in the line-array of localconf and that it should be written.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $setLocalconf = 0;
 
        // Used to set (error)messages from the executing functions like mail-sending, writing Localconf and such
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $messages = array();
 
        // Updated with line in localconf.php file that was changed.
        /**
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public $touchedLine = 0;
 
@@ -100,8 +101,11 @@ class t3lib_install {
 
        /**
         * Constructor function
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function __construct() {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+
                $this->sqlHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Sql\\SchemaMigrator');
        }
 
@@ -118,96 +122,11 @@ class t3lib_install {
         * @param boolean $quoteValue Whether the given value should be quoted before being written
         * @return void
         * @see writeToLocalconf_control()
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function setValueInLocalconfFile(&$line_array, $variable, $value, $quoteValue = TRUE) {
-               if (!$this->checkForBadString($value)) {
-                       return 0;
-               }
-               // Initialize
-               $found = 0;
-               $this->touchedLine = '';
-               $inArray = in_array($this->localconf_startEditPointToken, $line_array);
-               // Flag is set if the token should be set but is not yet.
-               $tokenSet = $this->localconf_startEditPointToken && !$inArray;
-               $stopAtToken = $this->localconf_startEditPointToken && $inArray;
-               $hasEndToken = in_array($this->localconf_endEditPointToken, $line_array);
-               $respectEndToken = $hasEndToken;
-               $comment = ' Modified or inserted by ' . $this->updateIdentity . '.';
-               $replace = array('["', '"]');
-               $search = array('[\'', '\']');
-               $varDoubleQuotes = str_replace($search, $replace, $variable);
-               // Search for variable name
-               if (!$this->localconf_addLinesOnly && !$tokenSet) {
-                       $line_array = array_reverse($line_array);
-                       foreach ($line_array as $k => $v) {
-                               $v2 = trim($v);
-                               if ($respectEndToken) {
-                                       if (strcmp($v2, $this->localconf_endEditPointToken)) {
-                                               $respectEndToken = FALSE;
-                                       } else {
-                                               continue;
-                                       }
-                               }
-                               if ($stopAtToken && !strcmp($v2, $this->localconf_startEditPointToken)) {
-                                       break;
-                               }
-                               // If stopAtToken and token found, break out of the loop..
-                               if (!strcmp(substr($v2, 0, strlen(($variable . ' '))), ($variable . ' '))) {
-                                       $mainparts = explode($variable, $v, 2);
-                                       // Should ALWAYS be.
-                                       if (count($mainparts) == 2) {
-                                               $subparts = explode('//', $mainparts[1], 2);
-                                               if ($quoteValue) {
-                                                       $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
-                                               }
-                                               $line_array[$k] = $mainparts[0] . $variable . ' = ' . $value . ';       ' . ('//' . $comment . str_replace($comment, '', $subparts[1]));
-                                               $this->touchedLine = count($line_array) - $k - 1;
-                                               $found = 1;
-                                               break;
-                                       }
-                               } elseif (!strcmp(substr($v2, 0, strlen(($varDoubleQuotes . ' '))), ($varDoubleQuotes . ' '))) {
-                                       // Due to a bug in the update wizard (fixed in TYPO3 4.1.7) it is possible
-                                       // that $TYPO3_CONF_VARS['SYS']['compat_version'] was enclosed by "" (double
-                                       // quotes) instead of the expected '' (single quotes) when is was written to
-                                       // localconf.php. The following code was added to make sure that values with
-                                       // double quotes are updated, too.
-                                       $mainparts = explode($varDoubleQuotes, $v, 2);
-                                       // Should ALWAYS be.
-                                       if (count($mainparts) == 2) {
-                                               $subparts = explode('//', $mainparts[1], 2);
-                                               if ($quoteValue) {
-                                                       $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
-                                               }
-                                               $line_array[$k] = $mainparts[0] . $variable . ' = ' . $value . ';       ' . ('//' . $comment . str_replace($comment, '', $subparts[1]));
-                                               $this->touchedLine = count($line_array) - $k - 1;
-                                               $found = 1;
-                                               break;
-                                       }
-                               }
-                       }
-                       $line_array = array_reverse($line_array);
-               }
-               if (!$found) {
-                       if ($tokenSet) {
-                               $line_array[] = $this->localconf_startEditPointToken;
-                               $line_array[] = '';
-                       }
-                       if ($quoteValue) {
-                               $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
-                       }
-                       $line_array[] = $variable . ' = ' . $value . '; // ' . $comment;
-                       if (!$hasEndToken) {
-                               $line_array[] = '';
-                               $line_array[] = $this->localconf_endEditPointToken;
-                       }
-                       $this->touchedLine = -1;
-               }
-               if ($variable == '$typo_db_password') {
-                       $this->messages[] = 'Updated ' . $variable;
-               } else {
-                       $this->messages[] = $variable . ' = ' . htmlspecialchars($value);
-               }
-               $this->setLocalconf = 1;
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+               return;
        }
 
        /**
@@ -218,55 +137,11 @@ class t3lib_install {
         * @param array $value value to be assigned to the variable
         * @return void
         * @see writeToLocalconf_control()
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function setArrayValueInLocalconfFile(array &$lines, $variable, array $value) {
-               $commentKey = '## ';
-               $inArray = in_array($commentKey . $this->localconf_startEditPointToken, $lines);
-               $tokenSet = $this->localconf_startEditPointToken && !$inArray;
-               // Flag is set if the token should be set but is not yet
-               $stopAtToken = $this->localconf_startEditPointToken && $inArray;
-               $comment = 'Modified or inserted by ' . $this->updateIdentity . '.';
-               $format = '%s = %s;     // ' . $comment;
-               $insertPos = count($lines);
-               $startPos = 0;
-               if (!($this->localconf_addLinesOnly || $tokenSet)) {
-                       for ($i = count($lines) - 1; $i > 0; $i--) {
-                               $line = trim($lines[$i]);
-                               if ($stopAtToken && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($line, $this->localconf_startEditPointToken)) {
-                                       break;
-                               }
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($line, '?>')) {
-                                       $insertPos = $i;
-                               }
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($line, $variable)) {
-                                       $startPos = $i;
-                                       break;
-                               }
-                       }
-               }
-               if ($startPos) {
-                       $this->touchedLine = $startPos;
-                       $endPos = $startPos;
-                       for ($i = $startPos; $i < count($lines); $i++) {
-                               $line = trim($lines[$i]);
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($line, ');')) {
-                                       $endPos = $i;
-                                       break;
-                               }
-                       }
-                       $startLines = array_slice($lines, 0, $startPos);
-                       $endLines = array_slice($lines, $endPos + 1);
-                       $lines = $startLines;
-                       $definition = $this->array_export($value);
-                       $lines[] = sprintf($format, $variable, $definition);
-                       foreach ($endLines as $line) {
-                               $lines[] = $line;
-                       }
-               } else {
-                       $lines[$insertPos] = sprintf($format, $variable, $this->array_export($value));
-                       $lines[] = '?>';
-                       $this->touchedLine = -1;
-               }
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+               return;
        }
 
        /**
@@ -275,8 +150,11 @@ class t3lib_install {
         *
         * @param array $variable
         * @return string
+        * @deprecated since 6.0, will be removed by 7.0
         */
        protected function array_export(array $variable) {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+
                $lines = explode('
 ', var_export($variable, TRUE));
                $out = 'array(';
@@ -306,50 +184,11 @@ class t3lib_install {
         * @param string $absFullPath Absolute path of alternative file to use (Notice: this path is not validated in terms of being inside 'TYPO3 space')
         * @return mixed If $inlines is not an array it will return an array with the lines from localconf.php. Otherwise it will return a status string, either "continue" (updated) or "nochange" (not updated)
         * @see setValueInLocalconfFile()
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function writeToLocalconf_control($inlines = '', $absFullPath = '') {
-               $tmpExt = '.TMP.php';
-               $writeToLocalconf_dat = array();
-               $writeToLocalconf_dat['file'] = $absFullPath ? $absFullPath : PATH_typo3conf . 'localconf.php';
-               $writeToLocalconf_dat['tmpfile'] = $writeToLocalconf_dat['file'] . $tmpExt;
-               // Checking write state of localconf.php
-               if (!$this->allowUpdateLocalConf) {
-                       throw new RuntimeException('TYPO3 Fatal Error: ->allowUpdateLocalConf flag in the install object is not set and therefore "localconf.php" cannot be altered.', 1270853915);
-               }
-               if (!@is_writable($writeToLocalconf_dat['file'])) {
-                       throw new RuntimeException('TYPO3 Fatal Error: ' . $writeToLocalconf_dat['file'] . ' is not writable!', 1270853916);
-               }
-               // Splitting localconf.php file into lines
-               $lines = explode(LF, str_replace(CR, '', trim(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($writeToLocalconf_dat['file']))));
-               $writeToLocalconf_dat['endLine'] = array_pop($lines);
-               // Getting "? >" ending.
-               // Checking if "updated" line was set by this tool - if so remove old line.
-               $updatedLine = array_pop($lines);
-               $writeToLocalconf_dat['updatedText'] = '// Updated by ' . $this->updateIdentity . ' ';
-               if (!strstr($updatedLine, $writeToLocalconf_dat['updatedText'])) {
-                       array_push($lines, $updatedLine);
-               }
-               // Setting a line and write
-               if (is_array($inlines)) {
-                       // Setting configuration
-                       $updatedLine = $writeToLocalconf_dat['updatedText'] . date(($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' H:i:s'));
-                       array_push($inlines, $updatedLine);
-                       array_push($inlines, $writeToLocalconf_dat['endLine']);
-                       if ($this->setLocalconf) {
-                               $success = $this->writeToLocalconf($inlines, $absFullPath);
-                               if ($success) {
-                                       return 'continue';
-                               } else {
-                                       return 'nochange';
-                               }
-                       } else {
-                               return 'nochange';
-                       }
-               } else {
-                       // Return lines found in localconf.php
-                       return $lines;
-               }
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+               return "nochange";
        }
 
        /**
@@ -358,52 +197,11 @@ class t3lib_install {
         * @param array $lines Array of lines to write back to localconf.php
         * @param string $absFullPath Absolute path of alternative file to use (Notice: this path is not validated in terms of being inside 'TYPO3 space')
         * @return boolean TRUE if method succeeded, otherwise FALSE
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function writeToLocalconf(array $lines, $absFullPath = '') {
-               $tmpExt = '.TMP.php';
-               $writeToLocalconf_dat = array();
-               $writeToLocalconf_dat['file'] = $absFullPath ? $absFullPath : PATH_typo3conf . 'localconf.php';
-               $writeToLocalconf_dat['tmpfile'] = $writeToLocalconf_dat['file'] . $tmpExt;
-               // Checking write state of localconf.php:
-               if (!$this->allowUpdateLocalConf) {
-                       throw new RuntimeException('TYPO3 Fatal Error: ->allowUpdateLocalConf flag in the install object is not set and therefore "localconf.php" cannot be altered.', 1270853915);
-               }
-               if (!@is_writable($writeToLocalconf_dat['file'])) {
-                       throw new RuntimeException('TYPO3 Fatal Error: ' . $writeToLocalconf_dat['file'] . ' is not writable!', 1270853916);
-               }
-               $writeToLocalconf_dat['endLine'] = array_pop($lines);
-               // Getting "? >" ending.
-               if (!strstr(('?' . '>'), $writeToLocalconf_dat['endLine'])) {
-                       $lines[] = $writeToLocalconf_dat['endLine'];
-                       $writeToLocalconf_dat['endLine'] = '?' . '>';
-               }
-               // Checking if "updated" line was set by this tool - if so remove old line.
-               $updatedLine = array_pop($lines);
-               $writeToLocalconf_dat['updatedText'] = '// Updated by ' . $this->updateIdentity . ' ';
-               if (!strstr($updatedLine, $writeToLocalconf_dat['updatedText'])) {
-                       $lines[] = $updatedLine;
-               }
-               $updatedLine = $writeToLocalconf_dat['updatedText'] . date(($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' H:i:s'));
-               $lines[] = $updatedLine;
-               $lines[] = $writeToLocalconf_dat['endLine'];
-               $success = FALSE;
-               if (!\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($writeToLocalconf_dat['tmpfile'], implode(LF, $lines))) {
-                       $msg = 'typo3conf/LocalConfiguration.php' . $tmpExt . ' could not be written - maybe a write access problem?';
-               } elseif (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($writeToLocalconf_dat['tmpfile']), implode(LF, $lines))) {
-                       @unlink($writeToLocalconf_dat['tmpfile']);
-                       $msg = 'typo3conf/LocalConfiguration.php' . $tmpExt . ' was NOT written properly (written content didn\'t match file content) - maybe a disk space problem?';
-               } elseif (!@copy($writeToLocalconf_dat['tmpfile'], $writeToLocalconf_dat['file'])) {
-                       $msg = 'typo3conf/LocalConfiguration.php could not be replaced by typo3conf/LocalConfiguration.php' . $tmpExt . ' - maybe a write access problem?';
-               } else {
-                       @unlink($writeToLocalconf_dat['tmpfile']);
-                       $success = TRUE;
-                       $msg = 'Configuration written to typo3conf/LocalConfiguration.php';
-               }
-               $this->messages[] = $msg;
-               if (!$success) {
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($msg, 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
-               }
-               return $success;
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+               return FALSE;
        }
 
        /**
@@ -412,9 +210,11 @@ class t3lib_install {
         * @param string $string String to test
         * @return boolean Returns TRUE if string is OK
         * @see setValueInLocalconfFile()
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function checkForBadString($string) {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+
                return preg_match('/[' . LF . CR . ']/', $string) ? FALSE : TRUE;
        }
 
@@ -424,9 +224,11 @@ class t3lib_install {
         * @param string $value Input value
         * @return string Output value
         * @see setValueInLocalconfFile()
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function slashValueForSingleDashes($value) {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+
                $value = str_replace('\'.LF.\'', '###INSTALL_TOOL_LINEBREAK###', $value);
                $value = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $value));
                $value = str_replace('###INSTALL_TOOL_LINEBREAK###', '\'.LF.\'', $value);
@@ -443,9 +245,11 @@ class t3lib_install {
         * @param array $currentValue Array of "current values" for each key/value pair in $arr. Shown if given.
         * @param boolean $cVfullMsg If set, will show the prefix "Current value" if $currentValue is given.
         * @return string HTML table with checkboxes for update. Must be wrapped in a form.
-        * @todo Define visibility
+        * @deprecated since 6.0, will be removed by 7.0
         */
        public function generateUpdateDatabaseForm_checkboxes($arr, $label, $checked = TRUE, $iconDis = FALSE, $currentValue = array(), $cVfullMsg = FALSE) {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+
                $out = array();
                if (is_array($arr)) {
                        $tableId = uniqid('table');
index 7d52c01..6d2fea5 100755 (executable)
@@ -78,7 +78,6 @@ if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('install')) {
        die('Install Tool is not loaded as an extension.<br />You must add the key "install" to the list of installed extensions in typo3conf/LocalConfiguration.php, $TYPO3_CONF_VARS[\'EXT\'][\'extListArray\'].');
 }
 require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('install') . 'mod/class.tx_install.php';
-$install_check = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Installer');
-$install_check->allowUpdateLocalConf = 1;
+$install_check = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Installer', TRUE);
 $install_check->init();
 ?>
\ No newline at end of file
index b6e9f7d..36581ed 100644 (file)
@@ -220,16 +220,6 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
-        * Wrapper for make instance to make
-        * mocking possible
-        *
-        * @return t3lib_install
-        */
-       protected function getT3libInstallInstance() {
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_install');
-       }
-
-       /**
         * Reload Cache files and Typo3LoadedExtensions
         *
         * @return void
index d7d5fc9..23d2832 100644 (file)
@@ -1,8 +1,6 @@
 <?php
 namespace TYPO3\CMS\Install;
 
-// TODO remove this requirement
-require_once PATH_t3lib . 'class.t3lib_install.php';
 /**
  * Install Tool module
  *
@@ -11,7 +9,7 @@ require_once PATH_t3lib . 'class.t3lib_install.php';
  * @package TYPO3
  * @subpackage tx_install
  */
-class Installer extends \t3lib_install {
+class Installer {
 
        /**
         * @todo Define visibility
@@ -39,9 +37,11 @@ class Installer extends \t3lib_install {
        public $markers = array();
 
        /**
-        * @todo Define visibility
+        * Used to set (error)messages from the executing functions like mail-sending, writing Localconf and such
+        *
+        * @var array
         */
-       public $messages = array();
+       protected $messages = array();
 
        /**
         * @todo Define visibility
@@ -234,13 +234,33 @@ class Installer extends \t3lib_install {
        );
 
        /**
+        * Backpath (used for icons etc.)
+        *
+        * @var string
+        */
+       protected $backPath = '../';
+
+       /**
+        * @var \TYPO3\CMS\Install\Sql\SchemaMigrator Instance of SQL handler
+        */
+       protected $sqlHandler = NULL;
+
+       /**
+        * Prefix for checkbox fields when updating database.
+        *
+        * @var string
+        */
+       protected $dbUpdateCheckboxPrefix = 'TYPO3_INSTALL[database_update]';
+
+       /**
         * Constructor
         *
         * @return void
         * @todo Define visibility
         */
        public function __construct() {
-               parent::__construct();
+               $this->sqlHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Sql\\SchemaMigrator');
+
                if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) {
                        $this->outputErrorAndExit('Install Tool deactivated.<br />
                                You must enable it by setting a password in typo3conf/LocalConfiguration.php. If you insert the value below at array position \'EXT\' \'installToolPassword\', the password will be \'joh316\':<br /><br />
@@ -1694,7 +1714,7 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
                                        $description = trim($commentArr[1][$k][$vk]);
                                        $isTextarea = preg_match('/^(<.*?>)?string \\(textarea\\)/i', $description) ? TRUE : FALSE;
                                        $doNotRender = preg_match('/^(<.*?>)?string \\(exclude\\)/i', $description) ? TRUE : FALSE;
-                                       if (!is_array($value) && !$doNotRender && ($this->checkForBadString($value) || $isTextarea)) {
+                                       if (!is_array($value) && !$doNotRender && (!preg_match('/[' . LF . CR . ']/', $value) || $isTextarea)) {
                                                $k2 = '[' . $vk . ']';
                                                if ($isTextarea) {
                                                        // Get the subpart for a textarea