| @@ -1,0 +1,25 @@ | ||
| 1 | +<?php | |
| 2 | +// Exit if accessed directly | |
| 3 | +if( !defined( 'ABSPATH' ) ) exit; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * RNL AUTOLOADER | |
| 7 | + * Looks in /code to see if a file matching the classname exists | |
| 8 | + * | |
| 9 | + * @param $class | |
| 10 | + * | |
| 11 | + * @since 1.2 Added test to see if function has been declared already. | |
| 12 | + * @since 1.0.0 | |
| 13 | + */ | |
| 14 | +if( ! function_exists( 'rnl_autoloader' ) ) { | |
| 15 | + | |
| 16 | + function rnl_autoloader( $class ) { | |
| 17 | + | |
| 18 | + $base_dir = __DIR__; | |
| 19 | + $class = strtolower( $class ); | |
| 20 | + $file = $base_dir . '/code/' . $class . '.php'; | |
| 21 | + if ( file_exists( $file ) ) { | |
| 22 | + require $file; | |
| 23 | + } | |
| 24 | + } | |
| 25 | +} | |