diff --git a/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..f319fb6812720 --- /dev/null +++ b/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Hooks: Hook init_sync_cron_jobs into init to ensure translation loading within the function is not triggered too early. diff --git a/projects/packages/sync/src/class-actions.php b/projects/packages/sync/src/class-actions.php index 2769030b4e68e..fb09385827392 100644 --- a/projects/packages/sync/src/class-actions.php +++ b/projects/packages/sync/src/class-actions.php @@ -116,7 +116,7 @@ public static function init() { } if ( self::sync_via_cron_allowed() ) { - self::init_sync_cron_jobs(); + add_action( 'init', array( __CLASS__, 'init_sync_cron_jobs' ), 1 ); } elseif ( wp_next_scheduled( 'jetpack_sync_cron' ) ) { self::clear_sync_cron_jobs(); } diff --git a/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..18dbc98c689ab --- /dev/null +++ b/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Admin: Changed initialization load order for menu items to prevent translation error. diff --git a/projects/packages/videopress/src/class-admin-ui.php b/projects/packages/videopress/src/class-admin-ui.php index ef5182a691076..e934b7cd4a4ba 100644 --- a/projects/packages/videopress/src/class-admin-ui.php +++ b/projects/packages/videopress/src/class-admin-ui.php @@ -34,6 +34,23 @@ class Admin_UI { * @return void */ public static function init() { + + add_action( 'admin_menu', array( __CLASS__, 'enable_menu' ) ); + + add_action( 'admin_footer-upload.php', array( __CLASS__, 'attachment_details_two_column_template' ) ); + add_action( 'admin_footer-post.php', array( __CLASS__, 'attachment_details_template' ), 20 ); + + add_filter( 'get_edit_post_link', array( __CLASS__, 'edit_video_link' ), 10, 3 ); + + add_action( 'admin_init', array( __CLASS__, 'remove_jetpack_hooks' ) ); + } + + /** + * Enable the menu, separately to init due to translations needing to run early for the page suffix. + * + * @return void + */ + public static function enable_menu() { $page_suffix = Admin_Menu::add_menu( __( 'Jetpack VideoPress', 'jetpack-videopress-pkg' ), _x( 'VideoPress', 'The Jetpack VideoPress product name, without the Jetpack prefix', 'jetpack-videopress-pkg' ), @@ -43,13 +60,6 @@ public static function init() { 3 ); add_action( 'load-' . $page_suffix, array( __CLASS__, 'admin_init' ) ); - - add_action( 'admin_footer-upload.php', array( __CLASS__, 'attachment_details_two_column_template' ) ); - add_action( 'admin_footer-post.php', array( __CLASS__, 'attachment_details_template' ), 20 ); - - add_filter( 'get_edit_post_link', array( __CLASS__, 'edit_video_link' ), 10, 3 ); - - add_action( 'admin_init', array( __CLASS__, 'remove_jetpack_hooks' ) ); } /** diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index 73b08dec3ed91..7120701294027 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -178,7 +178,7 @@ 'extensions/blocks/blog-stats/blog-stats.php' => ['PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/blogroll/blogroll-item/blogroll-item.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'extensions/blocks/calendly/calendly.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal'], - 'extensions/blocks/contact-info/class-jetpack-contact-info-block.php' => ['PhanTypeMismatchReturn'], + 'extensions/blocks/contact-info/contact-info.php' => ['PhanTypeMismatchReturn'], 'extensions/blocks/cookie-consent/cookie-consent.php' => ['PhanParamTooMany'], 'extensions/blocks/donations/donations.php' => ['PhanTypeMismatchArgument'], 'extensions/blocks/gif/gif.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], diff --git a/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..850d659cbcc69 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Hooks: Change several action priorities to ensure translation loading is not triggered too early. diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index 4f9a306cd26b9..dda2deb3cf61a 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -867,8 +867,7 @@ function ( $methods ) { * @action plugins_loaded */ public function late_initialization() { - add_action( 'plugins_loaded', array( 'Jetpack', 'load_modules' ), 100 ); - + add_action( 'after_setup_theme', array( 'Jetpack', 'load_modules' ), 1 ); My_Jetpack_Initializer::init(); // Initialize Boost Speed Score diff --git a/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php b/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php deleted file mode 100644 index 9c961dc8e2f2d..0000000000000 --- a/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php +++ /dev/null @@ -1,120 +0,0 @@ - $value ) { - if ( ! in_array( $attribute, $omit, true ) && ! empty( $value ) ) { - return true; - } - } - - return false; - } - - /** - * Adds email schema attributes. - * - * @param array $attr Array containing the email block attributes. - * @param string $content String containing the email block content. - * - * @return string - */ - public static function render_email( $attr, $content ) { - $content = self::has_attributes( $attr, array( 'className' ) ) ? - str_replace( 'href="mailto:', 'itemprop="email" href="mailto:', $content ) : - ''; - return $content; - } - - /** - * Adds phone schema attributes. Also wraps the tel link in a span so that - * it's recognized as a telephone number in Google's Structured Data. - * - * @param array $attr Array containing the phone block attributes. - * @param string $content String containing the phone block content. - * - * @return string - */ - public static function render_phone( $attr, $content ) { - if ( self::has_attributes( $attr, array( 'className' ) ) ) { - return str_replace( - array( ' $value ) { + if ( ! in_array( $attribute, $omit, true ) && ! empty( $value ) ) { + return true; + } + } + + return false; +} + +/** + * Adds email schema attributes. + * + * @param array $attr Array containing the email block attributes. + * @param string $content String containing the email block content. + * + * @return string + */ +function render_email( $attr, $content ) { + $content = has_attributes( $attr, array( 'className' ) ) ? + str_replace( 'href="mailto:', 'itemprop="email" href="mailto:', $content ) : + ''; + return $content; +} + +/** + * Adds phone schema attributes. Also wraps the tel link in a span so that + * it's recognized as a telephone number in Google's Structured Data. + * + * @param array $attr Array containing the phone block attributes. + * @param string $content String containing the phone block content. + * + * @return string + */ +function render_phone( $attr, $content ) { + if ( has_attributes( $attr, array( 'className' ) ) ) { + return str_replace( + array( '