mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed #1241 issue;
This commit is contained in:
@@ -93,7 +93,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
$this->secure();
|
||||
}
|
||||
|
||||
|
||||
function init_variables() {
|
||||
$this->role_meta = apply_filters(
|
||||
'um_role_meta_map',
|
||||
|
||||
@@ -23,6 +23,7 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
$this->cpt()->hooks();
|
||||
$this->screen();
|
||||
$this->secure()->hooks();
|
||||
$this->site_health();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,5 +61,17 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\common\secure'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.6.8
|
||||
*
|
||||
* @return Site_Health
|
||||
*/
|
||||
public function site_health() {
|
||||
if ( empty( UM()->classes['um\common\site_health'] ) ) {
|
||||
UM()->classes['um\common\site_health'] = new Site_Health();
|
||||
}
|
||||
return UM()->classes['um\common\site_health'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace um\common;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\common\Site_Health' ) ) {
|
||||
|
||||
/**
|
||||
* Class Site_Health
|
||||
*
|
||||
* @package um\common
|
||||
*
|
||||
* @since 2.6.8
|
||||
*/
|
||||
class Site_Health {
|
||||
|
||||
/**
|
||||
* Site_Health constructor.
|
||||
*
|
||||
* @since 2.6.8
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'site_status_test_php_modules', array( $this, 'add_required_modules' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends required PHP libraries.
|
||||
*
|
||||
* @param array $modules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_required_modules( $modules ) {
|
||||
$modules['mbstring']['required'] = true;
|
||||
$modules['exif']['required'] = true;
|
||||
$modules['iconv']['required'] = true;
|
||||
return $modules;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,7 +706,9 @@ function um_field_non_utf8_value( $value ) {
|
||||
if ( function_exists( 'mb_detect_encoding' ) ) {
|
||||
$encoding = mb_detect_encoding( $value, 'utf-8, iso-8859-1, ascii', true );
|
||||
if ( strcasecmp( $encoding, 'UTF-8' ) !== 0 ) {
|
||||
$value = iconv( $encoding, 'utf-8', $value );
|
||||
if ( function_exists( 'iconv' ) ) {
|
||||
$value = iconv( $encoding, 'utf-8', $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ function um_dynamic_user_profile_title( $title, $id = '' ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'utf8_decode' ) ) {
|
||||
if ( ! function_exists( 'mb_convert_encoding' ) ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ add_filter( 'um_clean_user_basename_filter', 'um_clean_user_basename_filter', 2,
|
||||
* @return array
|
||||
*/
|
||||
function um_before_update_profile( $changes, $user_id ) {
|
||||
// todo check if this option required and maybe there are some WordPress native ways how to make that without custom unused functions. Maybe fully deprecate 'um_force_utf8_strings' option which doesn't exist in UI.
|
||||
if ( ! UM()->options()->get( 'um_force_utf8_strings' ) ) {
|
||||
return $changes;
|
||||
}
|
||||
|
||||
@@ -2662,9 +2662,13 @@ function um_force_utf8_string( $value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
$arr_value = array();
|
||||
foreach ( $value as $key => $v ) {
|
||||
if ( ! function_exists( 'utf8_decode' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$utf8_decoded_value = utf8_decode( $v );
|
||||
|
||||
if ( mb_check_encoding( $utf8_decoded_value, 'UTF-8' ) ) {
|
||||
if ( function_exists( 'mb_check_encoding' ) && mb_check_encoding( $utf8_decoded_value, 'UTF-8' ) ) {
|
||||
array_push( $arr_value, $utf8_decoded_value );
|
||||
} else {
|
||||
array_push( $arr_value, $v );
|
||||
@@ -2674,11 +2678,12 @@ function um_force_utf8_string( $value ) {
|
||||
|
||||
return $arr_value;
|
||||
} else {
|
||||
if ( function_exists( 'utf8_decode' ) ) {
|
||||
$utf8_decoded_value = utf8_decode( $value );
|
||||
|
||||
$utf8_decoded_value = utf8_decode( $value );
|
||||
|
||||
if (mb_check_encoding( $utf8_decoded_value, 'UTF-8' )) {
|
||||
return $utf8_decoded_value;
|
||||
if ( function_exists( 'mb_check_encoding' ) && mb_check_encoding( $utf8_decoded_value, 'UTF-8' ) ) {
|
||||
return $utf8_decoded_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user