| 1 |
<?php |
| 2 |
|
| 3 |
namespace Photonic_Plugin\Core; |
| 4 |
|
| 5 |
use Photonic_Plugin\Platforms\Instagram; |
| 6 |
|
| 7 |
class Cron { |
| 8 |
public function __construct() { |
| 9 |
global $photonic_instagram_access_token; |
| 10 |
$to = get_option('admin_email'); |
| 11 |
$headers = array('Content-Type: text/html; charset=UTF-8'); |
| 12 |
|
| 13 |
if (!empty($to)) { |
| 14 |
$subject = sprintf(esc_attr__('[%s - Photonic] Access Credentials Expiring Soon!', 'photonic'), get_bloginfo('name')); |
| 15 |
$body = sprintf(esc_html__('You are using %1$s on your website at %2$s. You have set it up to authenticate against the following platforms, for which your credentials have expired or will expire soon: ', 'photonic'), '<a href="https://wordpress.org/plugins/photonic/">Photonic</a>', site_url()); |
| 16 |
|
| 17 |
$module_body = ''; |
| 18 |
if (!empty($photonic_instagram_access_token)) { |
| 19 |
require_once PHOTONIC_PATH . "/Platforms/Instagram.php"; |
| 20 |
$module = Instagram::get_instance(); |
| 21 |
$soon = $module->is_token_expiring_soon(10); |
| 22 |
if (!empty($soon)) { |
| 23 |
$module_body .= sprintf(esc_html__('%1$s%2$sInstagram%3$s - Instagram credentials expire every 60 days. Facebook requires you to reauthenticate to continue using application functionality. Please reauthenticate Photonic for Instagram from your dashboard (%4$s).%5$s', 'photonic'), '<li>', '<strong>', '</strong>', admin_url('admin.php?page=photonic-auth'), '</li>'); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
if (!empty($module_body)) { |
| 28 |
$body .= '<ul>' . $module_body . '</ul>'; |
| 29 |
wp_mail($to, $subject, $body, $headers); |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|