PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / views / notices / review.php

review.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.2.10, at admin/views/notices/review.php

132 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The admin review notice.
4 *
5 * @since 2.2.3
6 * @version 2.2.3
7 *
8 * @package Smart_Post_Show
9 * @subpackage Smart_Post_Show/admin/views/notices
10 * @author ShapedPlugin<[email protected]>
11 */
12 class SPS_Review {
13
14 public function __construct() {
15 add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
16 add_action( 'wp_ajax_smart-post-show-never-show-review-notice', array( $this, 'dismiss_review_notice' ) );
17 }
18
19 /**
20 * Display admin notice.
21 *
22 * @return void
23 */
24 public function display_admin_notice() {
25
26 // Show only to Admins.
27 if ( ! current_user_can( 'manage_options' ) ) {
28 return;
29 }
30
31 // Variable default value.
32 $review = get_option( 'smart_post_show_review_notice_dismiss' );
33 $time = time();
34 $load = false;
35
36 if ( ! $review ) {
37 $review = array(
38 'time' => $time,
39 'dismissed' => false,
40 );
41 add_option( 'smart_post_show_review_notice_dismiss', $review );
42 } else {
43 // Check if it has been dismissed or not.
44 if ( ( isset( $review['dismissed'] ) && ! $review['dismissed'] ) && ( isset( $review['time'] ) && ( ( $review['time'] + ( DAY_IN_SECONDS * 3 ) ) <= $time ) ) ) {
45 $load = true;
46 }
47 }
48
49 // If we cannot load, return early.
50 if ( ! $load ) {
51 return;
52 }
53 ?>
54 <div id="smart-post-show-review-notice" class="smart-post-show-review-notice">
55 <div class="sp-sps-plugin-icon">
56 <img src="<?php echo SP_PC_URL . 'admin/assets/img/images/sps-icon.svg'; ?>" alt="Smart Post Show">
57 </div>
58 <div class="sp-sps-notice-text">
59 <h3>Enjoying <strong>Smart Post Show</strong>?</h3>
60 <p>Hope that you had a good experience with the <strong>Smart Post Show</strong>. Would you please show us a little love by rating us in the <a href="https://wordpress.org/support/plugin/post-carousel/reviews/?filter=5#new-post" target="_blank"><strong>WordPress.org</strong></a>?
61 Just a minute to rate it. Thank you!</p>
62
63 <p class="sp-sps-review-actions">
64 <a href="https://wordpress.org/support/plugin/post-carousel/reviews/?filter=5#new-post" target="_blank" class="button button-primary notice-dismissed rate-testimonial">Rate Smart Post Show</a>
65 <a href="#" class="notice-dismissed remind-me-later"><span class="dashicons dashicons-clock"></span>Nope, maybe later
66 </a>
67 <a href="#" class="notice-dismissed never-show-again"><span class="dashicons dashicons-dismiss"></span>Never show again</a>
68 </p>
69 </div>
70 </div>
71
72 <script type='text/javascript'>
73
74 jQuery(document).ready( function($) {
75 $(document).on('click', '#smart-post-show-review-notice.smart-post-show-review-notice .notice-dismissed', function( event ) {
76 if ( $(this).hasClass('rate-testimonial') ) {
77 var notice_dismissed_value = "1";
78 }
79 if ( $(this).hasClass('remind-me-later') ) {
80 var notice_dismissed_value = "2";
81 event.preventDefault();
82 }
83 if ( $(this).hasClass('never-show-again') ) {
84 var notice_dismissed_value = "3";
85 event.preventDefault();
86 }
87
88 $.post( ajaxurl, {
89 action: 'smart-post-show-never-show-review-notice',
90 notice_dismissed_data : notice_dismissed_value
91 });
92
93 $('#smart-post-show-review-notice.smart-post-show-review-notice').hide();
94 });
95 });
96
97 </script>
98 <?php
99 }
100
101 /**
102 * Dismiss review notice
103 *
104 * @since 2.2.3
105 *
106 * @return void
107 **/
108 public function dismiss_review_notice() {
109 if ( ! $review ) {
110 $review = array();
111 }
112 switch ( $_POST['notice_dismissed_data'] ) {
113 case '1':
114 $review['time'] = time();
115 $review['dismissed'] = false;
116 break;
117 case '2':
118 $review['time'] = time();
119 $review['dismissed'] = false;
120 break;
121 case '3':
122 $review['time'] = time();
123 $review['dismissed'] = true;
124 break;
125 }
126 update_option( 'smart_post_show_review_notice_dismiss', $review );
127 die;
128 }
129 }
130
131 new SPS_Review();
132