From 6c4eaff370e90e76f9957abeca69bf4b0295eb7b Mon Sep 17 00:00:00 2001 From: Rinat Khaziev Date: Tue, 10 Dec 2024 11:24:13 -0600 Subject: [PATCH 1/5] Simplify the logic to display where Jetpack is loaded from --- vip-jetpack/vip-jetpack.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/vip-jetpack/vip-jetpack.php b/vip-jetpack/vip-jetpack.php index 380152691a..c9d4b07e13 100644 --- a/vip-jetpack/vip-jetpack.php +++ b/vip-jetpack/vip-jetpack.php @@ -364,16 +364,9 @@ function vip_filter_plugin_version_jetpack( $plugin_meta, $plugin_file ) { } if ( 'jetpack.php' === $plugin_file ) { - $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? 'Local' : - 'MU-Plugins'; - if ( defined( 'VIP_JETPACK_LOADED_VERSION' ) ) { - $version = constant( 'VIP_JETPACK_LOADED_VERSION' ); - } else { - $version = constant( 'JETPACK__VERSION' ); - } - - /* translators: Loaded Jetpack version number */ - $plugin_meta[0] = sprintf( esc_html__( '%1$s - Version %2$s' ), $type, $version ); + $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? 'Local' : 'MU-Plugins'; + $plugin_meta[0] = sprintf( '%s (%s)', $plugin_meta[0], $type ); + remove_filter( 'plugin_row_meta', 'vip_filter_plugin_version_jetpack', PHP_INT_MAX, 2 ); } return $plugin_meta; From 95aaa2c38748cb581b623982809b64ccae323c7e Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 10 Dec 2024 11:57:04 -0700 Subject: [PATCH 2/5] Fix empty string display of VIP_JETPACK_LOADED_VERSION --- vip-jetpack/vip-jetpack.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vip-jetpack/vip-jetpack.php b/vip-jetpack/vip-jetpack.php index c9d4b07e13..989259ac0b 100644 --- a/vip-jetpack/vip-jetpack.php +++ b/vip-jetpack/vip-jetpack.php @@ -365,7 +365,7 @@ function vip_filter_plugin_version_jetpack( $plugin_meta, $plugin_file ) { if ( 'jetpack.php' === $plugin_file ) { $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? 'Local' : 'MU-Plugins'; - $plugin_meta[0] = sprintf( '%s (%s)', $plugin_meta[0], $type ); + $plugin_meta[0] = sprintf( '%s (%s)', constant( 'JETPACK__VERSION' ), $type ); remove_filter( 'plugin_row_meta', 'vip_filter_plugin_version_jetpack', PHP_INT_MAX, 2 ); } From 191dd3925a0513d821b5141555fd526a27690dc3 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 10 Dec 2024 12:13:13 -0700 Subject: [PATCH 3/5] Only display local if it is local, otherwise leave blank --- vip-jetpack/vip-jetpack.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vip-jetpack/vip-jetpack.php b/vip-jetpack/vip-jetpack.php index 989259ac0b..080d8d458f 100644 --- a/vip-jetpack/vip-jetpack.php +++ b/vip-jetpack/vip-jetpack.php @@ -364,8 +364,8 @@ function vip_filter_plugin_version_jetpack( $plugin_meta, $plugin_file ) { } if ( 'jetpack.php' === $plugin_file ) { - $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? 'Local' : 'MU-Plugins'; - $plugin_meta[0] = sprintf( '%s (%s)', constant( 'JETPACK__VERSION' ), $type ); + $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? '(Local)' : ''; + $plugin_meta[0] = sprintf( '%s %s', constant( 'JETPACK__VERSION' ), $type ); remove_filter( 'plugin_row_meta', 'vip_filter_plugin_version_jetpack', PHP_INT_MAX, 2 ); } From d2821a6ab1c456810eaeef545f08eb53edfb60f4 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 10 Dec 2024 13:01:39 -0700 Subject: [PATCH 4/5] Add back Version text --- vip-jetpack/vip-jetpack.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vip-jetpack/vip-jetpack.php b/vip-jetpack/vip-jetpack.php index 080d8d458f..c3aa9bd45d 100644 --- a/vip-jetpack/vip-jetpack.php +++ b/vip-jetpack/vip-jetpack.php @@ -365,7 +365,8 @@ function vip_filter_plugin_version_jetpack( $plugin_meta, $plugin_file ) { if ( 'jetpack.php' === $plugin_file ) { $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? '(Local)' : ''; - $plugin_meta[0] = sprintf( '%s %s', constant( 'JETPACK__VERSION' ), $type ); + /* translators: Loaded Jetpack version number */ + $plugin_meta[0] = sprintf( esc_html__( 'Version %s %s' ), constant( 'JETPACK__VERSION' ), $type ); remove_filter( 'plugin_row_meta', 'vip_filter_plugin_version_jetpack', PHP_INT_MAX, 2 ); } From 9e9acfe446c73cab362610654ed716b9d61bf194 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 10 Dec 2024 13:03:45 -0700 Subject: [PATCH 5/5] lint --- vip-jetpack/vip-jetpack.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vip-jetpack/vip-jetpack.php b/vip-jetpack/vip-jetpack.php index c3aa9bd45d..4e2b047c84 100644 --- a/vip-jetpack/vip-jetpack.php +++ b/vip-jetpack/vip-jetpack.php @@ -364,9 +364,9 @@ function vip_filter_plugin_version_jetpack( $plugin_meta, $plugin_file ) { } if ( 'jetpack.php' === $plugin_file ) { - $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? '(Local)' : ''; + $type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? '(Local)' : ''; /* translators: Loaded Jetpack version number */ - $plugin_meta[0] = sprintf( esc_html__( 'Version %s %s' ), constant( 'JETPACK__VERSION' ), $type ); + $plugin_meta[0] = sprintf( esc_html__( 'Version %1$s %2$s' ), constant( 'JETPACK__VERSION' ), $type ); remove_filter( 'plugin_row_meta', 'vip_filter_plugin_version_jetpack', PHP_INT_MAX, 2 ); }