PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/system/library/language.php

https://bitbucket.org/jjasko/opencart_serbian
PHP | 31 lines | 24 code | 7 blank | 0 comment | 2 complexity | 3c8955e13a42500f7e6ddcd45273cd22 MD5 | raw file
  1. <?php
  2. final class Language {
  3. private $directory;
  4. private $data = array();
  5. public function __construct($directory) {
  6. $this->directory = $directory;
  7. }
  8. public function get($key) {
  9. return (isset($this->data[$key]) ? $this->data[$key] : $key);
  10. }
  11. public function load($filename) {
  12. $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php';
  13. if (file_exists($file)) {
  14. $_ = array();
  15. require($file);
  16. $this->data = array_merge($this->data, $_);
  17. return $this->data;
  18. } else {
  19. trigger_error('Error: Could not load language ' . $filename . '!');
  20. exit();
  21. }
  22. }
  23. }
  24. ?>