diff --git a/includes/action-scheduler/class-init.php b/includes/action-scheduler/class-init.php index e3f55f36..2e27a790 100644 --- a/includes/action-scheduler/class-init.php +++ b/includes/action-scheduler/class-init.php @@ -42,14 +42,7 @@ if ( ! class_exists( 'um\action_scheduler\Init' ) ) { */ public function __construct() { if ( ! $this->can_be_active() ) { - UM()->admin()->notices()->add_notice( - 'um-action-scheduler', - array( - 'class' => 'notice-warning is-dismissible', - // translators: %1$s - Plugin name, %1$s - Plugin Version - 'message' => '

' . sprintf( __( '%1$s %2$s The file needed to enable the Action Scheduler is missing. The plugin will continue to function as it did before, but without the new benefits offered by the Action Scheduler.', 'ultimate-member' ), UM_PLUGIN_NAME, UM_VERSION ) . '

', - ) - ); + add_action( 'init', array( $this, 'add_notice' ) ); } else { add_filter( 'um_settings_structure', array( $this, 'add_setting' ) ); @@ -60,6 +53,17 @@ if ( ! class_exists( 'um\action_scheduler\Init' ) ) { } } + public function add_notice() { + UM()->admin()->notices()->add_notice( + 'um-action-scheduler', + array( + 'class' => 'notice-warning is-dismissible', + // translators: %1$s - Plugin name, %1$s - Plugin Version + 'message' => '

' . sprintf( __( '%1$s %2$s The file needed to enable the Action Scheduler is missing. The plugin will continue to function as it did before, but without the new benefits offered by the Action Scheduler.', 'ultimate-member' ), UM_PLUGIN_NAME, UM_VERSION ) . '

', + ) + ); + } + /** * Adds the Action Scheduler setting to Ultimate Member feature settings * diff --git a/includes/admin/core/class-admin-navmenu.php b/includes/admin/core/class-admin-navmenu.php index d4a423e7..fef9914a 100644 --- a/includes/admin/core/class-admin-navmenu.php +++ b/includes/admin/core/class-admin-navmenu.php @@ -23,10 +23,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Navmenu' ) ) { * Admin_Navmenu constructor. */ public function __construct() { - self::$fields = array( - 'um_nav_public' => __( 'Display Mode', 'ultimate-member' ), - 'um_nav_roles' => __( 'By Role', 'ultimate-member' ), - ); + add_action( 'init', array( &$this, 'set_variables' ) ); add_action( 'customize_controls_print_footer_scripts', array( &$this, '_wp_template' ) ); add_action( 'wp_update_nav_menu_item', array( &$this, '_save' ), 10, 3 ); @@ -36,6 +33,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Navmenu' ) ) { // add_action( 'wp_nav_menu_item_custom_fields_customize_template', array( $this, 'wp_nav_menu_item_custom_fields_customize_template' ), 20, 5 ); } + public function set_variables() { + self::$fields = array( + 'um_nav_public' => __( 'Display Mode', 'ultimate-member' ), + 'um_nav_roles' => __( 'By Role', 'ultimate-member' ), + ); + } /** * Fires just before the move buttons of a nav menu item in the menu editor. diff --git a/includes/class-init.php b/includes/class-init.php index 1cd27dfa..6fe5a4fb 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -204,8 +204,8 @@ if ( ! class_exists( 'UM' ) ) { $this->is_filtering = 0; $this->honeypot = 'um_request'; - // textdomain loading - add_action( 'init', array( &$this, 'localize' ), 0 ); + // @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 // include UM classes $this->includes(); @@ -243,33 +243,33 @@ if ( ! class_exists( 'UM' ) ) { * * @since 2.8.5 WordPress native functions are used to make this function clear. */ - 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 Change UM language locale. - * 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() { +// $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 Change UM language locale. +// * 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' ); +// } /** * 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades