PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.13
ShopBuilder – WooCommerce Builder For Elementor v2.1.13
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/Admin/Notice/Review.php +34 -23 3.4.12.1.13 View file →
@@ -24,8 +24,10 @@
24 24 */
25 25 private function __construct() {
26 26 add_action( 'admin_init', [ $this, 'check_installation_time' ], 10 );
27 27 add_action( 'admin_init', [ $this, 'notice_actions' ], 5 );
28 +
29 + $this->remove_all_notices();
28 30 }
29 31
30 32 /**
31 33 * Check if review notice should be shown or not
@@ -32,9 +34,8 @@
32 34 *
33 35 * @return void
34 36 */
35 37 public function check_installation_time() {
36 -
37 38 $nobug = get_option( 'rtsb_admin_review_spare_me' );
38 39 $rated = get_option( 'rtsb_admin_review_rated' );
39 40
40 41 if ( '1' == $nobug || 'yes' == $rated ) {
@@ -40,25 +41,21 @@
40 41 if ( '1' == $nobug || 'yes' == $rated ) {
41 42 return;
42 43 }
43 44
45 + $now = strtotime( 'now' );
46 +
44 47 $install_date = ExtraSettings::instance()->get_option( 'rtsb_plugin_activation_time', false );
48 + $showing_date = strtotime( '+15 days', $install_date );
49 + $remind_time = get_option( 'rtsb_admin_review_remind_me' );
45 50
46 - // Bail until the activation time is recorded, otherwise the notice would show immediately.
47 - if ( ! $install_date ) {
48 - return;
51 + if ( ! $remind_time ) {
52 + $remind_time = $install_date;
49 53 }
50 54
51 - $now = strtotime( 'now' );
52 - $remind_time = get_option( 'rtsb_admin_review_remind_me' );
55 + $remind_due = strtotime( '+20 days', $remind_time );
53 56
54 - if ( $remind_time ) {
55 - // User asked to be reminded later: show again 20 days after that click.
56 - if ( $now < strtotime( '+20 days', $remind_time ) ) {
57 - return;
58 - }
59 - } elseif ( $now < strtotime( '+15 days', $install_date ) ) {
60 - // First time: show 15 days after installation.
57 + if ( ! $now > $showing_date || $now < $remind_due ) {
61 58 return;
62 59 }
63 60
64 61 add_action( 'admin_notices', [ $this, 'display_admin_notice' ] );
@@ -69,9 +66,8 @@
69 66 *
70 67 * @return void
71 68 */
72 69 public function notice_actions() {
73 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
74 70 if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'rtsb_notice_nonce' ) ) {
75 71 return;
76 72 }
77 73
@@ -130,11 +126,8 @@
130 126 /**
131 127 * Display Admin Notice, asking for a review
132 128 **/
133 129 public function display_admin_notice() {
134 - if ( isset( $GLOBALS['woobundle_notice'] ) || isset( $GLOBALS['rtsb__notice'] ) ) {
135 - return;
136 - }
137 130 global $pagenow;
138 131
139 132 $exclude = [
140 133 'themes.php',
@@ -159,9 +152,9 @@
159 152 $args = [ '_wpnonce' => wp_create_nonce( 'rtsb_notice_nonce' ) ];
160 153 $dont_disturb = add_query_arg( $args + [ 'rtsb_admin_review_spare_me' => '1' ], $this->rtsb_current_admin_url() );
161 154 $remind_me = add_query_arg( $args + [ 'rtsb_admin_review_remind_me' => '1' ], $this->rtsb_current_admin_url() );
162 155 $rated = add_query_arg( $args + [ 'rtsb_admin_review_rated' => '1' ], $this->rtsb_current_admin_url() );
163 - $reviewurl = 'https://wordpress.org/support/plugin/shopbuilder/reviews/#new-post';
156 + $reviewurl = 'https://wordpress.org/support/plugin/shopbuilder/reviews/?filter=5#new-post';
164 157 $plugin_name = 'ShopBuilder – Elementor WooCommerce Builder Addons';
165 158 ?>
166 159 <div class="notice rtsb-review-notice rtsb-review-notice--extended">
167 160 <div class="rtsb-review-notice_content">
@@ -168,13 +161,15 @@
168 161 <h3>Enjoying <?php echo esc_html( $plugin_name ); ?>? </h3>
169 162 <p>Thank you for choosing <strong>ShopBuilder</strong>. If you have found our plugin useful and makes you smile, please consider giving us a 5-star rating on WordPress.org. It will help us to grow.</p>
170 163 <div class="rtsb-review-notice_actions">
171 164 <a href="<?php echo esc_url( $reviewurl ); ?>"
172 - class="rtsb-review-button rtsb-going-to-review rtsb-review-button--cta" target="_blank"><span>⭐ Yes, You Deserve It!</span></a>
165 + class="rtsb-review-button rtsb-review-button--cta" target="_blank"><span>⭐ Yes, You Deserve It!</span></a>
173 166 <a href="<?php echo esc_url( $rated ); ?>"
174 167 class="rtsb-review-button rtsb-review-button--cta rtsb-review-button--outline"><span>😀 Already Rated!</span></a>
175 168 <a href="<?php echo esc_url( $remind_me ); ?>"
176 169 class="rtsb-review-button rtsb-review-button--cta rtsb-review-button--outline"><span>🔔 Remind Me Later</span></a>
170 + <a href="<?php echo esc_url( $dont_disturb ); ?>"
171 + class="rtsb-review-button rtsb-review-button--cta rtsb-review-button--error rtsb-review-button--outline"><span>😐 No Thanks </span></a>
177 172 </div>
178 173 </div>
179 174 </div>
180 175 <style>
@@ -244,16 +239,15 @@
244 239 padding: 0.4375rem 0.75rem;
245 240 border: 0;
246 241 border-radius: 3px;;
247 242 background: var(--e-button-context-color);
243 + color: #fff;
248 244 vertical-align: middle;
249 245 text-align: center;
250 - text-decoration: none !important;
246 + text-decoration: none;
251 247 white-space: nowrap;
252 248 }
253 - .rtsb-going-to-review {
254 - color: #fff !important;
255 - }
249 +
256 250 .rtsb-review-button:active {
257 251 background: var(--e-button-context-color-dark);
258 252 color: #fff;
259 253 text-decoration: none;
@@ -302,6 +296,23 @@
302 296 }
303 297 </style>
304 298 <?php
305 299 }
300 + }
301 +
302 + /**
303 + * Remove admin notices
304 + */
305 + public function remove_all_notices() {
306 + add_action(
307 + 'in_admin_header',
308 + function () {
309 + $screen = get_current_screen();
310 + if ( in_array( $screen->base, [ 'shopbuilder_page_rtsb-get-help' ], true ) ) {
311 + remove_all_actions( 'admin_notices' );
312 + remove_all_actions( 'all_admin_notices' );
313 + }
314 + },
315 + 1000
316 + );
306 317 }
307 318 }