PluginProbe ʕ •ᴥ•ʔ
MonsterInsights – Google Analytics Dashboard for WordPress (Website Stats Made Easy) / 10.1.3
MonsterInsights – Google Analytics Dashboard for WordPress (Website Stats Made Easy) v10.1.3
10.2.2 10.2.1 10.2.0 10.1.3 trunk 10.0.0 10.0.1 10.0.2 10.0.3 10.1.1 10.1.2 8.1.0 8.10.0 8.10.1 8.11.0 8.12.0 8.12.1 8.13.0 8.13.1 8.14.0 8.14.1 8.15 8.16 8.17 8.18 8.19.0 8.2.0 8.20.0 8.20.1 8.21.0 8.22.0 8.23.0 8.23.1 8.24.0 8.25.0 8.26.0 8.27.0 8.28.0 8.3.0 8.3.1 8.3.2 8.3.3 8.3.4 8.4.0 8.5.0 8.5.1 8.5.2 8.5.3 8.6.0 8.7.0 8.8.0 8.8.1 8.8.2 8.9.0 8.9.1 9.0.0 9.0.1 9.1.0 9.1.1 9.10.0 9.10.1 9.11.0 9.11.1 9.2.0 9.2.1 9.2.2 9.2.3 9.2.4 9.3.0 9.3.1 9.4.0 9.4.1 9.5.1 9.5.2 9.5.3 9.6.0 9.6.1 9.7.0 9.8.0 9.9.0
google-analytics-for-wordpress / includes / admin / review.php
google-analytics-for-wordpress / includes / admin Last commit date
feature-feedback 1 year ago licensing 1 year ago notifications 6 months ago pages 1 month ago reports 1 month ago site-notes 1 month ago admin-assets.php 1 month ago admin.php 1 month ago ajax.php 1 month ago api-auth.php 1 month ago class-monsterinsights-am-deactivation-survey.php 8 months ago class-monsterinsights-charitable-notice.php 7 months ago class-monsterinsights-onboarding.php 1 month ago class-monsterinsights-usage-tracking.php 1 month ago common.php 1 month ago eea-compliance.php 1 month ago exclude-page-metabox.php 1 month ago index.php 3 years ago notice.php 1 year ago notification-event-runner.php 1 year ago notification-event.php 1 year ago notifications.php 1 month ago product-feed-cronjob.php 6 months ago reporting.php 3 years ago review.php 1 year ago routes.php 1 month ago setup-checklist.php 1 month ago sharedcount.php 1 year ago tracking.php 7 months ago translations.php 1 year ago uninstall.php 4 years ago wp-site-health.php 3 years ago
review.php
206 lines
1 <?php
2
3 /**
4 * Ask for some love.
5 *
6 * @package MonsterInsights
7 * @author MonsterInsights
8 * @since 7.0.7
9 * @license GPL-2.0+
10 * @copyright Copyright (c) 2018, MonsterInsights LLC
11 * TODO:
12 * Go through this file and remove UA references/usages
13 * Check if this class is actually working
14 */
15 class MonsterInsights_Review {
16 /**
17 * Primary class constructor.
18 *
19 * @since 7.0.7
20 */
21 public function __construct() {
22 // Admin notice requesting review.
23 add_action( 'admin_notices', array( $this, 'review_request' ) );
24 add_action( 'wp_ajax_monsterinsights_review_dismiss', array( $this, 'review_dismiss' ) );
25 }
26
27 /**
28 * Add admin notices as needed for reviews.
29 *
30 * @since 7.0.7
31 */
32 public function review_request() {
33 // Only consider showing the review request to admin users.
34 if ( ! is_super_admin() ) {
35 return;
36 }
37
38 // If the user has opted out of product announcement notifications, don't
39 // display the review request.
40 if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) {
41 return;
42 }
43 // Verify that we can do a check for reviews.
44 $review = get_option( 'monsterinsights_review' );
45 $time = time();
46 $load = false;
47
48 if ( ! $review ) {
49 $review = array(
50 'time' => $time,
51 'dismissed' => false,
52 );
53 update_option( 'monsterinsights_review', $review );
54 } else {
55 // Check if it has been dismissed or not.
56 if ( ( isset( $review['dismissed'] ) && ! $review['dismissed'] ) && ( isset( $review['time'] ) && ( ( $review['time'] + DAY_IN_SECONDS ) <= $time ) ) ) {
57 $load = true;
58 }
59 }
60
61 // If we cannot load, return early.
62 if ( ! $load ) {
63 return;
64 }
65
66 $this->review();
67 }
68
69 /**
70 * Maybe show review request.
71 *
72 * @since 7.0.7
73 */
74 public function review() {
75 // Fetch when plugin was initially installed.
76 $activated = get_option( 'monsterinsights_over_time', array() );
77 $v4_code = monsterinsights_get_v4_id();
78
79 if ( ! empty( $activated['connected_date'] ) ) {
80 // Only continue if plugin has been tracking for at least 14 days.
81 $days = 14;
82 if ( monsterinsights_get_option( 'gadwp_migrated', 0 ) > 0 ) {
83 $days = 21;
84 }
85 if ( ( $activated['connected_date'] + ( DAY_IN_SECONDS * $days ) ) > time() ) {
86 return;
87 }
88 } else {
89 if ( empty( $activated ) ) {
90 $data = array(
91 'installed_version' => MONSTERINSIGHTS_VERSION,
92 'installed_date' => time(),
93 'installed_pro' => monsterinsights_is_pro_version(),
94 );
95 } else {
96 $data = $activated;
97 }
98 // If already has a UA code mark as connected now.
99 if ( ! empty( $v4_code ) ) {
100 $data['connected_date'] = time();
101 }
102
103 update_option( 'monsterinsights_over_time', $data, false );
104
105 return;
106 }
107
108 // Only proceed with displaying if the user is tracking.
109 if ( empty( $v4_code ) ) {
110 return;
111 }
112
113 $feedback_url = add_query_arg( array(
114 'wpf192157_24' => untrailingslashit( home_url() ),
115 'wpf192157_26' => monsterinsights_get_license_key(),
116 'wpf192157_27' => monsterinsights_is_pro_version() ? 'pro' : 'lite',
117 'wpf192157_28' => MONSTERINSIGHTS_VERSION,
118 ), 'https://www.monsterinsights.com/plugin-feedback/' );
119 $feedback_url = monsterinsights_get_url( 'review-notice', 'feedback', $feedback_url );
120 ?>
121 <div class="notice notice-info is-dismissible monsterinsights-review-notice">
122 <div class="monsterinsights-review-step">
123 <p>
124 <?php
125 echo wp_kses(
126 sprintf(
127 __( 'Hey - we noticed you\'ve been using %1$s for a while - that\'s great! Could you do us a BIG favor and give it a 5-star review on WordPress to help us spread the word and boost our motivation?', 'google-analytics-for-wordpress' ),
128 '<strong>MonsterInsights</strong>'
129 ),
130 array( 'strong' => array() )
131 );
132 ?>
133 </p>
134 <p>
135 <a
136 href="https://wordpress.org/support/plugin/google-analytics-for-wordpress/reviews/?filter=5#new-post"
137 class="monsterinsights-dismiss-review-notice monsterinsights-review-out"
138 target="_blank"
139 rel="noopener noreferrer"
140 >
141 <?php esc_html_e( 'Ok, you deserve it', 'google-analytics-for-wordpress' ); ?>
142 </a>
143 <br>
144 <a
145 href="#"
146 class="monsterinsights-dismiss-review-notice monsterinsights-review-later"
147 rel="noopener noreferrer"
148 >
149 <?php esc_html_e( 'Nope, maybe later', 'google-analytics-for-wordpress' ); ?>
150 </a>
151 <br>
152 <a
153 href="#"
154 class="monsterinsights-dismiss-review-notice"
155 rel="noopener noreferrer"
156 >
157 <?php esc_html_e( 'I already did', 'google-analytics-for-wordpress' ); ?>
158 </a>
159 </p>
160 </div>
161 </div>
162 <script type="text/javascript">
163 jQuery(document).ready(function ($) {
164 $(document).on('click', '.monsterinsights-dismiss-review-notice', function (event) {
165 if (!$(this).hasClass('monsterinsights-review-out')) {
166 event.preventDefault();
167 }
168 $.post(ajaxurl, {
169 action: 'monsterinsights_review_dismiss',
170 review_later: $(this).hasClass('monsterinsights-review-later')
171 });
172 $('.monsterinsights-review-notice').remove();
173 });
174 });
175 </script>
176 <?php
177 }
178
179 /**
180 * Dismiss the review admin notice
181 *
182 * @since 7.0.7
183 */
184 public function review_dismiss() {
185 $review = get_option( 'monsterinsights_review', array() );
186 $review['time'] = time();
187 $review['dismissed'] = true;
188 update_option( 'monsterinsights_review', $review );
189
190 if ( is_super_admin() && is_multisite() ) {
191 $site_list = get_sites();
192 foreach ( (array) $site_list as $site ) {
193 switch_to_blog( $site->blog_id );
194
195 update_option( 'monsterinsights_review', $review );
196
197 restore_current_blog();
198 }
199 }
200
201 die;
202 }
203 }
204
205 new MonsterInsights_Review();
206