base, array('plugins'))) {
return;
}
$delay_in_days_have_passed = get_option('ms_was_installed_on') < strtotime('-' . MetaSliderPlugin::EXTENDIFY_NOTICE_DELAY_IN_DAYS . ' days');
if (! $delay_in_days_have_passed) {
return;
}
ob_start(); ?>
.
printf(esc_html__('Learn more at %sextendify.com%s. ', 'ml-slider'), '', '');
// translators: %s surrounding the word 'here' and is wrapped with .
printf(esc_html__('If you\'d prefer not to have this button display in the editor, %ssee here%s.', 'ml-slider'), '', ''); ?>
esc_html__('The security check failed. Please refresh the page and try again.', 'ml-slider')
), 401);
}
update_user_option(get_current_user_id(), $extendifysdk_ms_notices_key, time());
wp_send_json_success();
});
add_action('wp_ajax_handle_extendify_install', function () use ($extendifysdk_ms_notices_key) {
if (! isset($_REQUEST['_wpnonce']) || ! wp_verify_nonce(sanitize_key($_REQUEST['_wpnonce']), $extendifysdk_ms_notices_key)) {
wp_send_json_error(array(
'message' => esc_html__('The security check failed. Please refresh the page and try again.', 'ml-slider')
), 401);
}
if (method_exists('Extendify\Library\Plugin', 'install_and_activate_plugin')) {
try {
$installed = Extendify\Library\Plugin::install_and_activate_plugin('extendify');
if (true === $installed) {
update_user_option(get_current_user_id(), $extendifysdk_ms_notices_key, time());
}
wp_send_json_success();
} catch (Exception $e) {
wp_send_json_error(array(
'message' => $e->getMessage()
), 500);
}
} else {
wp_send_json_error(array(
'message' => __('The Extendify SDK is not loaded.', 'ml-slider')
), 500);
}
});