87 if (count($rootline)) {
132 $normalizedExpression = preg_replace(array(
133 '/\\]\\s*(OR|\\|\\|)?\\s*\\[/i',
134 '/\\]\\s*(AND|&&)\\s*\\[/i' 138 ), trim($expression));
139 return $normalizedExpression;
148 public function match($expression) {
150 if ($this->simulateMatchResult) {
154 if (count($this->simulateMatchConditions)) {
155 return in_array($expression, $this->simulateMatchConditions);
158 if (!isset($this->pageId)) {
162 if (!isset($this->rootline)) {
168 if ($normalizedExpression[0] ===
'[' && substr($normalizedExpression, -1) ===
']') {
169 $innerExpression = substr($normalizedExpression, 1, -1);
170 $orParts = explode(
']||[', $innerExpression);
171 foreach ($orParts as $orPart) {
172 $andParts = explode(
']&&[', $orPart);
173 foreach ($andParts as $andPart) {
201 switch ($keyParts[0]) {
202 case 'applicationContext':
205 foreach ($values as $applicationContext) {
218 foreach ($browserInfo[
'all'] as $key => $value) {
219 $all .= $key . $value .
' ';
221 foreach ($values as $test) {
222 if (stripos($all, $test) !== FALSE) {
229 foreach ($values as $test) {
230 if (strcspn($test,
'=<>') == 0) {
233 if (doubleval(substr($test, 1)) == $browserInfo[
'version']) {
238 if (doubleval(substr($test, 1)) > $browserInfo[
'version']) {
243 if (doubleval(substr($test, 1)) < $browserInfo[
'version']) {
248 } elseif (strpos(
' ' . $browserInfo[
'version'], $test) == 1) {
257 $allSystems =
' ' . implode(
' ', $browserInfo[
'all_systems']);
258 foreach ($values as $test) {
259 if (stripos($allSystems, $test) !== FALSE) {
265 if (!isset($this->deviceInfo)) {
269 foreach ($values as $test) {
270 if ($this->deviceInfo == $test) {
276 $test = trim($value);
283 foreach ($values as $test) {
284 if (preg_match(
'/^\\*.+\\*$/', $test)) {
286 if (in_array(substr($test, 1, -1), $allLanguages)) {
295 if ($value ===
'devIP') {
296 $value = trim(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'devIPmask']);
322 $theEvalTime =
$GLOBALS[
'SIM_EXEC_TIME'];
325 $theTestValue = date(
'H', $theEvalTime);
328 $theTestValue = date(
'i', $theEvalTime);
331 $theTestValue = date(
'm', $theEvalTime);
334 $theTestValue = date(
'Y', $theEvalTime);
337 $theTestValue = date(
'w', $theEvalTime);
340 $theTestValue = date(
'd', $theEvalTime);
343 $theTestValue = date(
'z', $theEvalTime);
346 $theTestValue = (int)$theTestValue;
349 foreach ($values as $test) {
358 case 'compatVersion':
364 foreach ($values as $test) {
365 if ($test ==
'*' || (
string)$this->
getUserId() === (
string)$test) {
369 } elseif ($value ===
'') {
376 $property = $keyParts[1];
377 if (!empty($page) && isset($page[$property]) && (
string)$page[$property] === (
string)$value) {
384 foreach ($values as $test) {
385 $point = strcspn($test,
'!=<>');
386 $theVarName = substr($test, 0, $point);
388 $testValue = substr($test, $point);
396 foreach ($values as $test) {
397 $point = strcspn($test,
'=');
398 $theVarName = substr($test, 0, $point);
399 $nv = (string)$this->
getVariable(trim($theVarName));
400 $testValue = substr($test, $point + 1);
408 preg_match_all(
'/^\s*([^\(\s]+)\s*(?:\((.*)\))?\s*$/', $value, $matches);
409 $funcName = $matches[1][0];
411 if (is_callable($funcName) && call_user_func_array($funcName, $funcValues)) {
427 $arguments = trim($arguments);
428 while ($arguments !==
'') {
429 if ($arguments[0] ===
',') {
431 $arguments = substr($arguments, 1);
433 $pos = strcspn($arguments,
',\'"');
436 $quote = $arguments[0];
437 $segment = preg_replace(
'/^(.*?[^\\\])' . $quote .
'.*$/',
'\1', substr($arguments, 1));
438 $segment = str_replace(
'\\' . $quote, $quote, $segment);
441 $arguments = substr($arguments, strlen($segment) + 2);
442 $offset = strpos($arguments,
',');
443 if ($offset === FALSE) {
444 $offset = strlen($arguments);
446 $arguments = substr($arguments, $offset + 1);
448 $result[] = trim(substr($arguments, 0, $pos));
449 $arguments = substr($arguments, $pos + 1);
452 $arguments = trim($arguments);
465 if (count($vars) == 1) {
468 $splitAgain = explode(
'|', $vars[1], 2);
469 $k = trim($splitAgain[0]);
471 switch ((
string) trim($vars[0])) {
482 return trim($vars[1]);
488 if (count($splitAgain) > 1) {
489 if (is_array($value) && trim($splitAgain[1]) !==
'') {
490 $value = $this->
getGlobal($splitAgain[1], $value);
508 if (preg_match(
'/^(!?=+|<=?|>=?)\\s*([^\\s]*)\\s*$/', $test, $matches)) {
509 $operator = $matches[1];
510 $rightValue = $matches[2];
513 return $leftValue >= doubleval($rightValue);
516 return $leftValue <= doubleval($rightValue);
523 foreach ($rightValueParts as $rightValueSingle) {
524 if ($leftValue == doubleval($rightValueSingle)) {
529 return $found === FALSE;
532 return $leftValue < doubleval($rightValue);
535 return $leftValue > doubleval($rightValue);
543 foreach ($rightValueParts as $rightValueSingle) {
544 if ($leftValue == $rightValueSingle) {
564 if ($haystack === $needle) {
567 if (preg_match(
'/^\\/.+\\/$/', $needle)) {
571 $needle = str_replace(array(
'*',
'?'), array(
'###MANY###',
'###ONE###'), $needle);
572 $regex =
'/^' . preg_quote($needle,
'/') .
'$/';
574 $regex = str_replace(array(
'###MANY###',
'###ONE###'), array(
'.*',
'.'), $regex);
576 $result = (bool)preg_match($regex, $haystack);
588 return \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgent);
598 return \TYPO3\CMS\Core\Utility\ClientUtility::getDeviceType($userAgent);
610 $vars = explode(
'|', $var);
613 $theVar = isset($source) ? $source[$k] :
$GLOBALS[$k];
614 for ($a = 1; $a < $c; $a++) {
615 if (!isset($theVar)) {
618 $key = trim($vars[$a]);
619 if (is_object($theVar)) {
620 $theVar = $theVar->{$key};
621 } elseif (is_array($theVar)) {
622 $theVar = $theVar[$key];
627 if (!is_array($theVar) && !is_object($theVar)) {
676 abstract protected function getPage();
705 abstract protected function log($message);
searchStringWildcard($haystack, $needle)
parseUserFuncArguments($arguments)
setSimulateMatchConditions(array $simulateMatchConditions)
setSimulateMatchResult($simulateMatchResult)
getGlobal($var, $source=NULL)
static cmpFQDN($baseHost, $list)
static canBeInterpretedAsInteger($var)
static getIndpEnv($getEnvName)
evaluateConditionCommon($key, $value)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static cmpIP($baseIP, $list)
normalizeExpression($expression)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static compat_version($verNumberStr)
compareNumber($test, $leftValue)
getDeviceType($userAgent)
getBrowserInfo($userAgent)
setRootline(array $rootline)
evaluateCondition($string)
static getApplicationContext()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
getVariableCommon(array $vars)