1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-03 06:55:03 +03:00
ifhub.club/application/install/bootstrap.php
2014-07-28 13:23:41 +07:00

35 lines
898 B
PHP

<?php
define('INSTALL_DIR',dirname(__FILE__));
function install_func_underscore($sStr) {
return strtolower(preg_replace('/([^A-Z])([A-Z])/',"$1_$2",$sStr));
}
/**
* Загрузка классов инсталлятора
* пример - InstallCore, InstallStepInit
*
* @param $sClassName
* @return bool
*/
function install_autoload($sClassName) {
$aPath=explode('_',install_func_underscore($sClassName));
if (count($aPath)<2 or $aPath[0]!='install') {
return;
}
array_shift($aPath);
$sName=array_pop($aPath);
$sDir=join(DIRECTORY_SEPARATOR,$aPath);
$sPath=dirname(__FILE__).DIRECTORY_SEPARATOR.'backend'.DIRECTORY_SEPARATOR.($sDir ? $sDir.DIRECTORY_SEPARATOR : '').$sName.'.php';
if (file_exists($sPath)) {
require_once($sPath);
return true;
}
return false;
}
/**
* Подключаем загрузкик классов
*/
spl_autoload_register('install_autoload');