[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 autoload_func.php

Zen Cart 源代码 autoload_func.php




下载文件

文件名: autoload_func.php
文件类型: PHP文件
文件大小: 3.96 KiB
MD5: 6641fd9f8d4165ae3f5a1c7e5c7efe30

autoload_func.php - 关闭高亮
  1. <?php
  2. /**
  3.  * File contains the autoloader loop
  4.  *
  5.  * The autoloader loop takes the array from the auto_loaders directory
  6.  * and uses this this to constuct the InitSysytem.
  7.  * see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem} for more details.
  8.  *
  9.  * @package initSystem
  10.  * @copyright Copyright 2003-2009 Zen Cart Development Team
  11.  * @copyright Portions Copyright 2003 osCommerce
  12.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  13.  * @version $Id: autoload_func.php 14141 2009-08-10 19:34:47Z wilt $
  14.  */
  15. if (!defined('IS_ADMIN_FLAG')) {
  16.   die('Illegal Access');
  17. }
  18. reset($autoLoadConfig);
  19. ksort($autoLoadConfig);
  20. foreach ($autoLoadConfig as $actionPoint => $row) {
  21.   $debugOutput = "";
  22.   foreach($row as $entry) {
  23.     $debugOutput = 'actionPoint=>'.$actionPoint . ' ';
  24. //    $entry['loadFile'] = str_replace(array(':', '\\\\'), '', $entry['loadFile']);
  25.     switch($entry['autoType']) {
  26.       case 'include':
  27.       /**
  28.        * include a file as specified by autoloader array
  29.        */
  30.       if (file_exists($entry['loadFile'])) include($entry['loadFile']); else $debugOutput .= 'FAILED: ';
  31.       $debugOutput .= 'include(\'' . $entry['loadFile'] . '\');' . '<br />';
  32.       break;
  33.       case 'require':
  34.       /**
  35.        * require a file as specified by autoloader array
  36.        */
  37.       if (file_exists($entry['loadFile'])) require($entry['loadFile']); else $debugOutput .= 'FAILED: ';
  38.       $debugOutput .= 'require(\'' . $entry['loadFile'] . '\');' . '<br />';
  39.       break;
  40.       case 'init_script':
  41.       $baseDir = DIR_WS_INCLUDES . 'init_includes/';
  42.       if (file_exists(DIR_WS_INCLUDES . 'init_includes/overrides/' . $entry['loadFile'])) {
  43.         $baseDir = DIR_WS_INCLUDES . 'init_includes/overrides/';
  44.       }
  45.       /**
  46.        * include an init_script as specified by autoloader array
  47.        */
  48.       require($baseDir . $entry['loadFile']);
  49.       $debugOutput .= 'require(\'' . $baseDir . $entry['loadFile'] . '\');' . '<br />';
  50.       break;
  51.       case 'class':
  52.       if (isset($entry['classPath'])) {
  53.         $classPath = $entry['classPath'];
  54.       } else {
  55.         $classPath = DIR_FS_CATALOG . DIR_WS_CLASSES;
  56.       }
  57.       /**
  58.        * include a class definition as specified by autoloader array
  59.        */
  60.       if (file_exists($classPath . $entry['loadFile'])) include($classPath . $entry['loadFile']); else $debugOutput .= 'FAILED: ';
  61.       $debugOutput .= 'include(\'' . $classPath . $entry['loadFile'] . '\');' . '<br />';
  62.       break;
  63.       case 'classInstantiate':
  64.       $objectName = $entry['objectName'];
  65.       $className = $entry['className'];
  66.       if (isset($entry['classSession']) && $entry['classSession'] === true) {
  67.         if (isset($entry['checkInstantiated']) && $entry['checkInstantiated'] === true) {
  68.           if (!isset($_SESSION[$objectName])) {
  69.             $_SESSION[$objectName] = new $className();
  70.             $debugOutput .= 'if (!$_SESSION[' . $objectName . ']) { ';
  71.             $debugOutput .= '$_SESSION[' . $objectName . '] = new ' . $className . '();';
  72.             $debugOutput .= ' }<br />';
  73.           }
  74.         } else {
  75.           $_SESSION[$objectName] = new $className();
  76.           $debugOutput .= '  $_SESSION[' . $objectName . '] = new ' . $className . '();<br />';
  77.         }
  78.       } else {
  79.         $$objectName = new $className();
  80.         $debugOutput .= '$' . $objectName . ' = new ' . $className . '();<br />';
  81.       }
  82.       break;
  83.       case 'objectMethod':
  84.       $objectName = $entry['objectName'];
  85.       $methodName = $entry['methodName'];
  86.       if (is_object($_SESSION[$objectName])) {
  87.         $_SESSION[$objectName]->$methodName();
  88.         $debugOutput .= '$_SESSION[' . $objectName . ']->' . $methodName . '();<br />';
  89.       } else {
  90.         $$objectName->$methodName();
  91.         $debugOutput .= '$' . $objectName . '->' . $methodName . '();<br />';
  92.       }
  93.       break;
  94.     }
  95.     if (DEBUG_AUTOLOAD === true) echo $debugOutput;
  96.   }
  97. }
  98.  


cron