JFIF $ d d 7 * Z qn )ZP 0 !1 A "#a$2Qr D8 a Ri [f \m I ykI w0 c u F c Rı?lO7 к _f˓ [C $殷WF< _W ԣ s Kc ëI zyQy /_LK ℂ ;C",p F A : /] =H ~ , l s / 9 ć: [=/#f ; ) x { ٛE Q )~ = 𘙲r*2~ a _V = ' ku m F D } KYYC )( { * g& f `툪 r y ` = ^ c J. I ]( * `wq 1dđ #̩ ͑ 0 ; H ] u 搂 @:~ ו K L N s h } O I R* 8 :2 ! lD JV o ( 3 = M ( z Ȱ+i *N A r6K n S l ) ! J J Ӂ* % ݉?|D } d5: eP0 R; {$X' x F @ .ÊB {,WJ uQ ɲRI ;9 Q E琯 6 2fT .DU J ;*c P A\IL Nj! J ۱+ O\ ͔ ] ޒ S J ȧ c%A N ol ՎprU L Zԛe r E2= X D Xg VQeӓ k y P7 U* o m Q I s ,K `) 6\G3t?pgjr m ۛجw luGt f h 9uyP 0D;Uڽ"OXl i f $ ) &|ML 0 Z rm1 [ H XP l P R0 'G=i 2N +0 e 2 ]] 9 VT P O 7 h(F * 癈 ' = Q VZD F,d ߬ ~ T X G[ `le 69C R(!S2! P < 0 x < !1AQ "Raq 02Br #S CTb ? Ζ "]mH5WR 7 k.ۛ ! } Q~ + yԏ z |@ T20 S~ K e k *zF f^2X *( @ 8 r ? C I uI|֓>^Ex LgNU Y+{.R Ѫ τV YT D I 6 2 '8Y2 7'\T P.6 d &˦ @V q i |8 -O Ε ] ʔ U= T L 8= ;6c | !qfF3 a ů& ~$ l} 'NW U s$U k^S V : U#6w + +s &r+n ڐ { @ 29gL u " T Ù M=6 (^ "7 r}=6Yݾ lC u hquymp Ǧ G jhs ǜNl ɻ} o 7 #S6 a w 4 ! OS r D 5 7 % | ?x> L | / nD 6?/8 w # [ ) L 7 +6〼T A T g ! %5 Mm Z /c -{1_Je "| ^$ 'O & ޱմ < H vNqϡQ$ < 6 &Nݛ ֨tǻN (9 n ru~'όN sMG& ,uH Kw *Ī 5@ u6 BԒ i YN * f 0 _ GhKW u lT <nj- 0{ M L~ | /a v\ E = ?1 \ɟuq Ђ Y O a K ޡP q $ H8o Q˼EV ~ k 0 h' L Pp M -M" m^ !6l nմ 쮝C U T . ! :vMǨb h ډ Vc r @~p # !1QAa q ? AL0L x LU 4 d ; x " 16ad0 7.\ߋ 0 = P l v/ " c A Ay A|2pO8"d MV #1] = \ " ˡ ] k v I9 d ۓ & q ) ǐq E ꞅ v "P )q X &Q З non]я u ג./ ; gZ$ M QР 2M ]h ni 0 P $ێ 3CɏGjώy : m c # S_ l@ '_ \m|C 2`K _ 1 cIvGc $? PCQ S+D ? K aײ k Fr b 8 ύ NEدg ĝ U 3 6 #Ik+ v { v i ( ވ ? a e) X xy/*@Q Ǽ Ծ ) $ IWO l c G; !i k{ gOŀ L ('x T rb $ w) R $ & N1E td U3Uȉ1p M"N* (DNy d96.(jQ) X 5 c QɎMy W ? Q *!R > 6=7)Xj 5`J ] e 8%t ! + ' ! 1Q 5 !1 AQaq ё #2 "0BRb ? G t^ ## .l lQ T $ v , ,m 㵜5u bV =sY+ @d { N ! dn O < .- B; _w J t 6;Q Jd. Q c%p{ 1 ,sND dF H I0 Гo X ш e黅X ۢ F :)[ F G X ƹ / w _c MeD ,ʡc c . W D tA $ j@ : ) - #u c1< @ۗ9F ) KJ- hpP] _ x [ q B lb p ʖ w q " LFGd ƶ * s +ډ_Zc " ? % t[I P 6 J ]# =ɺ V v v CGs Gh1 > )6 |e y ? L ӣ m,4 G W Ui ` ] uJVo VDG< SB 6ϏQ @ TiU l y O U 0 kfV ~ ~}S Z @ *WU Ui ## ; s /[ = ! 7}" W N ] ' (L ! ~ y5 g9T̅J kbM' +s :S +B) v @ M j e C f j E 0 Y\Qn z G 1 д~ W o{T 9?` Rm yhsy3 !HAD ] m c1 ~ 2 L S u7x T ;j$ `} 4-> L# vzŏ I L S ֭ T { r jGK C ; b pU= - ` Bs K. S F w4 M q] Z dH S 0 ) tLg
<?php
if (!defined('ABSPATH')) die('No direct access allowed');
class UpdraftPlus_Temporary_Clone_Dash_Notice {
/**
* Constructor for the class.
*/
public function __construct() {
add_action('updraftplus_temporary_clone_refresh_connection', array($this, 'refresh_connection'));
add_action('wp_ajax_updraftplus_dash_notice_ajax', array($this, 'updraftplus_dash_notice_ajax'));
add_action('all_admin_notices', array($this, 'all_admin_notices_dashboard_notice'));
if (!wp_next_scheduled('updraftplus_temporary_clone_refresh_connection')) {
wp_schedule_event(time(), 'twicedaily', 'updraftplus_temporary_clone_refresh_connection');
}
if ('' == get_site_option('updraftplus_clone_scheduled_removal', '') || 0 == get_site_option('updraftplus_clone_package_cost', 0)) {
$this->refresh_connection();
}
}
/**
* This function will add a dashboard notice to every page, that shows the user when their clone will expire and directs them to UpdraftPlus.com to extend their clones life.
*
* @return void
*/
public function all_admin_notices_dashboard_notice() {
$date = strtotime(get_site_option('updraftplus_clone_scheduled_removal', ''));
if ('' == $date) {
$pretty_date = __('Unable to get renew date', 'updraftplus');
$date_diff = '';
} else {
$pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int) $date), 'M d, Y G:i');
/* translators: %s: human-readable time difference */
$date_diff = sprintf(__('%s from now', 'updraftplus'), human_time_diff($date));
}
$package_cost = get_site_option('updraftplus_clone_package_cost', 0);
$package_cost = empty($package_cost) ? 1 : $package_cost;
?>
<div id="updraftplus_temporary_clone-dashnotice" class="updated">
<div style="float:right;"><a href="#" onclick="jQuery.post('<?php echo esc_js(admin_url('admin-ajax.php')); ?>', {action: 'updraftplus_dash_notice_ajax', subaction: 'refresh_connection', nonce: '<?php echo esc_js(wp_create_nonce('updraftplus_refresh_connection'));?>' }, function() { location.reload(); });"><?php esc_html_e('Refresh connection', 'updraftplus'); ?></a></div>
<h1><?php esc_html_e('Welcome to your UpdraftClone (temporary clone)', 'updraftplus'); ?></h1>
<p>
<?php echo esc_html(__('Your clone will renew on:', 'updraftplus') . ' ' . $pretty_date . ' ' . get_option('timezone_string') . ' (' . $date_diff . ')'); ?>.
<?php
echo esc_html(
sprintf(
/* translators: %s: Token cost */
__('Each time your clone renews (weekly) it costs %s.', 'updraftplus'),
/* translators: %d: Number of tokens */
sprintf(_n('%d token', '%d tokens', $package_cost, 'updraftplus'), $package_cost)
).' '.__('You can shut this clone down at the following link:', 'updraftplus')
);
?> <a target="_blank" href="https://teamupdraft.com/my-account/?utm_source=udp-plugin&utm_medium=referral&utm_campaign=paac&utm_content=manage-your-clones&utm_creative_format=notice"><?php esc_html_e('Manage your clones', 'updraftplus'); ?></a>
</p>
<?php
$show_removal_warning = get_site_option('updraftplus_clone_removal_warning', false);
if ($show_removal_warning) echo '<p>'.esc_html__('Warning: You have no clone tokens remaining and either no subscriptions or no subscription that will renew before the clone expiry date.', 'updraftplus').'</p>'
?>
</div>
<?php
}
/**
* This function will perform security checks before allowing the ajax calls for the UpdraftClone VPS mu-plugin be processed.
*
* @return void
*/
public function updraftplus_dash_notice_ajax() {
if (is_user_logged_in() && current_user_can('manage_options')) {
$this->process_dash_notice_ajax();
} else {
return;
}
}
/**
* This function will handle the ajax calls for the UpdraftClone notice mu-plugin.
*
* @return void
*/
public function process_dash_notice_ajax() {
$return = array('code' => 'fail', 'data' => '');
if (!isset($_POST['subaction'])) {
$return['code'] = 'error';
$return['data'] = 'Missing subaction';
echo json_encode($return);
die();
}
if ('refresh_connection' === $_POST['subaction']) {
check_ajax_referer('updraftplus_refresh_connection', 'nonce');
$result = $this->refresh_connection();
if ($result) {
$return['code'] = 'success';
$return['data'] = $result;
} else {
$return['code'] = 'error';
$return['data'] = $result;
}
echo json_encode($return);
die();
} else {
$return['code'] = 'error';
$return['data'] = 'Unknown action';
echo json_encode($return);
die();
}
}
/**
* This function will refresh the stored clones expire date by calling UpdraftPlus.com and getting the latest value.
* Note this function needs three defines to work UPDRAFTPLUS_USER_ID and UPDRAFTPLUS_VPS_ID and UPDRAFTPLUS_UNIQUE_TOKEN.
*
* @return array - that contains the updated expire data or error information
*/
public function refresh_connection() {
global $updraftplus;
if (!defined('UPDRAFTPLUS_USER_ID') || !is_numeric(UPDRAFTPLUS_USER_ID) || !defined('UPDRAFTPLUS_VPS_ID') || !is_numeric(UPDRAFTPLUS_VPS_ID)) {
return array('code' => 'error', 'data' => 'No user or VPS ID found');
}
if (!defined('UPDRAFTPLUS_UNIQUE_TOKEN')) return array('code' => 'error', 'data' => 'No unique token found');
$user_id = UPDRAFTPLUS_USER_ID;
$vps_id = UPDRAFTPLUS_VPS_ID;
$token = UPDRAFTPLUS_UNIQUE_TOKEN;
$data = array('user_id' => $user_id, 'vps_id' => $vps_id, 'token' => $token);
$result = $updraftplus->get_updraftplus_clone()->clone_status($data);
if (!isset($result['data'])) return array('code' => 'error', 'data' => 'No data returned from clone status call');
$vps_info = $result['data'];
if (empty($vps_info['scheduled_removal'])) return array('code' => 'error', 'data' => 'No scheduled removal date found');
if (empty($vps_info['package_cost'])) return array('code' => 'error', 'data' => 'Missing the expected clone package cost information');
update_site_option('updraftplus_clone_scheduled_removal', $vps_info['scheduled_removal']);
update_site_option('updraftplus_clone_package_cost', $vps_info['package_cost']);
$clone_removal_warning = false;
if (isset($vps_info['tokens']) && 0 == $vps_info['tokens']) {
if (empty($vps_info['subscription_renewals'])) {
$clone_removal_warning = true;
} else {
$subscription_before_expire = false;
foreach ($vps_info['subscription_renewals'] as $renewal) {
if ($renewal < $vps_info['scheduled_removal']) $subscription_before_expire = true;
}
if (!$subscription_before_expire) $clone_removal_warning = true;
}
}
update_site_option('updraftplus_clone_removal_warning', $clone_removal_warning);
$vps_data = array(
'scheduled_removal' => $vps_info['scheduled_removal'],
'package_cost' => $vps_info['package_cost']
);
return array('code' => 'success', 'data' => $vps_data);
}
}
if (defined('UPDRAFTPLUS_THIS_IS_CLONE')) {
new UpdraftPlus_Temporary_Clone_Dash_Notice();
}