No Description

review.php 4.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. $state = NextendSocialLogin::$settings->get('review_state');
  3. if ((0 < $state && $state < 5) || $state == 6) {
  4. // Rated 1, 2, 3, 4 OR 6
  5. return;
  6. }
  7. ?>
  8. <?php if ($state == -1): ?>
  9. <div class="nsl-box-review nsl-box-review-step-1" data-stars="0">
  10. <div class="nsl-box-review-bigstar"></div>
  11. <div class="nsl-box-review-label" data-star="0"><?php _e('Rate your experience!', 'nextend-facebook-connect'); ?></div>
  12. <div class="nsl-box-review-label" data-star="1"><?php _e('Hated it', 'nextend-facebook-connect'); ?></div>
  13. <div class="nsl-box-review-label" data-star="2"><?php _e('Disliked it', 'nextend-facebook-connect'); ?></div>
  14. <div class="nsl-box-review-label" data-star="3"><?php _e('It was ok', 'nextend-facebook-connect'); ?></div>
  15. <div class="nsl-box-review-label" data-star="4"><?php _e('Liked it', 'nextend-facebook-connect'); ?></div>
  16. <div class="nsl-box-review-label" data-star="5"><?php _e('Loved it', 'nextend-facebook-connect'); ?></div>
  17. <div class="nsl-box-review-stars-container">
  18. <div class="nsl-box-review-star" data-star="1" data-href="<?php echo esc_attr(NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/suggestion/', 'dashboard-review-1')); ?>"></div>
  19. <div class="nsl-box-review-star" data-star="2" data-href="<?php echo esc_attr(NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/suggestion/', 'dashboard-review-2')); ?>"></div>
  20. <div class="nsl-box-review-star" data-star="3" data-href="<?php echo esc_attr(NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/satisfaction-feedback/', 'dashboard-review-3')); ?>"></div>
  21. <div class="nsl-box-review-star" data-star="4" data-href="<?php echo esc_attr(NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/satisfaction-feedback/', 'dashboard-review-4')); ?>"></div>
  22. <div class="nsl-box-review-star" data-star="5"></div>
  23. </div>
  24. </div>
  25. <?php endif; ?>
  26. <div class="nsl-box-review nsl-box-review-star-5" <?php if ($state != 5): ?>style="display:none;"<?php endif; ?>>
  27. <h3><?php _e('Please Leave a Review', 'nextend-facebook-connect'); ?></h3>
  28. <div class="nsl-box-review-star-5-description"><?php _e('If you are happy with <b>Nextend Social Login</b> and can take a minute please leave us a review. It will be a tremendous help for us!', 'nextend-facebook-connect'); ?></div>
  29. <div class="nsl-box-review-star-5-primary">
  30. <a href="<?php echo esc_attr(NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/redirect/nsl-review.html', 'dashboard-review-5')); ?>" target="_blank" class="button button-primary"><?php _e('Ok, you deserve it', 'nextend-facebook-connect'); ?></a>
  31. </div>
  32. <div class="nsl-box-review-star-5-close"></div>
  33. </div>
  34. <script>
  35. (function ($) {
  36. $(document).ready(function () {
  37. var $box = $('.nsl-box-review-step-1'),
  38. $box5 = $('.nsl-box-review-star-5'),
  39. updateReviewState = function (state) {
  40. $.post(ajaxurl, {
  41. 'action': 'nsl_save_review_state',
  42. 'review_state': state,
  43. '_ajax_nonce': <?php echo wp_json_encode(wp_create_nonce('nsl_save_review_state')); ?>
  44. });
  45. };
  46. $box.find('.nsl-box-review-star').on({
  47. mouseenter: function () {
  48. $box.attr('data-stars', $(this).data('star'));
  49. },
  50. click: function (e) {
  51. e.preventDefault();
  52. var star = parseInt($(this).data('star'));
  53. if (star < 5) {
  54. var win = window.open($(this).data('href'), '_blank');
  55. $box.remove();
  56. updateReviewState(star);
  57. win.focus();
  58. } else {
  59. updateReviewState(5);
  60. $box.remove();
  61. $box5.css('display', '');
  62. }
  63. }
  64. });
  65. $box.find('.nsl-box-review-stars-container').on({
  66. mouseleave: function () {
  67. $box.attr('data-stars', 0);
  68. }
  69. });
  70. $box5.find('a, .nsl-box-review-star-5-close').on('click', function () {
  71. $box5.remove();
  72. updateReviewState(6);
  73. });
  74. });
  75. })(jQuery);
  76. </script>