1 | <?php |
||
2 | /** |
||
3 | * Autoloader. |
||
4 | */ |
||
5 | |||
6 | // Bail if WordPress isn't loaded. |
||
7 | if ( ! defined( 'WPINC' ) ) { |
||
8 | die(); |
||
9 | } |
||
10 | |||
11 | /** |
||
12 | * Custom autoloader for the Easy Mailchimp Extender plugin. |
||
13 | * |
||
14 | * @author Jeremy Pry |
||
15 | * @since 6.2.0 |
||
16 | * |
||
17 | * @param string $class The name of the class to autoload. |
||
18 | */ |
||
19 | function yikes_inc_easy_mailchimp_extender_autoloader( $class ) { |
||
20 | static $map = null; |
||
21 | if ( null === $map ) { |
||
22 | $map = require( dirname( __FILE__ ) . '/class-map.php' ); |
||
23 | } |
||
24 | |||
25 | $class = strtolower( $class ); |
||
26 | if ( isset( $map[ $class ] ) ) { |
||
27 | require_once( dirname( __FILE__ ) . "/{$map[ $class ]}" ); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | spl_autoload_register( 'yikes_inc_easy_mailchimp_extender_autoloader' ); |
||
32 |