function wr2x_validate_pro($subscr_id) { if (empty($subscr_id)) { delete_option('wr2x_pro_serial', ""); delete_option('wr2x_pro_status', ""); set_transient('wr2x_validated', false, 0); return false; } require_once wr2x_get_wordpress_root() . WPINC . '/class-IXR.php'; require_once wr2x_get_wordpress_root() . WPINC . '/class-wp-http-ixr-client.php'; $client = new WP_HTTP_IXR_Client('http://apps.meow.fr/xmlrpc.php'); if (!$client->query('meow_sales.auth', $subscr_id, 'retina', get_site_url())) { update_option('wr2x_pro_serial', ""); update_option('wr2x_pro_status', "A network error: " . $client->getErrorMessage()); set_transient('wr2x_validated', false, 0); return false; } $post = $client->getResponse(); if (!$post['success']) { if ($post['message_code'] == "NO_SUBSCRIPTION") { $status = __("Your serial does not seem right."); } else { if ($post['message_code'] == "NOT_ACTIVE") { $status = __("Your subscription is not active."); } else { if ($post['message_code'] == "TOO_MANY_URLS") { $status = __("Too many URLs are linked to your subscription."); } else { $status = "There is a problem with your subscription."; } } } update_option('wr2x_pro_serial', ""); update_option('wr2x_pro_status', $status); set_transient('wr2x_validated', false, 0); return false; } set_transient('wr2x_validated', $subscr_id, 3600 * 24 * 100); update_option('wr2x_pro_serial', $subscr_id); update_option('wr2x_pro_status', __("Your subscription is enabled.")); return true; }
function wr2x_from_url_to_system($url) { $img_pathinfo = wr2x_get_pathinfo_from_image_src($url); $filepath = trailingslashit(wr2x_get_wordpress_root()) . $img_pathinfo; if (file_exists($filepath)) { return $filepath; } $filepath = trailingslashit(wr2x_get_upload_root()) . $img_pathinfo; if (file_exists($filepath)) { return $filepath; } return null; }