mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHACENEMENT: Change behaviour of the MenufestBuilder to use spl_autoload_register instead of traditional __autoload.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@111831 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bdd30fa4fd
commit
a5dfb6257d
@ -131,6 +131,21 @@ define('PR_LOW',10);
|
||||
|
||||
increase_memory_limit_to('64M');
|
||||
|
||||
/**
|
||||
* Sapphire class autoloader. Requires the ManifestBuilder to work.
|
||||
* $_CLASS_MANIFEST must have been loaded up by ManifestBuilder for this to successfully load
|
||||
* classes. Classes will be loaded from any PHP file within the application.
|
||||
* If your class contains an underscore, for example, Page_Controller, then the filename is
|
||||
* expected to be the stuff before the underscore. In this case, Page.php.
|
||||
*/
|
||||
function sapphire_autoload($className) {
|
||||
global $_CLASS_MANIFEST;
|
||||
if(($pos = strpos($className,'_')) !== false) $className = substr($className,0,$pos);
|
||||
if(isset($_CLASS_MANIFEST[$className])) include_once($_CLASS_MANIFEST[$className]);
|
||||
}
|
||||
|
||||
spl_autoload_register('sapphire_autoload');
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
|
||||
@ -219,19 +234,6 @@ function getTempFolder() {
|
||||
return $ssTmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sapphire class autoloader. Requires the ManifestBuilder to work.
|
||||
* $_CLASS_MANIFEST must have been loaded up by ManifestBuilder for this to successfully load
|
||||
* classes. Classes will be loaded from any PHP file within the application.
|
||||
* If your class contains an underscore, for example, Page_Controller, then the filename is
|
||||
* expected to be the stuff before the underscore. In this case, Page.php.
|
||||
*/
|
||||
function __autoload($className) {
|
||||
global $_CLASS_MANIFEST;
|
||||
if(($pos = strpos($className,'_')) !== false) $className = substr($className,0,$pos);
|
||||
if(isset($_CLASS_MANIFEST[$className])) include_once($_CLASS_MANIFEST[$className]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file where that class is stored
|
||||
*/
|
||||
@ -331,4 +333,4 @@ function increase_time_limit_to($timeLimit = null) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user