/**
  * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
  *
  * @param	string		$string: The condition to match against its criterias.
  * @return	boolean		Whether the condition matched
  * @see t3lib_tsparser::parse()
  */
 protected function evaluateCondition($string)
 {
     list($key, $value) = t3lib_div::trimExplode('=', $string, FALSE, 2);
     $result = parent::evaluateConditionCommon($key, $value);
     if (is_bool($result)) {
         return $result;
     } else {
         switch ($key) {
             case 'usergroup':
                 $groupList = $this->getGroupList();
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 foreach ($values as $test) {
                     if ($test == '*' || t3lib_div::inList($groupList, $test)) {
                         return TRUE;
                     }
                 }
                 break;
             case 'adminUser':
                 if ($this->isUserLoggedIn()) {
                     $result = !((bool) $value xor $this->isAdminUser());
                     return $result;
                 }
                 break;
             case 'treeLevel':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 $treeLevel = count($this->rootline) - 1;
                 // If a new page is being edited or saved the treeLevel is higher by one:
                 if ($this->isNewPageWithPageId($this->pageId)) {
                     $treeLevel++;
                 }
                 foreach ($values as $test) {
                     if ($test == $treeLevel) {
                         return TRUE;
                     }
                 }
                 break;
             case 'PIDupinRootline':
             case 'PIDinRootline':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 if ($key == 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
                     foreach ($values as $test) {
                         foreach ($this->rootline as $rl_dat) {
                             if ($rl_dat['uid'] == $test) {
                                 return TRUE;
                             }
                         }
                     }
                 }
                 break;
         }
     }
     return FALSE;
 }
 /**
  * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
  *
  * @param	string		$string: The condition to match against its criterias.
  * @return	boolean		Whether the condition matched
  * @see t3lib_tsparser::parse()
  */
 protected function evaluateCondition($string)
 {
     list($key, $value) = t3lib_div::trimExplode('=', $string, FALSE, 2);
     $result = parent::evaluateConditionCommon($key, $value);
     if (is_bool($result)) {
         return $result;
     } else {
         switch ($key) {
             case 'usergroup':
                 $groupList = $this->getGroupList();
                 if ($groupList != '0,-1') {
                     // '0,-1' is the default usergroups when not logged in!
                     $values = t3lib_div::trimExplode(',', $value, TRUE);
                     foreach ($values as $test) {
                         if ($test == '*' || t3lib_div::inList($groupList, $test)) {
                             return TRUE;
                         }
                     }
                 }
                 break;
             case 'treeLevel':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 $treeLevel = count($this->rootline) - 1;
                 foreach ($values as $test) {
                     if ($test == $treeLevel) {
                         return TRUE;
                     }
                 }
                 break;
             case 'PIDupinRootline':
             case 'PIDinRootline':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 if ($key == 'PIDinRootline' || !in_array($this->pageId, $values)) {
                     foreach ($values as $test) {
                         foreach ($this->rootline as $rl_dat) {
                             if ($rl_dat['uid'] == $test) {
                                 return TRUE;
                             }
                         }
                     }
                 }
                 break;
         }
     }
     return FALSE;
 }