forked from crowdfavorite-mirrors/wp-w3-total-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cdn_Fsd_Core.php
executable file
·41 lines (35 loc) · 967 Bytes
/
Cdn_Fsd_Core.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
<?php
namespace W3TC;
/**
* Core for FSD CDN
*/
class Cdn_Fsd_Core {
/**
* Returns CDN object
*/
function get_engine() {
static $engine_object = null;
if ( is_null( $engine_object ) ) {
$c = Dispatcher::config();
$engine = $c->get_string( 'cdn.engine' );
switch ( $engine ) {
case 'cloudfront_fsd':
$engine_object = new Cdn_CloudFrontFsd_Engine( array(
'access_key' => $c->get_string( 'cdn.cloudfront_fsd.access_key' ),
'secret_key' => $c->get_string( 'cdn.cloudfront_fsd.secret_key' ),
'distribution_id' => $c->get_string( 'cdn.cloudfront_fsd.distribution_id' )
) );
break;
case 'maxcdn_fsd':
$engine_object = new Cdn_MaxCdnFsd_Engine( array(
'api_key' => $c->get_string( 'cdn.maxcdn_fsd.api_key' ),
'zone_id' => $c->get_integer( 'cdn.maxcdn_fsd.zone_id' )
) );
break;
default:
throw new \Exception( 'unknown engine ' . $engine );
}
}
return $engine_object;
}
}