-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapiadlib.autoload.php
More file actions
98 lines (77 loc) · 2.25 KB
/
apiadlib.autoload.php
File metadata and controls
98 lines (77 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* APIAdLib
* Autoload
* Class for register and autoload library classes with spl_autoload...
*
* PHP Version 5.2
*
* @package APIAdLib
* @category WebServices
* @copyright 2012, Vadim Pshentsov. All Rights Reserved.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @author V.Pshentsov <pshentsoff@gmail.com>
*
*/
/**
* Class APIAdLibAutoload
* Class for register and autoload library classes with spl_autoload...
*/
class APIAdLibAutoload {
/**
*
* Global Array with descriptions array for every supported library
* Descriptions array format:
* 'path' - path to library folder
*
*/
private static $APIADLIB_PATHS = array(
//APIAdLib Extensions for Yandex Direct API Library (same as for GAW)
'YDirectExt/Lib/',
'YDirectExt/Util/',
// APIAdLib Extensions for Google AdWords API Library
'AdWordsExt/Lib/',
'AdWordsExt/Util/',
// Yandex.Direct paths
'YDirect/Lib/',
'YDirect/Util/',
// Common classes paths
'Common/Lib/',
'Common/Util/',
// Google AdWords paths
'AdWords/Lib/',
'AdWords/Util/',
// old versions removed
// @since 0.3.6
// 'AdWords/v200909/',
// 'AdWords/v201003/',
// 'AdWords/v201008/',
// 'AdWords/v201101/',
// 'AdWords/v201109/',
// @since 0.7
'AdWords/v201406/',
// @since 0.4
'AdWords/v201402/',
// @since 0.3
'AdWords/v201309/',
'AdWords/v201306/',
);
// Saves last loaded filename for future logging purposes
private static $_lastLoadedFilename;
/**
* Library classes autoload function for SPL autoload functions stack
*/
public static function LoadClass($class_name) {
foreach(self::$APIADLIB_PATHS as $key => $class_path) {
$class_filepath = dirname(__FILE__).'/'.$class_path.$class_name.'.php';
if(!file_exists($class_filepath)) continue;
self::$_lastLoadedFilename = $class_filepath;
require_once(self::$_lastLoadedFilename);
break;
}
}
}
/**
* Register library autoload class method in spl_autoload stack
*/
spl_autoload_register(array('APIADLibAutoload','LoadClass'));