import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Loader
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Loader.php 12507 2008-11-10 16:29:09Z matthew $
|
||||
* @version $Id: Loader.php 15519 2009-05-11 11:57:05Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ class Zend_Loader
|
||||
self::loadFile($file, $dirs, true);
|
||||
} else {
|
||||
self::_securityCheck($file);
|
||||
include_once $file;
|
||||
include $file;
|
||||
}
|
||||
|
||||
if (!class_exists($class, false) && !interface_exists($class, false)) {
|
||||
@ -177,13 +177,15 @@ class Zend_Loader
|
||||
* spl_autoload_register(array('Zend_Loader', 'autoload'));
|
||||
* </code>
|
||||
*
|
||||
* @param string $class
|
||||
* @deprecated Since 1.8.0
|
||||
* @param string $class
|
||||
* @return string|false Class name on success; false on failure
|
||||
*/
|
||||
public static function autoload($class)
|
||||
{
|
||||
trigger_error(__CLASS__ . '::' . __METHOD__ . ' is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead', E_USER_NOTICE);
|
||||
try {
|
||||
self::loadClass($class);
|
||||
@self::loadClass($class);
|
||||
return $class;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
@ -193,6 +195,7 @@ class Zend_Loader
|
||||
/**
|
||||
* Register {@link autoload()} with spl_autoload()
|
||||
*
|
||||
* @deprecated Since 1.8.0
|
||||
* @param string $class (optional)
|
||||
* @param boolean $enabled (optional)
|
||||
* @return void
|
||||
@ -201,22 +204,26 @@ class Zend_Loader
|
||||
*/
|
||||
public static function registerAutoload($class = 'Zend_Loader', $enabled = true)
|
||||
{
|
||||
if (!function_exists('spl_autoload_register')) {
|
||||
require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception('spl_autoload does not exist in this PHP installation');
|
||||
}
|
||||
trigger_error(__CLASS__ . '::' . __METHOD__ . ' is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead', E_USER_NOTICE);
|
||||
require_once 'Zend/Loader/Autoloader.php';
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
$autoloader->setFallbackAutoloader(true);
|
||||
|
||||
self::loadClass($class);
|
||||
$methods = get_class_methods($class);
|
||||
if (!in_array('autoload', (array) $methods)) {
|
||||
require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
|
||||
}
|
||||
if ('Zend_Loader' != $class) {
|
||||
self::loadClass($class);
|
||||
$methods = get_class_methods($class);
|
||||
if (!in_array('autoload', (array) $methods)) {
|
||||
require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
|
||||
}
|
||||
|
||||
if ($enabled === true) {
|
||||
spl_autoload_register(array($class, 'autoload'));
|
||||
} else {
|
||||
spl_autoload_unregister(array($class, 'autoload'));
|
||||
$callback = array($class, 'autoload');
|
||||
|
||||
if ($enabled) {
|
||||
$autoloader->pushAutoloader($callback);
|
||||
} else {
|
||||
$autoloader->removeAutoloader($callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +239,7 @@ class Zend_Loader
|
||||
/**
|
||||
* Security check
|
||||
*/
|
||||
if (preg_match('/[^a-z0-9\\/\\\\_.-]/i', $filename)) {
|
||||
if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $filename)) {
|
||||
require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception('Security check: Illegal character in filename');
|
||||
}
|
||||
|
Reference in New Issue
Block a user