# wt-security/1.3.3/library/Localization.php

WebTotem Security, version 1.3.3. 36 lines.

- Page: https://pluginprobe.com/plugins/wt-security/1.3.3/code/library/Localization.php
- Raw: https://pluginprobe.com/plugins/wt-security/1.3.3/raw/library/Localization.php
- Modified: 2020-01-28T20:07:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wt-security/1.3.3/code/library/Localization.php#L10-L20`.

```php
<?php defined('ABSPATH') or die("Protected By Webtotem Wordpress Security!");


class WTSEC_LIBRARY_Localization
{

    public static function lmsg($lmsg,$values = []){
        $default = 'en_US';
        $lang = get_locale();
        $path = self::getPath($lang);
        $messages = [];
        if(is_file($path)){
            include $path;
        }else{
            include self::getPath($default);
        }
        $keys = explode(".",$lmsg);
        foreach ($keys as $key) {
            if(!isset($messages[$key])){
                break;
            }
            $messages = &$messages[$key];
        }
        if(is_string($messages)){
            foreach ($values as $_key => $value){
                $messages = str_replace("%%".$_key."%%",$value,$messages);
            }
            return $messages;
        }
        return "[".$lmsg."]";
    }

    public static function getPath($lang){
        return WTSEC_PLUGIN_PATH.'resources/locales/'.$lang.'.php';
    }
}
```
