Role Manager #9

Merged
Tetrakern merged 122 commits from role_manager into main 2023-08-15 05:44:27 +08:00
Showing only changes of commit 0d38bae9b2 - Show all commits

View File

@ -1365,6 +1365,9 @@ if ( ! function_exists( 'fictioneer_get_font_colors' ) ) {
/**
* Explodes string into an array
*
* Strips lines breaks, trims whitespaces, and removes empty elements.
* Values might not be unique.
*
* @since 5.1.3
*
* @param string $string The string to explode.
@ -1373,8 +1376,11 @@ if ( ! function_exists( 'fictioneer_get_font_colors' ) ) {
*/
function fictioneer_explode_list( $string ) {
if ( empty( $string ) ) return [];
if ( empty( $string ) ) {
return [];
}
$string = str_replace( ["\n", "\r"], '', $string ); // Remove line breaks
$array = explode( ',', $string );
$array = array_map( 'trim', $array ); // Remove extra whitespaces
$array = array_filter( $array, 'strlen' ); // Remove empty elements