includes/cli/class-wc-cli-customer.php 1 location
|
@@ 635-646 (lines=12) @@
|
| 632 |
|
* @param string $email the customer's email |
| 633 |
|
* @return string the URL to the customer's avatar |
| 634 |
|
*/ |
| 635 |
|
protected function get_avatar_url( $email ) { |
| 636 |
|
$avatar_html = get_avatar( $email ); |
| 637 |
|
|
| 638 |
|
// Get the URL of the avatar from the provided HTML |
| 639 |
|
preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); |
| 640 |
|
|
| 641 |
|
if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { |
| 642 |
|
return esc_url_raw( $matches[1] ); |
| 643 |
|
} |
| 644 |
|
|
| 645 |
|
return null; |
| 646 |
|
} |
| 647 |
|
|
| 648 |
|
/** |
| 649 |
|
* Add/Update customer data. |
includes/wc-user-functions.php 1 location
|
@@ 673-684 (lines=12) @@
|
| 670 |
|
* @param string $email the customer's email. |
| 671 |
|
* @return string the URL to the customer's avatar. |
| 672 |
|
*/ |
| 673 |
|
function wc_get_customer_avatar_url( $email ) { |
| 674 |
|
$avatar_html = get_avatar( $email ); |
| 675 |
|
|
| 676 |
|
// Get the URL of the avatar from the provided HTML. |
| 677 |
|
preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); |
| 678 |
|
|
| 679 |
|
if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { |
| 680 |
|
return esc_url_raw( $matches[1] ); |
| 681 |
|
} |
| 682 |
|
|
| 683 |
|
return null; |
| 684 |
|
} |
| 685 |
|
|
includes/class-wc-customer.php 1 location
|
@@ 331-342 (lines=12) @@
|
| 328 |
|
* @since 2.7.0 |
| 329 |
|
* @return string |
| 330 |
|
*/ |
| 331 |
|
public function get_avatar_url() { |
| 332 |
|
$avatar_html = get_avatar( $this->get_email() ); |
| 333 |
|
|
| 334 |
|
// Get the URL of the avatar from the provided HTML |
| 335 |
|
preg_match( '/src=["|\'](.+)[\&|"|\']/U', $avatar_html, $matches ); |
| 336 |
|
|
| 337 |
|
if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) { |
| 338 |
|
return esc_url( $matches[1] ); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
return ''; |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
/** |
| 345 |
|
* Return the date this customer was created. |