⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smarty.class.php

📁 类似youtube的视频分享网站源码。有后台管理系统及模板
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/** * Project:     Smarty: the PHP compiling template engine * File:        Smarty.class.php * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * For questions, help, comments, discussion, etc., please join the * Smarty mailing list. Send a blank e-mail to * smarty-general-subscribe@lists.php.net * * @link http://smarty.php.net/ * @copyright 2001-2004 ispi of Lincoln, Inc. * @author Monte Ohrt <monte@ispi.net> * @author Andrei Zmievski <andrei@php.net> * @package Smarty * @version 2.6.6 *//* $Id: Smarty.class.php,v 1.504 2004/10/01 15:26:44 messju Exp $ *//** * DIR_SEP isn't used anymore, but third party apps might */if(!defined('DIR_SEP')) {    define('DIR_SEP', DIRECTORY_SEPARATOR);}/** * set SMARTY_DIR to absolute path to Smarty library files. * if not defined, include_path will be used. Sets SMARTY_DIR only if user * application has not already defined it. */if (!defined('SMARTY_DIR')) {    define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);}if (!defined('SMARTY_CORE_DIR')) {    define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);}define('SMARTY_PHP_PASSTHRU',   0);define('SMARTY_PHP_QUOTE',      1);define('SMARTY_PHP_REMOVE',     2);define('SMARTY_PHP_ALLOW',      3);/** * @package Smarty */class Smarty{    /**#@+     * Smarty Configuration Section     */    /**     * The name of the directory where templates are located.     *     * @var string     */    var $template_dir    =  'templates';    /**     * The directory where compiled templates are located.     *     * @var string     */    var $compile_dir     =  'templates_c';    /**     * The directory where config files are located.     *     * @var string     */    var $config_dir      =  'configs';    /**     * An array of directories searched for plugins.     *     * @var array     */    var $plugins_dir     =  array('plugins');    /**     * If debugging is enabled, a debug console window will display     * when the page loads (make sure your browser allows unrequested     * popup windows)     *     * @var boolean     */    var $debugging       =  false;    /**     * When set, smarty does uses this value as error_reporting-level.     *     * @var boolean     */    var $error_reporting  =  null;    /**     * This is the path to the debug console template. If not set,     * the default one will be used.     *     * @var string     */    var $debug_tpl       =  '';    /**     * This determines if debugging is enable-able from the browser.     * <ul>     *  <li>NONE => no debugging control allowed</li>     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>     * </ul>     * @link http://www.foo.dom/index.php?SMARTY_DEBUG     * @var string     */    var $debugging_ctrl  =  'NONE';    /**     * This tells Smarty whether to check for recompiling or not. Recompiling     * does not need to happen unless a template or config file is changed.     * Typically you enable this during development, and disable for     * production.     *     * @var boolean     */    var $compile_check   =  true;    /**     * This forces templates to compile every time. Useful for development     * or debugging.     *     * @var boolean     */    var $force_compile   =  false;    /**     * This enables template caching.     * <ul>     *  <li>0 = no caching</li>     *  <li>1 = use class cache_lifetime value</li>     *  <li>2 = use cache_lifetime in cache file</li>     * </ul>     * @var integer     */    var $caching         =  0;    /**     * The name of the directory for cache files.     *     * @var string     */    var $cache_dir       =  'cache';    /**     * This is the number of seconds cached content will persist.     * <ul>     *  <li>0 = always regenerate cache</li>     *  <li>-1 = never expires</li>     * </ul>     *     * @var integer     */    var $cache_lifetime  =  3600;    /**     * Only used when $caching is enabled. If true, then If-Modified-Since headers     * are respected with cached content, and appropriate HTTP headers are sent.     * This way repeated hits to a cached page do not send the entire page to the     * client every time.     *     * @var boolean     */    var $cache_modified_check = false;    /**     * This determines how Smarty handles "<?php ... ?>" tags in templates.     * possible values:     * <ul>     *  <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>     *  <li>SMARTY_PHP_QUOTE    -> escape tags as entities</li>     *  <li>SMARTY_PHP_REMOVE   -> remove php tags</li>     *  <li>SMARTY_PHP_ALLOW    -> execute php tags</li>     * </ul>     *     * @var integer     */    var $php_handling    =  SMARTY_PHP_PASSTHRU;    /**     * This enables template security. When enabled, many things are restricted     * in the templates that normally would go unchecked. This is useful when     * untrusted parties are editing templates and you want a reasonable level     * of security. (no direct execution of PHP in templates for example)     *     * @var boolean     */    var $security       =   false;    /**     * This is the list of template directories that are considered secure. This     * is used only if {@link $security} is enabled. One directory per array     * element.  {@link $template_dir} is in this list implicitly.     *     * @var array     */    var $secure_dir     =   array();    /**     * These are the security settings for Smarty. They are used only when     * {@link $security} is enabled.     *     * @var array     */    var $security_settings  = array(                                    'PHP_HANDLING'    => false,                                    'IF_FUNCS'        => array('array', 'list',                                                               'isset', 'empty',                                                               'count', 'sizeof',                                                               'in_array', 'is_array',                                                               'true','false'),                                    'INCLUDE_ANY'     => false,                                    'PHP_TAGS'        => false,                                    'MODIFIER_FUNCS'  => array('count'),                                    'ALLOW_CONSTANTS'  => false                                   );    /**     * This is an array of directories where trusted php scripts reside.     * {@link $security} is disabled during their inclusion/execution.     *     * @var array     */    var $trusted_dir        = array();    /**     * The left delimiter used for the template tags.     *     * @var string     */    var $left_delimiter  =  '{';    /**     * The right delimiter used for the template tags.     *     * @var string     */    var $right_delimiter =  '}';    /**     * The order in which request variables are registered, similar to     * variables_order in php.ini E = Environment, G = GET, P = POST,     * C = Cookies, S = Server     *     * @var string     */    var $request_vars_order    = 'EGPCS';    /**     * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)     * are uses as request-vars or $_*[]-vars. note: if     * request_use_auto_globals is true, then $request_vars_order has     * no effect, but the php-ini-value "gpc_order"     *     * @var boolean     */    var $request_use_auto_globals      = true;    /**     * Set this if you want different sets of compiled files for the same     * templates. This is useful for things like different languages.     * Instead of creating separate sets of templates per language, you     * set different compile_ids like 'en' and 'de'.     *     * @var string     */    var $compile_id            = null;    /**     * This tells Smarty whether or not to use sub dirs in the cache/ and     * templates_c/ directories. sub directories better organized, but     * may not work well with PHP safe mode enabled.     *     * @var boolean     *     */    var $use_sub_dirs          = false;    /**     * This is a list of the modifiers to apply to all template variables.     * Put each modifier in a separate array element in the order you want     * them applied. example: <code>array('escape:"htmlall"');</code>     *     * @var array     */    var $default_modifiers        = array();    /**     * This is the resource type to be used when not specified     * at the beginning of the resource path. examples:     * $smarty->display('file:index.tpl');     * $smarty->display('db:index.tpl');     * $smarty->display('index.tpl'); // will use default resource type     * {include file="file:index.tpl"}     * {include file="db:index.tpl"}     * {include file="index.tpl"} {* will use default resource type *}     *     * @var array     */    var $default_resource_type    = 'file';    /**     * The function used for cache file handling. If not set, built-in caching is used.     *     * @var null|string function name     */    var $cache_handler_func   = null;    /**     * This indicates which filters are automatically loaded into Smarty.     *     * @var array array of filter names     */    var $autoload_filters = array();    /**#@+     * @var boolean     */    /**     * This tells if config file vars of the same name overwrite each other or not.     * if disabled, same name variables are accumulated in an array.     */    var $config_overwrite = true;    /**     * This tells whether or not to automatically booleanize config file variables.     * If enabled, then the strings "on", "true", and "yes" are treated as boolean     * true, and "off", "false" and "no" are treated as boolean false.     */    var $config_booleanize = true;    /**     * This tells whether hidden sections [.foobar] are readable from the     * tempalates or not. Normally you would never allow this since that is     * the point behind hidden sections: the application can access them, but     * the templates cannot.     */    var $config_read_hidden = false;    /**     * This tells whether or not automatically fix newlines in config files.     * It basically converts \r (mac) or \r\n (dos) to \n     */    var $config_fix_newlines = true;    /**#@-*/    /**     * If a template cannot be found, this PHP function will be executed.     * Useful for creating templates on-the-fly or other special action.     *     * @var string function name     */    var $default_template_handler_func = '';    /**     * The file that contains the compiler class. This can a full     * pathname, or relative to the php_include path.     *     * @var string     */    var $compiler_file        =    'Smarty_Compiler.class.php';    /**     * The class used for compiling templates.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -