1 <?php
3 /**
4 * Project: Smarty: the PHP compiling template engine
5 * File: Smarty.class.php
6 * SVN: $Id: Smarty.class.php 3557 2010-04-28 20:30:27Z Uwe.Tews $
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * For questions, help, comments, discussion, etc., please join the
23 * Smarty mailing list. Send a blank e-mail to
24 * smarty-discussion-subscribe@googlegroups.com
25 *
26 * @link http://www.smarty.net/
27 * @copyright 2008 New Digital Group, Inc.
28 * @author Monte Ohrt <monte at ohrt dot com>
29 * @author Uwe Tews
30 * @package Smarty
31 * @version 3-SVN$Rev: 3286 $
32 */
34 /**
35 * define shorthand directory separator constant
36 */
37 if (!defined('DS')) {
38 define('DS', DIRECTORY_SEPARATOR);
39 }
41 /**
42 * set SMARTY_DIR to absolute path to Smarty library files.
43 * Sets SMARTY_DIR only if user application has not already defined it.
44 */
45 if (!defined('SMARTY_DIR')) {
46 define('SMARTY_DIR', dirname(__FILE__) . DS);
47 }
49 /**
50 * set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
51 * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
52 */
53 if (!defined('SMARTY_SYSPLUGINS_DIR')) {
54 define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
55 }
56 if (!defined('SMARTY_PLUGINS_DIR')) {
57 define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
58 }
59 if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
60 define('SMARTY_RESOURCE_CHAR_SET', 'UTF-8');
61 }
62 if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
63 define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
64 }
66 /**
67 * define variable scopes
68 */
69 define('SMARTY_LOCAL_SCOPE', 0);
70 define('SMARTY_PARENT_SCOPE', 1);
71 define('SMARTY_ROOT_SCOPE', 2);
72 define('SMARTY_GLOBAL_SCOPE', 3);
74 /**
75 * define caching modes
76 */
77 define('SMARTY_CACHING_OFF', 0);
78 define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
79 define('SMARTY_CACHING_LIFETIME_SAVED', 2);
81 /**
82 * This determines how Smarty handles "<?php ... ?>" tags in templates.
83 * possible values:
84 */
85 define('SMARTY_PHP_PASSTHRU', 0); //-> print tags as plain text
86 define('SMARTY_PHP_QUOTE', 1); //-> escape tags as entities
87 define('SMARTY_PHP_REMOVE', 2); //-> escape tags as entities
88 define('SMARTY_PHP_ALLOW', 3); //-> escape tags as entities
90 /**
91 * register the class autoloader
92 */
93 if (!defined('SMARTY_SPL_AUTOLOAD')) {
94 define('SMARTY_SPL_AUTOLOAD', 0);
95 }
97 if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) {
98 $registeredAutoLoadFunctions = spl_autoload_functions();
99 if (!isset($registeredAutoLoadFunctions['spl_autoload'])) {
100 spl_autoload_register();
101 }
102 } else {
103 spl_autoload_register('smartyAutoload');
104 }
106 /**
107 * This is the main Smarty class
108 */
109 class Smarty extends Smarty_Internal_Data {
110 // smarty version
111 const SMARTY_VERSION = 'Smarty-3.0-RC2';
112 // auto literal on delimiters with whitspace
113 public $auto_literal = true;
114 // display error on not assigned variables
115 public $error_unassigned = false;
116 // template directory
117 public $template_dir = null;
118 // default template handler
119 public $default_template_handler_func = null;
120 // compile directory
121 public $compile_dir = null;
122 // plugins directory
123 public $plugins_dir = null;
124 // cache directory
125 public $cache_dir = null;
126 // config directory
127 public $config_dir = null;
128 // force template compiling?
129 public $force_compile = false;
130 // check template for modifications?
131 public $compile_check = true;
132 // locking concurrent compiles
133 public $compile_locking = true;
134 // use sub dirs for compiled/cached files?
135 public $use_sub_dirs = false;
136 // compile_error?
137 public $compile_error = false;
138 // caching enabled
139 public $caching = false;
140 // merge compiled includea
141 public $merge_compiled_includes = false;
142 // cache lifetime
143 public $cache_lifetime = 3600;
144 // force cache file creation
145 public $force_cache = false;
146 // cache_id
147 public $cache_id = null;
148 // compile_id
149 public $compile_id = null;
150 // template delimiters
151 public $left_delimiter = "{";
152 public $right_delimiter = "}";
153 // security
154 public $security_class = 'Smarty_Security';
155 public $php_handling = SMARTY_PHP_PASSTHRU;
156 public $allow_php_tag = false;
157 public $allow_php_templates = false;
158 public $security = false;
159 public $security_policy = null;
160 public $security_handler = null;
161 public $direct_access_security = true;
162 // debug mode
163 public $debugging = false;
164 public $debugging_ctrl = 'NONE';
165 public $smarty_debug_id = 'SMARTY_DEBUG';
166 public $debug_tpl = null;
167 // When set, smarty does uses this value as error_reporting-level.
168 public $error_reporting = null;
169 // config var settings
170 public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
171 public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
172 public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
173 // config vars
174 public $config_vars = array();
175 // assigned tpl vars
176 public $tpl_vars = array();
177 // assigned global tpl vars
178 public $global_tpl_vars = array();
179 // dummy parent object
180 public $parent = null;
181 // global template functions
182 public $template_functions = array();
183 // resource type used if none given
184 public $default_resource_type = 'file';
185 // caching type
186 public $caching_type = 'file';
187 // internal cache resource types
188 public $cache_resource_types = array('file');
189 // internal cache resource objects
190 public $cache_resource_objects = array();
191 // internal config properties
192 public $properties = array();
193 // config type
194 public $default_config_type = 'file';
195 // exception handler: array('ExceptionClass','ExceptionMethod');
196 public $exception_handler = null;
197 // cached template objects
198 public $template_objects = null;
199 // check If-Modified-Since headers
200 public $cache_modified_check = false;
201 // registered plugins
202 public $registered_plugins = array();
203 // plugin search order
204 public $plugin_search_order = array('function', 'block', 'compiler', 'class');
205 // registered objects
206 public $registered_objects = array();
207 // registered filters
208 public $registered_filters = array();
209 // autoload filter
210 public $autoload_filters = array();
211 // status of filter on variable output
212 public $variable_filter = true;
213 // default modifier
214 public $default_modifiers = array();
215 // global internal smarty vars
216 public $_smarty_vars = array();
217 // start time for execution time calculation
218 public $start_time = 0;
219 // default file permissions
220 public $_file_perms = 0644;
221 // default dir permissions
222 public $_dir_perms = 0771;
223 // smarty object reference
224 public $smarty = null;
225 // block data at template inheritance
226 public $block_data = array();
227 public $block_data_stack = array();
228 // block tag hierarchy
229 public $_tag_stack = array();
230 // plugins
231 public $_plugins = array();
232 // generate deprecated function call notices?
233 public $deprecation_notices = true;
235 /**
236 * Class constructor, initializes basic smarty properties
237 */
238 public function __construct()
239 {
240 // self reference needed by other classes methods
241 $this->smarty = $this;
243 if (is_callable('mb_internal_encoding')) {
244 mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
245 }
246 $this->start_time = $this->_get_time();
247 // set exception handler
248 if (!empty($this->exception_handler))
249 set_exception_handler($this->exception_handler);
250 // set default dirs
251 $this->template_dir = array('.' . DS . 'templates' . DS);
252 $this->compile_dir = '.' . DS . 'templates_c' . DS;
253 $this->plugins_dir = array(SMARTY_PLUGINS_DIR);
254 $this->cache_dir = '.' . DS . 'cache' . DS;
255 $this->config_dir = '.' . DS . 'configs' . DS;
256 $this->debug_tpl = SMARTY_DIR . 'debug.tpl';
257 if (!$this->debugging && $this->debugging_ctrl == 'URL') {
258 if (isset($_SERVER['QUERY_STRING'])) {
259 $_query_string = $_SERVER['QUERY_STRING'];
260 } else {
261 $_query_string = '';
262 }
263 if (false !== strpos($_query_string, $this->smarty_debug_id)) {
264 if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) {
265 // enable debugging for this browser session
266 setcookie('SMARTY_DEBUG', true);
267 $this->debugging = true;
268 } elseif (false !== strpos($_query_string, $this->smarty_debug_id . '=off')) {
269 // disable debugging for this browser session
270 setcookie('SMARTY_DEBUG', false);
271 $this->debugging = false;
272 } else {
273 // enable debugging for this page
274 $this->debugging = true;
275 }
276 } else {
277 if (isset($_COOKIE['SMARTY_DEBUG'])) {
278 $this->debugging = true;
279 }
280 }
281 }
282 if (isset($_SERVER['SCRIPT_NAME'])) {
283 $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
284 }
285 }
287 /**
288 * Class destructor
289 */
290 public function __destruct()
291 {
292 // restore to previous exception handler, if any
293 if (!empty($this->exception_handler))
294 restore_exception_handler();
295 }
297 /**
298 * fetches a rendered Smarty template
299 *
300 * @param string $template the resource handle of the template file or template object
301 * @param mixed $cache_id cache id to be used with this template
302 * @param mixed $compile_id compile id to be used with this template
303 * @param object $ |null $parent next higher level of Smarty variables
304 * @return string rendered template output
305 */
306 public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false)
307 {
308 if (is_object($cache_id)) {
309 $parent = $cache_id;
310 $cache_id = null;
311 }
312 if ($parent === null) {
313 // get default Smarty data object
314 $parent = $this;
315 }
316 array_push($this->block_data_stack, $this->block_data);
317 $this->block_data = array();
318 // create template object if necessary
319 ($template instanceof $this->template_class)? $_template = $template :
320 $_template = $this->createTemplate ($template, $cache_id, $compile_id, $parent);
321 $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
322 ? $this->error_reporting : error_reporting() &~E_NOTICE);
323 // obtain data for cache modified check
324 if ($this->cache_modified_check && $this->caching && $display) {
325 $_isCached = $_template->isCached() && !$_template->has_nocache_code;
326 if ($_isCached) {
327 $_gmt_mtime = gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT';
328 } else {
329 $_gmt_mtime = '';
330 }
331 }
332 // return redered template
333 if (isset($this->autoload_filters['output']) || isset($this->registered_filters['output'])) {
334 $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $this, $_template);
335 } else {
336 $_output = $_template->getRenderedTemplate();
337 }
338 $_template->rendered_content = null;
339 error_reporting($_smarty_old_error_level);
340 // display or fetch
341 if ($display) {
342 if ($this->caching && $this->cache_modified_check) {
343 $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
344 if ($_isCached && $_gmt_mtime == $_last_modified_date) {
345 if (php_sapi_name() == 'cgi')
346 header('Status: 304 Not Modified');
347 else
348 header('HTTP/1.1 304 Not Modified');
349 } else {
350 header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT');
351 echo $_output;
352 }
353 } else {
354 echo $_output;
355 }
356 // debug output
357 if ($this->debugging) {
358 Smarty_Internal_Debug::display_debug($this);
359 }
360 $this->block_data = array_pop($this->block_data_stack);
361 return;
362 } else {
363 // return fetched content
364 $this->block_data = array_pop($this->block_data_stack);
365 return $_output;
366 }
367 }
369 /**
370 * displays a Smarty template
371 *
372 * @param string $ |object $template the resource handle of the template file or template object
373 * @param mixed $cache_id cache id to be used with this template
374 * @param mixed $compile_id compile id to be used with this template
375 * @param object $parent next higher level of Smarty variables
376 */
377 public function display($template, $cache_id = null, $compile_id = null, $parent = null)
378 {
379 // display template
380 $this->fetch ($template, $cache_id, $compile_id, $parent, true);
381 }
383 /**
384 * test if cache i valid
385 *
386 * @param string $ |object $template the resource handle of the template file or template object
387 * @param mixed $cache_id cache id to be used with this template
388 * @param mixed $compile_id compile id to be used with this template
389 * @return boolean cache status
390 */
391 public function isCached($template, $cache_id = null, $compile_id = null)
392 {
393 if (!($template instanceof $this->template_class)) {
394 $template = $this->createTemplate ($template, $cache_id, $compile_id, $this);
395 }
396 // return cache status of template
397 return $template->isCached();
398 }
400 /**
401 * creates a data object
402 *
403 * @param object $parent next higher level of Smarty variables
404 * @returns object data object
405 */
406 public function createData($parent = null)
407 {
408 return new Smarty_Data($parent, $this);
409 }
411 /**
412 * creates a template object
413 *
414 * @param string $template the resource handle of the template file
415 * @param object $parent next higher level of Smarty variables
416 * @param mixed $cache_id cache id to be used with this template
417 * @param mixed $compile_id compile id to be used with this template
418 * @returns object template object
419 */
420 public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
421 {
422 if (is_object($cache_id) || is_array($cache_id)) {
423 $parent = $cache_id;
424 $cache_id = null;
425 }
426 if (is_array($parent)) {
427 $data = $parent;
428 $parent = null;
429 } else {
430 $data = null;
431 }
432 if (!is_object($template)) {
433 // we got a template resource
434 // already in template cache?
435 $_templateId = crc32($template . $cache_id . $compile_id);
436 if (isset($this->template_objects[$_templateId]) && $this->caching) {
437 // return cached template object
438 $tpl = $this->template_objects[$_templateId];
439 } else {
440 // create new template object
441 $tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
442 }
443 } else {
444 // just return a copy of template class
445 $tpl = $template;
446 }
447 // fill data if present
448 if (is_array($data)) {
449 // set up variable values
450 foreach ($data as $_key => $_val) {
451 $tpl->tpl_vars[$_key] = new Smarty_variable($_val);
452 }
453 }
454 return $tpl;
455 }
457 /**
458 * Loads security class and enables security
459 */
460 public function enableSecurity()
461 {
462 if (isset($this->security_class)) {
463 $this->security_policy = new $this->security_class;
464 $this->security_handler = new Smarty_Internal_Security_Handler($this);
465 $this->security = true;
466 } else {
467 throw new Exception('Property security_class is not defined');
468 }
469 }
471 /**
472 * Disable security
473 */
474 public function disableSecurity()
475 {
476 $this->security = false;
477 }
479 /**
480 * Set template directory
481 *
482 * @param string $ |array $template_dir folder(s) of template sorces
483 */
484 public function setTemplateDir($template_dir)
485 {
486 $this->template_dir = (array)$template_dir;
487 return;
488 }
490 /**
491 * Adds template directory(s) to existing ones
492 *
493 * @param string $ |array $template_dir folder(s) of template sources
494 */
495 public function addTemplateDir($template_dir)
496 {
497 $this->template_dir = array_merge((array)$this->template_dir, (array)$template_dir);
498 $this->template_dir = array_unique($this->template_dir);
499 return;
500 }
502 /**
503 * Check if a template resource exists
504 *
505 * @param string $resource_name template name
506 * @return boolean status
507 */
508 function templateExists($resource_name)
509 {
510 // create template object
511 $tpl = new $this->template_class($resource_name, $this);
512 // check if it does exists
513 return $tpl->isExisting();
514 }
516 /**
517 * Takes unknown classes and loads plugin files for them
518 * class name format: Smarty_PluginType_PluginName
519 * plugin filename format: plugintype.pluginname.php
520 *
521 * @param string $plugin_name class plugin name to load
522 * @return string |boolean filepath of loaded file or false
523 */
524 public function loadPlugin($plugin_name, $check = true)
525 {
526 // if function or class exists, exit silently (already loaded)
527 if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
528 return true;
529 // Plugin name is expected to be: Smarty_[Type]_[Name]
530 $_plugin_name = strtolower($plugin_name);
531 $_name_parts = explode('_', $_plugin_name, 3);
532 // class name must have three parts to be valid plugin
533 if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
534 throw new Exception("plugin {$plugin_name} is not a valid name format");
535 return false;
536 }
537 // if type is "internal", get plugin from sysplugins
538 if ($_name_parts[1] == 'internal') {
539 $file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
540 if (file_exists($file)) {
541 require_once($file);
542 return $file;
543 } else {
544 return false;
545 }
546 }
547 // plugin filename is expected to be: [type].[name].php
548 $_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
549 // loop through plugin dirs and find the plugin
550 foreach((array)$this->plugins_dir as $_plugin_dir) {
551 if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
552 $_plugin_dir .= DS;
553 }
554 $file = $_plugin_dir . $_plugin_filename;
555 if (file_exists($file)) {
556 require_once($file);
557 return $file;
558 }
559 }
560 // no plugin loaded
561 return false;
562 }
564 /**
565 * load a filter of specified type and name
566 *
567 * @param string $type filter type
568 * @param string $name filter name
569 * @return bool
570 */
571 function loadFilter($type, $name)
572 {
573 $_plugin = "smarty_{$type}filter_{$name}";
574 $_filter_name = $_plugin;
575 if ($this->loadPlugin($_plugin)) {
576 if (class_exists($_plugin, false)) {
577 $_plugin = array($_plugin, 'execute');
578 }
579 if (is_callable($_plugin)) {
580 return $this->registered_filters[$type][$_filter_name] = $_plugin;
581 }
582 }
583 throw new Exception("{$type}filter \"{$name}\" not callable");
584 return false;
585 }
587 /**
588 * Sets the exception handler for Smarty.
589 *
590 * @param mixed $handler function name or array with object/method names
591 * @return string previous exception handler
592 */
593 public function setExceptionHandler($handler)
594 {
595 $this->exception_handler = $handler;
596 return set_exception_handler($handler);
597 }
599 /**
600 * trigger Smarty error
601 *
602 * @param string $error_msg
603 * @param integer $error_type
604 */
605 public function trigger_error($error_msg, $error_type = E_USER_WARNING)
606 {
607 throw new Exception("Smarty error: $error_msg");
608 }
610 /**
611 * Return internal filter name
612 *
613 * @param callback $function_name
614 */
615 public function _get_filter_name($function_name)
616 {
617 if (is_array($function_name)) {
618 $_class_name = (is_object($function_name[0]) ?
619 get_class($function_name[0]) : $function_name[0]);
620 return $_class_name . '_' . $function_name[1];
621 } else {
622 return $function_name;
623 }
624 }
626 /**
627 * Adds directory of plugin files
628 *
629 * @param object $smarty
630 * @param string $ |array $ plugins folder
631 * @return
632 */
633 function addPluginsDir($plugins_dir)
634 {
635 $this->plugins_dir = array_merge((array)$this->plugins_dir, (array)$plugins_dir);
636 $this->plugins_dir = array_unique($this->plugins_dir);
637 return;
638 }
640 /**
641 * Returns a single or all global variables
642 *
643 * @param object $smarty
644 * @param string $varname variable name or null
645 * @return string variable value or or array of variables
646 */
647 function getGlobal($varname = null)
648 {
649 if (isset($varname)) {
650 if (isset($this->global_tpl_vars[$varname])) {
651 return $this->global_tpl_vars[$varname]->value;
652 } else {
653 return '';
654 }
655 } else {
656 $_result = array();
657 foreach ($this->global_tpl_vars AS $key => $var) {
658 $_result[$key] = $var->value;
659 }
660 return $_result;
661 }
662 }
664 /**
665 * return a reference to a registered object
666 *
667 * @param string $name object name
668 * @return object
669 */
670 function getRegisteredObject($name)
671 {
672 if (!isset($this->registered_objects[$name]))
673 throw new Exception("'$name' is not a registered object");
675 if (!is_object($this->registered_objects[$name][0]))
676 throw new Exception("registered '$name' is not an object");
678 return $this->registered_objects[$name][0];
679 }
681 /**
682 * return name of debugging template
683 *
684 * @return string
685 */
686 function getDebugTemplate()
687 {
688 return $this->debug_tpl;
689 }
691 /**
692 * set the debug template
693 *
694 * @param string $tpl_name
695 * @return bool
696 */
697 function setDebugTemplate($tpl_name)
698 {
699 return $this->debug_tpl = $tpl_name;
700 }
702 /**
703 * lazy loads (valid) property objects
704 *
705 * @param string $name property name
706 */
707 public function __get($name)
708 {
709 if (in_array($name, array('register', 'unregister', 'utility', 'cache'))) {
710 $class = "Smarty_Internal_" . ucfirst($name);
711 $this->$name = new $class($this);
712 return $this->$name;
713 } else if ($name == '_version') {
714 // Smarty 2 BC
715 $this->_version = self::SMARTY_VERSION;
716 return $this->_version;
717 }
718 return null;
719 }
721 /**
722 * Takes unknown class methods and lazy loads sysplugin files for them
723 * class name format: Smarty_Method_MethodName
724 * plugin filename format: method.methodname.php
725 *
726 * @param string $name unknown methode name
727 * @param array $args aurgument array
728 */
729 public function __call($name, $args)
730 {
731 static $camel_func;
732 if (!isset($camel_func))
733 $camel_func = create_function('$c', 'return "_" . strtolower($c[1]);');
734 // PHP4 call to constructor?
735 if (strtolower($name) == 'smarty') {
736 throw new Exception('Please use parent::__construct() to call parent constuctor');
737 return false;
738 }
739 // see if this is a set/get for a property
740 $first3 = strtolower(substr($name, 0, 3));
741 if (in_array($first3, array('set', 'get')) && substr($name, 3, 1) !== '_') {
742 // try to keep case correct for future PHP 6.0 case-sensitive class methods
743 // lcfirst() not available < PHP 5.3.0, so improvise
744 $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);
745 // convert camel case to underscored name
746 $property_name = preg_replace_callback('/([A-Z])/', $camel_func, $property_name);
747 if (!property_exists($this, $property_name)) {
748 throw new Exception("property '$property_name' does not exist.");
749 return false;
750 }
751 if ($first3 == 'get')
752 return $this->$property_name;
753 else
754 return $this->$property_name = $args[0];
755 }
756 // Smarty Backward Compatible wrapper
757 if (!isset($this->wrapper)) {
758 $this->wrapper = new Smarty_Internal_Wrapper($this);
759 }
760 return $this->wrapper->convert($name, $args);
761 }
762 }
764 function smartyAutoload($class)
765 {
766 $_class = strtolower($class);
767 if (substr($_class, 0, 16) === 'smarty_internal_' || $_class == 'smarty_security') {
768 include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
769 }
770 }
772 ?>