From 42820ea88dbb324438d2ad6cd61a3b56c7c4df6f Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Tue, 21 Oct 2014 10:51:16 -0200 Subject: [PATCH] introduced the wc_strtolower() function, closes #6575 --- includes/wc-formatting-functions.php | 12 ++++++++++++ includes/wc-order-functions.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/wc-formatting-functions.php b/includes/wc-formatting-functions.php index de339b8634f..bb0f93bf07e 100644 --- a/includes/wc-formatting-functions.php +++ b/includes/wc-formatting-functions.php @@ -589,3 +589,15 @@ function wc_format_phone_number( $tel ) { $tel = str_replace( '.', '-', $tel ); return $tel; } + +/** + * Make a string lowercase. + * Try to use mb_strtolower() when available. + * + * @since 2.3 + * @param string $string + * @return string + */ +function wc_strtolower( $string ) { + return function_exists( 'mb_strtolower' ) ? mb_strtolower( $string ) : strtolower( $string ); +} diff --git a/includes/wc-order-functions.php b/includes/wc-order-functions.php index d0d8207e3d6..f0472d7dc88 100644 --- a/includes/wc-order-functions.php +++ b/includes/wc-order-functions.php @@ -56,7 +56,7 @@ function wc_get_order_status_name( $status ) { $status = 'wc-' === substr( $status, 0, 3 ) ? substr( $status, 3 ) : $status; $status = isset( $statuses[ 'wc-' . $status ] ) ? $statuses[ 'wc-' . $status ] : $status; - return function_exists( 'mb_strtolower' ) ? mb_strtolower( $status ) : strtolower( $status ); + return wc_strtolower( $status ); } /**