Js.php 867 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\FileReader\Reader;
  3. use ThurData\Servers\KerioEmail\Core\ServiceLocator;
  4. /**
  5. * Description of Json
  6. *
  7. * @author Rafał Ossowski <rafal.os@thurdata.com>
  8. */
  9. class Js extends AbstractType
  10. {
  11. protected function loadFile()
  12. {
  13. $return = '';
  14. try
  15. {
  16. if (file_exists($this->path . DS . $this->file))
  17. {
  18. $return = file_get_contents($this->path . DS . $this->file);
  19. foreach ($this->renderData as $key => $value)
  20. {
  21. $return = str_replace("#$key#", $value, $return);
  22. }
  23. }
  24. }
  25. catch (\Exception $e)
  26. {
  27. ServiceLocator::call('errorManager')->addError(self::class, $e->getMessage(), $e->getTrace());
  28. }
  29. $this->data = $return;
  30. }
  31. }