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 .
'core/exception/',
128 $sBasePath .
'core/interface/',
129 $sBasePath .
'core/cache/',
130 $sBasePath .
'core/cache/connectors/',
131 $sBasePath .
'core/wysiwigpro/',
132 $sBasePath .
'admin/reports/',
140 if (!function_exists(
'registerShopAutoLoad')) {
144 function registerShopAutoLoad()
146 spl_autoload_register(
"oxAutoload");
150 if (!function_exists(
'registerComposerAutoLoad')) {
154 function registerComposerAutoLoad()
156 $autoloaderPath = __DIR__ .
'/../modules/vendor/autoload.php';
157 if (file_exists($autoloaderPath)) {
158 include_once $autoloaderPath;
163 if (!function_exists(
'getShopBasePath')) {
169 function getShopBasePath()
182 if (defined(
'OX_IS_ADMIN')) {
197 ini_set(
'session.name',
'sid');
198 ini_set(
'session.use_cookies', 0);
199 ini_set(
'session.use_trans_sid', 0);
200 ini_set(
'url_rewriter.tags',
'');
203 if (!function_exists(
'error_404_handler')) {
211 function error_404_handler($sUrl =
'')
228 echo
"<div class='error_box'>" .
oxRegistry::getLang()->translateString(
'userError') .
"<code>[$iErrorNr] $sErrorText</code></div>";
241 $out = var_export($mVar,
true);
242 $f = fopen(
$myConfig->getConfigParam(
'sCompileDir') .
"/vardump.txt",
"a");
252 if (!function_exists(
'isSearchEngineUrl')) {
272 $f = fopen(
'out.txt',
'a');
273 $sString = var_export($mVar,
true);
274 fputs($f, $sString .
"\n---------------------------------------------\n");
289 if ($a->cnt == $b->cnt) {
293 return ($a->cnt < $b->cnt) ? -1 : 1;
296 if (!function_exists(
'startProfile')) {
302 function startProfile($sProfileName)
305 global $aExecutionCounts;
306 if (!isset($aExecutionCounts[$sProfileName])) {
307 $aExecutionCounts[$sProfileName] = 0;
309 if (!isset($aStartTimes[$sProfileName])) {
310 $aStartTimes[$sProfileName] = 0;
312 $aExecutionCounts[$sProfileName]++;
313 $aStartTimes[$sProfileName] = microtime(
true);
317 if (!function_exists(
'stopProfile')) {
323 function stopProfile($sProfileName)
325 global $aProfileTimes;
327 if (!isset($aProfileTimes[$sProfileName])) {
328 $aProfileTimes[$sProfileName] = 0;
330 $aProfileTimes[$sProfileName] += microtime(
true) - $aStartTimes[$sProfileName];
346 startProfile(
'oxNew');
347 $aArgs = func_get_args();
349 stopProfile(
'oxNew');
387 $sTplSource = $oSmarty->oxidcache->value;
389 $oSmarty->security =
true;
406 if (isset($oSmarty->oxidtimecache->value)) {
408 $iTplTimestamp = $oSmarty->oxidtimecache->value;
411 $iTplTimestamp = time();
443 if (!function_exists(
'getLangTableIdx')) {
452 function getLangTableIdx($iLangId)
456 $iLangPerTable = ($iLangPerTable > 1) ? $iLangPerTable : 8;
458 $iTableIdx = (int) ($iLangId / $iLangPerTable);
464 if (!function_exists(
'getLangTableName')) {
474 function getLangTableName($sTable, $iLangId)
476 $iTableIdx = getLangTableIdx($iLangId);
479 $sLangTableSuffix = $sLangTableSuffix ? $sLangTableSuffix :
"_set";
481 $sTable .= $sLangTableSuffix . $iTableIdx;
488 if (!function_exists(
'getViewName')) {
499 function getViewName($sTable, $iLangId = null, $sShopId = null)
505 if (!
$myConfig->getConfigParam(
'blSkipViewUsage')) {
510 if ($iLangId != -1 && $blIsMultiLang) {
513 $sAbbr = $oLang->getLanguageAbbr($iLangId);
514 $sViewSfx .=
"_{$sAbbr}";
517 if ($sViewSfx || (($iLangId == -1 || $sShopId == -1) && $blIsMultiLang)) {
518 return "oxv_{$sTable}{$sViewSfx}";
527 if (!function_exists(
'getRequestUrl')) {
536 function getRequestUrl($sParams =
'', $blReturnUrl =
false)
538 if ($_SERVER[
"REQUEST_METHOD"] !=
"POST") {
540 if (isset($_SERVER[
'REQUEST_URI']) && $_SERVER[
'REQUEST_URI']) {
541 $sRequest = $_SERVER[
'REQUEST_URI'];
544 $sRequest = $_SERVER[
'SCRIPT_URI'];
548 if ($sRequest && ($iPos = stripos($sRequest,
'?')) !==
false) {
552 $sRequest =
'index.php' . $oStr->substr($sRequest, $iPos);
555 $sRequest = $oStr->preg_replace(
'/(&|\?)(force_)?(admin_)?sid=[^&]*&?/',
'$1', $sRequest);
556 $sRequest = $oStr->preg_replace(
'/(&|\?)stoken=[^&]*&?/',
'$1', $sRequest);
557 $sRequest = $oStr->preg_replace(
'/&$/',
'', $sRequest);
559 return str_replace(
'&',
'&', $sRequest);
565 registerComposerAutoLoad();
566 registerShopAutoLoad();