Skip to content

Commit

Permalink
Removed "Upgrade" page.
Browse files Browse the repository at this point in the history
  • Loading branch information
seb86 committed Dec 17, 2023
1 parent ea397e4 commit 5f9f48c
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions includes/admin/class-cocart-admin-menus.php
Expand Up @@ -25,14 +25,6 @@ class CoCart_Admin_Menus {
*/
public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'cocart_page_title_upgrade', function() {
return __( 'Upgrade CoCart', 'cart-rest-api-for-woocommerce' );
} );
add_action( 'cocart_page_wc_bar_breadcrumb_upgrade', function() {
return __( 'Upgrade CoCart', 'cart-rest-api-for-woocommerce' );
} );
add_action( 'cocart_page_section_upgrade', array( $this, 'upgrade_cocart_content' ) );
add_filter( 'parent_file', array( $this, 'highlight_submenu_upgrade' ) );
} // END __construct()

/**
Expand Down Expand Up @@ -75,18 +67,6 @@ public function admin_menu() {
);
}

// If CoCart Pro is not active then add sub-menu to upgrade.
if ( ! CoCart_Helpers::is_cocart_pro_activated() ) {
add_submenu_page(
'cocart',
'',
esc_attr__( 'Upgrade', 'cart-rest-api-for-woocommerce' ),
apply_filters( 'cocart_screen_capability', 'manage_options' ),
'upgrade-cocart',
array( $this, 'redirect_upgrade' )
);
}

// Register WooCommerce Admin Bar.
if ( CoCart_Helpers::is_wc_version_gte( '4.0' ) && function_exists( 'wc_admin_connect_page' ) ) {
wc_admin_connect_page(
Expand Down Expand Up @@ -143,47 +123,6 @@ public static function cocart_page() {
}
} // END cocart_page()

/**
* Upgrade CoCart content.
*
* @access public
* @static
* @since 3.1.0
*/
public static function upgrade_cocart_content() {
include_once dirname( __FILE__ ) . '/views/html-upgrade-cocart.php';
} // END upgrade_cocart_content()

/**
* Redirects to upgrade section of CoCart Page.
*
* @access public
* @since 3.1.0
*/
public function redirect_upgrade() {
wp_safe_redirect( admin_url( 'admin.php?page=cocart&section=upgrade' ) );
exit;
} // END redirect_upgrade()

/**
* Sets the sub-menu active if viewing upgrade section.
*
* @access public
* @since 3.1.0
* @param string $parent_file The parent file.
* @return mixed
*/
public function highlight_submenu_upgrade( $parent_file ) {
global $plugin_page;

$section = ! isset( $_GET['section'] ) ? '' : trim( sanitize_key( wp_unslash( $_GET['section'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended

if ( 'cocart' === $plugin_page && 'upgrade' === $section ) {
$plugin_page = 'upgrade-cocart'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}

return $parent_file;
} // END highlight_submenu_upgrade()

} // END class

Expand Down

0 comments on commit 5f9f48c

Please sign in to comment.