CommonJs.php
3 years ago
ConnectionIcon.php
3 years ago
ManualScheduling.php
2 years ago
SaveSchedulingButton.php
3 years ago
SchedulingHelp.php
2 years ago
SchedulingOptions.php
2 years ago
SchedulingUI.php
2 years ago
SchedulingOptions.php
872 lines
| 1 | <?php |
| 2 | if(!defined('ABSPATH')) { |
| 3 | die(); |
| 4 | } |
| 5 | |
| 6 | $scheduling = \Wpae\Scheduling\Scheduling::create(); |
| 7 | $schedulingExportOptions = $export->options; |
| 8 | $hasActiveLicense = $scheduling->checkLicense(); |
| 9 | $cron_job_key = PMXE_Plugin::getInstance()->getOption('cron_job_key'); |
| 10 | $options = \PMXE_Plugin::getInstance()->getOption(); |
| 11 | ?> |
| 12 | <style type="text/css"> |
| 13 | .days-of-week { |
| 14 | margin-left: 5px; |
| 15 | } |
| 16 | |
| 17 | .days-of-week li { |
| 18 | border: 1px solid #ccc; |
| 19 | border-radius: 5px; |
| 20 | padding: 10px 30px;; |
| 21 | display: inline-block; |
| 22 | margin-right: 10px; |
| 23 | cursor: pointer; |
| 24 | font-weight: bold; |
| 25 | width: 38px; |
| 26 | text-align: center; |
| 27 | height: 16px; |
| 28 | color: rgb(68,68,68); |
| 29 | float: left; |
| 30 | } |
| 31 | |
| 32 | .days-of-week li.selected { |
| 33 | color: #fff; |
| 34 | background-color: #425F9A; |
| 35 | border-color: #585858; |
| 36 | } |
| 37 | |
| 38 | #weekly, #monthly { |
| 39 | height: 40px; |
| 40 | } |
| 41 | |
| 42 | .timepicker { |
| 43 | width: 100px; |
| 44 | padding: 10px; |
| 45 | border-radius: 5px; |
| 46 | margin-right: 10px; |
| 47 | } |
| 48 | |
| 49 | #times { |
| 50 | margin-top: 5px; |
| 51 | width: 800px; |
| 52 | } |
| 53 | |
| 54 | #times input { |
| 55 | margin-top: 10px; |
| 56 | margin-left: 0; |
| 57 | float: left; |
| 58 | } |
| 59 | |
| 60 | #times input.error { |
| 61 | border-color: red !important; |
| 62 | } |
| 63 | |
| 64 | .subscribe { |
| 65 | |
| 66 | } |
| 67 | |
| 68 | .subscribe .button-container { |
| 69 | float: left; |
| 70 | width: 150px; |
| 71 | } |
| 72 | |
| 73 | .subscribe .text-container { |
| 74 | float: left; |
| 75 | width: auto; |
| 76 | } |
| 77 | |
| 78 | .subscribe .text-container p { |
| 79 | margin: 0; |
| 80 | color: #425F9A; |
| 81 | font-size: 14px; |
| 82 | font-weight: bold; |
| 83 | } |
| 84 | |
| 85 | .subscribe .text-container p a { |
| 86 | color: #425F9A; |
| 87 | text-decoration: underline; |
| 88 | } |
| 89 | |
| 90 | .save { |
| 91 | padding-left: 5px; |
| 92 | padding-top: 5px; |
| 93 | width: auto; |
| 94 | } |
| 95 | |
| 96 | .ui-timepicker-wrapper { |
| 97 | width: 98px; |
| 98 | } |
| 99 | |
| 100 | .easing-spinner { |
| 101 | width: 30px; |
| 102 | height: 30px; |
| 103 | position: relative; |
| 104 | display: inline-block; |
| 105 | |
| 106 | margin-top: 7px; |
| 107 | margin-left: -25px; |
| 108 | |
| 109 | float: left; |
| 110 | } |
| 111 | |
| 112 | .double-bounce1, .double-bounce2 { |
| 113 | width: 100%; |
| 114 | height: 100%; |
| 115 | border-radius: 50%; |
| 116 | background-color: #fff; |
| 117 | opacity: 0.6; |
| 118 | position: absolute; |
| 119 | top: 0; |
| 120 | left: 0; |
| 121 | |
| 122 | -webkit-animation: sk-bounce 2.0s infinite ease-in-out; |
| 123 | animation: sk-bounce 2.0s infinite ease-in-out; |
| 124 | } |
| 125 | |
| 126 | .double-bounce2 { |
| 127 | -webkit-animation-delay: -1.0s; |
| 128 | animation-delay: -1.0s; |
| 129 | } |
| 130 | |
| 131 | .wpae-save-button svg { |
| 132 | margin-top: 7px; |
| 133 | margin-left: -215px; |
| 134 | display: inline-block; |
| 135 | position: relative; |
| 136 | } |
| 137 | |
| 138 | @-webkit-keyframes sk-bounce { |
| 139 | 0%, 100% { |
| 140 | -webkit-transform: scale(0.0) |
| 141 | } |
| 142 | 50% { |
| 143 | -webkit-transform: scale(1.0) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | @keyframes sk-bounce { |
| 148 | 0%, 100% { |
| 149 | transform: scale(0.0); |
| 150 | -webkit-transform: scale(0.0); |
| 151 | } |
| 152 | 50% { |
| 153 | transform: scale(1.0); |
| 154 | -webkit-transform: scale(1.0); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | #add-subscription-field { |
| 159 | position: absolute; |
| 160 | left: -152px; |
| 161 | top: -2px; |
| 162 | height: 46px; |
| 163 | border-radius: 5px; |
| 164 | font-size: 17px; |
| 165 | padding-left: 10px; |
| 166 | display: none; |
| 167 | width: 140px; |
| 168 | } |
| 169 | |
| 170 | #find-subscription-link { |
| 171 | position: absolute; |
| 172 | left: 133px; |
| 173 | top: 14px; |
| 174 | height:30px; |
| 175 | width: 300px; |
| 176 | display: none; |
| 177 | } |
| 178 | |
| 179 | #find-subscription-link a { |
| 180 | display: block; |
| 181 | width: 100%; |
| 182 | height: 46px; |
| 183 | white-space: nowrap; |
| 184 | } |
| 185 | |
| 186 | #weekly li.error, #monthly li.error { |
| 187 | border-color: red; |
| 188 | } |
| 189 | |
| 190 | .chosen-single { |
| 191 | margin-bottom: 0 !important; |
| 192 | } |
| 193 | |
| 194 | .chosen-container.chosen-with-drop .chosen-drop { |
| 195 | margin-top: 0 !important; |
| 196 | } |
| 197 | |
| 198 | .wpallexport-preview-content h4{ |
| 199 | font-size: 14px; |
| 200 | margin-bottom: 5px; |
| 201 | color: #40acad; |
| 202 | text-decoration: none; |
| 203 | } |
| 204 | .manual-scheduling { margin-left: 26px;} |
| 205 | </style> |
| 206 | |
| 207 | <script type="text/javascript"> |
| 208 | (function ($) { |
| 209 | $(function () { |
| 210 | |
| 211 | var hasActiveLicense = <?php echo $hasActiveLicense? 'true':'false'; ?>; |
| 212 | |
| 213 | function isAutomaticSchedulingEnabled() { |
| 214 | return $('input[name="scheduling_enable"]:checked').val() == 1; |
| 215 | } |
| 216 | |
| 217 | $(document).ready(function () { |
| 218 | |
| 219 | function openSchedulingAccordeonIfClosed() { |
| 220 | if ($('.wpallexport-file-options').hasClass('closed')) { |
| 221 | // Open accordion |
| 222 | $('#scheduling-title').trigger('click'); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | window.pmxeValidateSchedulingForm = function () { |
| 227 | |
| 228 | var schedulingEnabled = isAutomaticSchedulingEnabled(); |
| 229 | |
| 230 | if (!schedulingEnabled) { |
| 231 | return { |
| 232 | isValid: true |
| 233 | }; |
| 234 | } |
| 235 | |
| 236 | var runOn = $('input[name="scheduling_run_on"]:checked').val(); |
| 237 | |
| 238 | // Validate weekdays |
| 239 | if (runOn == 'weekly') { |
| 240 | var weeklyDays = $('#weekly_days').val(); |
| 241 | |
| 242 | if (weeklyDays == '') { |
| 243 | $('#weekly li').addClass('error'); |
| 244 | return { |
| 245 | isValid: false, |
| 246 | message: 'Please select at least a day on which the export should run' |
| 247 | } |
| 248 | } |
| 249 | } else if (runOn == 'monthly') { |
| 250 | var monthlyDays = $('#monthly_days').val(); |
| 251 | |
| 252 | if (monthlyDays == '') { |
| 253 | $('#monthly li').addClass('error'); |
| 254 | return { |
| 255 | isValid: false, |
| 256 | message: 'Please select at least a day on which the export should run' |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // Validate times |
| 262 | var timeValid = true; |
| 263 | var timeMessage = 'Please select at least a time for the export to run'; |
| 264 | var timeInputs = $('.timepicker'); |
| 265 | var timesHasValues = false; |
| 266 | |
| 267 | timeInputs.each(function (key, $elem) { |
| 268 | |
| 269 | if($(this).val() !== ''){ |
| 270 | timesHasValues = true; |
| 271 | } |
| 272 | |
| 273 | if (!$(this).val().match(/^(0?[1-9]|1[012])(:[0-5]\d)[APap][mM]$/) && $(this).val() != '') { |
| 274 | $(this).addClass('error'); |
| 275 | timeValid = false; |
| 276 | } else { |
| 277 | $(this).removeClass('error'); |
| 278 | } |
| 279 | }); |
| 280 | |
| 281 | if(!timesHasValues) { |
| 282 | timeValid = false; |
| 283 | $('.timepicker').addClass('error'); |
| 284 | } |
| 285 | |
| 286 | if (!timeValid) { |
| 287 | return { |
| 288 | isValid: false, |
| 289 | message: timeMessage |
| 290 | }; |
| 291 | } |
| 292 | |
| 293 | return { |
| 294 | isValid: true |
| 295 | }; |
| 296 | }; |
| 297 | |
| 298 | |
| 299 | |
| 300 | $('#weekly li').on('click', function () { |
| 301 | |
| 302 | $('#weekly li').removeClass('error'); |
| 303 | |
| 304 | if ($(this).hasClass('selected')) { |
| 305 | $(this).removeClass('selected'); |
| 306 | } else { |
| 307 | $(this).addClass('selected'); |
| 308 | } |
| 309 | |
| 310 | $('#weekly_days').val(''); |
| 311 | |
| 312 | $('#weekly li.selected').each(function () { |
| 313 | var val = $(this).data('day'); |
| 314 | $('#weekly_days').val($('#weekly_days').val() + val + ','); |
| 315 | }); |
| 316 | |
| 317 | $('#weekly_days').val($('#weekly_days').val().slice(0, -1)); |
| 318 | |
| 319 | }); |
| 320 | |
| 321 | $('#monthly li').on('click', function () { |
| 322 | |
| 323 | $('#monthly li').removeClass('error'); |
| 324 | $(this).parent().parent().find('.days-of-week li').removeClass('selected'); |
| 325 | $(this).addClass('selected'); |
| 326 | |
| 327 | $('#monthly_days').val($(this).data('day')); |
| 328 | }); |
| 329 | |
| 330 | $('input[name="scheduling_run_on"]').on('change', function () { |
| 331 | var val = $('input[name="scheduling_run_on"]:checked').val(); |
| 332 | if (val == "weekly") { |
| 333 | |
| 334 | $('#weekly').slideDown({ |
| 335 | queue: false |
| 336 | }); |
| 337 | $('#monthly').slideUp({ |
| 338 | queue: false |
| 339 | }); |
| 340 | |
| 341 | } else if (val == "monthly") { |
| 342 | |
| 343 | $('#weekly').slideUp({ |
| 344 | queue: false |
| 345 | }); |
| 346 | $('#monthly').slideDown({ |
| 347 | queue: false |
| 348 | }); |
| 349 | } |
| 350 | }); |
| 351 | |
| 352 | $('.timepicker').timepicker(); |
| 353 | |
| 354 | var selectedTimes = []; |
| 355 | |
| 356 | var onTimeSelected = function () { |
| 357 | |
| 358 | selectedTimes.push([$(this).val(), $(this).val() + 1]); |
| 359 | |
| 360 | var isLastChild = $(this).is(':last-child'); |
| 361 | if (isLastChild) { |
| 362 | $(this).parent().append('<input class="timepicker" name="scheduling_times[]" style="display: none;" type="text" />'); |
| 363 | $('.timepicker:last-child').timepicker({ |
| 364 | 'disableTimeRanges': selectedTimes |
| 365 | }); |
| 366 | $('.timepicker:last-child').fadeIn('fast'); |
| 367 | $('.timepicker').on('changeTime', onTimeSelected); |
| 368 | } |
| 369 | }; |
| 370 | |
| 371 | $('.timepicker').on('changeTime', onTimeSelected); |
| 372 | |
| 373 | $('#timezone').chosen({width: '320px'}); |
| 374 | |
| 375 | |
| 376 | $('.wpae-save-button').on('click', function (e) { |
| 377 | |
| 378 | var initialValue = $(this).find('.save-text').html(); |
| 379 | var schedulingEnable = $('input[name="scheduling_enable"]:checked').val() == 1; |
| 380 | if(!hasActiveLicense) { |
| 381 | if (!$(this).data('iunderstand') && schedulingEnable) { |
| 382 | $('#no-subscription').slideDown(); |
| 383 | $(this).find('.save-text').html('<?php echo esc_html('I Understand');?>'); |
| 384 | $(this).find('.save-text').css('left', '100px'); |
| 385 | $(this).data('iunderstand', 1); |
| 386 | |
| 387 | openSchedulingAccordeonIfClosed(); |
| 388 | e.preventDefault(); |
| 389 | return; |
| 390 | } else { |
| 391 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 392 | $(document).trigger(submitEvent); |
| 393 | |
| 394 | return; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // Don't process scheduling |
| 399 | if (!hasActiveLicense) { |
| 400 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 401 | $(document).trigger(submitEvent); |
| 402 | |
| 403 | return; |
| 404 | } |
| 405 | |
| 406 | var validationResponse = pmxeValidateSchedulingForm(); |
| 407 | if (!validationResponse.isValid) { |
| 408 | |
| 409 | openSchedulingAccordeonIfClosed(); |
| 410 | $('html, body').animate({ |
| 411 | scrollTop: $("#scheduling-title").offset().top-100 |
| 412 | }, 500); |
| 413 | e.preventDefault(); |
| 414 | return false; |
| 415 | } |
| 416 | |
| 417 | var $button = $(this); |
| 418 | |
| 419 | var formData = $('#scheduling-form :input').serializeArray(); |
| 420 | |
| 421 | formData.push({name: 'security', value: wp_all_export_security}); |
| 422 | formData.push({name: 'action', value: 'save_scheduling'}); |
| 423 | formData.push({name: 'element_id', value: <?php echo intval($export_id); ?>}); |
| 424 | formData.push({name: 'scheduling_enable', value: $('input[name="scheduling_enable"]:checked').val()}); |
| 425 | |
| 426 | $.ajax({ |
| 427 | type: 'POST', |
| 428 | url: ajaxurl, |
| 429 | data: formData, |
| 430 | success: function (response) { |
| 431 | |
| 432 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 433 | $(document).trigger(submitEvent); |
| 434 | |
| 435 | }, |
| 436 | error: function () { |
| 437 | } |
| 438 | }); |
| 439 | }); |
| 440 | |
| 441 | $('.wp_all_export_confirm_and_run').on('click', function(e){ |
| 442 | |
| 443 | e.preventDefault(); |
| 444 | |
| 445 | var schedulingEnable = isAutomaticSchedulingEnabled(); |
| 446 | |
| 447 | if(schedulingEnable) { |
| 448 | |
| 449 | |
| 450 | if(!hasActiveLicense) { |
| 451 | if (!$(this).data('iunderstand') && schedulingEnable) { |
| 452 | $('#no-subscription').slideDown(); |
| 453 | $(this).find('.save-text').html('<?php echo esc_html('I Understand');?>'); |
| 454 | $(this).find('.save-text').css('left', '100px'); |
| 455 | $(this).data('iunderstand', 1); |
| 456 | |
| 457 | openSchedulingAccordeonIfClosed(); |
| 458 | |
| 459 | $('html, body').animate({ |
| 460 | scrollTop: $(".wpallexport-submit-buttons").offset().top+200 |
| 461 | }, 900); |
| 462 | |
| 463 | e.preventDefault(); |
| 464 | return; |
| 465 | } else { |
| 466 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 467 | $(document).trigger(submitEvent); |
| 468 | |
| 469 | return; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | var validationResponse = pmxeValidateSchedulingForm(); |
| 474 | if (!validationResponse.isValid) { |
| 475 | |
| 476 | openSchedulingAccordeonIfClosed(); |
| 477 | $('html, body').animate({ |
| 478 | scrollTop: $("#scheduling-title").offset().top-100 |
| 479 | }, 500); |
| 480 | e.preventDefault(); |
| 481 | return false; |
| 482 | } |
| 483 | |
| 484 | var $button = $('.wpae-scheduling-status'); |
| 485 | $button.find('.easing-spinner').toggle(); |
| 486 | |
| 487 | var formData = $('#scheduling-form :input').serializeArray(); |
| 488 | |
| 489 | formData.push({name: 'security', value: wp_all_export_security}); |
| 490 | formData.push({name: 'action', value: 'save_scheduling'}); |
| 491 | formData.push({name: 'element_id', value: <?php echo intval($export_id); ?>}); |
| 492 | formData.push({name: 'scheduling_enable', value: $('input[name="scheduling_enable"]:checked').val()}); |
| 493 | |
| 494 | $.ajax({ |
| 495 | type: 'POST', |
| 496 | url: ajaxurl, |
| 497 | data: formData, |
| 498 | success: function (response) { |
| 499 | $button.find('.easing-spinner').toggle(); |
| 500 | $button.find('svg').show(); |
| 501 | |
| 502 | setTimeout(function(){ |
| 503 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 504 | $(document).trigger(submitEvent); |
| 505 | }, 1000); |
| 506 | |
| 507 | }, |
| 508 | error: function () { |
| 509 | $button.find('.easing-spinner').toggle(); |
| 510 | } |
| 511 | }); |
| 512 | |
| 513 | return false; |
| 514 | } else { |
| 515 | $('form.choose-export-options').trigger('submit'); |
| 516 | |
| 517 | } |
| 518 | |
| 519 | return false; |
| 520 | }); |
| 521 | |
| 522 | <?php if($schedulingExportOptions['scheduling_timezone'] == 'UTC') { |
| 523 | ?> |
| 524 | var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 525 | |
| 526 | if($('#timezone').find("option:contains('"+ timeZone +"')").length != 0){ |
| 527 | $('#timezone').trigger("chosen:updated"); |
| 528 | $('#timezone').val(timeZone); |
| 529 | $('#timezone').trigger("chosen:updated"); |
| 530 | }else{ |
| 531 | var parts = timeZone.split('/'); |
| 532 | var lastPart = parts[parts.length-1]; |
| 533 | var opt = $('#timezone').find("option:contains('"+ lastPart +"')"); |
| 534 | |
| 535 | $('#timezone').val(opt.val()); |
| 536 | $('#timezone').trigger("chosen:updated"); |
| 537 | } |
| 538 | |
| 539 | <?php |
| 540 | } |
| 541 | ?> |
| 542 | |
| 543 | var saveSubscription = false; |
| 544 | |
| 545 | $('#add-subscription').on('click', function(){ |
| 546 | |
| 547 | $('#add-subscription-field').show(); |
| 548 | $('#add-subscription-field').animate({width:'400px'}, 225); |
| 549 | $('#add-subscription-field').animate({left:'-1px'}, 225); |
| 550 | $('#subscribe-button .button-subscribe').css('background-color','#46ba69'); |
| 551 | |
| 552 | $('.text-container p').fadeOut(); |
| 553 | |
| 554 | setTimeout(function () { |
| 555 | $('#find-subscription-link').show(); |
| 556 | $('#find-subscription-link').animate({left: '410px'}, 300, 'swing'); |
| 557 | }, 225); |
| 558 | $('.subscribe-button-text').html('<?php esc_html_e('Activate'); ?>'); |
| 559 | saveSubscription = true; |
| 560 | return false; |
| 561 | }); |
| 562 | |
| 563 | $('#subscribe-button').on('click', function(){ |
| 564 | |
| 565 | if(saveSubscription) { |
| 566 | $('#subscribe-button .easing-spinner').show(); |
| 567 | |
| 568 | var license = $('#add-subscription-field').val(); |
| 569 | $.ajax({ |
| 570 | url:ajaxurl+'?action=wpae_api&q=schedulingLicense/saveSchedulingLicense&security=<?php echo esc_js(wp_create_nonce("wp_all_export_secure"));?>', |
| 571 | type:"POST", |
| 572 | data: { |
| 573 | license: license |
| 574 | }, |
| 575 | dataType:"json", |
| 576 | success: function(response){ |
| 577 | |
| 578 | $('#subscribe-button .button-subscribe').css('background-color','#425f9a'); |
| 579 | if(response.success) { |
| 580 | hasActiveLicense = true; |
| 581 | $('#subscribe-button .easing-spinner').hide(); |
| 582 | $('#subscribe-button svg.success').show(); |
| 583 | $('#subscribe-button svg.success').fadeOut(3000, function () { |
| 584 | $('.subscribe').hide({queue: false}); |
| 585 | $('#subscribe-filler').show({queue: false}); |
| 586 | }); |
| 587 | |
| 588 | $('.wpai-no-license').hide(); |
| 589 | $('.wpai-license').show(); |
| 590 | } else { |
| 591 | $('#subscribe-button .easing-spinner').hide(); |
| 592 | $('#subscribe-button svg.error').show(); |
| 593 | $('.subscribe-button-text').html('<?php esc_html_e('Subscribe'); ?>'); |
| 594 | |
| 595 | $('#subscribe-button svg.error').fadeOut(3000, function () { |
| 596 | $('#subscribe-button svg.error').hide({queue: false}); |
| 597 | |
| 598 | }); |
| 599 | |
| 600 | $('#add-subscription').html('<?php esc_html_e('Invalid license, try again?');?>'); |
| 601 | $('.text-container p').fadeIn(); |
| 602 | |
| 603 | $('#find-subscription-link').animate({width: 'toggle'}, 300, 'swing'); |
| 604 | |
| 605 | setTimeout(function () { |
| 606 | $('#add-subscription-field').animate({width:'140px'}, 225); |
| 607 | $('#add-subscription-field').animate({left:'-152px'}, 225); |
| 608 | }, 300); |
| 609 | |
| 610 | $('#add-subscription-field').val(''); |
| 611 | |
| 612 | $('#subscribe-button-text').html('<?php esc_html_e('Subscribe'); ?>'); |
| 613 | saveSubscription = false; |
| 614 | } |
| 615 | } |
| 616 | }); |
| 617 | |
| 618 | return false; |
| 619 | } |
| 620 | }); |
| 621 | }); |
| 622 | // help scheduling template |
| 623 | $('.help_scheduling').on('click', function(){ |
| 624 | |
| 625 | $('.wp-all-export-scheduling-help').css('left', ($( document ).width()/2) - 255 ).show(); |
| 626 | $('#wp-all-export-scheduling-help-inner').css('max-height', $( window ).height()-150).show(); |
| 627 | $('.wpallexport-overlay').show(); |
| 628 | return false; |
| 629 | }); |
| 630 | |
| 631 | $('.wp_all_export_scheduling_help').find('h3').on('click', function(){ |
| 632 | var $action = $(this).find('span').html(); |
| 633 | $('.wp_all_export_scheduling_help').find('h3').each(function(){ |
| 634 | $(this).find('span').html("+"); |
| 635 | }); |
| 636 | if ( $action == "+" ) { |
| 637 | $('.wp_all_export_help_tab').slideUp(); |
| 638 | $('.wp_all_export_help_tab[rel=' + $(this).attr('id') + ']').slideDown(); |
| 639 | $(this).find('span').html("-"); |
| 640 | } |
| 641 | else{ |
| 642 | $('.wp_all_export_help_tab[rel=' + $(this).attr('id') + ']').slideUp(); |
| 643 | $(this).find('span').html("+"); |
| 644 | } |
| 645 | }); |
| 646 | }); |
| 647 | })(jQuery); |
| 648 | |
| 649 | </script> |
| 650 | <?php require __DIR__.'/CommonJs.php'; ?> |
| 651 | <div class="wpallexport-collapsed wpallexport-section wpallexport-file-options closed wpallexport-scheduling" style="margin-top: -10px; margin-bottom: 10px;"> |
| 652 | <div id="scheduling-form"> |
| 653 | |
| 654 | <div class="wpallexport-content-section" style="padding-bottom: 15px; margin-bottom: 10px;"> |
| 655 | <div class="wpallexport-collapsed-header" id="scheduling-options-header" style="padding-left: 25px;"> |
| 656 | <h3 id="scheduling-title" style="position: relative;"> |
| 657 | <?php esc_html_e('Scheduling Options', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 658 | </h3> |
| 659 | </div> |
| 660 | |
| 661 | <div class="wpallexport-collapsed-content" style="padding: 0; height: auto; display: none;"> |
| 662 | <div class="wpallexport-collapsed-content-inner" style="padding-bottom: 0; overflow: auto;"> |
| 663 | <div style="margin-bottom: 20px;"> |
| 664 | <label> |
| 665 | <input type="radio" name="scheduling_enable" value="0" <?php if(!$schedulingExportOptions['scheduling_enable']) { ?> checked="checked" <?php } ?>/> |
| 666 | <h4 style="display: inline-block; margin-top:3px; margin-bottom:-2px;"><?php esc_html_e('Do Not Schedule'); ?></h4> |
| 667 | </label> |
| 668 | </div> |
| 669 | <div> |
| 670 | <label> |
| 671 | <input type="radio" name="scheduling_enable" value="1" <?php if($schedulingExportOptions['scheduling_enable'] == 1) {?> checked="checked" <?php }?>/> |
| 672 | |
| 673 | <h4 style="margin: 0; display: inline-flex; align-items: center;"><?php esc_html_e('Automatic Scheduling', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 674 | <span class="connection-icon" style="margin-left: 8px; height: 16px;"> |
| 675 | <?php include_once('ConnectionIcon.php'); ?> |
| 676 | </span> |
| 677 | <?php if($schedulingExportOptions['scheduling_enable'] == 1) { ?> |
| 678 | <?php if (!$scheduling->checkConnection()) { ?> |
| 679 | <span class="wpai-license" style="margin-left: 8px; font-weight: normal; <?php if(!$hasActiveLicense) { ?> display: none; <?php }?>"><span class="unable-to-connect">Unable to connect, please contact support.</span></span> |
| 680 | <?php } ?> |
| 681 | <?php } ?> |
| 682 | </h4> |
| 683 | </label> |
| 684 | </div> |
| 685 | <div style="margin-bottom: 10px; margin-left:26px;"> |
| 686 | <label style="font-size: 13px;"> |
| 687 | <?php esc_html_e('Run this export on a schedule.'); ?> |
| 688 | </label> |
| 689 | </div> |
| 690 | <div id="automatic-scheduling" |
| 691 | style="margin-left: 21px; <?php if ($schedulingExportOptions['scheduling_enable'] != 1) { ?> display: none; <?php } ?>"> |
| 692 | <div> |
| 693 | <div class="input"> |
| 694 | <label style="color: rgb(68,68,68);"> |
| 695 | <input |
| 696 | type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> checked="checked" <?php } ?> |
| 697 | name="scheduling_run_on" value="weekly" |
| 698 | checked="checked"/> <?php esc_html_e('Every week on...', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 699 | </label> |
| 700 | </div> |
| 701 | <input type="hidden" style="width: 500px;" name="scheduling_weekly_days" |
| 702 | value="<?php echo esc_attr($schedulingExportOptions['scheduling_weekly_days']); ?>" id="weekly_days"/> |
| 703 | <?php |
| 704 | if (isset($schedulingExportOptions['scheduling_weekly_days'])) { |
| 705 | $weeklyArray = explode(',', $schedulingExportOptions['scheduling_weekly_days']); |
| 706 | } else { |
| 707 | $weeklyArray = array(); |
| 708 | } |
| 709 | ?> |
| 710 | <ul class="days-of-week" id="weekly" style="<?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> display: none; <?php } ?>"> |
| 711 | <li data-day="0" <?php if (in_array('0', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 712 | Mon |
| 713 | </li> |
| 714 | <li data-day="1" <?php if (in_array('1', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 715 | Tue |
| 716 | </li> |
| 717 | <li data-day="2" <?php if (in_array('2', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 718 | Wed |
| 719 | </li> |
| 720 | <li data-day="3" <?php if (in_array('3', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 721 | Thu |
| 722 | </li> |
| 723 | <li data-day="4" <?php if (in_array('4', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 724 | Fri |
| 725 | </li> |
| 726 | <li data-day="5" <?php if (in_array('5', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 727 | Sat |
| 728 | </li> |
| 729 | <li data-day="6" <?php if (in_array('6', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 730 | Sun |
| 731 | </li> |
| 732 | </ul> |
| 733 | </div> |
| 734 | <div style="clear: both;"></div> |
| 735 | <div> |
| 736 | <div class="input"> |
| 737 | <label style="color: rgb(68,68,68);"> |
| 738 | <input |
| 739 | type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> checked="checked" <?php } ?> |
| 740 | name="scheduling_run_on" |
| 741 | value="monthly"/> <?php esc_html_e('Every month on the first...', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 742 | </label> |
| 743 | </div> |
| 744 | <input type="hidden" name="scheduling_monthly_days" value="<?php if (isset($schedulingExportOptions['scheduling_monthly_days'])) echo esc_attr($schedulingExportOptions['scheduling_monthly_days']); ?>" id="monthly_days"/> |
| 745 | <?php |
| 746 | if (isset($schedulingExportOptions['scheduling_monthly_days'])) { |
| 747 | $monthlyArray = explode(',', $schedulingExportOptions['scheduling_monthly_days']); |
| 748 | } else { |
| 749 | $monthlyArray = array(); |
| 750 | } |
| 751 | ?> |
| 752 | <ul class="days-of-week" id="monthly" |
| 753 | style="<?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> display: none; <?php } ?>"> |
| 754 | <li data-day="0" <?php if (in_array('0', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 755 | Mon |
| 756 | </li> |
| 757 | <li data-day="1" <?php if (in_array('1', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 758 | Tue |
| 759 | </li> |
| 760 | <li data-day="2" <?php if (in_array('2', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 761 | Wed |
| 762 | </li> |
| 763 | <li data-day="3" <?php if (in_array('3', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 764 | Thu |
| 765 | </li> |
| 766 | <li data-day="4" <?php if (in_array('4', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 767 | Fri |
| 768 | </li> |
| 769 | <li data-day="5" <?php if (in_array('5', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 770 | Sat |
| 771 | </li> |
| 772 | <li data-day="6" <?php if (in_array('6', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 773 | Sun |
| 774 | </li> |
| 775 | </ul> |
| 776 | </div> |
| 777 | <div style="clear: both;"></div> |
| 778 | |
| 779 | <div id="times-container" style="margin-left: 5px;"> |
| 780 | <div style="margin-top: 10px; margin-bottom: 5px;"> |
| 781 | What times do you want this export to run? |
| 782 | </div> |
| 783 | |
| 784 | <div id="times" style="margin-bottom: 10px;"> |
| 785 | <?php if (is_array($schedulingExportOptions['scheduling_times'])) { |
| 786 | foreach ($schedulingExportOptions['scheduling_times'] as $time) { ?> |
| 787 | |
| 788 | <?php if ($time) { ?> |
| 789 | <input class="timepicker" type="text" name="scheduling_times[]" |
| 790 | value="<?php echo esc_attr($time); ?>"/> |
| 791 | <?php } ?> |
| 792 | <?php } ?> |
| 793 | <input class="timepicker" type="text" name="scheduling_times[]"/> |
| 794 | <?php } ?> |
| 795 | </div> |
| 796 | <div style="clear: both;"></div> |
| 797 | <div class="timezone-select" style="position:absolute; margin-top: 10px;"> |
| 798 | <?php |
| 799 | |
| 800 | $timezoneValue = false; |
| 801 | if ($schedulingExportOptions['scheduling_timezone']) { |
| 802 | $timezoneValue = $schedulingExportOptions['scheduling_timezone']; |
| 803 | } |
| 804 | |
| 805 | $timezoneSelect = new \Wpae\Scheduling\Timezone\TimezoneSelect(); |
| 806 | echo $timezoneSelect->getTimezoneSelect($timezoneValue); |
| 807 | ?> |
| 808 | </div> |
| 809 | </div> |
| 810 | <div style="height: 60px; margin-top: 30px; <?php if(!$hasActiveLicense) {?>display: none; <?php } ?>" id="subscribe-filler"> </div> |
| 811 | <?php |
| 812 | if (!$hasActiveLicense) { |
| 813 | ?> |
| 814 | <div class="subscribe" style="margin-left: 5px; margin-top: 65px; margin-bottom: 130px; position: relative;"> |
| 815 | <div class="button-container"> |
| 816 | |
| 817 | <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=515704" target="_blank" id="subscribe-button"> |
| 818 | <div class="button button-primary button-hero wpallexport-large-button button-subscribe" |
| 819 | style="background-image: none; width: 140px; text-align: center; position: absolute; z-index: 4;"> |
| 820 | <svg class="success" width="30" height="30" viewBox="0 0 1792 1792" |
| 821 | xmlns="http://www.w3.org/2000/svg" |
| 822 | style="fill: white; display: none; position: absolute; top: 6px; left: 15px;"> |
| 823 | <path |
| 824 | d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z" |
| 825 | fill="white"/> |
| 826 | </svg> |
| 827 | <svg class="error" width="30" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg" |
| 828 | style="fill: red; display: none; position: absolute; top: 6px; left: 15px;"> |
| 829 | <path d="M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"/></svg> |
| 830 | <div class="easing-spinner" style="display: none; position: absolute; left: 37px;"> |
| 831 | <div class="double-bounce1"></div> |
| 832 | <div class="double-bounce2"></div> |
| 833 | </div> |
| 834 | |
| 835 | <span class="subscribe-button-text"> |
| 836 | <?php esc_html_e('Subscribe'); ?> |
| 837 | </span> |
| 838 | </div> |
| 839 | </a> |
| 840 | </div> |
| 841 | <div class="text-container" style="position: absolute; left: 150px; top: 2px;"> |
| 842 | <p><?php esc_html_e('Get automatic scheduling for unlimited sites, just $19/mo.', PMXE_Plugin::LANGUAGE_DOMAIN); ?></p> |
| 843 | <p><?php esc_html_e('Have a license?', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 844 | <a href="#" id="add-subscription"><?php esc_html_e('Register this site.'); ?></a> <?php esc_html_e('Questions?', PMXE_Plugin::LANGUAGE_DOMAIN); ?> <a href="#" class="help_scheduling">Read more.</a></p> |
| 845 | <input type="password" id="add-subscription-field" style="position: absolute; z-index: 2; font-size: 14px;" placeholder="<?php esc_html_e('Enter your license', PMXE_Plugin::LANGUAGE_DOMAIN); ?>"/> |
| 846 | <div style="position: absolute;" id="find-subscription-link"><a href="http://www.wpallimport.com/portal/automatic-scheduling/" target="_blank"><?php esc_html_e('Find your license at the customer portal.', PMXE_Plugin::LANGUAGE_DOMAIN);?></a></div> |
| 847 | </div> |
| 848 | </div> |
| 849 | <?php |
| 850 | } ?> |
| 851 | </div> |
| 852 | <div style="clear:both"></div> |
| 853 | <?php require 'ManualScheduling.php'; ?> |
| 854 | </div> |
| 855 | </div> |
| 856 | </div> |
| 857 | |
| 858 | <div style="clear: both;"></div> |
| 859 | </div> |
| 860 | </div> |
| 861 | |
| 862 | <fieldset class="optionsset column rad4 wp-all-export-scheduling-help"> |
| 863 | |
| 864 | <div class="title"> |
| 865 | <span style="font-size:1.5em;" class="wpallexport-add-row-title"><?php esc_html_e('Automatic Scheduling', 'wp_all_export_plugin'); ?></span> |
| 866 | </div> |
| 867 | |
| 868 | <?php |
| 869 | include_once 'SchedulingHelp.php'; |
| 870 | ?> |
| 871 | </fieldset> |
| 872 |