| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> |
| 2 |
<div id="wpvr-admin-notice-five-star-review" class="wpvr-admin-notice-dashboard wpvr-promo-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpvr-dismiss-notice-five-star-review') ); ?>" data-id="five-star-review" data-lifespan="0"> |
| 3 |
<div class="wpvr-review-step wpvr-review-step-1"> |
| 4 |
<p> <?php esc_html_e("Hey, I noticed you've made nice tour with WP VR! Are you enjoying WP VR?",'wpvr'); ?> </p> |
| 5 |
<div class="wpvr-review-actions"> |
| 6 |
<button class="button-primary wpvr-review-switch-step" data-step="3" ><?php esc_html_e("Yes","wpvr"); ?></button><br> |
| 7 |
<button class="button-link wpvr-review-switch-step" data-step="2" id="review_not_now_feed_back"><?php esc_html_e("Not Really","wpvr"); ?></button> |
| 8 |
</div> |
| 9 |
</div> |
| 10 |
<!-- <div class="wpvr-review-step wpvr-review-step-2" style="display:none;">--> |
| 11 |
<!-- <p>--><?php //// echo __("We're sorry to hear you aren't enjoying Easy Digital Downloads. We would love a chance to improve. Could you take a minute and let us know what we can do better?","wpvr") ?><!--</p>--> |
| 12 |
<!-- <div class="wpvr-review-actions">--> |
| 13 |
<!-- <a href="https://rextheme.com/your-account/?active_tab=support" class="button button-secondary wpvr-promo-notice-dismiss" target="_blank">--><?php //echo __("Give Feedback","wpvr") ?><!--</a><br>--> |
| 14 |
<!-- <button class="button-link wpvr-promo-notice-dismiss-no-feedback" id="review_not_now_feed_back">--><?php //// echo __("No thanks","wpvr") ?><!--</button>--> |
| 15 |
<!-- </div>--> |
| 16 |
<!-- </div>--> |
| 17 |
<div class="wpvr-review-step wpvr-review-step-3" style="display:none;"> |
| 18 |
<p><?php esc_html_e("That's awesome! Could you please do me a BIG favor and give it a rating on WordPress to help us grow and motivate us?","wpvr"); ?> <strong>~<?php esc_html_e("Lincoln Islam","wpvr"); ?></strong> - Founder & Visionary</p> |
| 19 |
<div class="wpvr-review-actions"> |
| 20 |
<a href="https://wordpress.org/support/plugin/wpvr/reviews/#new-post" class="button button-primary wpvr-promo-notice-dismiss" target="_blank" rel="noopener noreferrer" id="review_rate_now">Ok, you deserve it!</a><br> |
| 21 |
<button class="button-link wpvr-promo-notice-dismiss" id="review_rated_already"><?php esc_html_e("Already given","wpvr"); ?></button> |
| 22 |
<button class="button-link wpvr-promo-notice-dismiss-next-week" id="review_not_now"><?php esc_html_e("No thanks","wpvr"); ?></button> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
<script type="text/javascript"> |
| 26 |
jQuery(document).ready(function ($) { |
| 27 |
var steps = $('.wpvr-review-switch-step'); |
| 28 |
steps.on('click', function (e) { |
| 29 |
e.preventDefault(); |
| 30 |
var target = $(this).data('step'); |
| 31 |
if (target) { |
| 32 |
var notice = $(this).closest('.wpvr-promo-notice'); |
| 33 |
var review_step = notice.find('.wpvr-review-step-' + target); |
| 34 |
if (review_step.length) { |
| 35 |
var thisStep = $(this).closest('.wpvr-review-step'); |
| 36 |
// wpvrFadeOut(thisStep); |
| 37 |
thisStep.hide(); |
| 38 |
review_step.show() |
| 39 |
// wpvrFadeIn(review_step); |
| 40 |
} |
| 41 |
} |
| 42 |
}); |
| 43 |
|
| 44 |
// Add event listener for "No thanks" button |
| 45 |
var noThanksBtn = $('#review_rate_now, #review_not_now, #review_rated_already, #review_not_now_feed_back'); |
| 46 |
noThanksBtn.on('click', function (e) { |
| 47 |
e.preventDefault(); |
| 48 |
$(this).prop('disabled', true); |
| 49 |
if($(this).attr('href')){ |
| 50 |
window.open($(this).attr('href'), '_blank'); |
| 51 |
} |
| 52 |
$(this).closest('.wpvr-promo-notice').fadeOut(); |
| 53 |
var nonce = $(this).closest('.wpvr-promo-notice').attr('data-nonce'); |
| 54 |
let btn_id = $(this).attr("id"); |
| 55 |
let show = true; |
| 56 |
let frequency = ""; |
| 57 |
|
| 58 |
if ("review_rate_now" === btn_id || "review_rated_already" === btn_id) { |
| 59 |
if ("review_rated_already" === btn_id) e.preventDefault(); |
| 60 |
show = false; |
| 61 |
frequency = "never"; |
| 62 |
} else if ("review_not_now" === btn_id || "review_not_now_feed_back" === btn_id) { |
| 63 |
e.preventDefault(); |
| 64 |
show = false; |
| 65 |
frequency = "one_week"; |
| 66 |
} |
| 67 |
|
| 68 |
const payload = { |
| 69 |
show: show, |
| 70 |
frequency: frequency, |
| 71 |
}; |
| 72 |
$.ajax({ |
| 73 |
url: '<?php echo esc_url(admin_url('admin-ajax.php')); ?>', |
| 74 |
type: 'POST', |
| 75 |
data: { |
| 76 |
action: 'wpvr_review_request', |
| 77 |
payload: payload, |
| 78 |
nonce: nonce |
| 79 |
}, |
| 80 |
success: function (response) { |
| 81 |
if(response.success){ |
| 82 |
$(this).closest('.wpvr-promo-notice').fadeOut(); |
| 83 |
} |
| 84 |
}, |
| 85 |
error: function (xhr, status, error) { |
| 86 |
// Handle error |
| 87 |
console.error('Error in AJAX request'); |
| 88 |
} |
| 89 |
}); |
| 90 |
}); |
| 91 |
}); |
| 92 |
|
| 93 |
</script> |
| 94 |
</div> |
| 95 |
|
| 96 |
<style> |
| 97 |
#wpvr-admin-notice-five-star-review .wpvr-review-actions { |
| 98 |
display: flex; |
| 99 |
gap: 12px; |
| 100 |
} |
| 101 |
#wpvr-admin-notice-five-star-review .wpvr-review-step { |
| 102 |
display: flex; |
| 103 |
align-items: center; |
| 104 |
gap: 10px; |
| 105 |
background: #fff; |
| 106 |
padding: 0px 20px; |
| 107 |
transition: opacity 0.4s ease, transform 0.4s ease; |
| 108 |
} |
| 109 |
#wpvr-admin-notice-five-star-review { |
| 110 |
margin: 0 auto; |
| 111 |
padding: 10px 20px; |
| 112 |
display: flex; |
| 113 |
align-items: center; |
| 114 |
justify-content: center; |
| 115 |
width: auto; |
| 116 |
} |
| 117 |
.wpvr-promo-notice-dismiss-next-week{ |
| 118 |
color: #7696b1!important; |
| 119 |
} |
| 120 |
|
| 121 |
@media screen and (max-width: 782px) { |
| 122 |
/* Your CSS styles for screens with a width of 768 pixels or more */ |
| 123 |
/* For example: */ |
| 124 |
#wpvr-admin-notice-five-star-review .wpvr-review-step.wpvr-review-step-3 .wpvr-review-actions { |
| 125 |
padding: 10px; |
| 126 |
gap: 12px; |
| 127 |
display:block |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
@media screen and (max-width: 1480px) { |
| 132 |
/* Your CSS styles for screens with a width of 768 pixels or more */ |
| 133 |
/* For example: */ |
| 134 |
#wpvr-admin-notice-five-star-review { |
| 135 |
padding: 9px 41px; |
| 136 |
} |
| 137 |
#wpvr-admin-notice-five-star-review .wpvr-review-step.wpvr-review-step-3 .wpvr-review-actions { |
| 138 |
display: block; |
| 139 |
margin-top: 10px; |
| 140 |
margin-bottom: 10px; |
| 141 |
text-align: center; |
| 142 |
} |
| 143 |
#review_rated_already{ |
| 144 |
margin-top: 5px; |
| 145 |
margin-bottom: 5px; |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
#wpvr-admin-notice-five-star-review .wpvr-review-step { |
| 150 |
display: flex; |
| 151 |
align-items: center; |
| 152 |
gap: 10px; |
| 153 |
background: #fff; |
| 154 |
padding: 0px 23px; |
| 155 |
transition: opacity 0.4s ease, transform 0.4s ease; |
| 156 |
} |
| 157 |
|
| 158 |
} |
| 159 |
</style> |
| 160 |
|