Skip to content

Commit

Permalink
Simplify the logic to display where Jetpack is loaded from (#6046)
Browse files Browse the repository at this point in the history
* Simplify the logic to display where Jetpack is loaded from
* Fix empty string display of VIP_JETPACK_LOADED_VERSION
* Only display local if it is local, otherwise leave blank

---------

Co-authored-by: Rebecca Hum <[email protected]>
  • Loading branch information
rinatkhaziev and rebeccahum authored Dec 10, 2024
1 parent c82dc65 commit f970e62
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions vip-jetpack/vip-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,10 @@ 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' );
}

$type = defined( 'WPCOM_VIP_JETPACK_LOCAL' ) && constant( 'WPCOM_VIP_JETPACK_LOCAL' ) ? '(Local)' : '';
/* translators: Loaded Jetpack version number */
$plugin_meta[0] = sprintf( esc_html__( '%1$s - Version %2$s' ), $type, $version );
$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 );
}

return $plugin_meta;
Expand Down

0 comments on commit f970e62

Please sign in to comment.