PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.5.1
ShopBuilder – WooCommerce Builder For Elementor v2.5.1
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Controllers/Dependencies.php +60 -15 3.4.22.5.1 View file →
@@ -18,11 +18,8 @@
18 18 const PLUGIN_NAME = 'ShopBuilder - Woocommerce Builder for Elementor';
19 19
20 20 use SingletonTrait;
21 21
22 - /**
23 - * @var array
24 - */
25 22 private $missing = [];
26 23 /**
27 24 * @var bool
28 25 */
@@ -43,26 +40,33 @@
43 40 }
44 41 if ( ! function_exists( 'wp_create_nonce' ) ) {
45 42 require_once ABSPATH . 'wp-includes/pluggable.php';
46 43 }
44 + // Check WooCommerce
45 + $woocommerce = 'woocommerce/woocommerce.php';
47 46
48 - // Check WooCommerce.
49 - $woocommerce = 'woocommerce/woocommerce.php';
50 47 if ( ! is_plugin_active( $woocommerce ) ) {
51 48 if ( $this->is_plugins_installed( $woocommerce ) ) {
52 49 $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $woocommerce . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $woocommerce );
53 50 $message = sprintf(
54 - '<strong>%s</strong> requires <strong>WooCommerce</strong> plugin to be active. Please activate WooCommerce to continue.',
51 + '<strong>%s</strong> %s <strong>%s</strong> %s',
55 52 esc_html( self::PLUGIN_NAME ),
53 + esc_html__( 'requires', 'shopbuilder' ),
54 + esc_html__( 'WooCommerce', 'shopbuilder' ),
55 + esc_html__( 'plugin to be active. Please activate WooCommerce to continue.', 'shopbuilder' )
56 56 );
57 - $button_text = 'Activate WooCommerce';
57 + $button_text = esc_html__( 'Activate WooCommerce', 'shopbuilder' );
58 +
58 59 } else {
59 60 $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
60 61 $message = sprintf(
61 - '<strong>%s</strong> requires <strong>WooCommerce</strong> plugin to be active. Please activate WooCommerce to continue.',
62 + '<strong>%s</strong> %s <strong>%s</strong> %s',
62 63 esc_html( self::PLUGIN_NAME ),
64 + esc_html__( 'requires', 'shopbuilder' ),
65 + esc_html__( 'WooCommerce', 'shopbuilder' ),
66 + esc_html__( 'plugin to be installed and activated. Please install WooCommerce to continue.', 'shopbuilder' )
63 67 );
64 - $button_text = 'Install WooCommerce';
68 + $button_text = esc_html__( 'Install WooCommerce', 'shopbuilder' );
65 69 }
66 70 $this->missing['woocommerce'] = [
67 71 'name' => 'WooCommerce',
68 72 'slug' => 'woocommerce',
@@ -70,13 +74,53 @@
70 74 'url' => $activation_url,
71 75 'message' => $message,
72 76 'button_txt' => $button_text,
73 77 ];
74 - $this->allOk = false;
75 78 }
76 79
80 + $elementor = 'elementor/elementor.php';
81 +
82 + if ( ! is_plugin_active( $elementor ) ) {
83 +
84 + if ( $this->is_plugins_installed( $elementor ) ) {
85 + $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $elementor . '&amp;plugin_status=all&amp;paged=1&amp;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 + $button_text = esc_html__( 'Activate Elementor', 'shopbuilder' );
94 +
95 + } else {
96 + $activation_url = wp_nonce_url(
97 + self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ),
98 + 'install-plugin_elementor'
99 + );
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 + $button_text = esc_html__( 'Install Elementor', 'shopbuilder' );
108 + }
109 +
110 + $this->missing['elementor'] = [
111 + 'name' => 'Elementor',
112 + 'slug' => 'elementor',
113 + 'file_name' => $elementor,
114 + 'url' => $activation_url,
115 + 'message' => $message,
116 + 'button_txt' => $button_text,
117 + ];
118 + }
77 119 if ( ! empty( $this->missing ) ) {
78 120 add_action( 'admin_notices', [ $this, '_missing_plugins_warning' ] );
121 +
122 + $this->allOk = false;
79 123 }
80 124
81 125 return $this->allOk;
82 126 }
@@ -90,11 +134,11 @@
90 134 unset( $_GET['activate'] );
91 135 }
92 136 $message = sprintf(
93 137 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
94 - esc_html( '"%1$s" requires "%2$s" version %3$s or greater.' ),
95 - '<strong>ShopBuilder</strong>',
96 - '<strong>PHP</strong>',
138 + esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'shopbuilder' ),
139 + '<strong>' . esc_html__( 'ShopBuilder', 'shopbuilder' ) . '</strong>',
140 + '<strong>' . esc_html__( 'PHP', 'shopbuilder' ) . '</strong>',
97 141 self::MINIMUM_PHP_VERSION
98 142 );
99 143 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) );
100 144 }
@@ -109,14 +153,15 @@
109 153 $counter++;
110 154 if ( $counter == count( $this->missing ) ) {
111 155 $sep = '';
112 156 } elseif ( $counter == count( $this->missing ) - 1 ) {
113 - $sep = ' and ';
157 + $sep = ' ' . esc_html__( 'and', 'shopbuilder' ) . ' ';
114 158 } else {
115 159 $sep = ', ';
116 160 }
117 161 if ( current_user_can( 'activate_plugins' ) ) {
118 - $button = ! empty( $plugin['url'] ) ? '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">' . esc_html( $plugin['button_txt'] ) . '</a></p>' : '';
162 + $button = '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">' . esc_html( $plugin['button_txt'] ) . '</a></p>';
163 + // $plugin['message'] Already used escaping function
119 164 printf( '<div class="error"><p>%1$s</p>%2$s</div>', $plugin['message'], $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
120 165 } else {
121 166 $missingPlugins .= '<strong>' . esc_html( $plugin['name'] ) . '</strong>' . $sep;
122 167 }