PageRenderTime 176ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/classes/Smarty_2.6.26/Smarty.class.php

https://bitbucket.org/flth/xtcm
PHP | 1972 lines | 1061 code | 177 blank | 734 comment | 140 complexity | c4fc6a0443cfeba5584251f51bcfa6eb MD5 | raw file
Possible License(s): AGPL-1.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Project: Smarty: the PHP compiling template engine
  4. * File: Smarty.class.php
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. * For questions, help, comments, discussion, etc., please join the
  21. * Smarty mailing list. Send a blank e-mail to
  22. * smarty-discussion-subscribe@googlegroups.com
  23. *
  24. * @link http://www.smarty.net/
  25. * @copyright 2001-2005 New Digital Group, Inc.
  26. * @author Monte Ohrt <monte at ohrt dot com>
  27. * @author Andrei Zmievski <andrei@php.net>
  28. * @package Smarty
  29. * @version 2.6.26
  30. * Modiied for xt:Commerce v3.0.4 SP2.1 (c)2009 by Hetfield - www.MerZ-IT-SerVice.de
  31. */
  32. /* $Id: Smarty.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
  33. /**
  34. * DIR_SEP isn't used anymore, but third party apps might
  35. */
  36. if(!defined('DIR_SEP')) {
  37. define('DIR_SEP', DIRECTORY_SEPARATOR);
  38. }
  39. /**
  40. * set SMARTY_DIR to absolute path to Smarty library files.
  41. * if not defined, include_path will be used. Sets SMARTY_DIR only if user
  42. * application has not already defined it.
  43. */
  44. if (!defined('SMARTY_DIR')) {
  45. define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
  46. }
  47. if (!defined('SMARTY_CORE_DIR')) {
  48. define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
  49. }
  50. define('SMARTY_PHP_PASSTHRU', 0);
  51. define('SMARTY_PHP_QUOTE', 1);
  52. define('SMARTY_PHP_REMOVE', 2);
  53. define('SMARTY_PHP_ALLOW', 3);
  54. /**
  55. * @package Smarty
  56. */
  57. class Smarty
  58. {
  59. /**#@+
  60. * Smarty Configuration Section
  61. */
  62. /**
  63. * The name of the directory where templates are located.
  64. *
  65. * @var string
  66. */
  67. var $template_dir = 'templates';
  68. /**
  69. * The directory where compiled templates are located.
  70. *
  71. * @var string
  72. */
  73. var $compile_dir = 'templates_c';
  74. /**
  75. * The directory where config files are located.
  76. *
  77. * @var string
  78. */
  79. // BOF - Tomcraft - 2009-05-26 - change path to "lang"
  80. // var $config_dir = 'configs';
  81. var $config_dir = 'lang'; // Modified for xt:Commerce v3.0.4 SP2.1 (c)2009 by Hetfield - www.MerZ-IT-SerVice.de
  82. // EOF - Tomcraft - 2009-05-26 - change path to "lang"
  83. /**
  84. * An array of directories searched for plugins.
  85. *
  86. * @var array
  87. */
  88. var $plugins_dir = array('plugins');
  89. /**
  90. * If debugging is enabled, a debug console window will display
  91. * when the page loads (make sure your browser allows unrequested
  92. * popup windows)
  93. *
  94. * @var boolean
  95. */
  96. var $debugging = false;
  97. /**
  98. * When set, smarty does uses this value as error_reporting-level.
  99. *
  100. * @var integer
  101. */
  102. var $error_reporting = null;
  103. /**
  104. * This is the path to the debug console template. If not set,
  105. * the default one will be used.
  106. *
  107. * @var string
  108. */
  109. var $debug_tpl = '';
  110. /**
  111. * This determines if debugging is enable-able from the browser.
  112. * <ul>
  113. * <li>NONE => no debugging control allowed</li>
  114. * <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
  115. * </ul>
  116. * @link http://www.foo.dom/index.php?SMARTY_DEBUG
  117. * @var string
  118. */
  119. var $debugging_ctrl = 'NONE';
  120. /**
  121. * This tells Smarty whether to check for recompiling or not. Recompiling
  122. * does not need to happen unless a template or config file is changed.
  123. * Typically you enable this during development, and disable for
  124. * production.
  125. *
  126. * @var boolean
  127. */
  128. var $compile_check = true;
  129. /**
  130. * This forces templates to compile every time. Useful for development
  131. * or debugging.
  132. *
  133. * @var boolean
  134. */
  135. var $force_compile = false;
  136. /**
  137. * This enables template caching.
  138. * <ul>
  139. * <li>0 = no caching</li>
  140. * <li>1 = use class cache_lifetime value</li>
  141. * <li>2 = use cache_lifetime in cache file</li>
  142. * </ul>
  143. * @var integer
  144. */
  145. var $caching = 0;
  146. /**
  147. * The name of the directory for cache files.
  148. *
  149. * @var string
  150. */
  151. var $cache_dir = 'cache';
  152. /**
  153. * This is the number of seconds cached content will persist.
  154. * <ul>
  155. * <li>0 = always regenerate cache</li>
  156. * <li>-1 = never expires</li>
  157. * </ul>
  158. *
  159. * @var integer
  160. */
  161. var $cache_lifetime = 3600;
  162. /**
  163. * Only used when $caching is enabled. If true, then If-Modified-Since headers
  164. * are respected with cached content, and appropriate HTTP headers are sent.
  165. * This way repeated hits to a cached page do not send the entire page to the
  166. * client every time.
  167. *
  168. * @var boolean
  169. */
  170. var $cache_modified_check = false;
  171. /**
  172. * This determines how Smarty handles "<?php ... ?>" tags in templates.
  173. * possible values:
  174. * <ul>
  175. * <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
  176. * <li>SMARTY_PHP_QUOTE -> escape tags as entities</li>
  177. * <li>SMARTY_PHP_REMOVE -> remove php tags</li>
  178. * <li>SMARTY_PHP_ALLOW -> execute php tags</li>
  179. * </ul>
  180. *
  181. * @var integer
  182. */
  183. var $php_handling = SMARTY_PHP_PASSTHRU;
  184. /**
  185. * This enables template security. When enabled, many things are restricted
  186. * in the templates that normally would go unchecked. This is useful when
  187. * untrusted parties are editing templates and you want a reasonable level
  188. * of security. (no direct execution of PHP in templates for example)
  189. *
  190. * @var boolean
  191. */
  192. var $security = false;
  193. /**
  194. * This is the list of template directories that are considered secure. This
  195. * is used only if {@link $security} is enabled. One directory per array
  196. * element. {@link $template_dir} is in this list implicitly.
  197. *
  198. * @var array
  199. */
  200. var $secure_dir = array();
  201. /**
  202. * These are the security settings for Smarty. They are used only when
  203. * {@link $security} is enabled.
  204. *
  205. * @var array
  206. */
  207. var $security_settings = array(
  208. 'PHP_HANDLING' => false,
  209. 'IF_FUNCS' => array('array', 'list',
  210. 'isset', 'empty',
  211. 'count', 'sizeof',
  212. 'in_array', 'is_array',
  213. 'true', 'false', 'null'),
  214. 'INCLUDE_ANY' => false,
  215. 'PHP_TAGS' => false,
  216. 'MODIFIER_FUNCS' => array('count'),
  217. 'ALLOW_CONSTANTS' => false,
  218. 'ALLOW_SUPER_GLOBALS' => true
  219. );
  220. /**
  221. * This is an array of directories where trusted php scripts reside.
  222. * {@link $security} is disabled during their inclusion/execution.
  223. *
  224. * @var array
  225. */
  226. var $trusted_dir = array();
  227. /**
  228. * The left delimiter used for the template tags.
  229. *
  230. * @var string
  231. */
  232. var $left_delimiter = '{';
  233. /**
  234. * The right delimiter used for the template tags.
  235. *
  236. * @var string
  237. */
  238. var $right_delimiter = '}';
  239. /**
  240. * The order in which request variables are registered, similar to
  241. * variables_order in php.ini E = Environment, G = GET, P = POST,
  242. * C = Cookies, S = Server
  243. *
  244. * @var string
  245. */
  246. var $request_vars_order = 'EGPCS';
  247. /**
  248. * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
  249. * are uses as request-vars or $_*[]-vars. note: if
  250. * request_use_auto_globals is true, then $request_vars_order has
  251. * no effect, but the php-ini-value "gpc_order"
  252. *
  253. * @var boolean
  254. */
  255. var $request_use_auto_globals = true;
  256. /**
  257. * Set this if you want different sets of compiled files for the same
  258. * templates. This is useful for things like different languages.
  259. * Instead of creating separate sets of templates per language, you
  260. * set different compile_ids like 'en' and 'de'.
  261. *
  262. * @var string
  263. */
  264. var $compile_id = null;
  265. /**
  266. * This tells Smarty whether or not to use sub dirs in the cache/ and
  267. * templates_c/ directories. sub directories better organized, but
  268. * may not work well with PHP safe mode enabled.
  269. *
  270. * @var boolean
  271. *
  272. */
  273. var $use_sub_dirs = false;
  274. /**
  275. * This is a list of the modifiers to apply to all template variables.
  276. * Put each modifier in a separate array element in the order you want
  277. * them applied. example: <code>array('escape:"htmlall"');</code>
  278. *
  279. * @var array
  280. */
  281. var $default_modifiers = array();
  282. /**
  283. * This is the resource type to be used when not specified
  284. * at the beginning of the resource path. examples:
  285. * $smarty->display('file:index.tpl');
  286. * $smarty->display('db:index.tpl');
  287. * $smarty->display('index.tpl'); // will use default resource type
  288. * {include file="file:index.tpl"}
  289. * {include file="db:index.tpl"}
  290. * {include file="index.tpl"} {* will use default resource type *}
  291. *
  292. * @var array
  293. */
  294. var $default_resource_type = 'file';
  295. /**
  296. * The function used for cache file handling. If not set, built-in caching is used.
  297. *
  298. * @var null|string function name
  299. */
  300. var $cache_handler_func = null;
  301. /**
  302. * This indicates which filters are automatically loaded into Smarty.
  303. *
  304. * @var array array of filter names
  305. */
  306. var $autoload_filters = array();
  307. /**#@+
  308. * @var boolean
  309. */
  310. /**
  311. * This tells if config file vars of the same name overwrite each other or not.
  312. * if disabled, same name variables are accumulated in an array.
  313. */
  314. var $config_overwrite = true;
  315. /**
  316. * This tells whether or not to automatically booleanize config file variables.
  317. * If enabled, then the strings "on", "true", and "yes" are treated as boolean
  318. * true, and "off", "false" and "no" are treated as boolean false.
  319. */
  320. var $config_booleanize = true;
  321. /**
  322. * This tells whether hidden sections [.foobar] are readable from the
  323. * tempalates or not. Normally you would never allow this since that is
  324. * the point behind hidden sections: the application can access them, but
  325. * the templates cannot.
  326. */
  327. var $config_read_hidden = false;
  328. /**
  329. * This tells whether or not automatically fix newlines in config files.
  330. * It basically converts \r (mac) or \r\n (dos) to \n
  331. */
  332. var $config_fix_newlines = true;
  333. /**#@-*/
  334. /**
  335. * If a template cannot be found, this PHP function will be executed.
  336. * Useful for creating templates on-the-fly or other special action.
  337. *
  338. * @var string function name
  339. */
  340. var $default_template_handler_func = '';
  341. /**
  342. * The file that contains the compiler class. This can a full
  343. * pathname, or relative to the php_include path.
  344. *
  345. * @var string
  346. */
  347. var $compiler_file = 'Smarty_Compiler.class.php';
  348. /**
  349. * The class used for compiling templates.
  350. *
  351. * @var string
  352. */
  353. var $compiler_class = 'Smarty_Compiler';
  354. /**
  355. * The class used to load config vars.
  356. *
  357. * @var string
  358. */
  359. var $config_class = 'Config_File';
  360. /**#@+
  361. * END Smarty Configuration Section
  362. * There should be no need to touch anything below this line.
  363. * @access private
  364. */
  365. /**
  366. * where assigned template vars are kept
  367. *
  368. * @var array
  369. */
  370. var $_tpl_vars = array();
  371. /**
  372. * stores run-time $smarty.* vars
  373. *
  374. * @var null|array
  375. */
  376. var $_smarty_vars = null;
  377. /**
  378. * keeps track of sections
  379. *
  380. * @var array
  381. */
  382. var $_sections = array();
  383. /**
  384. * keeps track of foreach blocks
  385. *
  386. * @var array
  387. */
  388. var $_foreach = array();
  389. /**
  390. * keeps track of tag hierarchy
  391. *
  392. * @var array
  393. */
  394. var $_tag_stack = array();
  395. /**
  396. * configuration object
  397. *
  398. * @var Config_file
  399. */
  400. var $_conf_obj = null;
  401. /**
  402. * loaded configuration settings
  403. *
  404. * @var array
  405. */
  406. var $_config = array(array('vars' => array(), 'files' => array()));
  407. /**
  408. * md5 checksum of the string 'Smarty'
  409. *
  410. * @var string
  411. */
  412. var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f';
  413. /**
  414. * Smarty version number
  415. *
  416. * @var string
  417. */
  418. var $_version = '2.6.26';
  419. /**
  420. * current template inclusion depth
  421. *
  422. * @var integer
  423. */
  424. var $_inclusion_depth = 0;
  425. /**
  426. * for different compiled templates
  427. *
  428. * @var string
  429. */
  430. var $_compile_id = null;
  431. /**
  432. * text in URL to enable debug mode
  433. *
  434. * @var string
  435. */
  436. var $_smarty_debug_id = 'SMARTY_DEBUG';
  437. /**
  438. * debugging information for debug console
  439. *
  440. * @var array
  441. */
  442. var $_smarty_debug_info = array();
  443. /**
  444. * info that makes up a cache file
  445. *
  446. * @var array
  447. */
  448. var $_cache_info = array();
  449. /**
  450. * default file permissions
  451. *
  452. * @var integer
  453. */
  454. var $_file_perms = 0644;
  455. /**
  456. * default dir permissions
  457. *
  458. * @var integer
  459. */
  460. var $_dir_perms = 0771;
  461. /**
  462. * registered objects
  463. *
  464. * @var array
  465. */
  466. var $_reg_objects = array();
  467. /**
  468. * table keeping track of plugins
  469. *
  470. * @var array
  471. */
  472. var $_plugins = array(
  473. 'modifier' => array(),
  474. 'function' => array(),
  475. 'block' => array(),
  476. 'compiler' => array(),
  477. 'prefilter' => array(),
  478. 'postfilter' => array(),
  479. 'outputfilter' => array(),
  480. 'resource' => array(),
  481. 'insert' => array());
  482. /**
  483. * cache serials
  484. *
  485. * @var array
  486. */
  487. var $_cache_serials = array();
  488. /**
  489. * name of optional cache include file
  490. *
  491. * @var string
  492. */
  493. var $_cache_include = null;
  494. /**
  495. * indicate if the current code is used in a compiled
  496. * include
  497. *
  498. * @var string
  499. */
  500. var $_cache_including = false;
  501. /**#@-*/
  502. /**
  503. * The class constructor.
  504. */
  505. function Smarty()
  506. {
  507. $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
  508. : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
  509. }
  510. /**
  511. * assigns values to template variables
  512. *
  513. * @param array|string $tpl_var the template variable name(s)
  514. * @param mixed $value the value to assign
  515. */
  516. function assign($tpl_var, $value = null)
  517. {
  518. if (is_array($tpl_var)){
  519. foreach ($tpl_var as $key => $val) {
  520. if ($key != '') {
  521. $this->_tpl_vars[$key] = $val;
  522. }
  523. }
  524. } else {
  525. if ($tpl_var != '')
  526. $this->_tpl_vars[$tpl_var] = $value;
  527. }
  528. }
  529. /**
  530. * assigns values to template variables by reference
  531. *
  532. * @param string $tpl_var the template variable name
  533. * @param mixed $value the referenced value to assign
  534. */
  535. function assign_by_ref($tpl_var, &$value)
  536. {
  537. if ($tpl_var != '')
  538. $this->_tpl_vars[$tpl_var] = &$value;
  539. }
  540. /**
  541. * appends values to template variables
  542. *
  543. * @param array|string $tpl_var the template variable name(s)
  544. * @param mixed $value the value to append
  545. */
  546. function append($tpl_var, $value=null, $merge=false)
  547. {
  548. if (is_array($tpl_var)) {
  549. // $tpl_var is an array, ignore $value
  550. foreach ($tpl_var as $_key => $_val) {
  551. if ($_key != '') {
  552. if(!@is_array($this->_tpl_vars[$_key])) {
  553. settype($this->_tpl_vars[$_key],'array');
  554. }
  555. if($merge && is_array($_val)) {
  556. foreach($_val as $_mkey => $_mval) {
  557. $this->_tpl_vars[$_key][$_mkey] = $_mval;
  558. }
  559. } else {
  560. $this->_tpl_vars[$_key][] = $_val;
  561. }
  562. }
  563. }
  564. } else {
  565. if ($tpl_var != '' && isset($value)) {
  566. if(!@is_array($this->_tpl_vars[$tpl_var])) {
  567. settype($this->_tpl_vars[$tpl_var],'array');
  568. }
  569. if($merge && is_array($value)) {
  570. foreach($value as $_mkey => $_mval) {
  571. $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
  572. }
  573. } else {
  574. $this->_tpl_vars[$tpl_var][] = $value;
  575. }
  576. }
  577. }
  578. }
  579. /**
  580. * appends values to template variables by reference
  581. *
  582. * @param string $tpl_var the template variable name
  583. * @param mixed $value the referenced value to append
  584. */
  585. function append_by_ref($tpl_var, &$value, $merge=false)
  586. {
  587. if ($tpl_var != '' && isset($value)) {
  588. if(!@is_array($this->_tpl_vars[$tpl_var])) {
  589. settype($this->_tpl_vars[$tpl_var],'array');
  590. }
  591. if ($merge && is_array($value)) {
  592. foreach($value as $_key => $_val) {
  593. $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
  594. }
  595. } else {
  596. $this->_tpl_vars[$tpl_var][] = &$value;
  597. }
  598. }
  599. }
  600. /**
  601. * clear the given assigned template variable.
  602. *
  603. * @param string $tpl_var the template variable to clear
  604. */
  605. function clear_assign($tpl_var)
  606. {
  607. if (is_array($tpl_var))
  608. foreach ($tpl_var as $curr_var)
  609. unset($this->_tpl_vars[$curr_var]);
  610. else
  611. unset($this->_tpl_vars[$tpl_var]);
  612. }
  613. /**
  614. * Registers custom function to be used in templates
  615. *
  616. * @param string $function the name of the template function
  617. * @param string $function_impl the name of the PHP function to register
  618. */
  619. function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
  620. {
  621. $this->_plugins['function'][$function] =
  622. array($function_impl, null, null, false, $cacheable, $cache_attrs);
  623. }
  624. /**
  625. * Unregisters custom function
  626. *
  627. * @param string $function name of template function
  628. */
  629. function unregister_function($function)
  630. {
  631. unset($this->_plugins['function'][$function]);
  632. }
  633. /**
  634. * Registers object to be used in templates
  635. *
  636. * @param string $object name of template object
  637. * @param object &$object_impl the referenced PHP object to register
  638. * @param null|array $allowed list of allowed methods (empty = all)
  639. * @param boolean $smarty_args smarty argument format, else traditional
  640. * @param null|array $block_functs list of methods that are block format
  641. */
  642. function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
  643. {
  644. settype($allowed, 'array');
  645. settype($smarty_args, 'boolean');
  646. $this->_reg_objects[$object] =
  647. array(&$object_impl, $allowed, $smarty_args, $block_methods);
  648. }
  649. /**
  650. * Unregisters object
  651. *
  652. * @param string $object name of template object
  653. */
  654. function unregister_object($object)
  655. {
  656. unset($this->_reg_objects[$object]);
  657. }
  658. /**
  659. * Registers block function to be used in templates
  660. *
  661. * @param string $block name of template block
  662. * @param string $block_impl PHP function to register
  663. */
  664. function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
  665. {
  666. $this->_plugins['block'][$block] =
  667. array($block_impl, null, null, false, $cacheable, $cache_attrs);
  668. }
  669. /**
  670. * Unregisters block function
  671. *
  672. * @param string $block name of template function
  673. */
  674. function unregister_block($block)
  675. {
  676. unset($this->_plugins['block'][$block]);
  677. }
  678. /**
  679. * Registers compiler function
  680. *
  681. * @param string $function name of template function
  682. * @param string $function_impl name of PHP function to register
  683. */
  684. function register_compiler_function($function, $function_impl, $cacheable=true)
  685. {
  686. $this->_plugins['compiler'][$function] =
  687. array($function_impl, null, null, false, $cacheable);
  688. }
  689. /**
  690. * Unregisters compiler function
  691. *
  692. * @param string $function name of template function
  693. */
  694. function unregister_compiler_function($function)
  695. {
  696. unset($this->_plugins['compiler'][$function]);
  697. }
  698. /**
  699. * Registers modifier to be used in templates
  700. *
  701. * @param string $modifier name of template modifier
  702. * @param string $modifier_impl name of PHP function to register
  703. */
  704. function register_modifier($modifier, $modifier_impl)
  705. {
  706. $this->_plugins['modifier'][$modifier] =
  707. array($modifier_impl, null, null, false);
  708. }
  709. /**
  710. * Unregisters modifier
  711. *
  712. * @param string $modifier name of template modifier
  713. */
  714. function unregister_modifier($modifier)
  715. {
  716. unset($this->_plugins['modifier'][$modifier]);
  717. }
  718. /**
  719. * Registers a resource to fetch a template
  720. *
  721. * @param string $type name of resource
  722. * @param array $functions array of functions to handle resource
  723. */
  724. function register_resource($type, $functions)
  725. {
  726. if (count($functions)==4) {
  727. $this->_plugins['resource'][$type] =
  728. array($functions, false);
  729. } elseif (count($functions)==5) {
  730. $this->_plugins['resource'][$type] =
  731. array(array(array(&$functions[0], $functions[1])
  732. ,array(&$functions[0], $functions[2])
  733. ,array(&$functions[0], $functions[3])
  734. ,array(&$functions[0], $functions[4]))
  735. ,false);
  736. } else {
  737. $this->trigger_error("malformed function-list for '$type' in register_resource");
  738. }
  739. }
  740. /**
  741. * Unregisters a resource
  742. *
  743. * @param string $type name of resource
  744. */
  745. function unregister_resource($type)
  746. {
  747. unset($this->_plugins['resource'][$type]);
  748. }
  749. /**
  750. * Registers a prefilter function to apply
  751. * to a template before compiling
  752. *
  753. * @param callback $function
  754. */
  755. function register_prefilter($function)
  756. {
  757. $this->_plugins['prefilter'][$this->_get_filter_name($function)]
  758. = array($function, null, null, false);
  759. }
  760. /**
  761. * Unregisters a prefilter function
  762. *
  763. * @param callback $function
  764. */
  765. function unregister_prefilter($function)
  766. {
  767. unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]);
  768. }
  769. /**
  770. * Registers a postfilter function to apply
  771. * to a compiled template after compilation
  772. *
  773. * @param callback $function
  774. */
  775. function register_postfilter($function)
  776. {
  777. $this->_plugins['postfilter'][$this->_get_filter_name($function)]
  778. = array($function, null, null, false);
  779. }
  780. /**
  781. * Unregisters a postfilter function
  782. *
  783. * @param callback $function
  784. */
  785. function unregister_postfilter($function)
  786. {
  787. unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]);
  788. }
  789. /**
  790. * Registers an output filter function to apply
  791. * to a template output
  792. *
  793. * @param callback $function
  794. */
  795. function register_outputfilter($function)
  796. {
  797. $this->_plugins['outputfilter'][$this->_get_filter_name($function)]
  798. = array($function, null, null, false);
  799. }
  800. /**
  801. * Unregisters an outputfilter function
  802. *
  803. * @param callback $function
  804. */
  805. function unregister_outputfilter($function)
  806. {
  807. unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]);
  808. }
  809. /**
  810. * load a filter of specified type and name
  811. *
  812. * @param string $type filter type
  813. * @param string $name filter name
  814. */
  815. function load_filter($type, $name)
  816. {
  817. switch ($type) {
  818. case 'output':
  819. $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
  820. require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
  821. smarty_core_load_plugins($_params, $this);
  822. break;
  823. case 'pre':
  824. case 'post':
  825. if (!isset($this->_plugins[$type . 'filter'][$name]))
  826. $this->_plugins[$type . 'filter'][$name] = false;
  827. break;
  828. }
  829. }
  830. /**
  831. * clear cached content for the given template and cache id
  832. *
  833. * @param string $tpl_file name of template file
  834. * @param string $cache_id name of cache_id
  835. * @param string $compile_id name of compile_id
  836. * @param string $exp_time expiration time
  837. * @return boolean
  838. */
  839. function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
  840. {
  841. if (!isset($compile_id))
  842. $compile_id = $this->compile_id;
  843. if (!isset($tpl_file))
  844. $compile_id = null;
  845. $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
  846. if (!empty($this->cache_handler_func)) {
  847. return call_user_func_array($this->cache_handler_func,
  848. array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
  849. } else {
  850. $_params = array('auto_base' => $this->cache_dir,
  851. 'auto_source' => $tpl_file,
  852. 'auto_id' => $_auto_id,
  853. 'exp_time' => $exp_time);
  854. require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
  855. return smarty_core_rm_auto($_params, $this);
  856. }
  857. }
  858. /**
  859. * clear the entire contents of cache (all templates)
  860. *
  861. * @param string $exp_time expire time
  862. * @return boolean results of {@link smarty_core_rm_auto()}
  863. */
  864. function clear_all_cache($exp_time = null)
  865. {
  866. return $this->clear_cache(null, null, null, $exp_time);
  867. }
  868. /**
  869. * test to see if valid cache exists for this template
  870. *
  871. * @param string $tpl_file name of template file
  872. * @param string $cache_id
  873. * @param string $compile_id
  874. * @return string|false results of {@link _read_cache_file()}
  875. */
  876. function is_cached($tpl_file, $cache_id = null, $compile_id = null)
  877. {
  878. if (!$this->caching)
  879. return false;
  880. if (!isset($compile_id))
  881. $compile_id = $this->compile_id;
  882. $_params = array(
  883. 'tpl_file' => $tpl_file,
  884. 'cache_id' => $cache_id,
  885. 'compile_id' => $compile_id
  886. );
  887. require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
  888. return smarty_core_read_cache_file($_params, $this);
  889. }
  890. /**
  891. * clear all the assigned template variables.
  892. *
  893. */
  894. function clear_all_assign()
  895. {
  896. $this->_tpl_vars = array();
  897. }
  898. /**
  899. * clears compiled version of specified template resource,
  900. * or all compiled template files if one is not specified.
  901. * This function is for advanced use only, not normally needed.
  902. *
  903. * @param string $tpl_file
  904. * @param string $compile_id
  905. * @param string $exp_time
  906. * @return boolean results of {@link smarty_core_rm_auto()}
  907. */
  908. function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
  909. {
  910. if (!isset($compile_id)) {
  911. $compile_id = $this->compile_id;
  912. }
  913. $_params = array('auto_base' => $this->compile_dir,
  914. 'auto_source' => $tpl_file,
  915. 'auto_id' => $compile_id,
  916. 'exp_time' => $exp_time,
  917. 'extensions' => array('.inc', '.php'));
  918. require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
  919. return smarty_core_rm_auto($_params, $this);
  920. }
  921. /**
  922. * Checks whether requested template exists.
  923. *
  924. * @param string $tpl_file
  925. * @return boolean
  926. */
  927. function template_exists($tpl_file)
  928. {
  929. $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
  930. return $this->_fetch_resource_info($_params);
  931. }
  932. /**
  933. * Returns an array containing template variables
  934. *
  935. * @param string $name
  936. * @param string $type
  937. * @return array
  938. */
  939. function &get_template_vars($name=null)
  940. {
  941. if(!isset($name)) {
  942. return $this->_tpl_vars;
  943. } elseif(isset($this->_tpl_vars[$name])) {
  944. return $this->_tpl_vars[$name];
  945. } else {
  946. // var non-existant, return valid reference
  947. $_tmp = null;
  948. return $_tmp;
  949. }
  950. }
  951. /**
  952. * Returns an array containing config variables
  953. *
  954. * @param string $name
  955. * @param string $type
  956. * @return array
  957. */
  958. function &get_config_vars($name=null)
  959. {
  960. if(!isset($name) && is_array($this->_config[0])) {
  961. return $this->_config[0]['vars'];
  962. } else if(isset($this->_config[0]['vars'][$name])) {
  963. return $this->_config[0]['vars'][$name];
  964. } else {
  965. // var non-existant, return valid reference
  966. $_tmp = null;
  967. return $_tmp;
  968. }
  969. }
  970. /**
  971. * trigger Smarty error
  972. *
  973. * @param string $error_msg
  974. * @param integer $error_type
  975. */
  976. function trigger_error($error_msg, $error_type = E_USER_WARNING)
  977. {
  978. trigger_error("Smarty error: $error_msg", $error_type);
  979. }
  980. /**
  981. * executes & displays the template results
  982. *
  983. * @param string $resource_name
  984. * @param string $cache_id
  985. * @param string $compile_id
  986. */
  987. function display($resource_name, $cache_id = null, $compile_id = null)
  988. {
  989. $this->fetch($resource_name, $cache_id, $compile_id, true);
  990. }
  991. /**
  992. * executes & returns or displays the template results
  993. *
  994. * @param string $resource_name
  995. * @param string $cache_id
  996. * @param string $compile_id
  997. * @param boolean $display
  998. */
  999. function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
  1000. {
  1001. static $_cache_info = array();
  1002. $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
  1003. ? $this->error_reporting : error_reporting() & ~E_NOTICE);
  1004. if (!$this->debugging && $this->debugging_ctrl == 'URL') {
  1005. $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
  1006. if (@strstr($_query_string, $this->_smarty_debug_id)) {
  1007. if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
  1008. // enable debugging for this browser session
  1009. @setcookie('SMARTY_DEBUG', true);
  1010. $this->debugging = true;
  1011. } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
  1012. // disable debugging for this browser session
  1013. @setcookie('SMARTY_DEBUG', false);
  1014. $this->debugging = false;
  1015. } else {
  1016. // enable debugging for this page
  1017. $this->debugging = true;
  1018. }
  1019. } else {
  1020. $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
  1021. }
  1022. }
  1023. if ($this->debugging) {
  1024. // capture time for debugging info
  1025. $_params = array();
  1026. require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
  1027. $_debug_start_time = smarty_core_get_microtime($_params, $this);
  1028. $this->_smarty_debug_info[] = array('type' => 'template',
  1029. 'filename' => $resource_name,
  1030. 'depth' => 0);
  1031. $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
  1032. }
  1033. if (!isset($compile_id)) {
  1034. $compile_id = $this->compile_id;
  1035. }
  1036. $this->_compile_id = $compile_id;
  1037. $this->_inclusion_depth = 0;
  1038. if ($this->caching) {
  1039. // save old cache_info, initialize cache_info
  1040. array_push($_cache_info, $this->_cache_info);
  1041. $this->_cache_info = array();
  1042. $_params = array(
  1043. 'tpl_file' => $resource_name,
  1044. 'cache_id' => $cache_id,
  1045. 'compile_id' => $compile_id,
  1046. 'results' => null
  1047. );
  1048. require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
  1049. if (smarty_core_read_cache_file($_params, $this)) {
  1050. $_smarty_results = $_params['results'];
  1051. if (!empty($this->_cache_info['insert_tags'])) {
  1052. $_params = array('plugins' => $this->_cache_info['insert_tags']);
  1053. require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
  1054. smarty_core_load_plugins($_params, $this);
  1055. $_params = array('results' => $_smarty_results);
  1056. require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
  1057. $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
  1058. }
  1059. if (!empty($this->_cache_info['cache_serials'])) {
  1060. $_params = array('results' => $_smarty_results);
  1061. require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php');
  1062. $_smarty_results = smarty_core_process_compiled_include($_params, $this);
  1063. }
  1064. if ($display) {
  1065. if ($this->debugging)
  1066. {
  1067. // capture time for debugging info
  1068. $_params = array();
  1069. require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
  1070. $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
  1071. require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
  1072. $_smarty_results .= smarty_core_display_debug_console($_params, $this);
  1073. }
  1074. if ($this->cache_modified_check) {
  1075. $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
  1076. $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
  1077. $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
  1078. if (@count($this->_cache_info['insert_tags']) == 0
  1079. && !$this->_cache_serials
  1080. && $_gmt_mtime == $_last_modified_date) {
  1081. if (php_sapi_name()=='cgi')
  1082. header('Status: 304 Not Modified');
  1083. else
  1084. header('HTTP/1.1 304 Not Modified');
  1085. } else {
  1086. header('Last-Modified: '.$_gmt_mtime);
  1087. echo $_smarty_results;
  1088. }
  1089. } else {
  1090. echo $_smarty_results;
  1091. }
  1092. error_reporting($_smarty_old_error_level);
  1093. // restore initial cache_info
  1094. $this->_cache_info = array_pop($_cache_info);
  1095. return true;
  1096. } else {
  1097. error_reporting($_smarty_old_error_level);
  1098. // restore initial cache_info
  1099. $this->_cache_info = array_pop($_cache_info);
  1100. return $_smarty_results;
  1101. }
  1102. } else {
  1103. $this->_cache_info['template'][$resource_name] = true;
  1104. if ($this->cache_modified_check && $display) {
  1105. header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
  1106. }
  1107. }
  1108. }
  1109. // load filters that are marked as autoload
  1110. if (count($this->autoload_filters)) {
  1111. foreach ($this->autoload_filters as $_filter_type => $_filters) {
  1112. foreach ($_filters as $_filter) {
  1113. $this->load_filter($_filter_type, $_filter);
  1114. }
  1115. }
  1116. }
  1117. $_smarty_compile_path = $this->_get_compile_path($resource_name);
  1118. // if we just need to display the results, don't perform output
  1119. // buffering - for speed
  1120. $_cache_including = $this->_cache_including;
  1121. $this->_cache_including = false;
  1122. if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
  1123. if ($this->_is_compiled($resource_name, $_smarty_compile_path)
  1124. || $this->_compile_resource($resource_name, $_smarty_compile_path))
  1125. {
  1126. include($_smarty_compile_path);
  1127. }
  1128. } else {
  1129. ob_start();
  1130. if ($this->_is_compiled($resource_name, $_smarty_compile_path)
  1131. || $this->_compile_resource($resource_name, $_smarty_compile_path))
  1132. {
  1133. include($_smarty_compile_path);
  1134. }
  1135. $_smarty_results = ob_get_contents();
  1136. ob_end_clean();
  1137. foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) {
  1138. $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
  1139. }
  1140. }
  1141. if ($this->caching) {
  1142. $_params = array('tpl_file' => $resource_name,
  1143. 'cache_id' => $cache_id,
  1144. 'compile_id' => $compile_id,
  1145. 'results' => $_smarty_results);
  1146. require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php');
  1147. smarty_core_write_cache_file($_params, $this);
  1148. require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
  1149. $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
  1150. if ($this->_cache_serials) {
  1151. // strip nocache-tags from output
  1152. $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s'
  1153. ,''
  1154. ,$_smarty_results);
  1155. }
  1156. // restore initial cache_info
  1157. $this->_cache_info = array_pop($_cache_info);
  1158. }
  1159. $this->_cache_including = $_cache_including;
  1160. if ($display) {
  1161. if (isset($_smarty_results)) { echo $_smarty_results; }
  1162. if ($this->debugging) {
  1163. // capture time for debugging info
  1164. $_params = array();
  1165. require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
  1166. $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
  1167. require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
  1168. echo smarty_core_display_debug_console($_params, $this);
  1169. }
  1170. error_reporting($_smarty_old_error_level);
  1171. return;
  1172. } else {
  1173. error_reporting($_smarty_old_error_level);
  1174. // BOF - Tomcraft - 2009-05-26 - Modified for xt:Commerce v3.0.4 SP2.1
  1175. //if (isset($_smarty_results)) { return $_smarty_results; }
  1176. if (file_exists('includes/local/configure.php')) {
  1177. if (isset($_smarty_results)) { return '<!-- Begin: '.$resource_name.' -->'.$_smarty_results.'<!-- End: '.$resource_name.' -->'; }
  1178. } else {
  1179. if (isset($_smarty_results)) { return $_smarty_results; }
  1180. }
  1181. // EOF - Tomcraft - 2009-05-26 - Modified for xt:Commerce v3.0.4 SP2.1
  1182. }
  1183. }
  1184. /**
  1185. * load configuration values
  1186. *
  1187. * @param string $file
  1188. * @param string $section
  1189. * @param string $scope
  1190. */
  1191. function config_load($file, $section = null, $scope = 'global')
  1192. {
  1193. require_once($this->_get_plugin_filepath('function', 'config_load'));
  1194. smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
  1195. }
  1196. /**
  1197. * return a reference to a registered object
  1198. *
  1199. * @param string $name
  1200. * @return object
  1201. */
  1202. function &get_registered_object($name) {
  1203. if (!isset($this->_reg_objects[$name]))
  1204. $this->_trigger_fatal_error("'$name' is not a registered object");
  1205. if (!is_object($this->_reg_objects[$name][0]))
  1206. $this->_trigger_fatal_error("registered '$name' is not an object");
  1207. return $this->_reg_objects[$name][0];
  1208. }
  1209. /**
  1210. * clear configuration values
  1211. *
  1212. * @param string $var
  1213. */
  1214. function clear_config($var = null)
  1215. {
  1216. if(!isset($var)) {
  1217. // clear all values
  1218. $this->_config = array(array('vars' => array(),
  1219. 'files' => array()));
  1220. } else {
  1221. unset($this->_config[0]['vars'][$var]);
  1222. }
  1223. }
  1224. /**
  1225. * get filepath of requested plugin
  1226. *
  1227. * @param string $type
  1228. * @param string $name
  1229. * @return string|false
  1230. */
  1231. function _get_plugin_filepath($type, $name)
  1232. {
  1233. $_params = array('type' => $type, 'name' => $name);
  1234. require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php');
  1235. return smarty_core_assemble_plugin_filepath($_params, $this);
  1236. }
  1237. /**
  1238. * test if resource needs compiling
  1239. *
  1240. * @param string $resource_name
  1241. * @param string $compile_path
  1242. * @return boolean
  1243. */
  1244. function _is_compiled($resource_name, $compile_path)
  1245. {
  1246. if (!$this->force_compile && file_exists($compile_path)) {
  1247. if (!$this->compile_check) {
  1248. // no need to check compiled file
  1249. return true;
  1250. } else {
  1251. // get file source and timestamp
  1252. $_params = array('resource_name' => $resource_name, 'get_source'=>false);
  1253. if (!$this->_fetch_resource_info($_params)) {
  1254. return false;
  1255. }
  1256. if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
  1257. // template not expired, no recompile
  1258. return true;
  1259. } else {
  1260. // compile template
  1261. return false;
  1262. }
  1263. }
  1264. } else {
  1265. // compiled template does not exist, or forced compile
  1266. return false;
  1267. }
  1268. }
  1269. /**
  1270. * compile the template
  1271. *
  1272. * @param string $resource_name
  1273. * @param string $compile_path
  1274. * @return boolean
  1275. */
  1276. function _compile_resource($resource_name, $compile_path)
  1277. {
  1278. $_params = array('resource_name' => $resource_name);
  1279. if (!$this->_fetch_resource_info($_params)) {
  1280. return false;
  1281. }
  1282. $_source_content = $_params['source_content'];
  1283. $_cache_include = substr($compile_path, 0, -4).'.inc';
  1284. if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
  1285. // if a _cache_serial was set, we also have to write an include-file:
  1286. if ($this->_cache_include_info) {
  1287. require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
  1288. smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)), $this);
  1289. }
  1290. $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
  1291. require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
  1292. smarty_core_write_compiled_resource($_params, $this);
  1293. return true;
  1294. } else {
  1295. return false;
  1296. }
  1297. }
  1298. /**
  1299. * compile the given source
  1300. *
  1301. * @param string $resource_name
  1302. * @param string $source_content
  1303. * @param string $compiled_content
  1304. * @return boolean
  1305. */
  1306. function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
  1307. {
  1308. if (file_exists(SMARTY_DIR . $this->compiler_file)) {
  1309. require_once(SMARTY_DIR . $this->compiler_file);
  1310. } else {
  1311. // use include_path
  1312. require_once($this->compiler_file);
  1313. }
  1314. $smarty_compiler = new $this->compiler_class;
  1315. $smarty_compiler->template_dir = $this->template_dir;
  1316. $smarty_compiler->compile_dir = $this->compile_dir;
  1317. $smarty_compiler->plugins_dir = $this->plugins_dir;
  1318. $smarty_compiler->config_dir = $this->config_dir;
  1319. $smarty_compiler->force_compile = $this->force_compile;
  1320. $smarty_compiler->caching = $this->caching;
  1321. $smarty_compiler->php_handling = $this->php_handling;
  1322. $smarty_compiler->left_delimiter = $this->left_delimiter;
  1323. $smarty_compiler->right_delimiter = $this->right_delimiter;
  1324. $smarty_compiler->_version = $this->_version;
  1325. $smarty_compiler->security = $this->security;
  1326. $smarty_compiler->secure_dir = $this->secure_dir;
  1327. $smarty_compiler->security_settings = $this->security_settings;
  1328. $smarty_compiler->trusted_dir = $this->trusted_dir;
  1329. $smarty_compiler->use_sub_dirs = $this->use_sub_dirs;
  1330. $smarty_compiler->_reg_objects = &$this->_reg_objects;
  1331. $smarty_compiler->_plugins = &$this->_plugins;
  1332. $smarty_compiler->_tpl_vars = &$this->_tpl_vars;
  1333. $smarty_compiler->default_modifiers = $this->default_modifiers;
  1334. $smarty_compiler->compile_id = $this->_compile_id;
  1335. $smarty_compiler->_config = $this->_config;
  1336. $smarty_compiler->request_use_auto_globals = $this->request_use_auto_globals;
  1337. if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
  1338. $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
  1339. }
  1340. $smarty_compiler->_cache_include = $cache_include_path;
  1341. $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);
  1342. if ($smarty_compiler->_cache_serial) {
  1343. $this->_cache_include_info = array(
  1344. 'cache_serial'=>$smarty_compiler->_cache_serial
  1345. ,'plugins_code'=>$smarty_compiler->_plugins_code
  1346. ,'include_file_path' => $cache_include_path);
  1347. } else {
  1348. $this->_cache_include_info = null;
  1349. }
  1350. return $_results;
  1351. }
  1352. /**
  1353. * Get the compile path for this resource
  1354. *
  1355. * @param string $resource_name
  1356. * @return string results of {@link _get_auto_filename()}
  1357. */
  1358. function _get_compile_path($resource_name)
  1359. {
  1360. return $this->_get_auto_filename($this->compile_dir, $resource_name,
  1361. $this->_compile_id) . '.php';
  1362. }
  1363. /**
  1364. * fetch the template info. Gets timestamp, and source
  1365. * if get_source is true
  1366. *
  1367. * sets $source_content to the source of the template, and
  1368. * $resource_timestamp to its time stamp
  1369. * @param string $resource_name
  1370. * @param string $source_content
  1371. * @param integer $resource_timestamp
  1372. * @param boolean $get_source
  1373. * @param boolean $quiet
  1374. * @return boolean
  1375. */
  1376. function _fetch_resource_info(&$params)
  1377. {
  1378. if(!isset($params['get_source'])) { $params['get_source'] = true; }
  1379. if(!isset($params['quiet'])) { $params['quiet'] = false; }
  1380. $_return = false;
  1381. $_params = array('resource_name'

Large files files are truncated, but you can click here to view the full file