PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/library/vendors/Smarty-2.6.25/libs/Smarty.class.php

http://github.com/vanillaforums/Garden
PHP | 1981 lines | 1068 code | 181 blank | 732 comment | 138 complexity | 63e38a8bd9937bca641263e2fd78a4bc MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, AGPL-1.0, BSD-3-Clause, MIT

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

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