[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/ -> Autoloader.php (source)

   1  <?php
   2  
   3  PHPExcel_Autoloader::register();
   4  //    As we always try to run the autoloader before anything else, we can use it to do a few
   5  //        simple checks and initialisations
   6  //PHPExcel_Shared_ZipStreamWrapper::register();
   7  // check mbstring.func_overload
   8  if (ini_get('mbstring.func_overload') & 2) {
   9      throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
  10  }
  11  PHPExcel_Shared_String::buildCharacterSets();
  12  
  13  /**
  14   * PHPExcel
  15   *
  16   * Copyright (c) 2006 - 2015 PHPExcel
  17   *
  18   * This library is free software; you can redistribute it and/or
  19   * modify it under the terms of the GNU Lesser General Public
  20   * License as published by the Free Software Foundation; either
  21   * version 2.1 of the License, or (at your option) any later version.
  22   *
  23   * This library is distributed in the hope that it will be useful,
  24   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  26   * Lesser General Public License for more details.
  27   *
  28   * You should have received a copy of the GNU Lesser General Public
  29   * License along with this library; if not, write to the Free Software
  30   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  31   *
  32   * @category   PHPExcel
  33   * @package    PHPExcel
  34   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  35   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  36   * @version    ##VERSION##, ##DATE##
  37   */
  38  class PHPExcel_Autoloader
  39  {
  40      /**
  41       * Register the Autoloader with SPL
  42       *
  43       */
  44      public static function register()
  45      {
  46          if (function_exists('__autoload')) {
  47              // Register any existing autoloader function with SPL, so we don't get any clashes
  48              spl_autoload_register('__autoload');
  49          }
  50          // Register ourselves with SPL
  51          if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
  52              return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
  53          } else {
  54              return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
  55          }
  56      }
  57  
  58      /**
  59       * Autoload a class identified by name
  60       *
  61       * @param    string    $pClassName        Name of the object to load
  62       */
  63      public static function load($pClassName)
  64      {
  65          if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
  66              // Either already loaded, or not a PHPExcel class request
  67              return false;
  68          }
  69  
  70          $pClassFilePath = PHPEXCEL_ROOT .
  71              str_replace('_', DIRECTORY_SEPARATOR, $pClassName) .
  72              '.php';
  73  
  74          if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
  75              // Can't load
  76              return false;
  77          }
  78  
  79          require($pClassFilePath);
  80      }
  81  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1