mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- add bootstrap file to load and register Smarty_Autoloader. Change composer.json to make it known to composer
This commit is contained in:
@@ -1,3 +1,17 @@
|
|||||||
|
Smarty: the PHP compiling template engine
|
||||||
|
|
||||||
|
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 below for more details.
|
||||||
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.31-dev ===== (xx.xx.xx)
|
===== 3.1.31-dev ===== (xx.xx.xx)
|
||||||
|
08.11.2016
|
||||||
|
- add bootstrap file to load and register Smarty_Autoloader. Change composer.json to make it known to composer
|
||||||
|
|
||||||
07.11.2016
|
07.11.2016
|
||||||
- optimization of lexer speed https://github.com/smarty-php/smarty/issues/311
|
- optimization of lexer speed https://github.com/smarty-php/smarty/issues/311
|
||||||
|
|
||||||
|
@@ -28,11 +28,7 @@
|
|||||||
"php": ">=5.2"
|
"php": ">=5.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"files": ["libs/bootstrap.php"]
|
||||||
"libs/Smarty.class.php",
|
|
||||||
"libs/SmartyBC.class.php",
|
|
||||||
"libs/sysplugins/"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
|
@@ -13,9 +13,10 @@
|
|||||||
* Usage:
|
* Usage:
|
||||||
* require_once '...path/Autoloader.php';
|
* require_once '...path/Autoloader.php';
|
||||||
* Smarty_Autoloader::register();
|
* Smarty_Autoloader::register();
|
||||||
|
* or
|
||||||
|
* include '...path/bootstarp.php';
|
||||||
|
*
|
||||||
* $smarty = new Smarty();
|
* $smarty = new Smarty();
|
||||||
* Note: This autoloader is not needed if you use Composer.
|
|
||||||
* Composer will automatically add the classes of the Smarty package to it common autoloader.
|
|
||||||
*/
|
*/
|
||||||
class Smarty_Autoloader
|
class Smarty_Autoloader
|
||||||
{
|
{
|
||||||
@@ -24,14 +25,14 @@ class Smarty_Autoloader
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $SMARTY_DIR = '';
|
public static $SMARTY_DIR = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filepath to Smarty internal plugins
|
* Filepath to Smarty internal plugins
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $SMARTY_SYSPLUGINS_DIR = '';
|
public static $SMARTY_SYSPLUGINS_DIR = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array with Smarty core classes and their filename
|
* Array with Smarty core classes and their filename
|
||||||
@@ -89,18 +90,20 @@ class Smarty_Autoloader
|
|||||||
*/
|
*/
|
||||||
public static function autoload($class)
|
public static function autoload($class)
|
||||||
{
|
{
|
||||||
$_class = strtolower($class);
|
if ($class[ 0 ] !== 'S' && strpos($class, 'Smarty') !== 0) {
|
||||||
if (strpos($_class, 'smarty') !== 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
$_class = strtolower($class);
|
||||||
if (is_file($file)) {
|
if (isset(self::$rootClasses[ $_class ])) {
|
||||||
include $file;
|
|
||||||
} else if (isset(self::$rootClasses[ $_class ])) {
|
|
||||||
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
|
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
include $file;
|
include $file;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
||||||
|
if (is_file($file)) {
|
||||||
|
include $file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -66,23 +66,16 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try loading the Smarty_Internal_Data class
|
* Load Smarty_Autoloader
|
||||||
* 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_Autoloader')) {
|
||||||
if (!class_exists('Smarty_Internal_Data', true)) {
|
include __DIR__ . '/bootstrap.php';
|
||||||
require_once dirname(__FILE__) . '/Autoloader.php';
|
|
||||||
Smarty_Autoloader::registerBC();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load always needed external class files
|
* 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_data.php';
|
||||||
}
|
|
||||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.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_templatebase.php';
|
||||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
|
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
|
||||||
@@ -90,6 +83,7 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
|
|||||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.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_source.php';
|
||||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
|
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
|
||||||
|
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main Smarty class
|
* This is the main Smarty class
|
||||||
@@ -114,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.31-dev/41';
|
const SMARTY_VERSION = '3.1.31-dev/42';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
17
libs/bootstrap.php
Normal file
17
libs/bootstrap.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is part of the Smarty package.
|
||||||
|
*
|
||||||
|
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load and register Smarty Autoloader
|
||||||
|
*/
|
||||||
|
if (!class_exists('Smarty_Autoloader')) {
|
||||||
|
require __DIR__ . '/Autoloader.php';
|
||||||
|
}
|
||||||
|
Smarty_Autoloader::register();
|
Reference in New Issue
Block a user