PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 2.1.7
Backup Migration v2.1.7
2.1.7 2.1.6 2.1.5.2 trunk 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.6.1 1.4.7 1.4.8 1.4.9 1.4.9.1 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.5.1
backup-backup / analyst / templates / forms / deactivate.php
backup-backup / analyst / templates / forms Last commit date
deactivate.php 2 weeks ago install.php 2 weeks ago
deactivate.php
159 lines
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2 <div id="analyst-deactivate-modal" class="analyst-modal" style="display: none">
3 <div class="analyst-modal-content" style="width: 500px">
4 <div class="analyst-disable-modal-mask" id="analyst-disable-deactivate-modal-mask" style="display: none"></div>
5 <div style="display: flex">
6 <div class="analyst-install-image-block" style="width: 80px">
7 <img src="<?php echo esc_url( $pencilImage ); ?>"/>
8 </div>
9 <div class="analyst-install-description-block" style="padding-left: 20px">
10 <strong class="analyst-modal-header">Why do you deactivate?</strong>
11 <div class="analyst-install-description-text" style="padding-top: 2px">
12 Please let us know, so we can improve it! Thank you <img class="analyst-smile-image" src="<?php echo esc_url( $smileImage ); ?>" alt="">
13 </div>
14 </div>
15 </div>
16 <div>
17 <ul id="analyst-deactivation-reasons">
18 <li>
19 <label>
20 <span>
21 <input type="radio" name="deactivation-reason">
22 </span>
23 <span class="question" data-question="I couldn't understand how to make it work">I couldn't understand how to make it work</span>
24 </label>
25 </li>
26 <li data-input-type="textarea" data-input-placeholder="What should have worked, but didn’t?">
27 <label>
28 <span>
29 <input type="radio" name="deactivation-reason">
30 </span>
31 <span class="question" data-question="The plugin didn't work as expected">The plugin didn't work as expected</span>
32 </label>
33 <div class="question-answer"></div>
34 </li>
35 <li data-input-type="input" data-input-placeholder="What is the plugin name?">
36 <label>
37 <span>
38 <input type="radio" name="deactivation-reason">
39 </span>
40 <span class="question" data-question="I found a better plugin">I found a better plugin</span>
41 </label>
42 <div class="question-answer"></div>
43 </li>
44 <li>
45 <label>
46 <span>
47 <input type="radio" name="deactivation-reason">
48 </span>
49 <span class="question" data-question="It's a temporary deactivation">It's a temporary deactivation</span>
50 </label>
51 <div class="question-answer"></div>
52 </li>
53 <li data-input-type="textarea" data-input-placeholder="Please provide the reason of deactivation">
54 <label>
55 <span>
56 <input type="radio" name="deactivation-reason">
57 </span>
58 <span class="question" data-question="Other">Other</span>
59 </label>
60 <div class="question-answer"></div>
61 </li>
62 </ul>
63 <p id="analyst-deactivation-error" style="color: #dc3232; font-size: 16px; display: none">Please let us know the reason for de-activation. Thank you!</p>
64 </div>
65 <div>
66 <button class="analyst-btn-grey" id="analyst-disabled-plugin-action">Deactivate</button>
67 </div>
68 <div class="" style="text-align: center; font-size: 18px; padding-top: 10px">
69 <button class="analyst-btn-secondary-ghost analyst-deactivate-modal-close" style="color: #cccccc">Cancel</button>
70 </div>
71 </div>
72 </div>
73
74 <script type="text/javascript">
75 (function ($) {
76 $('.deactivate').click(function (e) {
77 var anchor = $(this).find('[analyst-plugin-id]')
78 var pluginId = anchor.attr('analyst-plugin-id')
79 var isOptedIn = anchor.attr('analyst-plugin-opted-in') === '1'
80
81 // Do not ask for reason if not opted in
82 if (!isOptedIn) {
83 return
84 }
85
86 e.preventDefault()
87
88 $('#analyst-deactivate-modal')
89 .attr({
90 'analyst-plugin-id': pluginId,
91 'analyst-redirect-url': $(this).find('a').attr('href')
92 })
93 .show()
94 })
95
96 $('.analyst-deactivate-modal-close').click(function () {
97 $('#analyst-deactivate-modal').hide()
98 })
99
100 $('#analyst-deactivation-reasons input[name="deactivation-reason"]').change(function () {
101 $('.question-answer').empty()
102
103 var root = $('#analyst-deactivation-reasons input[name="deactivation-reason"]:checked').parents('li')
104
105 $('#analyst-deactivation-error').hide()
106
107 if (!root.attr('data-input-type')) return
108
109 var reasonInput = $('<' + root.attr('data-input-type') + '/>').attr({placeholder: root.attr('data-input-placeholder'), class: 'reason-answer'})
110
111 root.find('.question-answer').append(reasonInput)
112 })
113
114 $('#analyst-disabled-plugin-action').click(function () {
115 var pluginId = $('#analyst-deactivate-modal').attr('analyst-plugin-id')
116 var pluginDeactivationUrl = $('#analyst-deactivate-modal').attr('analyst-redirect-url')
117
118 var root = $('#analyst-deactivation-reasons input[name="deactivation-reason"]:checked').parents('li');
119
120 var reason = root.find('.question-answer .reason-answer').val();
121
122 var question = root.find('.question').attr('data-question').trim()
123
124 var $errorBlock = $('#analyst-deactivation-error')
125
126 if (!question) {
127 return $errorBlock.show()
128 }
129
130 $errorBlock.hide()
131
132 var data = {
133 action: 'analyst_plugin_deactivate_' + pluginId,
134 question: question,
135 analyst_nonce: analyst_opt_localize.analyst_nonce
136 }
137
138 if (reason) {
139 data['reason'] = reason.trim();
140 }
141
142 $(this).attr('disabled', true).text('Deactivating...');
143
144 $('#analyst-disable-deactivate-modal-mask').show();
145
146 $.ajax({
147 url: ajaxurl,
148 method: 'POST',
149 data: data
150 }).done(function () {
151 window.location.href = pluginDeactivationUrl
152
153 $('#analyst-disable-deactivate-modal-mask').hide();
154 })
155 })
156
157 })(jQuery)
158 </script>
159