autoload.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * iCalcreator, a PHP rfc2445/rfc5545 solution.
  4. *
  5. * This file is a part of iCalcreator.
  6. *
  7. * Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
  8. * Link http://kigkonsult.se/iCalcreator/index.php
  9. * Package iCalcreator
  10. * Version 2.24
  11. * License Subject matter of licence is the software iCalcreator.
  12. * The above copyright, link, package and version notices,
  13. * this licence notice and the [rfc5545] PRODID as implemented and
  14. * invoked in iCalcreator shall be included in all copies or
  15. * substantial portions of the iCalcreator.
  16. * iCalcreator can be used either under the terms of
  17. * a proprietary license, available at <https://kigkonsult.se/>
  18. * or the GNU Affero General Public License, version 3:
  19. * iCalcreator is free software: you can redistribute it and/or
  20. * modify it under the terms of the GNU Affero General Public License
  21. * as published by the Free Software Foundation, either version 3 of
  22. * the License, or (at your option) any later version.
  23. * iCalcreator 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
  26. * GNU Affero General Public License for more details.
  27. * You should have received a copy of the GNU Affero General Public
  28. * License along with this program.
  29. * If not, see <http://www.gnu.org/licenses/>.
  30. */
  31. /**
  32. * autoload.php
  33. *
  34. * iCalcreator package autoloader
  35. *
  36. * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
  37. * @since 2.23.16 - 2017-05-27
  38. */
  39. /**
  40. * Do NOT alter or remove the constant!!
  41. */
  42. define( 'ICALCREATOR_VERSION', 'iCalcreator 2.24' );
  43. /**
  44. * load iCalcreator src and support classes and traits
  45. */
  46. spl_autoload_register(
  47. function( $class ) {
  48. static $SRC = 'src';
  49. static $BS = '\\';
  50. static $PHP = '.php';
  51. static $PREFIX = 'kigkonsult\\iCalcreator\\';
  52. static $BASEDIR = null;
  53. if( is_null( $BASEDIR ))
  54. $BASEDIR = __DIR__ . DIRECTORY_SEPARATOR . $SRC . DIRECTORY_SEPARATOR;
  55. if( 0 != strncmp( $PREFIX, $class, 23 ))
  56. return false;
  57. $class = substr( $class, 23 );
  58. if( false !== strpos( $class, $BS ))
  59. $class = str_replace( $BS, DIRECTORY_SEPARATOR, $class );
  60. $file = $BASEDIR . $class . $PHP;
  61. if( file_exists( $file )) {
  62. require $file;
  63. return true;
  64. }
  65. return false;
  66. }
  67. );
  68. /**
  69. * iCalcreator timezones add-on functionality functions, IF required?
  70. */
  71. // include __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'iCal.tz.inc.php';