allOk = false; } if ( ! function_exists( 'is_plugin_active' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( ! function_exists( 'wp_create_nonce' ) ) { require_once ABSPATH . 'wp-includes/pluggable.php'; } // Check WooCommerce. $woocommerce = 'woocommerce/woocommerce.php'; if ( ! is_plugin_active( $woocommerce ) ) { if ( $this->is_plugins_installed( $woocommerce ) ) { $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $woocommerce . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $woocommerce ); $message = sprintf( '%s requires WooCommerce plugin to be active. Please activate WooCommerce to continue.', esc_html( self::PLUGIN_NAME ), ); $button_text = 'Activate WooCommerce'; } else { $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' ); $message = sprintf( '%s requires WooCommerce plugin to be active. Please activate WooCommerce to continue.', esc_html( self::PLUGIN_NAME ), ); $button_text = 'Install WooCommerce'; } $this->missing['woocommerce'] = [ 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'file_name' => $woocommerce, 'url' => $activation_url, 'message' => $message, 'button_txt' => $button_text, ]; $this->allOk = false; } if ( ! empty( $this->missing ) ) { add_action( 'admin_notices', [ $this, '_missing_plugins_warning' ] ); } return $this->allOk; } /** * Admin Notice For Required PHP Version */ public function minimum_php_version() { // Protect plugin Activation with error. if ( isset( $_GET['activate'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended unset( $_GET['activate'] ); } $message = sprintf( /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ esc_html( '"%1$s" requires "%2$s" version %3$s or greater.' ), 'ShopBuilder', 'PHP', self::MINIMUM_PHP_VERSION ); printf( '
%1$s
' . esc_html( $plugin['button_txt'] ) . '
' : ''; printf( '%1$s
%2$s