Ga_Admin.php
9 years ago
Ga_Autoloader.php
9 years ago
Ga_Frontend.php
9 years ago
Ga_Helper.php
9 years ago
Ga_Hook.php
9 years ago
Ga_Stats.php
9 years ago
Ga_View.php
9 years ago
Ga_Autoloader.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | class Ga_Autoloader { |
| 4 | |
| 5 | /** |
| 6 | * Registers clas loader. |
| 7 | */ |
| 8 | public static function register() { |
| 9 | spl_autoload_register( "Ga_Autoloader::loader" ); |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Class loader. |
| 14 | * |
| 15 | * @param $class_name |
| 16 | */ |
| 17 | private static function loader( $class_name ) { |
| 18 | $file_name = GA_PLUGIN_DIR . '/class/' . $class_name . '.php'; |
| 19 | if ( file_exists( $file_name ) ) { |
| 20 | require $file_name; |
| 21 | } |
| 22 | |
| 23 | if ( preg_match( '/Ga_Lib/', $class_name ) ) { |
| 24 | $file_name = GA_PLUGIN_DIR . '/lib/' . $class_name . '.php'; |
| 25 | if ( file_exists( $file_name ) ) { |
| 26 | require $file_name; |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |