HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //proc/self/root/usr/local/CyberCP/public/imunifyav/plib/library/ImunifyLocale.php
<?php

namespace Imunify360;

class ImunifyLocale
{

    public static function lmsg($key, $params = [])
    {
        $text = \pm_Locale::lmsg($key, $params);
        if (strpos($text, '{{') !== false || strpos($text, '}}') !== false) {
            $text = self::replace($text);
        }
        return $text;
    }

    private static function replace($text)
    {
        $text = preg_replace_callback('~\{\{(\d+):([^,]*),([^,]*)\}\}~', [self::class, 'enReplace'], $text);
        return preg_replace('~\{\{[^\]]*\}\}~', '', $text);
    }

    private static function enReplace($matches)
    {
        $cnt = $matches[1];
        $tr1 = $matches[2];
        $tr2 = $matches[3];

        if ($cnt == 1) {
            return $tr1;
        }
        return $tr2;
    }

}