ElggLogCache.php 724 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Cache logging information for later display
  4. *
  5. */
  6. class ElggLogCache {
  7. protected $cache;
  8. public function __construct() {
  9. $this->cache = array();
  10. }
  11. /**
  12. * Insert into cache
  13. *
  14. * @param mixed $data The log data to cache
  15. */
  16. public function insert($data) {
  17. $this->cache[] = $data;
  18. }
  19. /**
  20. * Insert into cache from plugin hook
  21. *
  22. * @param string $hook
  23. * @param string $type
  24. * @param bool $result
  25. * @param array $params Must have the data at $params['msg']
  26. */
  27. public function insertDump($hook, $type, $result, $params) {
  28. $this->insert($params['msg']);
  29. return false;
  30. }
  31. /**
  32. * Get the cache
  33. *
  34. * @return array
  35. */
  36. public function get() {
  37. return $this->cache;
  38. }
  39. }