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/Admin/Notice/Review.php +23 -34 2.1.73.4.0 View file →
@@ -24,10 +24,8 @@
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();
30 28 }
31 29
32 30 /**
33 31 * Check if review notice should be shown or not
@@ -34,8 +32,9 @@
34 32 *
35 33 * @return void
36 34 */
37 35 public function check_installation_time() {
36 +
38 37 $nobug = get_option( 'rtsb_admin_review_spare_me' );
39 38 $rated = get_option( 'rtsb_admin_review_rated' );
40 39
41 40 if ( '1' == $nobug || 'yes' == $rated ) {
@@ -41,21 +40,25 @@
41 40 if ( '1' == $nobug || 'yes' == $rated ) {
42 41 return;
43 42 }
44 43
45 - $now = strtotime( 'now' );
46 -
47 44 $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' );
50 45
51 - if ( ! $remind_time ) {
52 - $remind_time = $install_date;
46 + // Bail until the activation time is recorded, otherwise the notice would show immediately.
47 + if ( ! $install_date ) {
48 + return;
53 49 }
54 50
55 - $remind_due = strtotime( '+20 days', $remind_time );
51 + $now = strtotime( 'now' );
52 + $remind_time = get_option( 'rtsb_admin_review_remind_me' );
56 53
57 - if ( ! $now > $showing_date || $now < $remind_due ) {
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.
58 61 return;
59 62 }
60 63
61 64 add_action( 'admin_notices', [ $this, 'display_admin_notice' ] );
@@ -66,8 +69,9 @@
66 69 *
67 70 * @return void
68 71 */
69 72 public function notice_actions() {
73 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
70 74 if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'rtsb_notice_nonce' ) ) {
71 75 return;
72 76 }
73 77
@@ -126,8 +130,11 @@
126 130 /**
127 131 * Display Admin Notice, asking for a review
128 132 **/
129 133 public function display_admin_notice() {
134 + if ( isset( $GLOBALS['woobundle_notice'] ) || isset( $GLOBALS['rtsb__notice'] ) ) {
135 + return;
136 + }
130 137 global $pagenow;
131 138
132 139 $exclude = [
133 140 'themes.php',
@@ -152,9 +159,9 @@
152 159 $args = [ '_wpnonce' => wp_create_nonce( 'rtsb_notice_nonce' ) ];
153 160 $dont_disturb = add_query_arg( $args + [ 'rtsb_admin_review_spare_me' => '1' ], $this->rtsb_current_admin_url() );
154 161 $remind_me = add_query_arg( $args + [ 'rtsb_admin_review_remind_me' => '1' ], $this->rtsb_current_admin_url() );
155 162 $rated = add_query_arg( $args + [ 'rtsb_admin_review_rated' => '1' ], $this->rtsb_current_admin_url() );
156 - $reviewurl = 'https://wordpress.org/support/plugin/shopbuilder/reviews/?filter=5#new-post';
163 + $reviewurl = 'https://wordpress.org/support/plugin/shopbuilder/reviews/#new-post';
157 164 $plugin_name = 'ShopBuilder – Elementor WooCommerce Builder Addons';
158 165 ?>
159 166 <div class="notice rtsb-review-notice rtsb-review-notice--extended">
160 167 <div class="rtsb-review-notice_content">
@@ -161,15 +168,13 @@
161 168 <h3>Enjoying <?php echo esc_html( $plugin_name ); ?>? </h3>
162 169 <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>
163 170 <div class="rtsb-review-notice_actions">
164 171 <a href="<?php echo esc_url( $reviewurl ); ?>"
165 - class="rtsb-review-button rtsb-review-button--cta" target="_blank"><span>⭐ Yes, You Deserve It!</span></a>
172 + class="rtsb-review-button rtsb-going-to-review rtsb-review-button--cta" target="_blank"><span>⭐ Yes, You Deserve It!</span></a>
166 173 <a href="<?php echo esc_url( $rated ); ?>"
167 174 class="rtsb-review-button rtsb-review-button--cta rtsb-review-button--outline"><span>😀 Already Rated!</span></a>
168 175 <a href="<?php echo esc_url( $remind_me ); ?>"
169 176 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>
172 177 </div>
173 178 </div>
174 179 </div>
175 180 <style>
@@ -239,15 +244,16 @@
239 244 padding: 0.4375rem 0.75rem;
240 245 border: 0;
241 246 border-radius: 3px;;
242 247 background: var(--e-button-context-color);
243 - color: #fff;
244 248 vertical-align: middle;
245 249 text-align: center;
246 - text-decoration: none;
250 + text-decoration: none !important;
247 251 white-space: nowrap;
248 252 }
249 -
253 + .rtsb-going-to-review {
254 + color: #fff !important;
255 + }
250 256 .rtsb-review-button:active {
251 257 background: var(--e-button-context-color-dark);
252 258 color: #fff;
253 259 text-decoration: none;
@@ -296,23 +302,6 @@
296 302 }
297 303 </style>
298 304 <?php
299 305 }
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 - );
317 306 }
318 307 }