auto.php 788 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * ZeroBin
  4. *
  5. * a zero-knowledge paste bin
  6. *
  7. * @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
  8. * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
  9. * @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
  10. * @version 0.21
  11. */
  12. spl_autoload_register('auto::loader');
  13. /**
  14. * auto
  15. *
  16. * provides autoloading functionality
  17. */
  18. class auto
  19. {
  20. /**
  21. * strips slashes deeply
  22. *
  23. * @access public
  24. * @static
  25. * @param mixed $value
  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. }