mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-14 20:26:49 +09:00
Fix force UT8 encoding option
This commit is contained in:
+4
-1
@@ -1573,8 +1573,11 @@ class UM_Fields {
|
||||
if ( isset( $options_pair ) ) {
|
||||
$option_value = $k;
|
||||
}
|
||||
|
||||
$option_value = htmlentities($option_value);
|
||||
$option_value = apply_filters('um_select_dropdown_dynamic_option_value', $option_value);
|
||||
|
||||
$output .= '<option value="' . htmlentities($option_value) . '" ';
|
||||
$output .= '<option value="' . $option_value . '" ';
|
||||
if ( $this->is_selected($form_key, $option_value, $data) ) {
|
||||
$output.= 'selected';
|
||||
}
|
||||
|
||||
@@ -329,6 +329,7 @@
|
||||
* @uses hook filter: um_is_selected_filter_value
|
||||
*/
|
||||
add_filter('um_is_selected_filter_value','um_is_selected_filter_value',1,9);
|
||||
add_filter('um_select_dropdown_dynamic_option_value','um_is_selected_filter_value',1,10);
|
||||
function um_is_selected_filter_value( $value ){
|
||||
global $ultimatemember;
|
||||
|
||||
@@ -338,4 +339,26 @@
|
||||
$value = um_force_utf8_string( $value );
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter select dropdown to use UTF-8 encoding
|
||||
* @param array $options
|
||||
* @param array $data
|
||||
* @return $options
|
||||
* @uses hook filter: um_select_dropdown_dynamic_options
|
||||
*/
|
||||
add_filter('um_select_dropdown_dynamic_options','um_select_dropdown_dynamic_options_to_utf8',2,10);
|
||||
function um_select_dropdown_dynamic_options_to_utf8( $options, $data ){
|
||||
global $ultimatemember;
|
||||
|
||||
if( ! um_get_option('um_force_utf8_strings') )
|
||||
return $options;
|
||||
|
||||
foreach ( $options as $key => $value ) {
|
||||
$options[ $key ] = um_force_utf8_string( $value );
|
||||
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -90,3 +90,24 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter before update profile to force utf8 strings
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
* @uses hook filter: um_is_selected_filter_value
|
||||
*/
|
||||
add_filter('um_before_update_profile','um_before_update_profile',2,10);
|
||||
function um_before_update_profile( $changes, $user_id ){
|
||||
global $ultimatemember;
|
||||
|
||||
if( ! um_get_option('um_force_utf8_strings') )
|
||||
return $changes;
|
||||
|
||||
foreach( $changes as $key => $value ) {
|
||||
$changes[ $key ] = um_force_utf8_string( $value );
|
||||
|
||||
}
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
+1
-1
@@ -829,7 +829,7 @@ class UM_User {
|
||||
|
||||
$args['ID'] = $this->id;
|
||||
|
||||
$changes = apply_filters('um_before_update_profile');
|
||||
$changes = apply_filters('um_before_update_profile', $changes, $this->id);
|
||||
|
||||
// save or update profile meta
|
||||
foreach( $changes as $key => $value ) {
|
||||
|
||||
Reference in New Issue
Block a user