Project

General

Profile

« Previous | Next » 

Revision 2010

Added by darkviper almost 11 years ago

! WbAutoloader added possibility to load classes with additional file prefix 'class.'

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
03 Nov-2013 Build 2010 Manuela v.d.Decken(DarkViper)
15
! WbAutoloader added possibility to load classes with additional file prefix 'class.'
14 16
27 Nov-2013 Build 2009 Manuela v.d.Decken(DarkViper)
15 17
! framework/functions-utf8::entities_to_7bit() deprecated warning for modifier /e in preg_replace() corrected
16 18
25 Nov-2013 Build 2008 Manuela v.d.Decken(DarkViper)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '2009');
54
if(!defined('REVISION')) define('REVISION', '2010');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/WbAutoloader.php
16 16
 */
17 17
	static public function doRegister(array $aDirectories)
18 18
	{
19
		if(!sizeof(self::$_aSearchpatterns)) {
20
			if(sizeof($aDirectories > 0)) {
19
		if(!sizeof(self::$_aSearchpatterns))
20
		{
21
			if(sizeof($aDirectories > 0))
22
			{
21 23
				self::$_aSearchpatterns[] = '/(^.[^_].*$)/i';
22
				self::$_aReplacements[] = basename(dirname(__FILE__)).'_$1';
23
				foreach($aDirectories as $value => $shortKey) {
24
				self::$_aReplacements[] = basename(dirname(__FILE__)).'_\1';
25
				foreach($aDirectories as $value => $shortKey)
26
				{
24 27
					self::$_aSearchpatterns[] = '/^'.$shortKey.'_/i';
25 28
					self::$_aReplacements[] = $value.'_';
26 29
				}
......
34 37
 */
35 38
	static public function CoreAutoloader($sClassName)
36 39
	{
37
		if($sClassName == 'database'){
38
			$sFileName = dirname(__FILE__).'/class.database.php';
39
			if(is_file($sFileName)) { include($sFileName); }
40
		}else {
41
			$sClassName = preg_replace(self::$_aSearchpatterns, self::$_aReplacements, $sClassName);
42
			$sFileName = dirname(dirname(__FILE__)).'/'.str_replace('_', '/', $sClassName).'.php';
43
			if(is_file($sFileName = dirname(dirname(__FILE__)).'/'.str_replace('_', '/', $sClassName).'.php')) {
44
				include($sFileName);
40
		$sClassName = preg_replace(self::$_aSearchpatterns, self::$_aReplacements, $sClassName);
41
		$sFileName = dirname(dirname(__FILE__)).'/'.str_replace('_', '/', $sClassName).'.php';
42
		if (!is_file($sFileName = dirname(dirname(__FILE__)).'/'.str_replace('_', '/', $sClassName).'.php')) {
43
		// alternatively search for file with prefix 'class.'
44
			if (!is_file(($sFileName = dirname($sFileName).'/class.'.basename($sFileName)))) {
45
				return false;
45 46
			}
46 47
		}
48
		include($sFileName);
47 49
	}
48 50
} // end class Autoloader

Also available in: Unified diff