Text.php (498B)
1 <?php 2 3 class Text 4 { 5 private static $texts; 6 7 public static function get($key) 8 { 9 // if not $key 10 if (!$key) { 11 return null; 12 } 13 14 // load config file (this is only done once per application lifecycle) 15 if (!self::$texts) { 16 self::$texts = require('../application/config/texts.php'); 17 } 18 19 // check if array key exists 20 if (!array_key_exists($key, self::$texts)) { 21 return null; 22 } 23 24 return self::$texts[$key]; 25 } 26 27 }