PluginProbe ʕ •ᴥ•ʔ
Alma – Pay in installments or later for WooCommerce / 4.2.1
Alma – Pay in installments or later for WooCommerce v4.2.1
6.4.1 6.4.0 6.3.0 6.2.1 6.2.0 trunk 3.0.0 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.10.0 5.11.0 5.12.0 5.13.0 5.13.1 5.14.1 5.14.2 5.15.0 5.16.0 5.16.1 5.16.2 5.2.0 5.2.1 5.3.0 5.4.0 5.5.0 5.6.0 5.7.0 5.8.0 5.8.1 5.9.0 6.0.4 6.0.6 6.0.7 6.1.0
alma-gateway-for-woocommerce / autoload.php
alma-gateway-for-woocommerce Last commit date
assets 3 years ago includes 3 years ago languages 3 years ago public 3 years ago tests 3 years ago trunk 3 years ago vendor 3 years ago LICENSE 4 years ago alma-gateway-for-woocommerce.php 3 years ago autoload.php 3 years ago composer.json 3 years ago composer.lock 3 years ago phpcs.xml 3 years ago readme.txt 3 years ago uninstall.php 3 years ago
autoload.php
51 lines
1 <?php
2 /**
3 * Autoload.
4 *
5 * @package Alma_Gataway_For_Woocommerce
6 */
7
8 // Define the main autoloader.
9 spl_autoload_register( 'alma_wc_autoloader' );
10
11 /**
12 * Autoload the files.
13 *
14 * @param string $class_name The class name.
15 * @return void
16 */
17 function alma_wc_autoloader( $class_name ) {
18
19 $parent_namespace = 'Alma\Woocommerce';
20 $classes_subfolder = 'includes';
21
22 if ( false !== strpos( $class_name, $parent_namespace ) ) {
23 $classes_dir = realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR . $classes_subfolder . DIRECTORY_SEPARATOR;
24
25 // Project namespace.
26 $project_namespace = $parent_namespace . '\\';
27 $length = strlen( $project_namespace );
28
29 // Remove top level namespace (that is the current dir).
30 $class_file = substr( $class_name, $length );
31
32 // Swap underscores for dashes and lowercase.
33 $class_file = str_replace( '_', '-', strtolower( $class_file ) );
34
35 // Prepend `class-` to the filename (last class part).
36 $class_parts = explode( '\\', $class_file );
37 $last_index = count( $class_parts ) - 1;
38 $class_parts[ $last_index ] = 'class-' . $class_parts[ $last_index ];
39
40 // Join everything back together and add the file extension.
41 $class_file = implode( DIRECTORY_SEPARATOR, $class_parts ) . '.php';
42 $location = $classes_dir . $class_file;
43
44 if ( ! is_file( $location ) ) {
45 return;
46 }
47
48 require_once $location;
49 }
50 }
51