12 startProfile(
"oxAutoload");
13 $sClass = basename($sClass);
14 $sClass = strtolower($sClass);
16 static $sBasePath = null;
17 static $aClassDirs = null;
20 static $aTriedClasses = array();
24 $sBaseClassLocation = null;
25 $aBaseClasses = array(
"oxutils",
"oxsupercfg",
"oxutilsobject");
26 if (in_array($sClass, $aBaseClasses)) {
27 $sFilename = getShopBasePath() .
"core/" . $sClass .
".php";
35 if (isset($aClassPaths[$sClass])) {
36 stopProfile(
"oxAutoload");
37 include $aClassPaths[$sClass];
42 $sBasePath = getShopBasePath();
46 if ($aClassDirs == null) {
50 foreach ($aClassDirs as $sDir) {
51 $sFilename = $sDir . $sClass .
'.php';
52 if (file_exists($sFilename)) {
53 if (!isset($aClassPaths[$sClass])) {
54 $aClassPaths[$sClass] = $sFilename;
56 stopProfile(
"oxAutoload");
67 if (is_array($aModuleFiles)) {
68 $sBasePath = getShopBasePath();
69 $oModulelist =
oxNew(
'oxmodulelist');
70 $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
71 if (is_array($aActiveModuleInfo)) {
72 foreach ($aModuleFiles as $sModuleId => $aModules) {
73 if (isset($aModules[$sClass]) && isset($aActiveModuleInfo[$sModuleId])) {
74 $sPath = $aModules[$sClass];
75 $sFilename = $sBasePath .
'modules/' . $sPath;
76 if (file_exists($sFilename)) {
77 if (!isset($aClassPaths[$sClass])) {
78 $aClassPaths[$sClass] = $sFilename;
80 stopProfile(
"oxAutoload");
91 $sClass = preg_replace(
'/_parent$/i',
'', $sClass);
97 foreach ($aModules as $sParentName => $sModuleName) {
99 if (preg_match(
'/\b' . $sClass .
'($|\&)/i', $sModuleName)) {
100 $myUtilsObject->getClassName($sParentName);
103 $aTriedClasses[] = $sClass;
107 stopProfile(
"oxAutoload");
119 $aClassDirs = array($sBasePath .
'core/',
120 $sBasePath .
'application/components/widgets/',
121 $sBasePath .
'application/components/services/',
122 $sBasePath .
'application/components/',
123 $sBasePath .
'application/models/',
124 $sBasePath .
'application/controllers/',
125 $sBasePath .
'application/controllers/admin/',
126 $sBasePath .
'application/controllers/admin/reports/',
127 $sBasePath .
'views/',
128 $sBasePath .
'core/exception/',
129 $sBasePath .
'core/interface/',
130 $sBasePath .
'core/cache/',
131 $sBasePath .
'core/cache/connectors/',
132 $sBasePath .
'core/wysiwigpro/',
133 $sBasePath .
'admin/reports/',
134 $sBasePath .
'admin/',
135 $sBasePath .
'modules/',
143 if (!function_exists(
'registerShopAutoLoad')) {
147 function registerShopAutoLoad()
149 spl_autoload_register(
"oxAutoload");
153 if (!function_exists(
'registerComposerAutoLoad')) {
157 function registerComposerAutoLoad()
159 $autoloaderPath = __DIR__ .
'/../modules/vendor/autoload.php';
160 if (file_exists($autoloaderPath)) {
161 include_once $autoloaderPath;
166 if (!function_exists(
'getShopBasePath')) {
172 function getShopBasePath()
185 if (defined(
'OX_IS_ADMIN')) {
200 ini_set(
'session.name',
'sid');
201 ini_set(
'session.use_cookies', 0);
202 ini_set(
'session.use_trans_sid', 0);
203 ini_set(
'url_rewriter.tags',
'');
206 if (!function_exists(
'error_404_handler')) {
214 function error_404_handler($sUrl =
'')
231 echo
"<div class='error_box'>" .
oxRegistry::getLang()->translateString(
'userError') .
"<code>[$iErrorNr] $sErrorText</code></div>";
244 $out = var_export($mVar,
true);
245 $f = fopen(
$myConfig->getConfigParam(
'sCompileDir') .
"/vardump.txt",
"a");
255 if (!function_exists(
'isSearchEngineUrl')) {
275 $f = fopen(
'out.txt',
'a');
276 $sString = var_export($mVar,
true);
277 fputs($f, $sString .
"\n---------------------------------------------\n");
292 if ($a->cnt == $b->cnt) {
296 return ($a->cnt < $b->cnt) ? -1 : 1;
299 if (!function_exists(
'startProfile')) {
305 function startProfile($sProfileName)
308 global $aExecutionCounts;
309 if (!isset($aExecutionCounts[$sProfileName])) {
310 $aExecutionCounts[$sProfileName] = 0;
312 if (!isset($aStartTimes[$sProfileName])) {
313 $aStartTimes[$sProfileName] = 0;
315 $aExecutionCounts[$sProfileName]++;
316 $aStartTimes[$sProfileName] = microtime(
true);
320 if (!function_exists(
'stopProfile')) {
326 function stopProfile($sProfileName)
328 global $aProfileTimes;
330 if (!isset($aProfileTimes[$sProfileName])) {
331 $aProfileTimes[$sProfileName] = 0;
333 $aProfileTimes[$sProfileName] += microtime(
true) - $aStartTimes[$sProfileName];
349 startProfile(
'oxNew');
350 $aArgs = func_get_args();
352 stopProfile(
'oxNew');
390 $sTplSource = $oSmarty->oxidcache->value;
392 $oSmarty->security =
true;
409 if (isset($oSmarty->oxidtimecache->value)) {
411 $iTplTimestamp = $oSmarty->oxidtimecache->value;
414 $iTplTimestamp = time();
446 if (!function_exists(
'getLangTableIdx')) {
455 function getLangTableIdx($iLangId)
459 $iLangPerTable = ($iLangPerTable > 1) ? $iLangPerTable : 8;
461 $iTableIdx = (int) ($iLangId / $iLangPerTable);
467 if (!function_exists(
'getLangTableName')) {
477 function getLangTableName($sTable, $iLangId)
479 $iTableIdx = getLangTableIdx($iLangId);
482 $sLangTableSuffix = $sLangTableSuffix ? $sLangTableSuffix :
"_set";
484 $sTable .= $sLangTableSuffix . $iTableIdx;
491 if (!function_exists(
'getViewName')) {
502 function getViewName($sTable, $iLangId = null, $sShopId = null)
508 if (!
$myConfig->getConfigParam(
'blSkipViewUsage')) {
513 if ($iLangId != -1 && $blIsMultiLang) {
516 $sAbbr = $oLang->getLanguageAbbr($iLangId);
517 $sViewSfx .=
"_{$sAbbr}";
520 if ($sViewSfx || (($iLangId == -1 || $sShopId == -1) && $blIsMultiLang)) {
521 return "oxv_{$sTable}{$sViewSfx}";
530 if (!function_exists(
'getRequestUrl')) {
539 function getRequestUrl($sParams =
'', $blReturnUrl =
false)
541 if ($_SERVER[
"REQUEST_METHOD"] !=
"POST") {
543 if (isset($_SERVER[
'REQUEST_URI']) && $_SERVER[
'REQUEST_URI']) {
544 $sRequest = $_SERVER[
'REQUEST_URI'];
547 $sRequest = $_SERVER[
'SCRIPT_URI'];
551 if ($sRequest && ($iPos = stripos($sRequest,
'?')) !==
false) {
555 $sRequest =
'index.php' . $oStr->substr($sRequest, $iPos);
558 $sRequest = $oStr->preg_replace(
'/(&|\?)(force_)?(admin_)?sid=[^&]*&?/',
'$1', $sRequest);
559 $sRequest = $oStr->preg_replace(
'/(&|\?)stoken=[^&]*&?/',
'$1', $sRequest);
560 $sRequest = $oStr->preg_replace(
'/&$/',
'', $sRequest);
562 return str_replace(
'&',
'&', $sRequest);
568 registerComposerAutoLoad();
569 registerShopAutoLoad();