PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.1
Patchstack – WordPress & Plugins Security v2.2.1
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / lib / geoip2-php / maxmind-db / reader / autoload.php

autoload.php in Patchstack – WordPress & Plugins Security 2.2.1, at lib/geoip2-php/maxmind-db/reader/autoload.php

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