Skip to content

Commit

Permalink
Merge pull request #107 from WebDevStudios/hotfix/wc_sanitize_phone_n…
Browse files Browse the repository at this point in the history
…umber

CC-145 Provide fallback if wc_sanitize_phone_number isn't available
  • Loading branch information
richaber authored Jun 10, 2020
2 parents d119bee + bdd089d commit 582a78d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/View/Admin/WooTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,11 @@ private function validate_value( $field ) {
* @return string
*/
public function sanitize_phone_number( $value ) {
return wc_sanitize_phone_number( $value );
if ( function_exists( 'wc_sanitize_phone_number' ) ) {
return wc_sanitize_phone_number( $value );
}

return preg_replace( '/[^\d+]/', '', $value );
}

/**
Expand Down

0 comments on commit 582a78d

Please sign in to comment.