gpac.php 521 B

12345678910111213141516171819202122232425
  1. <?php namespace Gogs;
  2. define('GPAC_BASE_PATH', realpath(dirname(__FILE__)));
  3. // Autoload classes, withing the Gogs-prefix
  4. spl_autoload_register(function($class) {
  5. $prefix = "Gogs\\";
  6. $len = strlen($prefix);
  7. // Checks if prefix starts with Gogs\
  8. if (strncmp($prefix, $class, $len) !== 0) {
  9. return;
  10. }
  11. $file = GPAC_BASE_PATH . DIRECTORY_SEPARATOR;
  12. $file .= str_replace(
  13. "\\", DIRECTORY_SEPARATOR, substr($class, $len)
  14. ) . ".php";
  15. require_once $file;
  16. });
  17. return;
  18. ?>