PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / admin / notices / rating.php

rating.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster trunk, at includes/admin/notices/rating.php

138 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Admin\Notices;
4
5 defined( 'ABSPATH' ) || die();
6
7 /**
8 * SellKit rating class.
9 *
10 * @since 1.5.7
11 */
12 class Rating extends Notice_Base {
13
14 /**
15 * Notice key.
16 *
17 * @since 1.5.7
18 * @var string
19 */
20 public $key = 'rating';
21
22 /**
23 * Woocommerce_Settings constructor.
24 *
25 * @since 1.5.7
26 * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
27 */
28 public function __construct() {
29 parent::__construct();
30 }
31
32 /**
33 * Check if notice is valid or not.
34 *
35 * @since 1.5.7
36 * @return bool
37 */
38 public function is_valid() {
39 global $pagenow;
40
41 if ( 'index.php' !== $pagenow ) {
42 return false;
43 }
44
45 if ( in_array( $this->key, $this->dismissed_notices, true ) ) {
46 return false;
47 }
48
49 $rating_notice_trigger = sellkit_get_option( 'sellkit_rating_notice_trigger' );
50
51 if ( ! empty( $rating_notice_trigger ) && time() < $rating_notice_trigger ) {
52 return false;
53 }
54
55 if ( ! $this->has_sellkit_post() ) {
56 return false;
57 }
58
59 return true;
60 }
61
62 /**
63 * Set the priority of notice.
64 *
65 * @since 1.5.7
66 * @return int
67 */
68 public function priority() {
69 return 1;
70 }
71
72 /**
73 * Checks if some posts has been created or not in the SellKit.
74 *
75 * @since 1.5.7
76 * @return boolean
77 */
78 public function has_sellkit_post() {
79 $time = strtotime( '-7 days' );
80
81 $query = new \WP_Query( [
82 'post_type' => [
83 'sellkit-funnels',
84 'sellkit-discount',
85 'sellkit-coupon',
86 'sellkit-alert'
87 ],
88 'date_query' => [
89 [
90 'before' => [
91 'year' => intval( gmdate( 'Y', $time ) ),
92 'month' => intval( gmdate( 'm', $time ) ),
93 'day' => intval( gmdate( 'd', $time ) ),
94 ],
95 'inclusive' => false,
96 ],
97 ],
98 ] );
99
100 if ( ! empty( $query->posts ) ) {
101 return true;
102 }
103
104 return false;
105 }
106
107 /**
108 * Notice content wrapper.
109 *
110 * @since 1.5.7
111 */
112 public function notice_content_wrapper() {
113 ?>
114 <div class="sellkit-notice notice" data-key="<?php echo esc_attr( $this->key ); ?>">
115 <div class="sellkit-notice-aside"><span class="sellkit-notice-aside-icon"><span></span></span></div>
116 <div class="sellkit-notice-content">
117 <div class="sellkit-notice-content-body">
118 <?php echo esc_html__( 'If you enjoy using SellKit, could you take a moment to give us a 5-star rating? It won’t take more than a minute. Thank you for your support.', 'sellkit' ); ?>
119 </div>
120 <div class="sellkit-notice-content-footer">
121 <a class="button-primary" target="_blank" href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fplugin%2Fsellkit%2Freviews%2F%23new-post&locale=en_US"><?php echo esc_html__( 'Okay, You deserve it', 'sellkit' ); ?></a>
122 <a class="button-link sellkit-rating-notice-maybe-later">
123 <img src="<?php echo esc_url( sellkit()->plugin_assets_url() . 'img/icons/rating-notice-maybe-later.svg' ); ?>" alt="">
124 <?php echo esc_html__( 'Maybe later', 'sellkit' ); ?>
125 </a>
126 <a class="button-link sellkit-rating-notice-i-already-did">
127 <img src="<?php echo esc_url( sellkit()->plugin_assets_url() . 'img/icons/rating-notice-i-already-did.svg' ); ?>" alt="">
128 <?php echo esc_html__( 'I already did', 'sellkit' ); ?>
129 </a>
130 </div>
131 </div>
132 <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span>
133 </button>
134 </div>
135 <?php
136 }
137 }
138