PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 109
Lasso Lite – Affiliate Link Manager & Product Displays v109
157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 116 All 56 releases
simple-urls / autoload.php

autoload.php in Lasso Lite – Affiliate Link Manager & Product Displays 109, at autoload.php

31 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Register plugin autoloader. Example namespace: LassoLite\Models, LassoLite\Pages, LassoLite\Ajax,...
4 *
5 * @package Autoload
6 *
7 * @param string $class_name Name of the class to load.
8 */
9
10 spl_autoload_register(
11 function( $class_name ) {
12 $namespace_prefix = 'LassoLite';
13 $class_file_prefix = 'class-';
14 // ? Only do autoload for our plugin files
15 if ( strpos( $class_name, $namespace_prefix . '\\' ) === 0 ) {
16 $class_file = str_replace( array( '\\', $namespace_prefix . DIRECTORY_SEPARATOR ), array( DIRECTORY_SEPARATOR, '' ), $class_name ) . '.php';
17 $class_file = strtolower( $class_file );
18 $temp = explode( DIRECTORY_SEPARATOR, $class_file );
19 $file_name = end( $temp );
20 $correct_file_name = $class_file_prefix . $file_name;
21 $class_file = str_replace( $file_name, $correct_file_name, $class_file );
22 $class_file = str_replace( '_', '-', $class_file );
23 $class_file_path = SIMPLE_URLS_DIR . DIRECTORY_SEPARATOR . $class_file;
24
25 if ( file_exists( $class_file_path ) ) {
26 require_once $class_file_path;
27 }
28 }
29 }
30 );
31