PageRenderTime 58ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/library/Smarty.class.php

https://bitbucket.org/DenizYldrm/openemr
PHP | 1984 lines | 1078 code | 177 blank | 729 comment | 133 complexity | 3bc5f221cd9f4be6c9ec5c0c2c80fddf MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, MPL-2.0, LGPL-2.1

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

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