Beispiel #1
0
function item_description($item)
{
    $descr = $item['description'];
    $key = expand_item_key_by_data($item);
    for ($i = 9; $i > 0; $i--) {
        $descr = str_replace("\${$i}", get_n_param($key, $i), $descr);
    }
    return $descr;
}
Beispiel #2
0
function item_description($item)
{
    $descr = $item['description'];
    $key = expand_item_key_by_data($item);
    /**
     * Regular string functions used below are changed to zbx_*
     * wrappers to allow users to name steps in non-ascii chars.
     * Also $str[$i] calls were replased by zbx_substr($str, $i, 1)
     * @see ZBX-2349
     * @author Konstantin Buravcov
     */
    for ($i = 9; $i > 0; $i--) {
        $descr = str_replace("\${$i}", get_n_param($key, $i), $descr);
    }
    if ($res = preg_match_all('/' . ZBX_PREG_EXPRESSION_USER_MACROS . '/', $descr, $arr)) {
        $macros = CuserMacro::getMacros($arr[1], array('itemid' => $item['itemid']));
        $search = array_keys($macros);
        $values = array_values($macros);
        $descr = str_replace($search, $values, $descr);
    }
    return $descr;
}