This repository has been archived by the owner on May 23, 2023. It is now read-only.
forked from BoldGrid/w3-total-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CdnEngine.php
108 lines (85 loc) · 2.51 KB
/
CdnEngine.php
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
99
100
101
102
103
104
105
106
107
108
<?php
namespace W3TC;
/**
* class CdnEngine
*/
class CdnEngine {
/**
* Returns CdnEngine_Base instance
*
* @param string $engine
* @param array $config
* @return CdnEngine_Base
*/
static function instance( $engine, $config = array() ) {
static $instances = array();
$instance_key = sprintf( '%s_%s', $engine, md5( serialize( $config ) ) );
if ( !isset( $instances[$instance_key] ) ) {
switch ( $engine ) {
case 'akamai':
$instances[$instance_key] = new CdnEngine_Mirror_Akamai( $config );
break;
case 'att':
$instances[$instance_key] = new CdnEngine_Mirror_Att( $config );
break;
case 'azure':
$instances[$instance_key] = new CdnEngine_Azure( $config );
break;
case 'cf':
$instances[$instance_key] = new CdnEngine_CloudFront( $config );
break;
case 'cf2':
$instances[$instance_key] = new CdnEngine_Mirror_CloudFront( $config );
break;
case 'cotendo':
$instances[$instance_key] = new CdnEngine_Mirror_Cotendo( $config );
break;
case 'edgecast':
$instances[$instance_key] = new CdnEngine_Mirror_Edgecast( $config );
break;
case 'ftp':
$instances[$instance_key] = new CdnEngine_Ftp( $config );
break;
case 'google_drive':
$instances[$instance_key] = new CdnEngine_GoogleDrive( $config );
break;
case 'highwinds':
$instances[$instance_key] = new CdnEngine_Mirror_Highwinds( $config );
break;
case 'limelight':
$instances[$instance_key] = new CdnEngine_Mirror_LimeLight( $config );
break;
case 'maxcdn':
$instances[$instance_key] = new CdnEngine_Mirror_MaxCdn( $config );
break;
case 'mirror':
$instances[$instance_key] = new CdnEngine_Mirror( $config );
break;
case 'rackspace_cdn':
$instances[$instance_key] = new CdnEngine_Mirror_RackSpaceCdn( $config );
break;
case 'rscf':
$instances[$instance_key] =
new CdnEngine_RackSpaceCloudFiles( $config );
break;
case 's3':
$instances[$instance_key] = new CdnEngine_S3( $config );
break;
case 's3_compatible':
$instances[$instance_key] = new CdnEngine_S3_Compatible( $config );
break;
case 'stackpath':
$instances[$instance_key] = new CdnEngine_Mirror_StackPath( $config );
break;
case 'stackpath2':
$instances[$instance_key] = new CdnEngine_Mirror_StackPath2( $config );
break;
default :
trigger_error( 'Incorrect CDN engine', E_USER_WARNING );
$instances[$instance_key] = new CdnEngine_Base();
break;
}
}
return $instances[$instance_key];
}
}