| @@ -40,11 +40,11 @@ | ||
| 40 | 40 | } |
| 41 | 41 | if ( ! function_exists( 'wp_create_nonce' ) ) { |
| 42 | 42 | require_once ABSPATH . 'wp-includes/pluggable.php'; |
| 43 | 43 | } |
| 44 | - // Check WooCommerce | |
| 44 | + | |
| 45 | + // Check WooCommerce. | |
| 45 | 46 | $woocommerce = 'woocommerce/woocommerce.php'; |
| 46 | - | |
| 47 | 47 | if ( ! is_plugin_active( $woocommerce ) ) { |
| 48 | 48 | if ( $this->is_plugins_installed( $woocommerce ) ) { |
| 49 | 49 | $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $woocommerce . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $woocommerce ); |
| 50 | 50 | $message = sprintf( |
| @@ -54,9 +54,8 @@ | ||
| 54 | 54 | esc_html__( 'WooCommerce', 'shopbuilder' ), |
| 55 | 55 | esc_html__( 'plugin to be active. Please activate WooCommerce to continue.', 'shopbuilder' ) |
| 56 | 56 | ); |
| 57 | 57 | $button_text = esc_html__( 'Activate WooCommerce', 'shopbuilder' ); |
| 58 | - | |
| 59 | 58 | } else { |
| 60 | 59 | $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' ); |
| 61 | 60 | $message = sprintf( |
| 62 | 61 | '<strong>%s</strong> %s <strong>%s</strong> %s', |
| @@ -74,53 +73,43 @@ | ||
| 74 | 73 | 'url' => $activation_url, |
| 75 | 74 | 'message' => $message, |
| 76 | 75 | 'button_txt' => $button_text, |
| 77 | 76 | ]; |
| 77 | + $this->allOk = false; | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $elementor = 'elementor/elementor.php'; |
| 81 | 81 | |
| 82 | + /* | |
| 82 | 83 | if ( ! is_plugin_active( $elementor ) ) { |
| 83 | - | |
| 84 | + $message = sprintf( | |
| 85 | + '<strong>%s</strong> %s', | |
| 86 | + esc_html__( 'ShopBuilder - WooCommerce Builder for Elementor:', 'shopbuilder' ), | |
| 87 | + esc_html__( 'Elementor plugin is optional. Please install Elementor if you want to build WooCommerce pages using Elementor.', 'shopbuilder' ) | |
| 88 | + ); | |
| 84 | 89 | if ( $this->is_plugins_installed( $elementor ) ) { |
| 85 | 90 | $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $elementor . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $elementor ); |
| 86 | - $message = sprintf( | |
| 87 | - '<strong>%s</strong> %s <strong>%s</strong> %s', | |
| 88 | - esc_html( self::PLUGIN_NAME ), | |
| 89 | - esc_html__( 'requires', 'shopbuilder' ), | |
| 90 | - esc_html__( 'Elementor', 'shopbuilder' ), | |
| 91 | - esc_html__( 'plugin to be active. Please activate Elementor to continue.', 'shopbuilder' ) | |
| 92 | - ); | |
| 93 | 91 | $button_text = esc_html__( 'Activate Elementor', 'shopbuilder' ); |
| 94 | - | |
| 95 | 92 | } else { |
| 96 | 93 | $activation_url = wp_nonce_url( |
| 97 | 94 | self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), |
| 98 | 95 | 'install-plugin_elementor' |
| 99 | 96 | ); |
| 100 | - $message = sprintf( | |
| 101 | - '<strong>%s</strong> %s <strong>%s</strong> %s', | |
| 102 | - esc_html( self::PLUGIN_NAME ), | |
| 103 | - esc_html__( 'requires', 'shopbuilder' ), | |
| 104 | - esc_html__( 'Elementor', 'shopbuilder' ), | |
| 105 | - esc_html__( 'plugin to be installed and activated. Please install Elementor to continue.', 'shopbuilder' ) | |
| 106 | - ); | |
| 107 | 97 | $button_text = esc_html__( 'Install Elementor', 'shopbuilder' ); |
| 108 | 98 | } |
| 109 | - | |
| 110 | 99 | $this->missing['elementor'] = [ |
| 111 | 100 | 'name' => 'Elementor', |
| 112 | 101 | 'slug' => 'elementor', |
| 113 | 102 | 'file_name' => $elementor, |
| 114 | - 'url' => $activation_url, | |
| 115 | - 'message' => $message, | |
| 116 | - 'button_txt' => $button_text, | |
| 103 | + 'url' => '', | |
| 104 | + 'message' => $message . ' <a href="' . esc_url( $activation_url ) . '" > ' . esc_html( $button_text ) . '</a>', | |
| 105 | + 'button_txt' => '', | |
| 117 | 106 | ]; |
| 118 | 107 | } |
| 108 | + */ | |
| 109 | + | |
| 119 | 110 | if ( ! empty( $this->missing ) ) { |
| 120 | 111 | add_action( 'admin_notices', [ $this, '_missing_plugins_warning' ] ); |
| 121 | - | |
| 122 | - $this->allOk = false; | |
| 123 | 112 | } |
| 124 | 113 | |
| 125 | 114 | return $this->allOk; |
| 126 | 115 | } |
| @@ -158,9 +147,9 @@ | ||
| 158 | 147 | } else { |
| 159 | 148 | $sep = ', '; |
| 160 | 149 | } |
| 161 | 150 | if ( current_user_can( 'activate_plugins' ) ) { |
| 162 | - $button = '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">' . esc_html( $plugin['button_txt'] ) . '</a></p>'; | |
| 151 | + $button = ! empty($plugin['url'] ) ? '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">'. esc_html( $plugin['button_txt'] ) . '</a></p>' : ''; | |
| 163 | 152 | // $plugin['message'] Already used escaping function |
| 164 | 153 | printf( '<div class="error"><p>%1$s</p>%2$s</div>', $plugin['message'], $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 165 | 154 | } else { |
| 166 | 155 | $missingPlugins .= '<strong>' . esc_html( $plugin['name'] ) . '</strong>' . $sep; |