* changed hook for initialization of email templates paths;

* removed `load_plugin_textdomain` due to (article)[https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files]
* deprecated `UM()->localize()` function;
* deprecated `um_language_textdomain` filter hook;
This commit is contained in:
Mykyta Synelnikov
2024-11-29 14:09:23 +02:00
parent f5d81f1a41
commit b892a70756
4 changed files with 47 additions and 64 deletions
+11 -37
View File
@@ -175,7 +175,6 @@ if ( ! class_exists( 'UM' ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'ultimate-member' ), '1.0' );
}
/**
* UM constructor.
*
@@ -185,7 +184,6 @@ if ( ! class_exists( 'UM' ) ) {
parent::__construct();
}
/**
* UM pseudo-constructor.
*
@@ -202,19 +200,17 @@ if ( ! class_exists( 'UM' ) ) {
}
$this->is_filtering = 0;
$this->honeypot = 'um_request';
// @todo investigate permanently delete https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files
add_action( 'init', array( &$this, 'localize' ), 0 ); // textdomain loading
$this->honeypot = 'um_request';
// include UM classes
$this->includes();
// include hook files
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
//run hook for extensions init
// run hook for extensions init
add_action( 'plugins_loaded', array( &$this, 'extensions_init' ), -19 );
// Fallback to avoid fatal errors for users who still have UM extensions compatible with UM 1.3.x and install UM >= 2.0 version before these extensions update.
add_action( 'init', array( &$this, 'old_update_patch' ), 0 );
//run activation
@@ -222,7 +218,7 @@ if ( ! class_exists( 'UM' ) ) {
register_deactivation_hook( UM_PLUGIN, array( &$this, 'deactivation' ) );
if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) {
if ( ! defined( 'DOING_AJAX' ) && is_multisite() ) {
add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) );
}
@@ -242,39 +238,17 @@ if ( ! class_exists( 'UM' ) ) {
* Note: 'ultimate-member' is a default textdomain.
*
* @since 2.8.5 WordPress native functions are used to make this function clear.
* @deprecated 2.9.2 Ref. https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files
*/
// public function localize() {
// $default_domain = dirname( plugin_basename( UM_PLUGIN ) );
// /**
// * Filters the plugin's textdomain.
// *
// * @param {string} $domain Plugin's textdomain.
// *
// * @return {string} Maybe changed plugin's textdomain.
// *
// * @since 1.3.x
// * @hook um_language_textdomain
// *
// * @example <caption>Change UM language locale.</caption>
// * function my_um_language_textdomain( $domain ) {
// * $domain = 'ultimate-member-custom';
// * return $domain;
// * }
// * add_filter( 'um_language_textdomain', 'my_um_language_textdomain' );
// */
// $domain = apply_filters( 'um_language_textdomain', $default_domain );
//
// // Unload textdomain if it has already loaded.
// if ( is_textdomain_loaded( $domain ) ) {
// unload_textdomain( $domain, true );
// }
// load_plugin_textdomain( $domain, false, $default_domain . '/languages' );
// }
public function localize() {
_deprecated_function( __METHOD__, '2.9.2', '' );
}
/**
* 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades
* Fallback to avoid fatal errors for users who still have UM extensions compatible with UM 1.3.x and install UM >= 2.0 version before these extensions update.
* Doing 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades.
*/
function old_update_patch() {
public function old_update_patch() {
global $um_woocommerce, $um_bbpress, $um_followers, $um_friends, $um_mailchimp, $um_messaging, $um_mycred, $um_notices, $um_notifications, $um_online, $um_private_content, $um_profile_completeness, $um_recaptcha, $um_reviews, $um_activity, $um_social_login, $um_user_tags, $um_verified;
if ( is_object( $um_woocommerce ) ) {