PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.4.0
ShopBuilder – WooCommerce Builder For Elementor v3.4.0
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 +21 -65 2.0.23.4.0 View file →
@@ -18,8 +18,11 @@
18 18 const PLUGIN_NAME = 'ShopBuilder - Woocommerce Builder for Elementor';
19 19
20 20 use SingletonTrait;
21 21
22 + /**
23 + * @var array
24 + */
22 25 private $missing = [];
23 26 /**
24 27 * @var bool
25 28 */
@@ -40,33 +43,26 @@
40 43 }
41 44 if ( ! function_exists( 'wp_create_nonce' ) ) {
42 45 require_once ABSPATH . 'wp-includes/pluggable.php';
43 46 }
44 - // Check WooCommerce
47 +
48 + // Check WooCommerce.
45 49 $woocommerce = 'woocommerce/woocommerce.php';
46 -
47 50 if ( ! is_plugin_active( $woocommerce ) ) {
48 51 if ( $this->is_plugins_installed( $woocommerce ) ) {
49 52 $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $woocommerce . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $woocommerce );
50 53 $message = sprintf(
51 - '<strong>%s</strong> %s <strong>%s</strong> %s',
54 + '<strong>%s</strong> requires <strong>WooCommerce</strong> plugin to be active. Please activate WooCommerce to continue.',
52 55 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 = esc_html__( 'Activate WooCommerce', 'shopbuilder' );
58 -
57 + $button_text = 'Activate WooCommerce';
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 - '<strong>%s</strong> %s <strong>%s</strong> %s',
61 + '<strong>%s</strong> requires <strong>WooCommerce</strong> plugin to be active. Please activate WooCommerce to continue.',
63 62 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' )
67 63 );
68 - $button_text = esc_html__( 'Install WooCommerce', 'shopbuilder' );
64 + $button_text = 'Install WooCommerce';
69 65 }
70 66 $this->missing['woocommerce'] = [
71 67 'name' => 'WooCommerce',
72 68 'slug' => 'woocommerce',
@@ -74,51 +70,13 @@
74 70 'url' => $activation_url,
75 71 'message' => $message,
76 72 'button_txt' => $button_text,
77 73 ];
74 + $this->allOk = false;
78 75 }
79 76
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( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ),
97 - 'install-plugin_elementor' );
98 - $message = sprintf(
99 - '<strong>%s</strong> %s <strong>%s</strong> %s',
100 - esc_html( self::PLUGIN_NAME ),
101 - esc_html__( 'requires', 'shopbuilder' ),
102 - esc_html__( 'Elementor', 'shopbuilder' ),
103 - esc_html__( 'plugin to be installed and activated. Please install Elementor to continue.', 'shopbuilder' )
104 - );
105 - $button_text = esc_html__( 'Install Elementor', 'shopbuilder' );
106 - }
107 -
108 - $this->missing['elementor'] = [
109 - 'name' => 'Elementor',
110 - 'slug' => 'elementor',
111 - 'file_name' => $elementor,
112 - 'url' => $activation_url,
113 - 'message' => $message,
114 - 'button_txt' => $button_text,
115 - ];
116 - }
117 77 if ( ! empty( $this->missing ) ) {
118 78 add_action( 'admin_notices', [ $this, '_missing_plugins_warning' ] );
119 -
120 - $this->allOk = false;
121 79 }
122 80
123 81 return $this->allOk;
124 82 }
@@ -126,19 +84,20 @@
126 84 /**
127 85 * Admin Notice For Required PHP Version
128 86 */
129 87 public function minimum_php_version() {
130 - if ( isset( $_GET['activate'] ) ) {
88 + // Protect plugin Activation with error.
89 + if ( isset( $_GET['activate'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
131 90 unset( $_GET['activate'] );
132 91 }
133 92 $message = sprintf(
134 93 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
135 - esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'shopbuilder' ),
136 - '<strong>' . esc_html__( 'ShopBuilder', 'shopbuilder' ) . '</strong>',
137 - '<strong>' . esc_html__( 'PHP', 'shopbuilder' ) . '</strong>',
94 + esc_html( '"%1$s" requires "%2$s" version %3$s or greater.' ),
95 + '<strong>ShopBuilder</strong>',
96 + '<strong>PHP</strong>',
138 97 self::MINIMUM_PHP_VERSION
139 98 );
140 - printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
99 + printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) );
141 100 }
142 101
143 102 /**
144 103 * Adds admin notice.
@@ -146,19 +105,18 @@
146 105 public function _missing_plugins_warning() {
147 106 $missingPlugins = '';
148 107 $counter = 0;
149 108 foreach ( $this->missing as $plugin ) {
150 - $counter ++;
151 - if ( $counter == sizeof( $this->missing ) ) {
109 + $counter++;
110 + if ( $counter == count( $this->missing ) ) {
152 111 $sep = '';
153 - } elseif ( $counter == sizeof( $this->missing ) - 1 ) {
154 - $sep = ' ' . esc_html__( 'and', 'shopbuilder' ) . ' ';
112 + } elseif ( $counter == count( $this->missing ) - 1 ) {
113 + $sep = ' and ';
155 114 } else {
156 115 $sep = ', ';
157 116 }
158 117 if ( current_user_can( 'activate_plugins' ) ) {
159 - $button = '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">' . esc_html( $plugin['button_txt'] ) . '</a></p>';
160 - // $plugin['message'] Already used escaping function
118 + $button = ! empty( $plugin['url'] ) ? '<p><a href="' . esc_url( $plugin['url'] ) . '" class="button-primary">' . esc_html( $plugin['button_txt'] ) . '</a></p>' : '';
161 119 printf( '<div class="error"><p>%1$s</p>%2$s</div>', $plugin['message'], $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
162 120 } else {
163 121 $missingPlugins .= '<strong>' . esc_html( $plugin['name'] ) . '</strong>' . $sep;
164 122 }
@@ -174,7 +132,5 @@
174 132 $installed_plugins_list = get_plugins();
175 133
176 134 return isset( $installed_plugins_list[ $plugin_file_path ] );
177 135 }
178 -
179 -
180 136 }