Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php if (!defined("\101\102\x53\120\101\124\110")) { die; } class WC_Customer_Download_D..

Decoded Output download

<?php
 if (!defined("ABSPATH")) { die; } class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store_Interface { const DOWNLOAD_PERMISSION_DB_FIELDS = array("download_id", "product_id", "user_id", "user_email", "order_id", "order_key", "downloads_remaining", "access_granted", "download_count", "access_expires"); public function create_from_data($data) { $data = array_intersect_key($data, array_flip(self::DOWNLOAD_PERMISSION_DB_FIELDS)); $id = $this->insert_new_download_permission($data); do_action("woocommerce_grant_product_download_access", $data); return $id; } public function create(&$download) { global $wpdb; if (is_null($download->get_access_granted("edit"))) { $download->set_access_granted(time()); } $data = array(); foreach (self::DOWNLOAD_PERMISSION_DB_FIELDS as $db_field_name) { $value = call_user_func(array($download, "get_" . $db_field_name), "edit"); $data[$db_field_name] = $value; } $inserted_id = $this->insert_new_download_permission($data); if ($inserted_id) { $download->set_id($inserted_id); $download->apply_changes(); } do_action("woocommerce_grant_product_download_access", $data); } private function insert_new_download_permission($data) { global $wpdb; if (!isset($data["access_granted"])) { $data["access_granted"] = time(); } $data["access_granted"] = $this->adjust_date_for_db($data["access_granted"]); if (isset($data["access_expires"])) { $data["access_expires"] = $this->adjust_date_for_db($data["access_expires"]); } $format = array("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%d", "%s"); $result = $wpdb->insert($wpdb->prefix . "woocommerce_downloadable_product_permissions", apply_filters("woocommerce_downloadable_file_permission_data", $data), apply_filters("woocommerce_downloadable_file_permission_format", $format, $data)); return $result ? $wpdb->insert_id : false; } private function adjust_date_for_db($date) { if ("WC_DateTime" === get_class($date)) { $date = $date->getTimestamp(); } $adjusted_date = date("Y-m-d", $date); if ($adjusted_date) { return $adjusted_date; } $msg = sprintf(__("I don't know how to get a date from a %s", "woocommerce"), is_object($date) ? get_class($date) : gettype($date)); throw new Exception($msg); } public function read(&$download) { global $wpdb; if (!$download->get_id()) { throw new Exception(__("Invalid download.", "woocommerce")); } $download->set_defaults(); $raw_download = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE permission_id = %d", $download->get_id())); if (!$raw_download) { throw new Exception(__("Invalid download.", "woocommerce")); } $download->set_props(array("download_id" => $raw_download->download_id, "product_id" => $raw_download->product_id, "user_id" => $raw_download->user_id, "user_email" => $raw_download->user_email, "order_id" => $raw_download->order_id, "order_key" => $raw_download->order_key, "downloads_remaining" => $raw_download->downloads_remaining, "access_granted" => strtotime($raw_download->access_granted), "download_count" => $raw_download->download_count, "access_expires" => is_null($raw_download->access_expires) ? null : strtotime($raw_download->access_expires))); $download->set_object_read(true); } public function update(&$download) { global $wpdb; $data = array("download_id" => $download->get_download_id("edit"), "product_id" => $download->get_product_id("edit"), "user_id" => $download->get_user_id("edit"), "user_email" => $download->get_user_email("edit"), "order_id" => $download->get_order_id("edit"), "order_key" => $download->get_order_key("edit"), "downloads_remaining" => $download->get_downloads_remaining("edit"), "access_granted" => date("Y-m-d", $download->get_access_granted("edit")->getTimestamp()), "download_count" => $download->get_download_count("edit"), "access_expires" => !is_null($download->get_access_expires("edit")) ? date("Y-m-d", $download->get_access_expires("edit")->getTimestamp()) : null); $format = array("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%d", "%s"); $wpdb->update($wpdb->prefix . "woocommerce_downloadable_product_permissions", $data, array("permission_id" => $download->get_id()), $format); $download->apply_changes(); } public function delete(&$download, $args = array()) { global $wpdb; $download_id = $download->get_id(); $this->delete_by_id($download_id); $download->set_id(0); } public function delete_by_id($id) { global $wpdb; $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
\x9\x9	\x9WHERE permission_id = %d", $id)); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}wc_download_log\xa\x9\x9\x9	WHERE permission_id = %d", $id)); } private function delete_download_log_by_field_value($field, $value) { global $wpdb; $value_placeholder = ''; if (is_int($value)) { $value_placeholder = "%d"; } elseif (is_string($value)) { $value_placeholder = "%s"; } elseif (is_float($value)) { $value_placeholder = "%f"; } else { wc_doing_it_wrong(__METHOD__, __("Unsupported argument type provided as value.", "woocommerce"), "7.0"); return; } $query = "DELETE FROM {$wpdb->prefix}wc_download_log
\x9	\x9\x9\x9WHERE permission_id IN (
					    SELECT permission_id
		\x9\x9	    FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions\xa\x9\x9\x9\x9\x9    WHERE {$field} = {$value_placeholder}\xa\x9	\x9\x9	)"; $wpdb->query($wpdb->prepare($query, $value)); } public function delete_by_order_id($id) { global $wpdb; $this->delete_download_log_by_field_value("order_id", $id); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
		\x9\x9WHERE order_id = %d", $id)); } public function delete_by_download_id($id) { global $wpdb; $this->delete_download_log_by_field_value("download_id", $id); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions\xa	\x9\x9	WHERE download_id = %s", $id)); } public function delete_by_user_id($id) { global $wpdb; $this->delete_download_log_by_field_value("user_id", $id); return (bool) $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
			\x9WHERE user_id = %d", $id)); } public function delete_by_user_email($email) { global $wpdb; $this->delete_download_log_by_field_value("user_email", $email); return (bool) $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
\x9	\x9\x9WHERE user_email = %s", $email)); } private function get_download($data) { return new WC_Customer_Download($data); } public function get_downloads($args = array()) { global $wpdb; $args = wp_parse_args($args, array("user_email" => '', "user_id" => '', "order_id" => '', "order_key" => '', "product_id" => '', "download_id" => '', "orderby" => "permission_id", "order" => "ASC", "limit" => -1, "page" => 1, "return" => "objects")); $valid_fields = array("permission_id", "download_id", "product_id", "order_id", "order_key", "user_email", "user_id", "downloads_remaining", "access_granted", "access_expires", "download_count"); $get_results_output = ARRAY_A; if ("ids" === $args["return"]) { $fields = "permission_id"; } elseif ("objects" === $args["return"]) { $fields = "*"; $get_results_output = OBJECT; } else { $fields = explode(",", (string) $args["return"]); $fields = implode(", ", array_intersect($fields, $valid_fields)); } $query = array(); $query[] = "SELECT {$fields} FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE 1=1"; if ($args["user_email"]) { $query[] = $wpdb->prepare("AND user_email = %s", sanitize_email($args["user_email"])); } if ($args["user_id"]) { $query[] = $wpdb->prepare("AND user_id = %d", absint($args["user_id"])); } if ($args["order_id"]) { $query[] = $wpdb->prepare("AND order_id = %d", $args["order_id"]); } if ($args["order_key"]) { $query[] = $wpdb->prepare("AND order_key = %s", $args["order_key"]); } if ($args["product_id"]) { $query[] = $wpdb->prepare("AND product_id = %d", $args["product_id"]); } if ($args["download_id"]) { $query[] = $wpdb->prepare("AND download_id = %s", $args["download_id"]); } $orderby = in_array($args["orderby"], $valid_fields, true) ? $args["orderby"] : "permission_id"; $order = "DESC" === strtoupper($args["order"]) ? "DESC" : "ASC"; $orderby_sql = sanitize_sql_orderby("{$orderby} {$order}"); $query[] = "ORDER BY {$orderby_sql}"; if (0 < $args["limit"]) { $query[] = $wpdb->prepare("LIMIT %d, %d", absint($args["limit"]) * absint($args["page"] - 1), absint($args["limit"])); } $results = $wpdb->get_results(implode(" ", $query), $get_results_output); switch ($args["return"]) { case "ids": return wp_list_pluck($results, "permission_id"); case "objects": return array_map(array($this, "get_download"), $results); default: return $results; } } public function update_download_id($product_id, $old_id, $new_id) { global $wpdb; wc_deprecated_function(__METHOD__, "3.3"); $wpdb->update($wpdb->prefix . "woocommerce_downloadable_product_permissions", array("download_id" => $new_id), array("download_id" => $old_id, "product_id" => $product_id)); } public function get_downloads_for_customer($customer_id) { global $wpdb; return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions as permissions\xa	\x9\x9\x9WHERE user_id = %d
	\x9\x9	AND permissions.order_id > 0
	\x9\x9\x9AND\xa	\x9\x9\x9\x9(\xa\x9\x9\x9			permissions.downloads_remaining > 0
	\x9\x9\x9\x9\x9OR permissions.downloads_remaining = ''\xa	\x9\x9	\x9)\xa\x9\x9\x9\x9AND
\x9\x9	\x9\x9(\xa\x9\x9\x9			permissions.access_expires IS NULL
\x9\x9	\x9\x9	OR permissions.access_expires >= %s
		\x9\x9\x9	OR permissions.access_expires = '0000-00-00 00:00:00'\xa	\x9	\x9	)
	\x9	\x9ORDER BY permissions.order_id, permissions.product_id, permissions.permission_id;", $customer_id, date("Y-m-d", current_time("timestamp")))); } public function update_user_by_order_id($order_id, $customer_id, $email) { global $wpdb; $wpdb->update($wpdb->prefix . "woocommerce_downloadable_product_permissions", array("user_id" => $customer_id, "user_email" => $email), array("order_id" => $order_id), array("%d", "%s"), array("%d")); } } ?>

Did this file decode correctly?

Original Code

<?php
 if (!defined("\101\102\x53\120\101\124\110")) { die; } class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store_Interface { const DOWNLOAD_PERMISSION_DB_FIELDS = array("\x64\157\x77\x6e\154\x6f\x61\x64\137\151\144", "\x70\162\x6f\144\165\143\x74\137\x69\x64", "\x75\163\x65\162\137\x69\x64", "\x75\x73\x65\162\x5f\145\x6d\141\x69\x6c", "\x6f\x72\x64\145\162\x5f\151\144", "\x6f\x72\144\x65\162\137\153\145\x79", "\144\157\x77\x6e\154\x6f\141\144\x73\x5f\x72\x65\155\141\151\156\x69\x6e\x67", "\141\143\x63\145\x73\x73\137\147\x72\141\x6e\x74\x65\x64", "\x64\x6f\167\x6e\154\157\141\x64\137\143\x6f\x75\156\x74", "\x61\143\x63\x65\x73\x73\x5f\x65\x78\160\151\x72\x65\163"); public function create_from_data($data) { $data = array_intersect_key($data, array_flip(self::DOWNLOAD_PERMISSION_DB_FIELDS)); $id = $this->insert_new_download_permission($data); do_action("\167\x6f\x6f\143\x6f\155\155\x65\162\x63\x65\137\147\x72\141\156\164\137\x70\162\x6f\x64\x75\143\x74\137\144\157\x77\156\x6c\157\141\x64\x5f\x61\x63\x63\x65\x73\x73", $data); return $id; } public function create(&$download) { global $wpdb; if (is_null($download->get_access_granted("\x65\x64\151\164"))) { $download->set_access_granted(time()); } $data = array(); foreach (self::DOWNLOAD_PERMISSION_DB_FIELDS as $db_field_name) { $value = call_user_func(array($download, "\x67\145\164\x5f" . $db_field_name), "\145\144\151\x74"); $data[$db_field_name] = $value; } $inserted_id = $this->insert_new_download_permission($data); if ($inserted_id) { $download->set_id($inserted_id); $download->apply_changes(); } do_action("\167\x6f\x6f\x63\x6f\155\155\145\x72\143\x65\137\x67\x72\141\156\x74\x5f\x70\x72\157\x64\x75\x63\164\137\x64\x6f\167\x6e\154\157\x61\144\x5f\141\143\143\x65\x73\x73", $data); } private function insert_new_download_permission($data) { global $wpdb; if (!isset($data["\141\143\143\145\x73\163\137\x67\162\141\x6e\x74\x65\144"])) { $data["\x61\x63\x63\145\x73\x73\137\x67\x72\141\x6e\x74\145\144"] = time(); } $data["\141\143\143\145\x73\163\137\147\x72\141\x6e\x74\x65\144"] = $this->adjust_date_for_db($data["\141\x63\x63\x65\163\x73\x5f\x67\162\141\x6e\x74\145\x64"]); if (isset($data["\x61\143\143\x65\163\x73\x5f\x65\170\x70\x69\x72\x65\x73"])) { $data["\x61\x63\143\145\x73\163\137\145\x78\x70\x69\x72\x65\x73"] = $this->adjust_date_for_db($data["\x61\x63\x63\145\x73\x73\137\145\x78\160\151\x72\x65\x73"]); } $format = array("\x25\163", "\x25\163", "\45\x73", "\x25\163", "\45\163", "\45\163", "\x25\x73", "\x25\x73", "\45\x64", "\45\163"); $result = $wpdb->insert($wpdb->prefix . "\x77\157\157\143\157\x6d\x6d\x65\162\143\x65\137\144\157\167\x6e\154\157\x61\144\141\142\x6c\x65\137\x70\162\x6f\x64\165\143\164\x5f\160\x65\x72\x6d\151\x73\163\x69\157\156\163", apply_filters("\x77\157\157\143\157\x6d\155\145\x72\143\x65\137\144\x6f\167\156\x6c\x6f\141\x64\141\x62\x6c\x65\137\146\151\154\x65\x5f\160\x65\x72\155\x69\163\x73\151\157\156\137\144\141\x74\x61", $data), apply_filters("\167\157\x6f\x63\x6f\155\x6d\145\162\143\145\137\x64\157\167\156\x6c\x6f\141\144\141\142\154\145\137\x66\x69\x6c\145\x5f\160\x65\x72\x6d\151\163\x73\x69\157\156\137\x66\x6f\162\155\x61\164", $format, $data)); return $result ? $wpdb->insert_id : false; } private function adjust_date_for_db($date) { if ("\x57\103\x5f\104\x61\x74\145\124\x69\x6d\x65" === get_class($date)) { $date = $date->getTimestamp(); } $adjusted_date = date("\x59\55\x6d\55\x64", $date); if ($adjusted_date) { return $adjusted_date; } $msg = sprintf(__("\111\x20\x64\x6f\x6e\x27\164\x20\153\156\157\167\x20\150\x6f\167\x20\x74\157\x20\x67\145\x74\40\x61\x20\144\141\x74\x65\x20\146\162\157\x6d\40\141\x20\45\163", "\167\157\157\143\x6f\x6d\x6d\145\162\x63\145"), is_object($date) ? get_class($date) : gettype($date)); throw new Exception($msg); } public function read(&$download) { global $wpdb; if (!$download->get_id()) { throw new Exception(__("\x49\x6e\166\x61\154\x69\144\40\144\x6f\x77\156\154\157\141\144\56", "\x77\157\x6f\x63\157\x6d\x6d\145\162\143\145")); } $download->set_defaults(); $raw_download = $wpdb->get_row($wpdb->prepare("\123\105\x4c\x45\x43\x54\40\x2a\x20\x46\122\x4f\115\40{$wpdb->prefix}\x77\157\157\143\x6f\x6d\155\x65\x72\x63\145\x5f\x64\x6f\x77\156\154\x6f\141\x64\141\x62\154\145\x5f\x70\x72\157\x64\165\143\x74\x5f\160\145\162\x6d\x69\163\163\151\x6f\156\x73\40\x57\110\x45\122\105\x20\x70\145\x72\155\151\163\163\x69\x6f\156\x5f\x69\x64\40\x3d\x20\x25\x64", $download->get_id())); if (!$raw_download) { throw new Exception(__("\x49\156\166\141\154\x69\144\40\144\157\167\x6e\x6c\157\x61\144\x2e", "\167\157\157\143\157\x6d\155\x65\x72\x63\145")); } $download->set_props(array("\144\157\167\x6e\154\157\141\x64\x5f\x69\x64" => $raw_download->download_id, "\160\x72\157\144\165\143\x74\137\151\x64" => $raw_download->product_id, "\x75\163\x65\162\137\151\x64" => $raw_download->user_id, "\x75\x73\145\162\x5f\x65\155\141\x69\154" => $raw_download->user_email, "\x6f\162\x64\145\x72\137\151\x64" => $raw_download->order_id, "\x6f\x72\144\x65\162\x5f\153\x65\171" => $raw_download->order_key, "\x64\157\x77\156\x6c\157\141\x64\163\x5f\162\145\155\141\151\x6e\x69\156\x67" => $raw_download->downloads_remaining, "\141\x63\x63\x65\x73\163\x5f\x67\162\x61\156\x74\145\144" => strtotime($raw_download->access_granted), "\144\x6f\x77\156\154\x6f\141\x64\x5f\x63\x6f\165\156\x74" => $raw_download->download_count, "\x61\143\x63\x65\x73\163\137\145\x78\160\x69\162\x65\163" => is_null($raw_download->access_expires) ? null : strtotime($raw_download->access_expires))); $download->set_object_read(true); } public function update(&$download) { global $wpdb; $data = array("\x64\x6f\x77\x6e\x6c\x6f\x61\x64\137\151\x64" => $download->get_download_id("\x65\144\151\164"), "\160\162\x6f\144\x75\x63\164\x5f\151\x64" => $download->get_product_id("\145\144\x69\x74"), "\x75\x73\x65\162\137\x69\144" => $download->get_user_id("\145\144\x69\x74"), "\165\163\x65\x72\137\x65\155\x61\x69\x6c" => $download->get_user_email("\x65\144\x69\164"), "\157\x72\x64\x65\162\x5f\x69\144" => $download->get_order_id("\x65\x64\151\164"), "\157\162\144\x65\x72\x5f\x6b\x65\x79" => $download->get_order_key("\x65\x64\x69\164"), "\144\157\167\x6e\x6c\157\141\144\x73\137\x72\x65\x6d\141\x69\x6e\x69\x6e\x67" => $download->get_downloads_remaining("\145\144\x69\x74"), "\x61\143\143\x65\x73\x73\137\x67\162\x61\156\164\x65\x64" => date("\131\x2d\155\x2d\144", $download->get_access_granted("\145\x64\x69\164")->getTimestamp()), "\x64\x6f\167\x6e\x6c\157\x61\x64\137\143\157\165\156\x74" => $download->get_download_count("\145\x64\151\164"), "\141\x63\x63\145\x73\163\137\x65\170\160\x69\x72\145\163" => !is_null($download->get_access_expires("\x65\144\x69\x74")) ? date("\x59\55\x6d\x2d\144", $download->get_access_expires("\145\144\151\164")->getTimestamp()) : null); $format = array("\x25\163", "\45\163", "\45\163", "\x25\x73", "\45\163", "\45\163", "\x25\163", "\45\163", "\x25\144", "\45\163"); $wpdb->update($wpdb->prefix . "\167\157\x6f\x63\x6f\x6d\155\x65\162\x63\x65\137\x64\157\x77\x6e\x6c\157\141\x64\141\x62\154\x65\x5f\160\162\157\x64\x75\143\x74\x5f\160\145\162\155\151\x73\x73\x69\x6f\156\x73", $data, array("\160\x65\x72\155\x69\163\x73\x69\157\x6e\137\x69\144" => $download->get_id()), $format); $download->apply_changes(); } public function delete(&$download, $args = array()) { global $wpdb; $download_id = $download->get_id(); $this->delete_by_id($download_id); $download->set_id(0); } public function delete_by_id($id) { global $wpdb; $wpdb->query($wpdb->prepare("\104\105\114\105\x54\105\x20\x46\122\117\115\40{$wpdb->prefix}\167\157\x6f\143\x6f\x6d\155\x65\x72\x63\145\137\144\157\x77\x6e\154\x6f\141\x64\141\142\154\145\137\160\x72\157\x64\x75\143\x74\x5f\160\145\x72\x6d\151\x73\163\151\157\x6e\163\12\x9\x9\11\x9\x57\x48\105\122\x45\x20\160\x65\x72\155\x69\163\163\x69\x6f\156\x5f\x69\144\x20\75\x20\x25\144", $id)); $wpdb->query($wpdb->prepare("\x44\105\114\x45\124\105\40\106\122\117\115\40{$wpdb->prefix}\167\143\137\x64\157\167\156\x6c\x6f\x61\x64\x5f\154\x6f\147\xa\x9\x9\x9\11\127\110\x45\x52\x45\40\160\x65\x72\x6d\x69\163\163\x69\x6f\156\137\151\144\40\x3d\x20\x25\144", $id)); } private function delete_download_log_by_field_value($field, $value) { global $wpdb; $value_placeholder = ''; if (is_int($value)) { $value_placeholder = "\45\144"; } elseif (is_string($value)) { $value_placeholder = "\45\163"; } elseif (is_float($value)) { $value_placeholder = "\x25\x66"; } else { wc_doing_it_wrong(__METHOD__, __("\x55\x6e\x73\165\160\x70\x6f\162\x74\x65\144\40\x61\x72\147\165\155\145\156\x74\x20\x74\x79\x70\145\x20\x70\x72\157\166\x69\x64\x65\144\40\141\x73\40\166\141\x6c\x75\x65\56", "\x77\x6f\x6f\x63\x6f\155\x6d\x65\162\x63\145"), "\67\x2e\60"); return; } $query = "\104\105\x4c\105\x54\105\40\x46\x52\117\115\x20{$wpdb->prefix}\x77\143\137\x64\x6f\x77\x6e\154\157\141\x64\x5f\x6c\x6f\x67\12\x9\11\x9\x9\x9\127\110\x45\x52\105\x20\x70\145\162\x6d\x69\163\163\x69\x6f\156\x5f\x69\x64\x20\111\116\40\x28\12\11\11\11\11\11\x20\x20\40\x20\x53\x45\114\x45\103\x54\x20\x70\x65\x72\x6d\151\163\163\x69\x6f\156\137\151\144\12\11\11\x9\x9\11\x20\x20\40\40\x46\122\117\115\x20{$wpdb->prefix}\x77\x6f\x6f\x63\x6f\x6d\155\x65\x72\x63\145\137\x64\x6f\x77\156\154\x6f\141\144\x61\142\154\x65\137\160\x72\157\x64\165\143\x74\137\x70\x65\162\x6d\x69\163\x73\151\x6f\156\x73\xa\x9\x9\x9\x9\x9\x20\40\x20\40\x57\x48\105\122\105\x20{$field}\40\75\40{$value_placeholder}\xa\x9\11\x9\x9\11\51"; $wpdb->query($wpdb->prepare($query, $value)); } public function delete_by_order_id($id) { global $wpdb; $this->delete_download_log_by_field_value("\157\162\144\x65\162\137\151\144", $id); $wpdb->query($wpdb->prepare("\x44\x45\114\x45\124\x45\40\106\122\117\115\x20{$wpdb->prefix}\x77\157\x6f\x63\x6f\x6d\x6d\x65\162\x63\x65\137\x64\x6f\x77\156\154\x6f\141\x64\x61\142\154\x65\137\x70\x72\x6f\144\165\x63\164\x5f\160\145\162\155\x69\163\x73\x69\x6f\x6e\x73\12\11\11\x9\x9\x57\110\105\x52\x45\x20\157\x72\x64\x65\x72\137\x69\144\x20\75\x20\x25\144", $id)); } public function delete_by_download_id($id) { global $wpdb; $this->delete_download_log_by_field_value("\144\x6f\167\x6e\154\x6f\141\144\x5f\151\x64", $id); $wpdb->query($wpdb->prepare("\104\x45\114\105\x54\105\x20\x46\122\x4f\115\x20{$wpdb->prefix}\167\x6f\157\143\157\x6d\x6d\x65\x72\143\145\137\144\x6f\167\x6e\x6c\x6f\141\x64\141\x62\154\145\137\160\x72\157\144\x75\143\x74\137\160\145\162\x6d\151\163\163\x69\157\156\163\xa\11\x9\x9\11\127\110\105\122\x45\40\144\157\167\x6e\154\157\141\144\137\x69\x64\40\x3d\40\x25\x73", $id)); } public function delete_by_user_id($id) { global $wpdb; $this->delete_download_log_by_field_value("\x75\163\x65\162\137\151\x64", $id); return (bool) $wpdb->query($wpdb->prepare("\104\x45\114\105\124\105\x20\106\122\x4f\x4d\x20{$wpdb->prefix}\x77\157\157\x63\157\155\155\x65\162\x63\x65\137\144\x6f\167\156\x6c\x6f\141\144\x61\x62\x6c\x65\x5f\160\162\157\144\165\143\x74\137\x70\x65\162\155\x69\x73\163\x69\x6f\156\163\12\11\11\11\x9\127\110\105\x52\105\40\x75\163\145\x72\x5f\x69\x64\x20\75\40\45\144", $id)); } public function delete_by_user_email($email) { global $wpdb; $this->delete_download_log_by_field_value("\x75\x73\145\162\137\x65\x6d\141\151\x6c", $email); return (bool) $wpdb->query($wpdb->prepare("\x44\x45\114\x45\x54\105\x20\x46\122\x4f\115\40{$wpdb->prefix}\x77\x6f\157\143\x6f\155\x6d\x65\x72\143\145\x5f\x64\x6f\167\x6e\x6c\x6f\x61\144\141\142\x6c\145\x5f\x70\x72\x6f\x64\x75\x63\x74\x5f\160\x65\162\x6d\151\x73\163\x69\x6f\x6e\163\12\x9\11\x9\x9\127\110\x45\x52\105\40\165\x73\x65\x72\x5f\145\x6d\141\x69\x6c\40\x3d\x20\45\163", $email)); } private function get_download($data) { return new WC_Customer_Download($data); } public function get_downloads($args = array()) { global $wpdb; $args = wp_parse_args($args, array("\x75\163\x65\x72\x5f\x65\155\141\x69\x6c" => '', "\x75\x73\x65\162\137\151\x64" => '', "\157\162\x64\145\162\137\151\x64" => '', "\x6f\162\x64\145\x72\137\153\145\171" => '', "\160\x72\157\144\165\143\x74\137\151\144" => '', "\144\157\x77\x6e\154\x6f\141\x64\x5f\x69\144" => '', "\x6f\162\144\145\162\x62\x79" => "\x70\x65\162\x6d\151\163\x73\x69\157\156\x5f\151\x64", "\x6f\162\144\x65\162" => "\x41\123\103", "\154\x69\155\151\164" => -1, "\x70\x61\x67\145" => 1, "\x72\x65\x74\165\x72\x6e" => "\x6f\142\152\145\143\164\x73")); $valid_fields = array("\160\145\x72\155\151\163\x73\151\x6f\x6e\x5f\151\144", "\x64\157\167\x6e\x6c\x6f\x61\144\137\151\144", "\x70\x72\x6f\144\165\143\x74\x5f\151\x64", "\x6f\162\x64\x65\162\x5f\x69\144", "\157\162\144\145\x72\137\x6b\x65\171", "\165\x73\x65\x72\137\145\x6d\x61\x69\154", "\x75\x73\x65\x72\137\151\144", "\144\x6f\167\x6e\x6c\157\141\144\x73\x5f\x72\145\155\141\151\156\151\x6e\x67", "\141\143\143\145\x73\x73\x5f\x67\162\x61\156\164\x65\144", "\x61\x63\x63\x65\163\x73\137\x65\x78\160\151\x72\x65\163", "\144\x6f\x77\x6e\x6c\157\x61\x64\137\143\157\165\156\x74"); $get_results_output = ARRAY_A; if ("\151\x64\x73" === $args["\x72\x65\x74\165\x72\x6e"]) { $fields = "\x70\x65\x72\155\x69\163\x73\151\157\x6e\x5f\x69\x64"; } elseif ("\x6f\142\x6a\x65\x63\164\x73" === $args["\162\145\164\x75\x72\x6e"]) { $fields = "\x2a"; $get_results_output = OBJECT; } else { $fields = explode("\54", (string) $args["\162\x65\164\x75\x72\x6e"]); $fields = implode("\54\x20", array_intersect($fields, $valid_fields)); } $query = array(); $query[] = "\x53\x45\114\x45\x43\124\x20{$fields}\40\106\122\117\x4d\40{$wpdb->prefix}\x77\x6f\157\x63\x6f\x6d\x6d\145\x72\x63\145\137\144\157\167\156\154\x6f\141\144\x61\142\x6c\145\x5f\160\x72\157\144\x75\143\164\137\x70\145\162\x6d\151\163\163\151\157\156\x73\40\127\x48\x45\x52\x45\x20\61\x3d\x31"; if ($args["\x75\x73\145\162\137\x65\x6d\141\151\154"]) { $query[] = $wpdb->prepare("\101\x4e\x44\x20\165\163\x65\x72\137\145\x6d\x61\x69\x6c\x20\75\40\x25\163", sanitize_email($args["\165\163\145\x72\x5f\x65\x6d\141\151\154"])); } if ($args["\x75\163\x65\162\137\x69\x64"]) { $query[] = $wpdb->prepare("\x41\116\x44\x20\165\163\x65\162\137\151\x64\x20\75\x20\x25\x64", absint($args["\165\163\x65\162\x5f\151\x64"])); } if ($args["\x6f\x72\144\145\x72\x5f\x69\x64"]) { $query[] = $wpdb->prepare("\x41\116\104\40\x6f\x72\x64\145\162\137\151\144\40\75\x20\45\x64", $args["\x6f\x72\x64\x65\162\x5f\151\x64"]); } if ($args["\x6f\x72\144\145\x72\x5f\153\x65\x79"]) { $query[] = $wpdb->prepare("\x41\116\x44\x20\x6f\x72\x64\x65\162\137\x6b\x65\x79\40\x3d\40\45\163", $args["\x6f\162\144\x65\162\137\x6b\145\171"]); } if ($args["\160\x72\157\x64\165\143\x74\137\151\x64"]) { $query[] = $wpdb->prepare("\x41\116\x44\40\160\162\157\x64\165\x63\x74\137\x69\x64\x20\75\x20\45\144", $args["\160\x72\x6f\x64\x75\143\x74\x5f\151\144"]); } if ($args["\x64\157\167\156\154\157\141\144\x5f\x69\144"]) { $query[] = $wpdb->prepare("\101\116\104\40\144\x6f\x77\x6e\x6c\x6f\141\x64\x5f\x69\144\x20\75\40\45\x73", $args["\144\157\x77\156\154\x6f\141\144\137\x69\x64"]); } $orderby = in_array($args["\x6f\162\144\x65\x72\142\171"], $valid_fields, true) ? $args["\157\162\144\145\x72\142\171"] : "\x70\145\x72\x6d\151\x73\163\x69\x6f\156\x5f\151\144"; $order = "\104\x45\x53\103" === strtoupper($args["\x6f\x72\144\x65\162"]) ? "\104\x45\123\103" : "\x41\123\103"; $orderby_sql = sanitize_sql_orderby("{$orderby}\x20{$order}"); $query[] = "\x4f\x52\x44\105\122\x20\102\x59\x20{$orderby_sql}"; if (0 < $args["\154\151\x6d\151\164"]) { $query[] = $wpdb->prepare("\114\111\115\111\x54\40\45\x64\54\40\45\x64", absint($args["\154\x69\155\x69\164"]) * absint($args["\160\x61\x67\145"] - 1), absint($args["\x6c\151\155\x69\164"])); } $results = $wpdb->get_results(implode("\40", $query), $get_results_output); switch ($args["\x72\145\x74\165\162\156"]) { case "\x69\144\x73": return wp_list_pluck($results, "\x70\x65\x72\155\151\x73\x73\x69\x6f\156\137\x69\x64"); case "\x6f\x62\152\x65\x63\164\163": return array_map(array($this, "\147\145\164\137\144\x6f\x77\156\154\x6f\141\144"), $results); default: return $results; } } public function update_download_id($product_id, $old_id, $new_id) { global $wpdb; wc_deprecated_function(__METHOD__, "\x33\56\63"); $wpdb->update($wpdb->prefix . "\167\x6f\x6f\x63\x6f\155\x6d\145\162\x63\145\137\x64\157\167\x6e\x6c\x6f\141\x64\x61\142\x6c\145\x5f\x70\x72\x6f\x64\165\x63\x74\x5f\160\145\x72\x6d\151\x73\163\x69\x6f\x6e\x73", array("\x64\157\x77\x6e\154\157\x61\144\x5f\x69\144" => $new_id), array("\144\x6f\x77\156\x6c\157\x61\144\137\x69\144" => $old_id, "\160\x72\x6f\144\x75\143\x74\x5f\151\x64" => $product_id)); } public function get_downloads_for_customer($customer_id) { global $wpdb; return $wpdb->get_results($wpdb->prepare("\x53\105\114\x45\x43\124\40\x2a\x20\x46\122\x4f\115\x20{$wpdb->prefix}\x77\x6f\157\143\157\x6d\x6d\x65\162\143\145\137\x64\157\167\156\154\x6f\x61\144\141\142\x6c\145\x5f\160\162\157\x64\x75\143\164\x5f\160\x65\162\155\x69\x73\163\x69\157\x6e\x73\x20\x61\x73\x20\x70\145\162\155\x69\163\x73\151\157\156\163\xa\11\x9\x9\x9\127\110\105\122\105\x20\165\x73\x65\x72\137\x69\x64\x20\75\x20\x25\144\12\11\x9\x9\11\x41\116\x44\x20\160\x65\x72\x6d\x69\x73\x73\x69\x6f\x6e\x73\x2e\157\162\144\145\162\137\x69\144\40\x3e\x20\60\12\11\x9\x9\x9\x41\116\x44\xa\11\x9\x9\x9\x9\x28\xa\x9\x9\x9\11\11\11\160\x65\x72\155\151\x73\x73\151\157\156\163\x2e\x64\x6f\167\x6e\154\157\x61\x64\x73\137\162\x65\x6d\141\x69\x6e\151\156\147\x20\x3e\40\x30\12\11\x9\x9\x9\x9\x9\117\122\40\160\x65\x72\155\151\163\163\151\157\x6e\x73\56\144\x6f\x77\x6e\154\157\141\x64\163\x5f\x72\145\155\141\151\156\x69\x6e\147\x20\x3d\40\47\x27\xa\11\x9\x9\11\x9\x29\xa\x9\x9\x9\x9\x41\116\x44\12\x9\x9\11\x9\x9\x28\xa\x9\x9\x9\11\11\11\x70\x65\x72\155\x69\163\x73\x69\x6f\156\163\56\141\143\143\145\163\163\137\x65\x78\160\x69\162\145\x73\x20\111\123\40\x4e\125\114\114\12\x9\x9\11\x9\x9\11\117\x52\x20\160\x65\162\155\x69\163\x73\151\157\x6e\x73\x2e\x61\143\x63\x65\163\163\x5f\x65\170\160\x69\162\x65\163\x20\76\x3d\x20\45\163\12\11\11\x9\x9\x9\11\x4f\x52\x20\160\x65\x72\155\151\x73\163\x69\x6f\156\x73\x2e\141\x63\x63\145\x73\163\x5f\145\x78\160\151\162\145\163\x20\75\x20\x27\x30\60\x30\x30\x2d\x30\x30\x2d\60\60\40\x30\x30\x3a\x30\x30\x3a\x30\60\x27\xa\11\x9\11\x9\11\x29\12\11\x9\11\x9\117\122\104\x45\122\x20\102\x59\x20\160\x65\x72\x6d\151\x73\163\151\x6f\x6e\x73\56\x6f\x72\144\145\162\x5f\151\144\54\40\160\145\x72\155\x69\163\163\x69\157\x6e\x73\x2e\x70\162\x6f\144\165\143\164\x5f\151\144\x2c\40\x70\x65\x72\x6d\x69\x73\x73\151\x6f\x6e\x73\x2e\x70\x65\x72\x6d\151\x73\x73\151\x6f\156\137\151\144\x3b", $customer_id, date("\131\x2d\x6d\55\x64", current_time("\x74\151\155\x65\163\164\x61\155\160")))); } public function update_user_by_order_id($order_id, $customer_id, $email) { global $wpdb; $wpdb->update($wpdb->prefix . "\x77\x6f\x6f\143\x6f\x6d\155\x65\162\x63\145\x5f\144\x6f\167\x6e\x6c\157\141\144\x61\142\x6c\145\x5f\x70\x72\157\x64\165\143\x74\137\x70\145\162\x6d\x69\x73\x73\x69\157\x6e\163", array("\x75\x73\x65\x72\137\x69\144" => $customer_id, "\x75\x73\145\x72\137\145\155\x61\x69\x6c" => $email), array("\x6f\x72\x64\x65\162\x5f\x69\x64" => $order_id), array("\45\x64", "\45\163"), array("\x25\x64")); } }

Function Calls

None

Variables

None

Stats

MD5 c72e813cb09433e8c581a931f5b713f2
Eval Count 0
Decode Time 109 ms