PluginProbe
WebTotem Security / 1.3.3
WebTotem Security v1.3.3
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / library / Localization.php

Localization.php in WebTotem Security 1.3.3, at library/Localization.php

36 lines 982 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php defined('ABSPATH') or die("Protected By Webtotem Wordpress Security!");
2
3
4 class WTSEC_LIBRARY_Localization
5 {
6
7 public static function lmsg($lmsg,$values = []){
8 $default = 'en_US';
9 $lang = get_locale();
10 $path = self::getPath($lang);
11 $messages = [];
12 if(is_file($path)){
13 include $path;
14 }else{
15 include self::getPath($default);
16 }
17 $keys = explode(".",$lmsg);
18 foreach ($keys as $key) {
19 if(!isset($messages[$key])){
20 break;
21 }
22 $messages = &$messages[$key];
23 }
24 if(is_string($messages)){
25 foreach ($values as $_key => $value){
26 $messages = str_replace("%%".$_key."%%",$value,$messages);
27 }
28 return $messages;
29 }
30 return "[".$lmsg."]";
31 }
32
33 public static function getPath($lang){
34 return WTSEC_PLUGIN_PATH.'resources/locales/'.$lang.'.php';
35 }
36 }