| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 3 |
|
| 4 |
/** |
| 5 |
* Tell if WP Offload S3 compatibility is loaded. |
| 6 |
* |
| 7 |
* @since 1.7 |
| 8 |
* @author Grégory Viguier |
| 9 |
* |
| 10 |
* @return bool |
| 11 |
*/ |
| 12 |
function imagify_load_as3cf_compat() { |
| 13 |
if ( function_exists( 'as3cf_init' ) ) { |
| 14 |
// WP Offload S3 Lite. |
| 15 |
$version = ! empty( $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] ) ? $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] : false; |
| 16 |
|
| 17 |
if ( ! $version ) { |
| 18 |
return false; |
| 19 |
} |
| 20 |
|
| 21 |
if ( ! function_exists( 'amazon_web_services_init' ) && version_compare( $version, '1.3' ) < 0 ) { |
| 22 |
// Old version, plugin Amazon Web Services is required. |
| 23 |
return false; |
| 24 |
} |
| 25 |
|
| 26 |
if ( version_compare( $version, '2.3' ) >= 0 ) { |
| 27 |
// A new version that removes a punlic method. |
| 28 |
return false; |
| 29 |
} |
| 30 |
|
| 31 |
return true; |
| 32 |
} |
| 33 |
|
| 34 |
if ( function_exists( 'as3cf_pro_init' ) ) { |
| 35 |
// WP Offload S3 Pro. |
| 36 |
$version = ! empty( $GLOBALS['aws_meta']['amazon-s3-and-cloudfront-pro']['version'] ) ? $GLOBALS['aws_meta']['amazon-s3-and-cloudfront-pro']['version'] : false; |
| 37 |
|
| 38 |
if ( ! $version ) { |
| 39 |
return false; |
| 40 |
} |
| 41 |
|
| 42 |
if ( ! function_exists( 'amazon_web_services_init' ) && version_compare( $version, '1.6' ) < 0 ) { |
| 43 |
// Old version, plugin Amazon Web Services is required. |
| 44 |
return false; |
| 45 |
} |
| 46 |
|
| 47 |
if ( version_compare( $version, '2.3' ) >= 0 ) { |
| 48 |
// A new version that removes a punlic method. |
| 49 |
return false; |
| 50 |
} |
| 51 |
|
| 52 |
return true; |
| 53 |
} |
| 54 |
|
| 55 |
return false; |
| 56 |
} |
| 57 |
|
| 58 |
if ( imagify_load_as3cf_compat() ) : |
| 59 |
|
| 60 |
class_alias( '\\Imagify\\ThirdParty\\AS3CF\\Main', '\\Imagify_AS3CF' ); |
| 61 |
|
| 62 |
add_action( 'imagify_loaded', [ \Imagify\ThirdParty\AS3CF\Main::get_instance(), 'init' ], 1 ); |
| 63 |
|
| 64 |
endif; |
| 65 |
|