w2s-migrate-woo-to-shopify
Last commit date
admin
5 months ago
assets
5 months ago
includes
5 months ago
languages
5 months ago
public
5 months ago
README.txt
5 months ago
autoload.php
5 months ago
changelog.txt
5 months ago
uninstall.php
5 months ago
w2s-migrate-woo-to-shopify.php
5 months ago
autoload.php
28 lines
| 1 | <?php |
| 2 | namespace Shopify; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; |
| 6 | } |
| 7 | |
| 8 | spl_autoload_register( function ( $class ) { |
| 9 | $prefix = __NAMESPACE__; |
| 10 | $base_dir = __DIR__; |
| 11 | $len = strlen( $prefix ); |
| 12 | |
| 13 | if ( strncmp( $prefix, $class, $len ) !== 0 ) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | $relative_class = strtolower( substr( $class, $len ) ); |
| 18 | $relative_class = strtolower( str_replace( '_', '-', $relative_class ) ); |
| 19 | $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; |
| 20 | |
| 21 | if ( file_exists( $file ) ) { |
| 22 | require_once $file; |
| 23 | } else { |
| 24 | return; |
| 25 | } |
| 26 | } ); |
| 27 | |
| 28 |