PluginProbe
ShareThis Dashboard for Google Analytics / 3.4.1
ShareThis Dashboard for Google Analytics v3.4.1
3.4.1 3.4.0 3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 All 45 releases
googleanalytics / class / class-ga-autoloader.php

class-ga-autoloader.php in ShareThis Dashboard for Google Analytics 3.4.1, at class/class-ga-autoloader.php

64 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GoogleAnalytics Autoloader.
4 *
5 * @package GoogleAnalytics
6 */
7
8 /**
9 * Autoloader class.
10 */
11 class Ga_Autoloader {
12 /**
13 * Registers clas loader.
14 */
15 public static function register() {
16 spl_autoload_register( 'Ga_Autoloader::loader' );
17 }
18
19 /**
20 * Class loader.
21 *
22 * @param string $class_name Class name string.
23 */
24 private static function loader( $class_name ) {
25 $class_slug = 'class-' . str_replace( '_', '-', sanitize_title( $class_name ) );
26
27 // Core classes.
28 if ( preg_match( '/_Core/', $class_name ) ) {
29 $file_name = GA_PLUGIN_DIR . '/class/core/' . $class_slug . '.php';
30 if ( file_exists( $file_name ) ) {
31 require $file_name;
32 }
33 }
34
35 // Controllers.
36 if ( preg_match( '/_Controller/', $class_name ) ) {
37 $file_name = GA_PLUGIN_DIR . '/class/controller/' . $class_slug . '.php';
38 if ( file_exists( $file_name ) ) {
39 require $file_name;
40 }
41 }
42
43 // Classes.
44 $file_name = GA_PLUGIN_DIR . '/class/' . $class_slug . '.php';
45 if ( file_exists( $file_name ) ) {
46 require $file_name;
47 }
48
49 // Tools.
50 $file_name_tools = GA_PLUGIN_DIR . '/tools/' . $class_slug . '.php';
51 if ( file_exists( $file_name_tools ) ) {
52 require $file_name_tools;
53 }
54
55 // Libs.
56 if ( preg_match( '/Ga_Lib/', $class_name ) ) {
57 $file_name = GA_PLUGIN_DIR . '/lib/' . $class_slug . '.php';
58 if ( file_exists( $file_name ) ) {
59 require $file_name;
60 }
61 }
62 }
63 }
64