dir = $dir; } spl_autoload_register(array($this, 'autoload')); } /** * Make instances of the autoloaders for each directory in the plugin. * * @since 1.0.0 */ public static function register() { new self(AALB_INCLUDES_DIR); new self(AALB_ADMIN_DIR); new self(AALB_SIDEBAR_DIR); new self(AALB_PAAPI_DIR); new self(AALB_SHORTCODE_DIR); new self(AALB_LIBRARY_DIR); } /** * Callback function of spl_autoload_register to autoload the class. * * @since 1.0.0 * @param string $class Name of the class to autoload. */ public function autoload($class) { $path = $this->dir . strtolower($class) . '.php'; if(file_exists($path)) { require_once($path); } } } ?>