| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Makes it easy to load classes when you need them |
| 5 |
* |
| 6 |
* @param string $class name |
| 7 |
*/ |
| 8 |
function h5p_autoloader($class) { |
| 9 |
static $classmap; |
| 10 |
if (!isset($classmap)) { |
| 11 |
$classmap = array( |
| 12 |
// Core |
| 13 |
'H5PCore' => 'h5p-php-library/h5p.classes.php', |
| 14 |
'H5PFrameworkInterface' => 'h5p-php-library/h5p.classes.php', |
| 15 |
'H5PContentValidator' => 'h5p-php-library/h5p.classes.php', |
| 16 |
'H5PValidator' => 'h5p-php-library/h5p.classes.php', |
| 17 |
'H5PStorage' => 'h5p-php-library/h5p.classes.php', |
| 18 |
'H5PExport' => 'h5p-php-library/h5p.classes.php', |
| 19 |
'H5PDevelopment' => 'h5p-php-library/h5p-development.class.php', |
| 20 |
'H5PFileStorage' => 'h5p-php-library/h5p-file-storage.interface.php', |
| 21 |
'H5PDefaultStorage' => 'h5p-php-library/h5p-default-storage.class.php', |
| 22 |
'H5PEventBase' => 'h5p-php-library/h5p-event-base.class.php', |
| 23 |
'H5PMetadata' => 'h5p-php-library/h5p-metadata.class.php', |
| 24 |
|
| 25 |
// Editor |
| 26 |
'H5peditor' => 'h5p-editor-php-library/h5peditor.class.php', |
| 27 |
'H5peditorFile' => 'h5p-editor-php-library/h5peditor-file.class.php', |
| 28 |
'H5peditorStorage' => 'h5p-editor-php-library/h5peditor-storage.interface.php', |
| 29 |
'H5PEditorAjaxInterface' => 'h5p-editor-php-library/h5peditor-ajax.interface.php', |
| 30 |
'H5PEditorAjax' => 'h5p-editor-php-library/h5peditor-ajax.class.php', |
| 31 |
|
| 32 |
// Public |
| 33 |
'H5P_Event' => 'public/class-h5p-event.php', |
| 34 |
'H5P_Plugin' => 'public/class-h5p-plugin.php', |
| 35 |
'H5PWordPress' => 'public/class-h5p-wordpress.php', |
| 36 |
|
| 37 |
// Admin |
| 38 |
'H5P_Plugin_Admin' => 'admin/class-h5p-plugin-admin.php', |
| 39 |
'H5PContentAdmin' => 'admin/class-h5p-content-admin.php', |
| 40 |
'H5PContentQuery' => 'admin/class-h5p-content-query.php', |
| 41 |
'H5PLibraryAdmin' => 'admin/class-h5p-library-admin.php', |
| 42 |
'H5PEditorWordPressStorage' => 'admin/class-h5p-editor-wordpress-storage.php', |
| 43 |
'H5PEditorWordPressAjax' => 'admin/class-h5p-editor-wordpress-ajax.php', |
| 44 |
'H5PPrivacyPolicy' => 'admin/class-h5p-privacy-policy.php', |
| 45 |
'H5PUtils' => 'admin/class-h5p-utils.php', |
| 46 |
); |
| 47 |
} |
| 48 |
|
| 49 |
if (isset($classmap[$class])) { |
| 50 |
require_once plugin_dir_path(__FILE__) . $classmap[$class]; |
| 51 |
} |
| 52 |
} |
| 53 |
spl_autoload_register('h5p_autoloader'); |
| 54 |
|