Removed old get avatar method
This commit is contained in:
parent
14996ef97a
commit
aba4699ee2
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue