Go to the documentation of this file.00001 <?php
00010 final class tr {
00011
00017 private static $cfg;
00018
00022 private function __construct() {}
00023
00027 private static function initCfg() {
00028 if (!self::$cfg)
00029 self::$cfg = new config(factory::loadCfg(__CLASS__));
00030 }
00031
00040 public static function __($key, $show=false, $out=true) {
00041 self::initCfg();
00042 $ret = null;
00043 if (strpos($key, '_') !== false) {
00044 $keys = explode('_', $key);
00045 $ret = self::$cfg->getInArray($keys[0], $keys[1]);
00046 } else
00047 $ret = self::$cfg->get($key);
00048
00049 if ($out)
00050 $ret = utils::htmlOut($ret);
00051
00052 if (is_array($ret))
00053 $ret = array_map('nl2br', $ret);
00054 else
00055 $ret = nl2br($ret);
00056
00057 if ($show)
00058 echo $ret;
00059 else
00060 return $ret;
00061 }
00062 }