From aba4699ee2d7834a7f0604697286a5cc621204e6 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 17 Nov 2016 22:01:55 -0200 Subject: [PATCH] Removed old get avatar method --- .../api/legacy/v1/class-wc-api-customers.php | 22 ------------------ .../api/legacy/v2/class-wc-api-customers.php | 23 ------------------- .../api/legacy/v3/class-wc-api-customers.php | 23 ------------------- 3 files changed, 68 deletions(-) diff --git a/includes/api/legacy/v1/class-wc-api-customers.php b/includes/api/legacy/v1/class-wc-api-customers.php index c1959b28520..04fe43ee104 100644 --- a/includes/api/legacy/v1/class-wc-api-customers.php +++ b/includes/api/legacy/v1/class-wc-api-customers.php @@ -404,28 +404,6 @@ class WC_API_Customers extends WC_API_Resource { $query->query_where .= sprintf( " AND user_registered <= STR_TO_DATE( '%s', '%%Y-%%m-%%d %%h:%%i:%%s' )", esc_sql( $this->created_at_max ) ); } - /** - * Wrapper for @see get_avatar() which doesn't simply return - * the URL so we need to pluck it from the HTML img tag - * - * @since 2.1 - * @param string $email the customer's email - * @return string the URL to the customer's avatar - */ - private function get_avatar_url( $email ) { - - $avatar_html = get_avatar( $email ); - - // Get the URL of the avatar from the provided HTML - preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); - - if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { - return esc_url_raw( $matches[1] ); - } - - return null; - } - /** * Validate the request by checking: * diff --git a/includes/api/legacy/v2/class-wc-api-customers.php b/includes/api/legacy/v2/class-wc-api-customers.php index bfc1dd951ec..b9cdc87b81f 100644 --- a/includes/api/legacy/v2/class-wc-api-customers.php +++ b/includes/api/legacy/v2/class-wc-api-customers.php @@ -668,29 +668,6 @@ class WC_API_Customers extends WC_API_Resource { } } - /** - * Wrapper for @see get_avatar() which doesn't simply return - * the URL so we need to pluck it from the HTML img tag - * - * Kudos to https://github.com/WP-API/WP-API for offering a better solution - * - * @since 2.1 - * @param string $email the customer's email - * @return string the URL to the customer's avatar - */ - private function get_avatar_url( $email ) { - $avatar_html = get_avatar( $email ); - - // Get the URL of the avatar from the provided HTML - preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); - - if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { - return esc_url_raw( $matches[1] ); - } - - return null; - } - /** * Validate the request by checking: * diff --git a/includes/api/legacy/v3/class-wc-api-customers.php b/includes/api/legacy/v3/class-wc-api-customers.php index 0e19f4a87bc..bf781b8ca0d 100644 --- a/includes/api/legacy/v3/class-wc-api-customers.php +++ b/includes/api/legacy/v3/class-wc-api-customers.php @@ -657,29 +657,6 @@ class WC_API_Customers extends WC_API_Resource { } } - /** - * Wrapper for @see get_avatar() which doesn't simply return - * the URL so we need to pluck it from the HTML img tag - * - * Kudos to https://github.com/WP-API/WP-API for offering a better solution - * - * @since 2.1 - * @param string $email the customer's email - * @return string the URL to the customer's avatar - */ - private function get_avatar_url( $email ) { - $avatar_html = get_avatar( $email ); - - // Get the URL of the avatar from the provided HTML - preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); - - if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { - return esc_url_raw( $matches[1] ); - } - - return null; - } - /** * Validate the request by checking: *