Source
return ($param['type'] == self::PARAM_TYPE_QUOTED) ? self::unquoteParam($param['match']) : $param['match'];
<?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 is used to validate and parse a function.
*/
class CHistFunctionParser extends CParser {
protected const STATE_NEW = 0;
protected const STATE_END = 1;
protected const STATE_QUOTED = 3;
protected const STATE_END_OF_PARAMS = 4;
public const PARAM_TYPE_QUERY = 0;
public const PARAM_TYPE_PERIOD = 1;
public const PARAM_TYPE_QUOTED = 2;
public const PARAM_TYPE_UNQUOTED = 3;
/**
* An options array.
*
* Supported options:
* 'usermacros' => false Enable user macros usage in function parameters.
* 'lldmacros' => false Enable low-level discovery macros usage in function parameters.
* 'host_macro' => false Allow {HOST.HOST} macro as host name part in the query.
* 'host_macro_n' => false Allow {HOST.HOST} and {HOST.HOST<1-9>} macros as host name part in the query.
* 'empty_host' => false Allow empty hostname in the query string.
*
* @var array
*/
private $options = [
'usermacros' => false,
'lldmacros' => false,
'calculated' => false,
'host_macro' => false,
'host_macro_n' => false,
'empty_host' => false
];
private $query_parser;
private $period_parser;
private $user_macro_parser;
private $lld_macro_parser;
private $lld_macro_function_parser;
private $time_parser;