=woocommerce' ), 'install-plugin_woocommerce' ); $message = sprintf( /* translators: %1$s - Plugin Name, %2$s - install WooCommerce link open, %3$s - install WooCommerce link close. */ esc_html__( '%1$s requires WooCommerce to be installed and activated. Please %2$sinstall WooCommerce%3$s.', 'woogrow-compat-checker' ), '' . $plugin_name . '', '', '' ); $this->add_admin_notice( 'woocommerce-not-installed', 'error', $message ); } } /** * Add notices for out of date WooCommerce. */ public function wc_out_of_date() { if ( ! current_user_can( 'update_plugins' ) ) { return; } $plugin_name = $this->plugin_data['Name']; $wc_version_required = ( 1 === substr_count( $this->plugin_data['RequiresWC'], '.' ) ) ? $this->plugin_data['RequiresWC'] . '.0' : $this->plugin_data['RequiresWC']; // Pad .0 if the min required WC version is not in semvar format. $message = sprintf( /* translators: %1$s - Plugin Name, %2$s - minimum WooCommerce version, %3$s - update WooCommerce link open, %4$s - update WooCommerce link close, %5$s - download minimum WooCommerce link open, %6$s - download minimum WooCommerce link close. */ esc_html__( '%1$s requires WooCommerce version %2$s or higher. Please %3$supdate WooCommerce%4$s to the latest version, or %5$sdownload the minimum required version »%6$s', 'woogrow-compat-checker' ), '' . $plugin_name . '', $wc_version_required, '', '', '', '' ); $this->add_admin_notice( 'woocommerce-out-of-date', 'error', $message ); } /** * Adds notice for untested WooCommerce. */ public function wc_untested() { $plugin_name = $this->plugin_data['Name']; $wc_version = $this->get_wc_version(); $plugin_version = $this->plugin_data['Version']; $message = sprintf( /* translators: %1$s - Plugin Name, %2$s - Plugin version, %3$s - WooCommerce version number */ esc_html__( '%1$s - version %2$s is untested with WooCommerce %3$s.', 'woogrow-compat-checker' ), '' . $plugin_name . '', $plugin_version, $wc_version ); $this->add_admin_notice( 'woocommerce-untested', 'warning is-dismissible', $message ); } /** * Adds notice for WooCommerce upgrade recommendation. */ public function make_upgrade_recommendation() { // Bail if the user does not have the update plugins capability. if ( ! current_user_can( 'update_plugins' ) ) { return; } $plugin_name = $this->plugin_data['Name']; $current_wc_version = $this->get_wc_version(); $message = sprintf( /* translators: Placeholders: %1$s - plugin name, %2$s - WooCommerce version number, %3$s - opening HTML link tag, %4$s - closing HTML link tag */ esc_html__( 'Heads up! %1$s will soon discontinue support for WooCommerce %2$s. Please %3$supdate WooCommerce%4$s to take advantage of the latest updates and features.', 'woogrow-compat-checker' ), '' . $plugin_name . '', $current_wc_version, '', '' ); $this->add_admin_notice( 'woocommerce-upgrade-recommendation', 'warning is-dismissible', $message ); } /** * Run all compatibility checks. */ protected function run_checks() { try { $this->check_wc_installation_and_activation(); $this->check_wc_version(); $this->check_wc_upgrade_recommendation(); return true; } catch ( IncompatibleException $e ) { return false; } } }