Project

General

Profile

« Previous | Next » 

Revision 2124

Added by darkviper over 9 years ago

! /framework/initialize +
! /framework/WbAutoloader abbreviation list moved to initialize; added method getAbbreviations()

View differences:

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

  
14
16 May-2015 Build 2124 Manuela v.d.Decken(DarkViper)
15
! /framework/initialize +
16
! /framework/WbAutoloader  abbreviation list moved to initialize; added method getAbbreviations()
17
  SqlImport  modified for new export format of phpMyAdmin
14 18
01 Apr-2015 Build 2123 Manuela v.d.Decken(DarkViper)
15 19
! /framework/SqlImport  modified for new export format of phpMyAdmin
16 20
18 Mar-2015 Build 2122 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.4');
54
if(!defined('REVISION')) define('REVISION', '2123');
54
if(!defined('REVISION')) define('REVISION', '2124');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/initialize.php
114 114
 * Read DB settings from configuration file
115 115
 * @return array
116 116
 * @throws RuntimeException
117
 * 
117
 *
118 118
 */
119 119
    function initReadSetupFile()
120 120
    {
......
122 122
        initCheckValidCaller(array('save.php','index.php','config.php','upgrade-script.php'));
123 123
        $aCfg = array();
124 124

  
125
        $sSetupFile = dirname(dirname(__FILE__)).'/setup.ini.php';
125
        $sSetupFile = dirname(__DIR__).'/setup.ini.php';
126 126
        if(is_readable($sSetupFile)) {
127 127
            $aCfg = parse_ini_file($sSetupFile, true);
128 128
            if (!isset($aCfg['Constants']) || !isset($aCfg['DataBase'])) {
......
218 218
/* ***************************************************************************************
219 219
 * Start initialization                                                                  *
220 220
 ****************************************************************************************/
221
// reset global output buffering
222
    while (ob_get_level()) { ob_end_clean(); }
221 223
// test for existing and active old config.php
222 224
    if (defined('TABLE_PREFIX')) { /** TODO */ }
223
// initialize debug evaluation values ---	
225
// set system defaults
226
    date_default_timezone_set('UTC');
227

  
228
// initialize debug evaluation values ---
224 229
    $starttime = array_sum(explode(" ",microtime()));
225 230
    $iPhpDeclaredClasses = sizeof(get_declared_classes());
226 231
    $sDbConnectType = 'url'; // depending from class WbDatabase it can be 'url' or 'dsn'
......
241 246
    initSetInstallPathConstants();
242 247
    initSanitizeHttpReferer(WB_URL);
243 248
// register WB basic autoloader ---
244
    $sTmp = dirname(__FILE__).'/WbAutoloader.php';
249
    $sTmp = __DIR__.'/WbAutoloader.php';
245 250
    if(!class_exists('WbAutoloader')){
246 251
        include($sTmp);
247 252
    }
248
    WbAutoloader::doRegister(array(ADMIN_DIRECTORY=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i'));
253
    WbAutoloader::doRegister( array(
254
        'a' => trim(str_replace('\\', '/',ADMIN_DIRECTORY), '/'),
255
        'm' => 'modules',
256
        't' => 'templates',
257
        'i' => 'include',
258
        'v' => 'vendor'
259
    ));
260
//    WbAutoloader::doRegister(array(ADMIN_DIRECTORY=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i'));
249 261
// instantiate and initialize adaptor for temporary registry replacement ---
250 262
    $oReg = WbAdaptor::getInstance();
251 263
    $oReg->getWbConstants();
252 264
// register TWIG autoloader ---
253
    $sTmp = dirname(dirname(__FILE__)).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
265
    $sTmp = dirname(__DIR__).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
254 266
    if(!class_exists('Twig_Autoloader') && is_readable($sTmp)) {
255 267
        include($sTmp);
256
    	Twig_Autoloader::register();
268
        Twig_Autoloader::register();
257 269
    }
258 270
// register PHPMailer autoloader ---
259
    $sTmp = $oReg->AppPath.'include/phpmailer/PHPMailerAutoload.php';
271
    $sTmp = dirname(__DIR__).'include/phpmailer/PHPMailerAutoload.php';
260 272
    if (!function_exists('PHPMailerAutoload') && is_readable($sTmp)) {
261 273
        require($sTmp);
262 274
    }
263 275
// aktivate exceptionhandler ---
264 276
    if(!function_exists('globalExceptionHandler')) {
265
        include(dirname(__FILE__).'/globalExceptionHandler.php');
277
        include(__DIR__.'/globalExceptionHandler.php');
266 278
    }
267 279
// ---------------------------
268 280
// get Database connection data from configuration
......
334 346
    }
335 347
// get/set server timezone ---
336 348
    if(!defined('SERVER_TIMEZONE')) { define('SERVER_TIMEZONE', "UTC"); }
337
    date_default_timezone_set( SERVER_TIMEZONE );
338 349
    if(!defined('MAX_TIME')) { define('MAX_TIME', (pow(2, 31)-1)); } // 32-Bit Timestamp of 19 Jan 2038 03:14:07 GMT
339 350
    $sTmp = (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] != '') ? $_SERVER['HTTP_DNT'] : '0';
340 351
    if(!defined('DO_NOT_TRACK')) { define('DO_NOT_TRACK', ($sTmp[0] == '1')); }
......
342 353
    if(!defined('TIMEZONE')) { define('TIMEZONE', (isset($_SESSION['TIMEZONE']) ? $_SESSION['TIMEZONE'] : DEFAULT_TIMEZONE)); }
343 354
    if(!defined('DATE_FORMAT')) { define('DATE_FORMAT', (isset($_SESSION['DATE_FORMAT']) ? $_SESSION['DATE_FORMAT'] : DEFAULT_DATE_FORMAT)); }
344 355
    if(!defined('TIME_FORMAT')) { define('TIME_FORMAT', (isset($_SESSION['TIME_FORMAT']) ? $_SESSION['TIME_FORMAT'] : DEFAULT_TIME_FORMAT)); }
345
// set Theme directory --- 
356
// set Theme directory ---
346 357
    if(!defined('THEME_URL')) { define('THEME_URL',  WB_URL.'/templates/'.DEFAULT_THEME); }
347 358
    if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME); }
348 359
    if(!defined('THEME_REL')) { define('THEME_REL',  WB_REL.'/templates/'.DEFAULT_THEME); }
......
394 405
    }
395 406
    $_SESSION['LANGUAGE'] = LANGUAGE;
396 407
// activate translations / load language definitions
397
/** begin of deprecated part || will be replaced by class Translate **/	
408
/** begin of deprecated part || will be replaced by class Translate **/
398 409
// Load Language file
399 410
    if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
400 411
        $sMsg = 'Error loading language file '.LANGUAGE.', please check configuration';
......
408 419
    $oReg->getWbConstants();
409 420
// load and activate new global translation table
410 421
    $oTrans = Translate::getInstance();
411
/* initializise Translate old style */
422
/* initializise Translate old style *************************************************** */
412 423
    $oTrans->initialize(
413 424
        'en',
414 425
        (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''),
......
417 428
//        (Translate::CACHE_DISABLED|Translate::KEEP_MISSING),
418 429
        (DEBUG ? Translate::CACHE_DISABLED|Translate::KEEP_MISSING : 0)
419 430
    );
420
/* initializise Translate new style */
431
/* initializise Translate new style *************************************************** */
421 432
/*
422 433
    $oTrans->initialize(
423 434
        new TranslateAdaptorWbOldStyle,
branches/2.8.x/wb/framework/WbAutoloader.php
1 1
<?php
2
/* 
2
/*
3 3
 * To change this template, choose Tools | Templates
4 4
 * and open the template in the editor.
5 5
 */
......
7 7
class WbAutoloader
8 8
{
9 9

  
10
	static private $_aSearchpatterns = array();
11
	static private $_aReplacements = array();
12

  
10
    static private $aSearchpatterns = array();
11
    static private $aReplacements   = array();
12
    static private $aAbbreviations  = array();
13 13
/**
14 14
 * Register WB - CoreAutoloader as SPL autoloader
15
 * @param array $aDirectories list of 'directory'=>'shortKey'
15
 * @param array $aAbbreviations list of 'directory'=>'shortKey'
16 16
 */
17
	static public function doRegister(array $aDirectories)
18
	{
19
		if(!sizeof(self::$_aSearchpatterns))
20
		{
21
			if(sizeof($aDirectories > 0))
22
			{
23
				self::$_aSearchpatterns[] = '/(^.[^_].*$)/i';
24
				self::$_aReplacements[] = basename(dirname(__FILE__)).'_\1';
25
				foreach($aDirectories as $value => $shortKey)
26
				{
27
					self::$_aSearchpatterns[] = '/^'.$shortKey.'_/i';
28
					self::$_aReplacements[] = $value.'_';
29
				}
30
			}
31
		}
32
		spl_autoload_register(array(new self, 'CoreAutoloader'));
33
	}
17
    static public function doRegister(array $aAbbreviations)
18
    {
19
        if (!sizeof(self::$aSearchpatterns)) {
20
            if (sizeof($aAbbreviations > 0)) {
21
                self::$aAbbreviations = $aAbbreviations;
22
                self::$aSearchpatterns[] = '/(^.[^_].*$)/i';
23
                self::$aReplacements[] = basename(__DIR__).'_\1';
24
                foreach ($aAbbreviations as $shortKey => $value) {
25
                    self::$aSearchpatterns[] = '/^'.$shortKey.'_/i';
26
                    self::$aReplacements[] = $value.'_';
27
                }
28
            }
29
        }
30
        spl_autoload_register(array(new self, 'CoreAutoloader'));
31
    }
34 32
/**
35 33
 * tries autoloading the given class
36 34
 * @param  string $sClassName
37 35
 */
38
	static public function CoreAutoloader($sClassName)
39
	{
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;
46
			}
47
		}
48
		include($sFileName);
49
	}
36
    static public function CoreAutoloader($sClassName)
37
    {
38
        $sFileName = '';
39
        $sBaseDir = trim(str_replace('\\', '/', dirname(__DIR__)), '/').'/';
40
        $sClassName = preg_replace(self::$aSearchpatterns, self::$aReplacements, $sClassName);
41
        $sFileName = $sBaseDir.str_replace('_', '/', $sClassName);
42
        if (! is_readable($sFileName.'.php')) {
43
        // alternatively search for file with prefix 'class.'
44
            $sFileName = dirname($sFileName).'/class.'.basename($sFileName);
45
            if (! is_readable($sFileName.'.php')) {
46
                $sFileName = '';
47
            }
48
        }
49
        if ($sFileName) { include($sFileName.'.php'); }
50
    }
51
/**
52
 *
53
 * @return array list of abbreviations
54
 */
55
    static public function getAbbreviations()
56
    {
57
        return self::$aAbbreviations;
58
    }
50 59
} // end class Autoloader

Also available in: Unified diff