| 1 |
<?php |
| 2 |
|
| 3 |
namespace AgeGate\Integration; |
| 4 |
|
| 5 |
use AgeGate\Common\Settings; |
| 6 |
use AgeGate\Common\Integration; |
| 7 |
|
| 8 |
class Offload extends Integration |
| 9 |
{ |
| 10 |
public function exists() |
| 11 |
{ |
| 12 |
return class_exists('Amazon_S3_And_CloudFront'); |
| 13 |
} |
| 14 |
|
| 15 |
public function init() |
| 16 |
{ |
| 17 |
if ($this->exists()) { |
| 18 |
$settings = Settings::getInstance(); |
| 19 |
global $wp_filter; |
| 20 |
|
| 21 |
// TODO: when deprecated items no longer used, switch to has_filter('age_gate/logo/src'); |
| 22 |
if ($settings->logoId && count($wp_filter['age_gate/logo/src']->callbacks ?? []) < 2) { |
| 23 |
|
| 24 |
$settings->logo = wp_get_attachment_url($settings->logoId); |
| 25 |
|
| 26 |
} |
| 27 |
|
| 28 |
if ($settings->backgroundImageId) { |
| 29 |
$settings->backgroundImage = wp_get_attachment_url($settings->backgroundImageId); |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|