Skip to content

Commit cd19abd

Browse files
committed
fix the autoloader
1 parent c2b5e81 commit cd19abd

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

s3-uploads.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
include_once dirname(__FILE__) . '/inc/class-s3-uploads-wp-cli-command.php';
1313
}
1414

15-
require_once dirname(__FILE__) . '/inc/class-s3-uploads-changed-files-iterator.php';
16-
require_once dirname(__FILE__) . '/inc/class-s3-uploads-image-editor-imagick.php';
17-
require_once dirname(__FILE__) . '/inc/class-s3-uploads-local-stream-wrapper.php';
18-
require_once dirname(__FILE__) . '/inc/class-s3-uploads-stream-wrapper.php';
19-
require_once dirname(__FILE__) . '/inc/class-s3-uploads-uploadsyncbuilder.php';
20-
require_once dirname(__FILE__) . '/inc/class-s3-uploads.php';
21-
2215
add_action('plugins_loaded', 's3_uploads_init');
2316

2417
function s3_uploads_init()
@@ -94,5 +87,26 @@ function s3_uploads_enabled()
9487
return true;
9588
}
9689

90+
function s3_uploads_autoload($class)
91+
{
92+
$mapping = array(
93+
'S3_Uploads_ChangedFilesIterator' => __DIR__ . '/inc/class-s3-uploads-changed-files-iterator.php',
94+
'S3_Uploads_Image_Editor_Imagick' => __DIR__ . '/inc/class-s3-uploads-image-editor-imagick.php',
95+
'S3_Uploads_Local_Stream_Wrapper' => __DIR__ . '/inc/class-s3-uploads-local-stream-wrapper.php',
96+
'S3_Uploads_Stream_Wrapper' => __DIR__ . '/inc/class-s3-uploads-stream-wrapper.php',
97+
'S3_Uploads_UploadSyncBuilder' => __DIR__ . '/inc/class-s3-uploads-uploadsyncbuilder.php',
98+
'S3_Uploads_WP_CLI_Command' => __DIR__ . '/inc/class-s3-uploads-wp-cli-command.php',
99+
'S3_Uploads' => __DIR__ . '/inc/class-s3-uploads.php',
100+
);
101+
102+
if (isset($mapping[$class])) {
103+
if (isset($mapping[$class])) {
104+
include $mapping[$class];
105+
}
106+
}
107+
}
108+
109+
spl_autoload_register('s3_uploads_autoload', true);
110+
97111
// Require AWS Autoloader file.
98112
require_once dirname(__FILE__) . '/lib/aws-sdk/aws-autoloader.php';

0 commit comments

Comments
 (0)