Содержимое файла | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
304 | alex-w | 1 | <?php |
2 | |||
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 | */ |
||
15 | |||
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 | |||
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 | /** |
||
37 | * Get filepath to template source |
||
38 | * |
||
39 | * @param object $_template template object |
||
40 | * @return string return 'string' as template source is not a file |
||
41 | */ |
||
42 | public function getTemplateFilepath($_template) |
||
43 | { |
||
44 | // no filepath for strings |
||
45 | // return "string" for compiler error messages |
||
46 | return 'string'; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get timestamp to template source |
||
51 | * |
||
52 | * @param object $_template template object |
||
53 | * @return boolean false as string resources have no timestamp |
||
54 | */ |
||
55 | public function getTemplateTimestamp($_template) |
||
56 | { |
||
57 | // strings must always be compiled and have no timestamp |
||
58 | return false; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Retuen template source from resource name |
||
63 | * |
||
64 | * @param object $_template template object |
||
65 | * @return string content of template source |
||
66 | */ |
||
67 | public function getTemplateSource($_template) |
||
68 | { |
||
69 | // return template string |
||
70 | $_template->template_source = $_template->resource_name; |
||
71 | return true; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Return flag that this resource uses the compiler |
||
76 | * |
||
77 | * @return boolean true |
||
78 | */ |
||
79 | public function usesCompiler() |
||
80 | { |
||
81 | // resource string is template, needs compiler |
||
82 | return true; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Return flag that this resource is evaluated |
||
87 | * |
||
88 | * @return boolean true |
||
89 | */ |
||
90 | public function isEvaluated() |
||
91 | { |
||
92 | // compiled template is evaluated instead of saved to disk |
||
93 | return true; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Get filepath to compiled template |
||
98 | * |
||
99 | * @param object $_template template object |
||
100 | * @return boolean return false as compiled template is not stored |
||
101 | */ |
||
102 | public function getCompiledFilepath($_template) |
||
103 | { |
||
104 | // no filepath for strings |
||
105 | return false; |
||
106 | } |
||
107 | } |
||
108 | |||
109 | ?> |