PluginProbe
Tracking Code Manager / 2.3.0
Tracking Code Manager v2.3.0
2.8.0 2.7.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 All 29 releases
← All changes | autoload.php +48 -48 2.0.32.3.0 View file →
@@ -1,48 +1,48 @@
1 -<?php
2 -spl_autoload_register('tcmp_autoload');
3 -function tcmp_autoload($class) {
4 - $root=dirname(__FILE__).'/includes/classes/';
5 - tcmp_autoload_root($root, $class);
6 -}
7 -function tcmp_autoload_root($root, $class) {
8 - $slash=substr($root, strlen($root)-1);
9 - if($slash!='/' && $slash!='\\') {
10 - $root.='/';
11 - }
12 - $name=str_replace(TCMP_PLUGIN_PREFIX, '', $class);
13 - if(strpos($class, TCMP_PLUGIN_PREFIX)===FALSE) {
14 - //autoload only plugin classes
15 - return;
16 - }
17 -
18 - $h=opendir($root);
19 - while($file=readdir($h)) {
20 - if(is_dir($root.$file) && $file != '.' && $file != '..') {
21 - tcmp_autoload_root($root.$file, $class);
22 - } elseif(file_exists($root.$name.'.php')) {
23 - include_once($root.$name.'.php');
24 - } elseif(file_exists($root.$class.'.php')) {
25 - include_once($root.$class.'.php');
26 - }
27 - }
28 -}
29 -function tcmp_include_php($root) {
30 - $h=opendir($root);
31 - $slash=substr($root, strlen($root)-1);
32 - if($slash!='/' && $slash!='\\') {
33 - $root.='/';
34 - }
35 -
36 - while($file=readdir($h)) {
37 - if(is_dir($root.$file) && $file != '.' && $file != '..'){
38 - tcmp_include_php($root.$file);
39 - } elseif(strlen($file)>5) {
40 - $ext='.php';
41 - $length=strlen($ext);
42 - $start=$length*-1; //negative
43 - if(strcasecmp(substr($file, $start), $ext)==0) {
44 - include_once($root.$file);
45 - }
46 - }
47 - }
48 -}
1 +<?php
2 +spl_autoload_register( 'tcmp_autoload' );
3 +function tcmp_autoload( $class ) {
4 + $root = dirname( __FILE__ ) . '/includes/classes/';
5 + tcmp_autoload_root( $root, $class );
6 +}
7 +function tcmp_autoload_root( $root, $class ) {
8 + $slash = substr( $root, strlen( $root ) - 1 );
9 + if ( '/' !== $slash && '\\' !== $slash ) {
10 + $root .= '/';
11 + }
12 + $name = str_replace( TCMP_PLUGIN_PREFIX, '', $class );
13 + if ( strpos( $class, TCMP_PLUGIN_PREFIX ) === false ) {
14 + //autoload only plugin classes
15 + return;
16 + }
17 +
18 + $h = opendir( $root );
19 + while ( $file = readdir( $h ) ) {
20 + if ( is_dir( $root . $file ) && '.' !== $file && '..' !== $file ) {
21 + tcmp_autoload_root( $root . $file, $class );
22 + } elseif ( file_exists( $root . $name . '.php' ) ) {
23 + include_once( $root . $name . '.php' );
24 + } elseif ( file_exists( $root . $class . '.php' ) ) {
25 + include_once( $root . $class . '.php' );
26 + }
27 + }
28 +}
29 +function tcmp_include_php( $root ) {
30 + $h = opendir( $root );
31 + $slash = substr( $root, strlen( $root ) - 1 );
32 + if ( '/' !== $slash && '\\' !== $slash ) {
33 + $root .= '/';
34 + }
35 +
36 + while ( $file = readdir( $h ) ) {
37 + if ( is_dir( $root . $file ) && '.' !== $file && '..' !== $file ) {
38 + tcmp_include_php( $root . $file );
39 + } elseif ( strlen( $file ) > 5 ) {
40 + $ext = '.php';
41 + $length = strlen( $ext );
42 + $start = $length * -1; //negative
43 + if ( strcasecmp( substr( $file, $start ), $ext ) === 0 ) {
44 + include_once( $root . $file );
45 + }
46 + }
47 + }
48 +}