review-notice.php
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* Outputs the review request notification.
*
* @package WPZincDashboardWidget
* @author WP Zinc
*/
?>
<div class="notice notice-info is-dismissible wpzinc-review-<?php echo esc_attr( $this->plugin->name ); ?>">
<?php
if ( isset( $this->plugin->review_notice ) ) {
?>
<p>
<?php echo esc_html( $this->plugin->review_notice ); ?>
</p>
<?php
}
?>
<p>
<?php
echo sprintf(
/* translators: Plugin Name */
esc_html__( 'We\'d be super grateful if you could spread the word about %s and give it a 5 star rating on WordPress?', $this->plugin->name ), // phpcs:ignore WordPress.WP.I18n
esc_html( $this->plugin->displayName )
);
?>
</p>
<p>
<a href="<?php echo esc_url( $this->get_review_url() ); ?>" class="button button-primary" target="_blank">
<?php esc_html_e( 'Yes, Leave Review', $this->plugin->name ); // phpcs:ignore WordPress.WP.I18n ?>
</a>
<a href="<?php echo esc_url( $this->plugin->support_url ); ?>" class="button" rel="noopener" target="_blank">
<?php
echo sprintf(
/* translators: Plugin Name */
esc_html__( 'No, I\'m having issues with %s', $this->plugin->name ), // phpcs:ignore WordPress.WP.I18n
esc_html( $this->plugin->displayName )
);
?>
</a>
</p>
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
// Dismiss Review Notification.
$( 'div.wpzinc-review-<?php echo esc_attr( $this->plugin->name ); ?>' ).on( 'click', 'a, button.notice-dismiss', function( e ) {
// Do request
$.post(
ajaxurl,
{
action: '<?php echo esc_attr( str_replace( '-', '_', $this->plugin->name ) ); ?>_dismiss_review',
},
function( response ) {
}
);
// Hide notice.
$( 'div.wpzinc-review-<?php echo esc_attr( $this->plugin->name ); ?>' ).hide();
} );
} );
</script>
</div>