* Added feature in TYpoScript data type "getText" to get values from GET arrays via...
authorKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 16:39:09 +0000 (16:39 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 23 Apr 2004 16:39:09 +0000 (16:39 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@227 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php

index f9f9b02..8f467e2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
+
+       * Added feature in TYpoScript data type "getText" to get values from GET arrays via "GPvar" key word. Now you can specify ".date = GPvar : tx_myext|mode|index" to get value of &tx_myext[mode][index]
+
 2004-04-23  Kasper Skårhøj,,,  <kasper@typo3.com>
 
        * Added option "$TYPO3_CONF_VARS["GFX"]["gdlib_2"] = 'no_imagecopyresized_fix';" to avoid using the imagecopyresized workaround in stdgraphic class which has failed for some. Whether the workaround is needed anymore is not certain. Some people say it works fine without.
index 570dfa5..e04d63f 100755 (executable)
@@ -4490,7 +4490,16 @@ class tslib_cObj {
                        if ((string)$key!='')   {
                                switch(strtolower(trim($parts[0])))     {
                                        case 'gpvar':
-                                               $retVal = t3lib_div::_GP($key);
+                                               list($firstKey, $rest) = explode('|', $key, 2);
+                                               if (strlen(trim($firstKey)))    {
+                                                       $retVal = t3lib_div::_GP(trim($firstKey));
+                                                               // Look for deeper levels:
+                                                       if (strlen(trim($rest)))        {
+                                                               $retVal = is_array($retVal) ? $this->getGlobal($rest, $retVal) : '';
+                                                       }
+                                                               // Check that output is not an array:
+                                                       if (is_array($retVal))  $retVal = '';
+                                               }
                                        break;
                                        case 'tsfe':
                                                $retVal = $GLOBALS['TSFE']->$key;
@@ -4612,14 +4621,15 @@ class tslib_cObj {
         * Example: $var = "HTTP_SERVER_VARS | something" will return the value $GLOBALS['HTTP_SERVER_VARS']['something'] value
         *
         * @param       string          Key, see description of functon
+        * @param       array           If you want another array that $GLOBALS used, then just put it in here!
         * @return      mixed           Value from $GLOBALS
         * @access private
         * @see getData()
         */
-       function getGlobal($var) {
-               $vars = explode('|',$var);
+       function getGlobal($var, $source=NULL) {
+               $vars = explode('|', $var);
                $c = count($vars);
-               $theVar = $GLOBALS[trim($vars[0])];
+               $theVar = isset($source) ? $source[trim($vars[0])] : $GLOBALS[trim($vars[0])];
                for ($a=1;$a<$c;$a++) {
                        if (!isset($theVar))    {break;}
                        $theVar = $theVar[trim($vars[$a])];