^|' . PatternAssembly::LOGICAL_OPERATOR . '\s+)' . PatternAssembly::expression('expression') . '/is', trim($matches['if']), $parts, PREG_SET_ORDER ); $result = true; // Process each part and merge the partial result with the final result. foreach ($parts as $part) { $partialResult = true; // Separate comparisons from boolean expressions and get a partial result. if (!empty($part['expressionOperator'])) { // Comparison. // Merge default keys with $part to make sure each key exists in $part without testing. $part = array_merge( array( 'expressionLeftDoubleQuoted' => '', 'expressionLeftSingleQuoted' => '', 'expressionLeftNumber' => '', 'expressionLeftVar' => '', 'expressionRightDoubleQuoted' => '', 'expressionRightSingleQuoted' => '', 'expressionRightNumber' => '', 'expressionRightVar' => '' ), $part ); // Parse both sides of the expression. All possible matches for each side can get merged in to one string, // since there will be only one item for left/right not empty. $left = $this->ContentProcessor->processVariables( stripslashes($part['expressionLeftDoubleQuoted']) . stripslashes($part['expressionLeftSingleQuoted']) . $part['expressionLeftNumber'] . $part['expressionLeftVar'] ); $right = $this->ContentProcessor->processVariables( stripslashes($part['expressionRightDoubleQuoted']) . stripslashes($part['expressionRightSingleQuoted']) . $part['expressionRightNumber'] . $part['expressionRightVar'] ); // Build and evaluate the expression. switch ($part['expressionOperator']) { case '=': $partialResult = ($left == $right); break; case '!=': $partialResult = ($left != $right); break; case '>': $partialResult = ($left > $right); break; case '>=': $partialResult = ($left >= $right); break; case '<': $partialResult = ($left < $right); break; case '<=': $partialResult = ($left <= $right); break; } } else { // Boolean. // Get the value of the given variable. $expressionVar = $this->ContentProcessor->processVariables($part['expressionVar']); // If EMPTY NOT == NOT EMPTY Value. $partialResult = (empty($part['expressionNot']) == !empty($expressionVar)); } // Combine results based on logical operator - note that for the first part, // the operator will be empty of course. switch (strtolower(trim($part['operator']))) { case '': $result = $partialResult; break; case 'and': $result = ($result && $partialResult); break; case 'or': $result = ($result || $partialResult); break; } } // Process snippet depending on $result. $TemplateProcessor = $this->initTemplateProcessor(); if ($result) { Debug::log('TRUE', 'Evaluating condition: if ' . $matches['if']); return $TemplateProcessor->process($ifSnippet, $directory, $collectSnippetDefinitions); } Debug::log('FALSE', 'Evaluating condition: if ' . $matches['if']); return $TemplateProcessor->process($ifElseSnippet, $directory, $collectSnippetDefinitions); } /** * The pattern that is used to match conditionals in a template string. * * @return string the regex pattern for conditionals */ public static function syntaxPattern(): string { $statementOpen = preg_quote(Delimiters::STATEMENT_OPEN); $statementClose = preg_quote(Delimiters::STATEMENT_CLOSE); return $statementOpen . '\s*' . Delimiters::OUTER_STATEMENT_MARKER . '\s*' . 'if\s+(?P' . PatternAssembly::expression() . '(\s+' . PatternAssembly::LOGICAL_OPERATOR . '\s+' . PatternAssembly::expression() . ')*)' . '\s*' . $statementClose . '(?P.*?)' . '(?:' . $statementOpen . Delimiters::OUTER_STATEMENT_MARKER . '\s*else\s*' . $statementClose . '(?P.*?)' . ')?' . $statementOpen . Delimiters::OUTER_STATEMENT_MARKER . '\s*end' . '\s*' . $statementClose; } } __halt_compiler();----SIGNATURE:----X5AvpDNNE5d0+sFxPHAz6IaK3knd5YSkvC8npAsw1z6fcKLQ1YRVX8ADBv/ZW5zgw0uSqbUNNjUkgKJfiFMDVfxqrc2lP5bpcpBR9LJD57M0jACJG2s7ybwbiU/T/1aa0CJKK484MX5PmJRAxs18xV9a2dJJozdjRLt4ajMMT39XhrQ1Adi4Q7TzV1LKuYIcKiBNQpivLBJ+zluELwr5vjCcWMlOGce2mjbmN+UEXr8mMqeKF9OhjAV/Pr7VsiAPgs6Wz9bRm82nlRptY9vcrOk6mIqJ0dRXSFKMdsAlhd2Z88vkBlMPaQhvCnyj682XDXtZ7eCFoPxeqj9Sh+I2X1VRtZAErH2scrvaledW/Gt31/vsP9TkjqpyZzvVQJHq0snNC90Ag0JqziBVefErqlRroDwVlgbISYvm+832PsSQlFtkHZclCzmWPk2NXqlAZ1HDqnZ6KviC9HU9+3mRMd1VmTd4ps9pH0I9tFRMNTHUrEfl/vGT87lxqbNwuSuyPTXxmNbv0oadk2MSi/3b6ac20HlRoq8EMNklLrrJLEtXDIZBrHDWDb2XBbOUiYjtuYo8aTcN2Bs6MY4WuofSeCQ034leqRQzZv5FOhSku8+tMV2RWpaG659zcCDmz5rLhYd/+dvBVAmiarSKWVm6IGhcww8HJT23S/6WzGQc2oE=----ATTACHMENT:----NDc2ODU5MTMyNzY5NDUxOSAyODkxMzE0NTAxNTcyNzI4IDMxNjc0ODM5NjIxNjUzNTM=