install.php
118 lines
| 1 | <div id="analyst-install-modal" class="analyst-modal" style="display: none" analyst-plugin-id="<?php echo $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="<?php echo $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 & special deal |
| 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 | |
| 39 | <script type="text/javascript"> |
| 40 | (function ($) { |
| 41 | |
| 42 | var installPlugin = function (pluginId) { |
| 43 | var $error = $('#analyst-install-error') |
| 44 | |
| 45 | $error.hide() |
| 46 | |
| 47 | $.ajax({ |
| 48 | url: ajaxurl, |
| 49 | method: 'POST', |
| 50 | data: { |
| 51 | action: 'analyst_install_' + pluginId, |
| 52 | nonce: analyst_opt_localize.nonce |
| 53 | }, |
| 54 | success: function (data) { |
| 55 | if (data && !data.success) { |
| 56 | //error |
| 57 | $('#analyst-install-modal').hide() |
| 58 | |
| 59 | return |
| 60 | } |
| 61 | |
| 62 | window.location.reload() |
| 63 | }, |
| 64 | error: function () { |
| 65 | $('#analyst-install-modal').hide() |
| 66 | } |
| 67 | }).done(function () { |
| 68 | $('#analyst-disable-install-modal-mask').hide() |
| 69 | |
| 70 | $('#analyst-install-action') |
| 71 | .attr('disabled', false) |
| 72 | .text('Allow & Continue >') |
| 73 | }) |
| 74 | } |
| 75 | |
| 76 | if ($('#analyst-install-modal').attr('analyst-plugin-id')) { |
| 77 | $('#analyst-install-modal').show() |
| 78 | } |
| 79 | |
| 80 | |
| 81 | $('.analyst-install-modal-close').click(function () { |
| 82 | $('#analyst-install-modal').hide() |
| 83 | }) |
| 84 | |
| 85 | $('#analyst-install-action').click(function () { |
| 86 | var pluginId = $('#analyst-install-modal').attr('analyst-plugin-id') |
| 87 | |
| 88 | $('#analyst-install-action') |
| 89 | .attr('disabled', true) |
| 90 | .text('Please wait...') |
| 91 | |
| 92 | $('#analyst-disable-install-modal-mask').show() |
| 93 | |
| 94 | installPlugin(pluginId) |
| 95 | }) |
| 96 | |
| 97 | $('#analyst-permissions-toggle').click(function () { |
| 98 | var isVisible = $('#analyst-permissions-block').toggle().is(':visible') |
| 99 | |
| 100 | isVisible ? $(this).text('Close section') : $(this).text('Learn more') |
| 101 | |
| 102 | var poweredBy = $('#analyst-powered-by') |
| 103 | isVisible ? poweredBy.show() : poweredBy.hide() |
| 104 | }) |
| 105 | |
| 106 | $('#analyst-install-skip').click(function () { |
| 107 | var pluginId = $('#analyst-install-modal').attr('analyst-plugin-id') |
| 108 | |
| 109 | $.post(ajaxurl, { |
| 110 | action: 'analyst_skip_install_' + pluginId, |
| 111 | nonce: analyst_opt_localize.nonce |
| 112 | }).done(function () { |
| 113 | $('#analyst-install-modal').hide() |
| 114 | }) |
| 115 | }) |
| 116 | })(jQuery) |
| 117 | </script> |
| 118 |