admin-content.php
6 years ago
folder-deactivate-form.php
6 years ago
general-settings.php
6 years ago
help.php
6 years ago
upgrade-to-pro.php
6 years ago
folder-deactivate-form.php
413 lines
| 1 | <?php |
| 2 | defined('ABSPATH') or wp_die('Nope, not accessing this'); |
| 3 | ?> |
| 4 | <style> |
| 5 | .folder-hidden { |
| 6 | overflow: hidden; |
| 7 | } |
| 8 | |
| 9 | .folder-popup-overlay .folder-internal-message { |
| 10 | margin: 3px 0 3px 22px; |
| 11 | display: none; |
| 12 | } |
| 13 | |
| 14 | .folder-reason-input { |
| 15 | margin: 3px 0 3px 22px; |
| 16 | display: none; |
| 17 | } |
| 18 | |
| 19 | .folder-reason-input input[type="text"] { |
| 20 | width: 100%; |
| 21 | display: block; |
| 22 | } |
| 23 | |
| 24 | .folder-popup-overlay { |
| 25 | background: rgba(0, 0, 0, .8); |
| 26 | position: fixed; |
| 27 | top: 0; |
| 28 | left: 0; |
| 29 | height: 100%; |
| 30 | width: 100%; |
| 31 | z-index: 1000; |
| 32 | overflow: auto; |
| 33 | visibility: hidden; |
| 34 | opacity: 0; |
| 35 | transition: opacity 0.3s ease-in-out : |
| 36 | } |
| 37 | |
| 38 | .folder-popup-overlay.folder-active { |
| 39 | opacity: 1; |
| 40 | visibility: visible; |
| 41 | } |
| 42 | |
| 43 | .folder-serveypanel { |
| 44 | width: 600px; |
| 45 | background: #fff; |
| 46 | margin: 65px auto 0; |
| 47 | } |
| 48 | |
| 49 | .folder-popup-header { |
| 50 | background: #f1f1f1; |
| 51 | padding: 20px; |
| 52 | border-bottom: 1px solid #ccc; |
| 53 | } |
| 54 | |
| 55 | .folder-popup-header h2 { |
| 56 | margin: 0; |
| 57 | } |
| 58 | |
| 59 | .folder-popup-body { |
| 60 | padding: 10px 20px; |
| 61 | } |
| 62 | |
| 63 | .folder-popup-footer { |
| 64 | background: #f9f3f3; |
| 65 | padding: 10px 20px; |
| 66 | border-top: 1px solid #ccc; |
| 67 | } |
| 68 | |
| 69 | .folder-popup-footer:after { |
| 70 | content: ""; |
| 71 | display: table; |
| 72 | clear: both; |
| 73 | } |
| 74 | |
| 75 | .action-btns { |
| 76 | float: right; |
| 77 | } |
| 78 | |
| 79 | .folder-anonymous { |
| 80 | display: none; |
| 81 | } |
| 82 | |
| 83 | .attention, .error-message { |
| 84 | color: red; |
| 85 | font-weight: 600; |
| 86 | display: none; |
| 87 | } |
| 88 | |
| 89 | .folder-spinner { |
| 90 | display: none; |
| 91 | } |
| 92 | |
| 93 | .folder-spinner img { |
| 94 | margin-top: 3px; |
| 95 | } |
| 96 | |
| 97 | .folder-hidden-input { |
| 98 | padding: 10px 0 0; |
| 99 | display: none; |
| 100 | } |
| 101 | |
| 102 | .folder-hidden-input input[type='text'] { |
| 103 | padding: 0 10px; |
| 104 | width: 100%; |
| 105 | height: 26px; |
| 106 | line-height: 26px; |
| 107 | } |
| 108 | |
| 109 | .folder-hidden-input textarea { |
| 110 | padding: 10px; |
| 111 | width: 100%; |
| 112 | } |
| 113 | |
| 114 | span.folder-error-message { |
| 115 | color: #dd0000; |
| 116 | font-weight: 600; |
| 117 | } |
| 118 | |
| 119 | .form-control textarea { |
| 120 | width: 100%; |
| 121 | height: 100px; |
| 122 | margin-bottom: 10px; |
| 123 | } |
| 124 | |
| 125 | |
| 126 | .folder-help-btn { |
| 127 | position: fixed; |
| 128 | right: 20px; |
| 129 | bottom: 20px; |
| 130 | z-index: 1001 |
| 131 | } |
| 132 | |
| 133 | .folder-help-btn a { |
| 134 | display: block; |
| 135 | border: 3px solid #FFF; |
| 136 | width: 50px; |
| 137 | height: 50px; |
| 138 | -webkit-border-radius: 50%; |
| 139 | -moz-border-radius: 50%; |
| 140 | border-radius: 50%; |
| 141 | position: relative |
| 142 | } |
| 143 | |
| 144 | .folder-help-btn a img { |
| 145 | width: 100%; |
| 146 | height: auto; |
| 147 | display: block; |
| 148 | -webkit-border-radius: 50%; |
| 149 | -moz-border-radius: 50%; |
| 150 | border-radius: 50% |
| 151 | } |
| 152 | |
| 153 | .folder-help-form { |
| 154 | position: fixed; |
| 155 | right: 85px; |
| 156 | border: 1px solid #e9edf0; |
| 157 | bottom: 25px; |
| 158 | background: #fff; |
| 159 | -webkit-border-radius: 10px; |
| 160 | -moz-border-radius: 10px; |
| 161 | border-radius: 10px; |
| 162 | width: 320px; |
| 163 | z-index: 1001; |
| 164 | direction: ltr; |
| 165 | opacity: 0; |
| 166 | transition: .4s; |
| 167 | -webkit-transition: .4s; |
| 168 | -moz-transition: .4s |
| 169 | } |
| 170 | |
| 171 | .folder-help-form.active { |
| 172 | opacity: 1; |
| 173 | pointer-events: inherit |
| 174 | } |
| 175 | |
| 176 | .folder-help-header { |
| 177 | background: #f4f4f4; |
| 178 | border-bottom: solid 1px #e9edf0; |
| 179 | padding: 5px 20px; |
| 180 | -webkit-border-radius: 10px; |
| 181 | -moz-border-radius: 10px; |
| 182 | border-radius: 10px 10px 0 0; |
| 183 | font-size: 16px; |
| 184 | text-align: right |
| 185 | } |
| 186 | |
| 187 | .folder-help-header b { |
| 188 | float: left |
| 189 | } |
| 190 | |
| 191 | .folder-help-content { |
| 192 | margin-bottom: 10px; |
| 193 | padding: 20px 20px 10px |
| 194 | } |
| 195 | |
| 196 | .folder-help-form p { |
| 197 | margin: 0 0 1em |
| 198 | } |
| 199 | |
| 200 | .folder-form-field { |
| 201 | margin-bottom: 10px |
| 202 | } |
| 203 | |
| 204 | .folder-form-field input, .folder-form-field textarea { |
| 205 | -webkit-border-radius: 5px; |
| 206 | -moz-border-radius: 5px; |
| 207 | border-radius: 5px; |
| 208 | padding: 5px; |
| 209 | width: 100%; |
| 210 | box-sizing: border-box; |
| 211 | border: 1px solid #c5c5c5 |
| 212 | } |
| 213 | |
| 214 | .folder-form-field textarea { |
| 215 | height: 70px |
| 216 | } |
| 217 | |
| 218 | .folder-help-button { |
| 219 | border: none; |
| 220 | padding: 8px 0; |
| 221 | width: 100%; |
| 222 | background: #ff6624; |
| 223 | color: #fff; |
| 224 | border-radius: 18px |
| 225 | } |
| 226 | |
| 227 | .folder-help-form .error-message { |
| 228 | font-weight: 400; |
| 229 | font-size: 14px; |
| 230 | display: block; |
| 231 | } |
| 232 | |
| 233 | .folder-help-form input.input-error, .folder-help-form textarea.input-error { |
| 234 | border-color: #dc3232 |
| 235 | } |
| 236 | |
| 237 | .folder-help-btn span.tooltiptext { |
| 238 | position: absolute; |
| 239 | background: #000; |
| 240 | font-size: 12px; |
| 241 | color: #fff; |
| 242 | top: -35px; |
| 243 | width: 140%; |
| 244 | text-align: center; |
| 245 | left: -20%; |
| 246 | border-radius: 5px; |
| 247 | direction: ltr |
| 248 | } |
| 249 | |
| 250 | p.error-p, p.success-p { |
| 251 | margin: 0; |
| 252 | font-size: 14px; |
| 253 | text-align: center |
| 254 | } |
| 255 | |
| 256 | .folder-help-btn span.tooltiptext:after { |
| 257 | bottom: -20px; |
| 258 | content: ""; |
| 259 | transform: translateX(-50%); |
| 260 | height: 10px; |
| 261 | width: 0px; |
| 262 | border-width: 10px 5px 0; |
| 263 | border-style: solid; |
| 264 | border-color: #000 transparent transparent; |
| 265 | left: 50%; |
| 266 | position: absolute |
| 267 | } |
| 268 | .folder-help-btn { |
| 269 | display: none; |
| 270 | } |
| 271 | |
| 272 | p.success-p { |
| 273 | color: green |
| 274 | } |
| 275 | |
| 276 | p.error-p { |
| 277 | color: #dc3232 |
| 278 | } |
| 279 | |
| 280 | html[dir=rtl] .folder-help-btn { |
| 281 | left: 20px; |
| 282 | right: auto |
| 283 | } |
| 284 | |
| 285 | html[dir=rtl] .folder-help-form { |
| 286 | left: 85px; |
| 287 | right: auto |
| 288 | } |
| 289 | .folder-popup-body h3 { |
| 290 | line-height: 24px; |
| 291 | } |
| 292 | </style> |
| 293 | |
| 294 | <div class="folder-popup-overlay"> |
| 295 | <div class="folder-serveypanel"> |
| 296 | <form action="#" method="post" id="folder-deactivate-form"> |
| 297 | <div class="folder-popup-header"> |
| 298 | <h2><?php esc_html_e('Quick feedback about Folders', WCP_FOLDER); ?> 🙏</h2> |
| 299 | </div> |
| 300 | <div class="folder-popup-body"> |
| 301 | <h3><?php esc_html_e('Your feedback will help us improve the product, please tell us why did you decide to deactivate Folders :)', WCP_FOLDER); ?></h3> |
| 302 | <div class="form-control"> |
| 303 | <label></label> |
| 304 | <textarea placeholder="<?php esc_html_e("Your comment", WCP_FOLDER) ?>" id="folder-comment"></textarea> |
| 305 | </div> |
| 306 | <?php esc_html_e("Having any problem with the Folders plugins?", WCP_FOLDER) ?><a class='folder-deactivate-button' href='javascript:;'><?php esc_html_e("Click here", WCP_FOLDER) ?></a><?php esc_html_e(" to contact our support now", WCP_FOLDER) ?> |
| 307 | </div> |
| 308 | <div class="folder-popup-footer"> |
| 309 | <label class="folder-anonymous"><input type="checkbox"/><?php esc_html_e('Anonymous feedback', WCP_FOLDER); ?> |
| 310 | </label> |
| 311 | <input type="button" class="button button-secondary button-skip folder-popup-skip-feedback" |
| 312 | value="Skip & Deactivate"> |
| 313 | |
| 314 | <div class="action-btns"> |
| 315 | <span class="folder-spinner"> |
| 316 | <img src="<?php echo esc_url(admin_url('/images/spinner.gif')); ?>" alt=""> |
| 317 | </span> |
| 318 | <input type="submit" class="button button-secondary button-deactivate folder-popup-allow-deactivate" value="Submit & Deactivate" disabled="disabled"> |
| 319 | <a href="#" class="button button-primary folder-popup-button-close"><?php esc_html_e('Cancel', WCP_FOLDER); ?></a> |
| 320 | </div> |
| 321 | </div> |
| 322 | </form> |
| 323 | </div> |
| 324 | </div> |
| 325 | |
| 326 | |
| 327 | <script> |
| 328 | (function ($) { |
| 329 | |
| 330 | $(function () { |
| 331 | |
| 332 | $(document).on("click", ".folder-deactivate-button", function(e){ |
| 333 | e.stopPropagation(); |
| 334 | jQuery(".folder-popup-button-close").trigger("click"); |
| 335 | jQuery(".folder-help-btn").toggle(); |
| 336 | jQuery(".folder-help-form").toggleClass("active"); |
| 337 | jQuery("#user_email").focus(); |
| 338 | }); |
| 339 | |
| 340 | var folderPluginSlug = 'folders'; |
| 341 | // Code to fire when the DOM is ready. |
| 342 | |
| 343 | $(document).on('click', 'tr[data-slug="' + folderPluginSlug + '"] .deactivate', function (e) { |
| 344 | e.preventDefault(); |
| 345 | |
| 346 | $('.folder-popup-overlay').addClass('folder-active'); |
| 347 | $('body').addClass('folder-hidden'); |
| 348 | }); |
| 349 | $(document).on('click', '.folder-popup-button-close', function () { |
| 350 | close_popup(); |
| 351 | }); |
| 352 | $(document).on('click', ".folder-serveypanel,tr[data-slug='" + folderPluginSlug + "'] .deactivate", function (e) { |
| 353 | e.stopPropagation(); |
| 354 | }); |
| 355 | |
| 356 | $(document).click(function () { |
| 357 | close_popup(); |
| 358 | }); |
| 359 | $(document).on("keyup", "#folder-comment", function(){ |
| 360 | if($.trim($(this).val()) == "") { |
| 361 | $(".folder-popup-allow-deactivate").attr("disabled", true); |
| 362 | } else { |
| 363 | $(".folder-popup-allow-deactivate").attr("disabled", false); |
| 364 | } |
| 365 | }); |
| 366 | $(document).on('submit', '#folder-deactivate-form', function (event) { |
| 367 | event.preventDefault(); |
| 368 | |
| 369 | var _reason = jQuery('#folder-comment').val(); |
| 370 | |
| 371 | $.ajax({ |
| 372 | url: ajaxurl, |
| 373 | type: 'POST', |
| 374 | data: { |
| 375 | action: 'folder_plugin_deactivate', |
| 376 | reason: _reason, |
| 377 | nonce: '<?php echo esc_attr(wp_create_nonce('wcp_folder_deactivate_nonce')) ?>' |
| 378 | }, |
| 379 | beforeSend: function () { |
| 380 | $(".folder-spinner").show(); |
| 381 | $(".folder-popup-allow-deactivate").attr("disabled", "disabled"); |
| 382 | } |
| 383 | }).done(function (res) { |
| 384 | console.log(res); |
| 385 | res = jQuery.parseJSON(res); |
| 386 | if(res.valid == "0") { |
| 387 | alert(res.message); |
| 388 | window.location.reload(true); |
| 389 | } else { |
| 390 | $(".folder-spinner").hide(); |
| 391 | $(".folder-popup-allow-deactivate").removeAttr("disabled"); |
| 392 | window.location.href = $("tr[data-slug='" + folderPluginSlug + "'] .deactivate a").attr('href'); |
| 393 | } |
| 394 | }); |
| 395 | }); |
| 396 | |
| 397 | $('.folder-popup-skip-feedback').on('click', function (e) { |
| 398 | window.location.href = $("tr[data-slug='" + folderPluginSlug + "'] .deactivate a").attr('href'); |
| 399 | }) |
| 400 | |
| 401 | function close_popup() { |
| 402 | $('.folder-popup-overlay').removeClass('folder-active'); |
| 403 | $('#folder-deactivate-form').trigger("reset"); |
| 404 | $(".folder-popup-allow-deactivate").attr('disabled', 'disabled'); |
| 405 | $(".folder-reason-input").hide(); |
| 406 | $('body').removeClass('folder-hidden'); |
| 407 | $('.message.error-message').hide(); |
| 408 | } |
| 409 | }); |
| 410 | |
| 411 | })(jQuery); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code. |
| 412 | </script> |
| 413 | <?php include_once dirname(__FILE__)."/help.php" ?> |