PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 2.6.0
Tracking Code Manager v2.6.0
trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0
tracking-code-manager / autoload.php
tracking-code-manager Last commit date
assets 2 years ago includes 1 month ago languages 3 years ago LICENSE 1 year ago autoload.php 1 month ago index.php 1 month ago readme.txt 1 month ago screenshot-1.png 11 years ago screenshot-2.png 11 years ago screenshot-3.png 11 years ago screenshot-4.png 11 years ago screenshot-5.png 11 years ago tcmp_free_wp_kses_tags_attrs.php 3 years ago
autoload.php
50 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 spl_autoload_register( 'tcmp_autoload' );
4 function tcmp_autoload( $class ) {
5 $root = dirname( __FILE__ ) . '/includes/classes/';
6 tcmp_autoload_root( $root, $class );
7 }
8 function tcmp_autoload_root( $root, $class ) {
9 $slash = substr( $root, strlen( $root ) - 1 );
10 if ( '/' !== $slash && '\\' !== $slash ) {
11 $root .= '/';
12 }
13 $name = str_replace( TCMP_PLUGIN_PREFIX, '', $class );
14 if ( strpos( $class, TCMP_PLUGIN_PREFIX ) === false ) {
15 //autoload only plugin classes
16 return;
17 }
18
19 $h = opendir( $root );
20 while ( $file = readdir( $h ) ) {
21 if ( is_dir( $root . $file ) && '.' !== $file && '..' !== $file ) {
22 tcmp_autoload_root( $root . $file, $class );
23 } elseif ( file_exists( $root . $name . '.php' ) ) {
24 include_once( $root . $name . '.php' );
25 } elseif ( file_exists( $root . $class . '.php' ) ) {
26 include_once( $root . $class . '.php' );
27 }
28 }
29 }
30 function tcmp_include_php( $root ) {
31 $h = opendir( $root );
32 $slash = substr( $root, strlen( $root ) - 1 );
33 if ( '/' !== $slash && '\\' !== $slash ) {
34 $root .= '/';
35 }
36
37 while ( $file = readdir( $h ) ) {
38 if ( is_dir( $root . $file ) && '.' !== $file && '..' !== $file ) {
39 tcmp_include_php( $root . $file );
40 } elseif ( strlen( $file ) > 5 ) {
41 $ext = '.php';
42 $length = strlen( $ext );
43 $start = $length * -1; //negative
44 if ( strcasecmp( substr( $file, $start ), $ext ) === 0 ) {
45 include_once( $root . $file );
46 }
47 }
48 }
49 }
50