- fixed #1241 issue;

This commit is contained in:
Mykyta Synelnikov
2023-07-11 17:59:54 +03:00
parent 543e0a803a
commit 6c3b06dff0
8 changed files with 84 additions and 8 deletions
-1
View File
@@ -93,7 +93,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
$this->secure();
}
function init_variables() {
$this->role_meta = apply_filters(
'um_role_meta_map',
+13
View File
@@ -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'];
}
}
}
+42
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -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 );
}
}
}
+1 -1
View File
@@ -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;
}
+1
View File
@@ -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;
}
+10 -5
View File
@@ -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;
}
}
}
+14
View File
@@ -141,6 +141,10 @@ The plugin does not restrict access to the wp-login.php page when active, so tha
No, you do not need to use our plugins login or registration pages and can use another plugin or the default WordPress methods for user registration and login.
= Are additional PHP modules necessary for the plugin to work correctly? =
No specific extensions are needed. But we highly recommended keep active these PHP modules: `mbstring`, `json`, `dom`, `exif`, `gd`, `fileinfo`, `curl`, `iconv`. wp-admin > Tools > Site Health page has a summary about your installation and required modules. All major extensions are listed [here](https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions).
== Screenshots ==
1. Screenshot 1
@@ -162,6 +166,16 @@ No, you do not need to use our plugins login or registration pages and can us
IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
= 2.6.8: July 12, 2023 =
* Enhancements:
- Added: Secure settings. [Read more](https://docs.ultimatemember.com/article/1869-security-feature)
* Bugfixes:
- Fixed: Using some specific functions which cannot exist if PHP modules are disabled
= 2.6.7: July 1, 2023 =
* Bugfixes: