Skip to content

Commit

Permalink
Simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
Valter Lorran committed Jan 3, 2025
1 parent 4af49b1 commit 227c57b
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@ public function get_preferred_view( $screen, $fallback_global_preference = true
return self::DEFAULT_VIEW;
}

/**
* Check if the current site is a self-hosted site.
*
* @return bool Whether the site is a self-hosted site.
*/
private function is_self_hosted_site() {
if ( ! function_exists( 'is_jetpack_site' ) || ! function_exists( 'is_blog_atomic' ) ) {
return true;
}
$blog_id = get_current_blog_id();

return is_jetpack_site( $blog_id ) && ! is_blog_atomic( get_blog_details( $blog_id ) );
}

/**
* Get the Calypso or wp-admin link to CPT page.
*
Expand All @@ -85,7 +71,8 @@ private function is_self_hosted_site() {
public function get_cpt_menu_link( $ptype_obj ) {

$post_type = $ptype_obj->name;
$is_woocommerce_product_self_hosted = $post_type === 'product' && class_exists( 'WooCommerce' ) && $this->is_self_hosted_site();
$is_self_hosted_site = ! ( new Host() )->is_wpcom_platform();

Check failure on line 74 in projects/packages/masterbar/src/admin-menu/class-jetpack-admin-menu.php

View workflow job for this annotation

GitHub Actions / Static analysis

UndefError PhanUndeclaredClassMethod Call to method __construct from undeclared class \Automattic\Jetpack\Masterbar\Host

Check failure on line 74 in projects/packages/masterbar/src/admin-menu/class-jetpack-admin-menu.php

View workflow job for this annotation

GitHub Actions / Static analysis

UndefError PhanUndeclaredClassMethod Call to method is_wpcom_platform from undeclared class \Automattic\Jetpack\Masterbar\Host
$is_woocommerce_product_self_hosted = $post_type === 'product' && class_exists( 'WooCommerce' ) && $is_self_hosted_site;

if ( ! $is_woocommerce_product_self_hosted && ( new Modules() )->is_active( 'sso' ) && $ptype_obj->show_in_rest ) {
return 'https://wordpress.com/types/' . $post_type . '/' . $this->domain;
Expand Down

0 comments on commit 227c57b

Please sign in to comment.