diff --git a/projects/packages/connection/changelog/add-idc-custom-content-callback b/projects/packages/connection/changelog/add-idc-custom-content-callback new file mode 100644 index 0000000000000..be3f28ce28b3c --- /dev/null +++ b/projects/packages/connection/changelog/add-idc-custom-content-callback @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added a mechanism to use callbacks for package options. diff --git a/projects/packages/connection/src/identity-crisis/class-ui.php b/projects/packages/connection/src/identity-crisis/class-ui.php index ee4c5acb4e880..2066e2a5df9e2 100644 --- a/projects/packages/connection/src/identity-crisis/class-ui.php +++ b/projects/packages/connection/src/identity-crisis/class-ui.php @@ -168,6 +168,10 @@ function ( $c1, $c2 ) { continue; } + if ( isset( $consumer['customContent'] ) && is_callable( $consumer['customContent'] ) ) { + $consumer['customContent'] = call_user_func( $consumer['customContent'] ); + } + if ( isset( $_SERVER['REQUEST_URI'] ) && str_starts_with( filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ) ), $consumer['admin_page'] ) && strlen( $consumer['admin_page'] ) > $consumer_url_length ) { $consumer_chosen = $consumer; $consumer_url_length = strlen( $consumer['admin_page'] ); diff --git a/projects/plugins/jetpack/changelog/removed-i18n-from-early-deprecation-notices b/projects/plugins/jetpack/changelog/removed-i18n-from-early-deprecation-notices new file mode 100644 index 0000000000000..273ce7ce2e2a9 --- /dev/null +++ b/projects/plugins/jetpack/changelog/removed-i18n-from-early-deprecation-notices @@ -0,0 +1,4 @@ +Significance: patch +Type: compat + +WordPress 6.7 Compatibility: Fixed notices caused by translation calls happening too early in the load order. diff --git a/projects/plugins/jetpack/functions.global.php b/projects/plugins/jetpack/functions.global.php index 57ac1d24d0a5c..88ef11ae9a11e 100644 --- a/projects/plugins/jetpack/functions.global.php +++ b/projects/plugins/jetpack/functions.global.php @@ -50,8 +50,10 @@ function jetpack_deprecated_function( $function, $replacement, $version ) { // p ) { error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log sprintf( - /* Translators: 1. Function name. 2. Jetpack version number. */ - __( 'The %1$s function will be removed from the Jetpack plugin in version %2$s.', 'jetpack' ), + doing_action( 'after_setup_theme' ) || did_action( 'after_setup_theme' ) ? + /* Translators: 1. Function name. 2. Jetpack version number. */ + __( 'The %1$s function will be removed from the Jetpack plugin in version %2$s.', 'jetpack' ) + : 'The %1$s function will be removed from the Jetpack plugin in version %2$s.', $function, $removed_version ) diff --git a/projects/plugins/social/changelog/move-admin-menu-to-init b/projects/plugins/social/changelog/move-admin-menu-to-init new file mode 100644 index 0000000000000..c08dcf087a023 --- /dev/null +++ b/projects/plugins/social/changelog/move-admin-menu-to-init @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Moved the admin menu initialization to the init hook. diff --git a/projects/plugins/social/src/class-jetpack-social.php b/projects/plugins/social/src/class-jetpack-social.php index 2d8b351f6ac08..6f545e40ea5d3 100644 --- a/projects/plugins/social/src/class-jetpack-social.php +++ b/projects/plugins/social/src/class-jetpack-social.php @@ -47,17 +47,6 @@ public function __construct( $connection_manager = null ) { // Set up the REST authentication hooks. Connection_Rest_Authentication::init(); - $page_suffix = Admin_Menu::add_menu( - __( 'Jetpack Social', 'jetpack-social' ), - _x( 'Social', 'The Jetpack Social product name, without the Jetpack prefix', 'jetpack-social' ), - 'manage_options', - 'jetpack-social', - array( $this, 'plugin_settings_page' ), - 4 - ); - - add_action( 'load-' . $page_suffix, array( $this, 'admin_init' ) ); - // Init Jetpack packages add_action( 'plugins_loaded', @@ -93,6 +82,8 @@ function () { 1 ); + add_action( 'init', array( $this, 'do_init' ) ); + // Activate the module as the plugin is activated add_action( 'admin_init', array( $this, 'do_plugin_activation_activities' ) ); add_action( 'activated_plugin', array( $this, 'redirect_after_activation' ) ); @@ -105,7 +96,6 @@ function () { My_Jetpack_Initializer::init(); } ); - add_action( 'init', array( new Automattic\Jetpack\Social\Note(), 'init' ) ); $this->manager = $connection_manager ? $connection_manager : new Connection_Manager(); @@ -130,6 +120,25 @@ function () { add_filter( 'jetpack_social_admin_script_data', array( $this, 'set_social_admin_script_data' ) ); } + /** + * Initialize the parts of the plugin that have to be initialized later than + * plugins_loaded is firing. This includes translated strings. + */ + public function do_init() { + $page_suffix = Admin_Menu::add_menu( + __( 'Jetpack Social', 'jetpack-social' ), + _x( 'Social', 'The Jetpack Social product name, without the Jetpack prefix', 'jetpack-social' ), + 'manage_options', + 'jetpack-social', + array( $this, 'plugin_settings_page' ), + 4 + ); + + add_action( 'load-' . $page_suffix, array( $this, 'admin_init' ) ); + + ( new Automattic\Jetpack\Social\Note() )->init(); + } + /** * Initialize the admin resources. */