geoip redirection for superforex.com.au
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

46 rindas
1.4KB

  1. <?php
  2. /**
  3. * PSR-4 autoloader implementation for the MaxMind\DB namespace.
  4. * First we define the 'mmdb_autoload' function, and then we register
  5. * it with 'spl_autoload_register' so that PHP knows to use it.
  6. *
  7. * @param mixed $class
  8. */
  9. /**
  10. * Automatically include the file that defines <code>class</code>.
  11. *
  12. * @param string $class
  13. * the name of the class to load
  14. */
  15. function mmdb_autoload($class)
  16. {
  17. /*
  18. * A project-specific mapping between the namespaces and where
  19. * they're located. By convention, we include the trailing
  20. * slashes. The one-element array here simply makes things easy
  21. * to extend in the future if (for example) the test classes
  22. * begin to use one another.
  23. */
  24. $namespace_map = ['MaxMind\\Db\\' => __DIR__ . '/src/MaxMind/Db/'];
  25. foreach ($namespace_map as $prefix => $dir) {
  26. /* First swap out the namespace prefix with a directory... */
  27. $path = str_replace($prefix, $dir, $class);
  28. /* replace the namespace separator with a directory separator... */
  29. $path = str_replace('\\', '/', $path);
  30. /* and finally, add the PHP file extension to the result. */
  31. $path = $path . '.php';
  32. /* $path should now contain the path to a PHP file defining $class */
  33. if (file_exists($path)) {
  34. include $path;
  35. }
  36. }
  37. }
  38. spl_autoload_register('mmdb_autoload');