Autoloader.php 3.0 KB

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