Source
if ($expression['expression_type'] == EXPRESSION_TYPE_TRUE || $expression['expression_type'] == EXPRESSION_TYPE_FALSE) {
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* Class for regular expressions and Zabbix global expressions.
* Any string that begins with '@' is treated as Zabbix expression.
* Data from Zabbix expressions is taken from DB, and cached in static variable.
*
* @throws Exception
*/
class CGlobalRegexp {
const ERROR_REGEXP_NOT_EXISTS = 1;
/**
* Determine if it's Zabbix expression.
*
* @var bool
*/
protected $isZabbixRegexp;
/**
* If we create simple regular expression this contains itself as a string,
* if we create Zabbix expression this contains array of expressions taken from DB.
*
* @var array|string
*/
protected $expression;
/**
* Cache for Zabbix expressions.
*
* @var array
*/
private static $_cachedExpressions = [];
/**
* Initialize expression, gets data from db for Zabbix expressions.
*
* @param string $regExp
*
* @throws Exception
*/
public function __construct($regExp) {
if ($regExp[0] == '@') {