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