1
0

auto.php 801 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * PrivateBin
  4. *
  5. * a zero-knowledge paste bin
  6. *
  7. * @link https://github.com/PrivateBin/PrivateBin
  8. * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
  9. * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
  10. * @version 0.22
  11. */
  12. spl_autoload_register('auto::loader');
  13. /**
  14. * auto
  15. *
  16. * provides autoloading functionality
  17. */
  18. class auto
  19. {
  20. /**
  21. * includes file for given class name
  22. *
  23. * @access public
  24. * @static
  25. * @param string $class_name
  26. * @return mixed
  27. */
  28. public static function loader($class_name)
  29. {
  30. $filename = PATH . 'lib/' . str_replace('_', '/', $class_name) . '.php';
  31. if(is_readable($filename)) {
  32. return include $filename;
  33. }
  34. return false;
  35. }
  36. }