[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/ -> autoload_func.php (source)

   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-2006 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 4387 2006-09-04 13:54:28Z drbyte $

  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']);
  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']);
  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        if (file_exists($baseDir . $entry['loadFile'])) include($baseDir . $entry['loadFile']);
  49        $debugOutput .= 'include(\'' . $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']);
  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  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics