[FEATURE] TypoScript: Allow easy comparison against multiple values
[Packages/TYPO3.CMS.git] / t3lib / matchcondition / class.t3lib_matchcondition_abstract.php
index f125461..53bfdc4 100644 (file)
@@ -482,7 +482,19 @@ abstract class t3lib_matchCondition_abstract {
                                        return ($leftValue <= doubleval($rightValue));
                                break;
                                case '!=':
-                                       return ($leftValue != doubleval($rightValue));
+                                               // multiple values may be split with '|'
+                                               // see if none matches ("not in list")
+                                       $found = FALSE;
+
+                                       $rightValueParts = t3lib_div::trimExplode('|', $rightValue);
+                                       foreach ($rightValueParts as $rightValueSingle) {
+                                               if ($leftValue === doubleval($rightValueSingle)) {
+                                                       $found = TRUE;
+                                                       break;
+                                               }
+                                       }
+
+                                       return ($found === FALSE);
                                break;
                                case '<':
                                        return ($leftValue < doubleval($rightValue));
@@ -492,7 +504,20 @@ abstract class t3lib_matchCondition_abstract {
                                break;
                                default:
                                                // nothing valid found except '=', use '='
-                                       return ($leftValue == trim($rightValue));
+
+                                               // multiple values may be split with '|'
+                                               // see if one matches ("in list")
+                                       $found = FALSE;
+
+                                       $rightValueParts = t3lib_div::trimExplode('|', $rightValue);
+                                       foreach ($rightValueParts as $rightValueSingle) {
+                                               if ($leftValue == $rightValueSingle) {
+                                                       $found = TRUE;
+                                                       break;
+                                               }
+                                       }
+
+                                       return $found;
                                break;
                        }
                }