diff --git a/src/Autoloader.php b/src/Autoloader.php deleted file mode 100644 index 34b0884f911..00000000000 --- a/src/Autoloader.php +++ /dev/null @@ -1,70 +0,0 @@ -get_file_name_from_class( $class ); - $dir = trailingslashit( dirname( __FILE__ ) ); - - // Non-namespaced files. - if ( stristr( $class, 'WC_REST_' ) ) { - if ( stristr( $class, 'WC_REST_Blocks' ) ) { - $subdir = 'wc-blocks/'; - } elseif ( stristr( $class, '_V1_' ) ) { - $subdir = 'v1/'; - } elseif ( stristr( $class, '_V2_' ) ) { - $subdir = 'v2/'; - } else { - $subdir = 'v3/'; - } - - if ( file_exists( $dir . $subdir . $file ) ) { - include $dir . $subdir . $file; - return; - } - } - - if ( file_exists( $dir . $class . '.php' ) ) { - include $dir . $class . '.php'; - return; - } - - if ( file_exists( $dir . $file ) ) { - include $dir . $file; - return; - } - } -} diff --git a/src/RestApi.php b/src/RestApi.php index 345bad0f0d0..9090d54e35d 100644 --- a/src/RestApi.php +++ b/src/RestApi.php @@ -9,6 +9,10 @@ namespace WooCommerce; defined( 'ABSPATH' ) || exit; +if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) { + require __DIR__ . '/../vendor/autoload.php'; +} + use WooCommerce\Utilities\SingletonTrait; /** @@ -28,10 +32,6 @@ class RestApi { * Hook into WordPress ready to init the REST API as needed. */ public function init() { - // Get the autoloader for this version of the API. - if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) { - require __DIR__ . '/../vendor/autoload.php'; - } add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 ); }