1 | <?php |
||
26 | class XoopsTpl extends \Smarty |
||
27 | { |
||
28 | use SmartyBCTrait; |
||
29 | |||
30 | /** |
||
31 | * @var \Xoops\Core\Theme\XoopsTheme |
||
32 | */ |
||
33 | public $currentTheme = null; |
||
34 | |||
35 | /** |
||
36 | * XoopsTpl constructor |
||
37 | */ |
||
38 | 14 | public function __construct() |
|
68 | |||
69 | /** |
||
70 | * XOOPS legacy used '<{' and '}>' as delimiters rather than using the default '{' and '}'. |
||
71 | * This prefilter function converts any legacy delimiters to Smarty default delimiters. |
||
72 | * |
||
73 | * The intention is to phase out the legacy delimiters entirely. |
||
74 | * |
||
75 | * @param string $tpl_source template source |
||
76 | * @param \Smarty_Internal_Template $template template object |
||
77 | * |
||
78 | * @return string source with any legacy delimiters converted to standard default delimiters |
||
79 | */ |
||
80 | 5 | public function convertLegacyDelimiters($tpl_source, \Smarty_Internal_Template $template) |
|
81 | { |
||
82 | 5 | $countLeft = 0; |
|
83 | 5 | $countRight = -1; |
|
84 | 5 | $temp = str_replace('<{', '{', $tpl_source, $countLeft); |
|
85 | 5 | if ($countLeft>0) { |
|
86 | 1 | $temp = str_replace('}>', '}', $temp, $countRight); |
|
87 | } |
||
88 | 5 | return ($countLeft === $countRight) ? $temp : $tpl_source; |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * XoopsTpl::touch |
||
93 | * |
||
94 | * @param string $resourceName name of resource |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | 1 | public function touch($resourceName) |
|
107 | |||
108 | /** |
||
109 | * XoopsTpl::setCompileId() |
||
110 | * |
||
111 | * @param mixed $module_dirname module directory |
||
112 | * @param mixed $theme_set theme set |
||
113 | * @param mixed $template_set template set |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | 14 | public function setCompileId($module_dirname = null, $theme_set = null, $template_set = null) |
|
128 | |||
129 | /** |
||
130 | * XoopsTpl::clearModuleCompileCache() |
||
131 | * |
||
132 | * Clean up compiled and cached templates for a module |
||
133 | * |
||
134 | * TODO - handle $use_sub_dirs cases |
||
135 | * |
||
136 | * @param mixed $module_dirname module directory |
||
137 | * @param mixed $theme_set theme set |
||
138 | * @param mixed $template_set template set |
||
139 | * |
||
140 | * @return int number of deleted cache and compiler files |
||
141 | */ |
||
142 | public function clearModuleCompileCache($module_dirname = null, $theme_set = null, $template_set = null) |
||
163 | |||
164 | /** |
||
165 | * Empty cache for a specific template |
||
166 | * |
||
167 | * This is just a pass-through wrapper with a warning since this method previously existed |
||
168 | * only in XoopsTpl, but now is also a regular Smarty method. |
||
169 | * |
||
170 | * clearModuleCompileCache() is the replacement for the old clearCache |
||
171 | * |
||
172 | * @param string $template_name template name |
||
173 | * @param string $cache_id cache id |
||
174 | * @param string $compile_id compile id |
||
175 | * @param integer $exp_time expiration time |
||
176 | * @param string $type resource type |
||
177 | * |
||
178 | * @return integer number of cache files deleted |
||
179 | */ |
||
180 | 1 | public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) |
|
185 | } |
||
186 |