PageRenderTime 54ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/patTemplate/Stat.php

http://kko-verwaltung.googlecode.com/
PHP | 87 lines | 27 code | 4 blank | 56 comment | 3 complexity | 0e042f78ed9fb595bc997d9ce7a5a823 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?PHP
  2. /**
  3. * Base class for patTemplate Stat
  4. *
  5. * $Id: Stat.php 423 2006-02-26 12:28:19Z schst $
  6. *
  7. * A stat component should be implemented for each reader
  8. * to support caching. Stats return information about the
  9. * template source.
  10. *
  11. * @package patTemplate
  12. * @subpackage Stat
  13. * @author Stephan Schmidt <schst@php.net>
  14. */
  15. /**
  16. * Base class for patTemplate Stat
  17. *
  18. * $Id: Stat.php 423 2006-02-26 12:28:19Z schst $
  19. *
  20. * A stat component should be implemented for each reader
  21. * to support caching. Stats return information about the
  22. * template source.
  23. *
  24. * @package patTemplate
  25. * @subpackage Stat
  26. * @author Stephan Schmidt <schst@php.net>
  27. * @abstract
  28. */
  29. class patTemplate_Stat extends patTemplate_Module
  30. {
  31. /**
  32. * options, are identical to those of the corresponding reader
  33. *
  34. * @access private
  35. * @var array
  36. */
  37. var $_options = array();
  38. /**
  39. * get the modification time of a template
  40. *
  41. * Needed, if a template cache should be used, that auto-expires
  42. * the cache.
  43. *
  44. * @abstract must be implemented in the template readers
  45. * @param mixed input to read from.
  46. * This can be a string, a filename, a resource or whatever the derived class needs to read from
  47. * @return integer unix timestamp
  48. */
  49. function getModificationTime( $input )
  50. {
  51. return -1;
  52. }
  53. /**
  54. * set options
  55. *
  56. * @access public
  57. * @param array array containing options
  58. */
  59. function setOptions( $options )
  60. {
  61. $this->_options = $options;
  62. }
  63. /**
  64. * get the template root for this class
  65. *
  66. * @access public
  67. * @return string
  68. */
  69. function getTemplateRoot()
  70. {
  71. if (!isset($this->_options['root'])) {
  72. return null;
  73. }
  74. if (isset($this->_options['root'][$this->_name])) {
  75. return $this->_options['root'][$this->_name];
  76. }
  77. if (isset($this->_options['root']['__default'])) {
  78. return $this->_options['root']['__default'];
  79. }
  80. return null;
  81. }
  82. }
  83. ?>