smarty_internal_resource_string.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Resource String
  4. *
  5. * Implements the strings as resource for Smarty template
  6. *
  7. * @package Smarty
  8. * @subpackage TemplateResources
  9. * @author Uwe Tews
  10. */
  11. /**
  12. * Smarty Internal Plugin Resource String
  13. */
  14. class Smarty_Internal_Resource_String {
  15. public function __construct($smarty)
  16. {
  17. $this->smarty = $smarty;
  18. }
  19. // classes used for compiling Smarty templates from file resource
  20. public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
  21. public $template_lexer_class = 'Smarty_Internal_Templatelexer';
  22. public $template_parser_class = 'Smarty_Internal_Templateparser';
  23. // properties
  24. public $usesCompiler = true;
  25. public $isEvaluated = true;
  26. /**
  27. * Return flag if template source is existing
  28. *
  29. * @return boolean true
  30. */
  31. public function isExisting($template)
  32. {
  33. return true;
  34. }
  35. /**
  36. * Get filepath to template source
  37. *
  38. * @param object $_template template object
  39. * @return string return 'string' as template source is not a file
  40. */
  41. public function getTemplateFilepath($_template)
  42. {
  43. // no filepath for strings
  44. // return "string" for compiler error messages
  45. return 'string';
  46. }
  47. /**
  48. * Get timestamp to template source
  49. *
  50. * @param object $_template template object
  51. * @return boolean false as string resources have no timestamp
  52. */
  53. public function getTemplateTimestamp($_template)
  54. {
  55. // strings must always be compiled and have no timestamp
  56. return false;
  57. }
  58. /**
  59. * Retuen template source from resource name
  60. *
  61. * @param object $_template template object
  62. * @return string content of template source
  63. */
  64. public function getTemplateSource($_template)
  65. {
  66. // return template string
  67. $_template->template_source = $_template->resource_name;
  68. return true;
  69. }
  70. /**
  71. * Get filepath to compiled template
  72. *
  73. * @param object $_template template object
  74. * @return boolean return false as compiled template is not stored
  75. */
  76. public function getCompiledFilepath($_template)
  77. {
  78. // no filepath for strings
  79. return false;
  80. }
  81. }
  82. ?>