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 %s %s %s', esc_html( self::PLUGIN_NAME ), esc_html__( 'requires', 'shopbuilder' ), esc_html__( 'WooCommerce', 'shopbuilder' ), esc_html__( 'plugin to be active. Please activate WooCommerce to continue.', 'shopbuilder' ) ); $button_text = esc_html__( 'Activate WooCommerce', 'shopbuilder' ); } else { $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' ); $message = sprintf( '%s %s %s %s', esc_html( self::PLUGIN_NAME ), esc_html__( 'requires', 'shopbuilder' ), esc_html__( 'WooCommerce', 'shopbuilder' ), esc_html__( 'plugin to be installed and activated. Please install WooCommerce to continue.', 'shopbuilder' ) ); $button_text = esc_html__( 'Install WooCommerce', 'shopbuilder' ); } $this->missing['woocommerce'] = [ 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'file_name' => $woocommerce, 'url' => $activation_url, 'message' => $message, 'button_txt' => $button_text, ]; $this->allOk = false; } $elementor = 'elementor/elementor.php'; /* if ( ! is_plugin_active( $elementor ) ) { $message = sprintf( '%s %s', esc_html__( 'ShopBuilder - WooCommerce Builder for Elementor:', 'shopbuilder' ), esc_html__( 'Elementor plugin is optional. Please install Elementor if you want to build WooCommerce pages using Elementor.', 'shopbuilder' ) ); if ( $this->is_plugins_installed( $elementor ) ) { $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $elementor . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $elementor ); $button_text = esc_html__( 'Activate Elementor', 'shopbuilder' ); } else { $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); $button_text = esc_html__( 'Install Elementor', 'shopbuilder' ); } $this->missing['elementor'] = [ 'name' => 'Elementor', 'slug' => 'elementor', 'file_name' => $elementor, 'url' => '', 'message' => $message . ' ' . esc_html( $button_text ) . '', 'button_txt' => '', ]; } */ 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' ), '' . esc_html__( 'ShopBuilder', 'shopbuilder' ) . '', '' . esc_html__( 'PHP', 'shopbuilder' ) . '', self::MINIMUM_PHP_VERSION ); printf( '
%1$s
'. esc_html( $plugin['button_txt'] ) . '
' : ''; // $plugin['message'] Already used escaping function printf( '%1$s
%2$s