/** * Registers Smarty_Autoloader as an SPL autoloader. * * @param bool $prepend Whether to prepend the autoloader or not. */ public static function register($prepend = false) { self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR; self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR; if (version_compare(phpversion(), '5.3.0', '>=')) { spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); } else { spl_autoload_register(array(__CLASS__, 'autoload')); } }
/** * Registers Smarty_Autoloader as an SPL autoloader. * @param bool $prepend Whether to prepend the autoloader or not. */ public static function register($prepend = FALSE) { self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . '/'; self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : self::$SMARTY_DIR . 'sysplugins/'; if (version_compare(phpversion(), '5.3.0', '>=')) { spl_autoload_register([__CLASS__, 'autoload'], TRUE, $prepend); } else { spl_autoload_register([__CLASS__, 'autoload']); } }
} if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { /** * @deprecated in favor of Smarty::$_DATE_FORMAT */ define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); } /** * Try loading the Smarty_Internal_Data class * If we fail we must load Smarty's autoloader. * Otherwise we may have a global autoloader like Composer */ if (!class_exists('Smarty_Autoloader', false)) { if (!class_exists('Smarty_Internal_Data', true)) { require_once 'Autoloader.php'; Smarty_Autoloader::registerBC(); } } /** * Load always needed external class files */ if (!class_exists('Smarty_Internal_Data', false)) { require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; } require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php'; /** * This is the main Smarty class
} if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { /** * @deprecated in favor of Smarty::$_DATE_FORMAT */ define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); } /** * Try loading the Smarty_Internal_Data class * If we fail we must load Smarty's autoloader. * Otherwise we may have a global autoloader like Composer */ if (!class_exists('Smarty_Autoloader', false)) { if (!class_exists('Smarty_Internal_Data', false)) { require_once dirname(__FILE__) . '/Autoloader.php'; Smarty_Autoloader::registerBC(true); } } /** * Load always needed external class files */ if (!class_exists('Smarty_Internal_Data', false)) { require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; } require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php'; require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
public static function registerSmarty() { // Smarty autoloader require_once self::$libsPath . 'smarty/Autoloader.php'; Smarty_Autoloader::register(); }
function GetSmarty() { require_once "{$rootpath}/thirdparty/smarty/libs/Autoloader.php"; Smarty_Autoloader::register(); $smarty = new Smarty(); return $smarty; }