Нет описания

install.php 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <div id="analyst-install-modal" class="analyst-modal" style="display: none" analyst-plugin-id="<?=$pluginToInstall?>">
  2. <div class="analyst-modal-content" style="width: 450px">
  3. <div class="analyst-disable-modal-mask" id="analyst-disable-install-modal-mask" style="display: none"></div>
  4. <div style="display: flex">
  5. <div class="analyst-install-image-block">
  6. <img src="<?=$shieldImage?>"/>
  7. </div>
  8. <div class="analyst-install-description-block">
  9. <strong class="analyst-modal-header">Stay on the safe side</strong>
  10. <p class="analyst-install-description-text">Receive our plugin’s alerts in
  11. case of <strong>critical security</strong> & feature
  12. updates and allow non-sensitive
  13. diagnostic tracking.</p>
  14. </div>
  15. </div>
  16. <div class="analyst-modal-def-top-padding">
  17. <button class="analyst-btn-success" id="analyst-install-action">Allow & Continue ></button>
  18. </div>
  19. <div class="analyst-modal-def-top-padding" id="analyst-permissions-block" style="display: none">
  20. <span>You’re granting these permissions:</span>
  21. <ul class="analyst-install-permissions-list">
  22. <li><strong>Your profile information</strong> (name and email) ​</li>
  23. <li><strong>Your site information</strong> (URL, WP version, PHP info, plugins & themes)</li>
  24. <li><strong>Plugin notices</strong> (updates, announcements, marketing, no spam)</li>
  25. <li><strong>Plugin events</strong> (activation, deactivation and uninstall)​</li>
  26. </ul>
  27. </div>
  28. <div class="analyst-install-footer analyst-modal-def-top-padding">
  29. <span class="analyst-action-text" id="analyst-permissions-toggle">Learn more</span>
  30. <span id="analyst-powered-by" style="display: none;">Powered by <a href="https://sellcodes.com/blog/wordpress-feedback-system-for-plugin-creators/?utm_source=optin_screen" target="_blank" class="analyst-link">Sellcodes.com</a></span>
  31. <span class="analyst-action-text analyst-install-modal-close" id="analyst-install-skip">Skip</span>
  32. </div>
  33. <div id="analyst-install-error" class="analyst-modal-def-top-padding" style="display: none; text-align: center">
  34. <span style="color: #dc3232; font-size: 16px">Service unavailable. Please try again later</span>
  35. </div>
  36. </div>
  37. </div>
  38. <script type="text/javascript">
  39. (function ($) {
  40. var installPlugin = function (pluginId) {
  41. var $error = $('#analyst-install-error')
  42. $error.hide()
  43. $.ajax({
  44. url: ajaxurl,
  45. method: 'POST',
  46. data: {
  47. action: 'analyst_install_' + pluginId
  48. },
  49. success: function (data) {
  50. if (data && !data.success) {
  51. //error
  52. $('#analyst-install-modal').hide()
  53. return
  54. }
  55. window.location.reload()
  56. },
  57. error: function () {
  58. $('#analyst-install-modal').hide()
  59. }
  60. }).done(function () {
  61. $('#analyst-disable-install-modal-mask').hide()
  62. $('#analyst-install-action')
  63. .attr('disabled', false)
  64. .text('Allow & Continue >')
  65. })
  66. }
  67. if ($('#analyst-install-modal').attr('analyst-plugin-id')) {
  68. $('#analyst-install-modal').show()
  69. }
  70. $('.analyst-install-modal-close').click(function () {
  71. $('#analyst-install-modal').hide()
  72. })
  73. $('#analyst-install-action').click(function () {
  74. var pluginId = $('#analyst-install-modal').attr('analyst-plugin-id')
  75. $('#analyst-install-action')
  76. .attr('disabled', true)
  77. .text('Please wait...')
  78. $('#analyst-disable-install-modal-mask').show()
  79. installPlugin(pluginId)
  80. })
  81. $('#analyst-permissions-toggle').click(function () {
  82. var isVisible = $('#analyst-permissions-block').toggle().is(':visible')
  83. isVisible ? $(this).text('Close section') : $(this).text('Learn more')
  84. var poweredBy = $('#analyst-powered-by')
  85. isVisible ? poweredBy.show() : poweredBy.hide()
  86. })
  87. $('#analyst-install-skip').click(function () {
  88. var pluginId = $('#analyst-install-modal').attr('analyst-plugin-id')
  89. $.post(ajaxurl, {action: 'analyst_skip_install_' + pluginId}).done(function () {
  90. $('#analyst-install-modal').hide()
  91. })
  92. })
  93. })(jQuery)
  94. </script>