AutoLoader.inc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Autoloader
  4. *
  5. * @category Phpdocx
  6. * @package loader
  7. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  8. * (http://www.2mdc.com)
  9. * @license LGPL
  10. * @version 2.0
  11. * @link http://www.phpdocx.com
  12. * @since File available since Release 2.0
  13. */
  14. /**
  15. * Autoloader
  16. *
  17. * @category Phpdocx
  18. * @package loader
  19. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  20. * (http://www.2mdc.com)
  21. * @license http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  22. * @version 2.0
  23. * @link http://www.phpdocx.com
  24. * @since Class available since Release 2.0
  25. */
  26. class AutoLoader
  27. {
  28. /**
  29. * Autoload dompdf
  30. *
  31. * @access private
  32. * @param string $className Class to load
  33. */
  34. private static function autoloadDompdf($className)
  35. {
  36. $pathDompdf = dirname(__FILE__) . '/../pdf/dompdf_config.inc.php';
  37. if (file_exists($pathDompdf)) {
  38. require_once $pathDompdf;
  39. }
  40. }
  41. /**
  42. * Autoload log4php
  43. *
  44. * @access private
  45. * @param string $className Class to load
  46. */
  47. private static function autoloadLog4php($className)
  48. {
  49. $pathLogphp = dirname(__FILE__) . '/../lib/log4php/'
  50. . $className . '.php';
  51. if (file_exists($pathLogphp)) {
  52. require_once $pathLogphp;
  53. }
  54. }
  55. /**
  56. * Autoload phpdocx
  57. *
  58. * @access private
  59. * @param string $className Class to load
  60. */
  61. private static function autoloadPhpdocx($className)
  62. {
  63. $pathPhpdocx = dirname(__FILE__) . '/' . $className . '.inc';
  64. if (file_exists($pathPhpdocx)) {
  65. require_once $pathPhpdocx;
  66. }
  67. }
  68. /**
  69. * Main tags of relationships XML
  70. *
  71. * @access public
  72. * @static
  73. */
  74. public static function load()
  75. {
  76. spl_autoload_register(array('AutoLoader', 'autoloadPhpdocx'));
  77. spl_autoload_register(array('AutoLoader', 'autoloadLog4php'));
  78. }
  79. public static function loadPDF()
  80. {
  81. spl_autoload_register(array('AutoLoader', 'autoloadDompdf'));
  82. }
  83. }