| @@ -3,8 +3,34 @@ | ||
| 3 | 3 | jQuery('#mainwp-install-extensions-promo-modal').modal('show'); |
| 4 | 4 | return false; |
| 5 | 5 | }); |
| 6 | 6 | |
| 7 | +jQuery(document).on('click', '#mainwp-extension-update-check-retry', function () { | |
| 8 | + let button = jQuery(this); | |
| 9 | + let status = jQuery('#mainwp-extension-update-check-retry-status'); | |
| 10 | + let failedText = button.data('failed-text'); | |
| 11 | + | |
| 12 | + button.addClass('loading disabled').prop('disabled', true); | |
| 13 | + status.text(''); | |
| 14 | + | |
| 15 | + jQuery.post(ajaxurl, mainwp_secure_data({ | |
| 16 | + action: 'mainwp_extension_update_check_retry' | |
| 17 | + }), function (response) { | |
| 18 | + if (response && response.result === 'SUCCESS') { | |
| 19 | + location.reload(); | |
| 20 | + return; | |
| 21 | + } | |
| 22 | + | |
| 23 | + status.text(response && response.error ? response.error : failedText); | |
| 24 | + button.removeClass('loading disabled').prop('disabled', false); | |
| 25 | + }, 'json').fail(function () { | |
| 26 | + status.text(failedText); | |
| 27 | + button.removeClass('loading disabled').prop('disabled', false); | |
| 28 | + }); | |
| 29 | + | |
| 30 | + return false; | |
| 31 | +}); | |
| 32 | + | |
| 7 | 33 | jQuery(document).on('click', '#mainwp-extensions-show-all', function () { |
| 8 | 34 | jQuery(this).addClass('green'); |
| 9 | 35 | jQuery('#mainwp-extensions-show-extensions').removeClass('green'); |
| 10 | 36 | jQuery('#mainwp-extensions-show-integrations').removeClass('green'); |
| @@ -267,13 +293,13 @@ | ||
| 267 | 293 | let $btn = jQuery(this); // ✅ store correct context |
| 268 | 294 | |
| 269 | 295 | loadingEl.show(); |
| 270 | 296 | |
| 271 | - let msg = __('Disabling add-on...'); | |
| 297 | + let msg = MainWP.I18n.t('Disabling add-on...'); | |
| 272 | 298 | if (whatAct === 'active') { |
| 273 | - msg = __('Enabling add-on...'); | |
| 299 | + msg = MainWP.I18n.t('Enabling add-on...'); | |
| 274 | 300 | } else if (whatAct === 'remove') { |
| 275 | - msg = __('Removing add-on...'); | |
| 301 | + msg = MainWP.I18n.t('Removing add-on...'); | |
| 276 | 302 | } |
| 277 | 303 | |
| 278 | 304 | loadingEl.find('.ui.text.loader').html(msg); |
| 279 | 305 | |
| @@ -286,9 +312,9 @@ | ||
| 286 | 312 | function handleAddonResponse(response) { |
| 287 | 313 | $btn.attr('disabled', false); // ✅ correct button |
| 288 | 314 | |
| 289 | 315 | if (!response) { |
| 290 | - showError(__('Undefined error')); | |
| 316 | + showError(MainWP.I18n.t('Undefined error')); | |
| 291 | 317 | return; |
| 292 | 318 | } |
| 293 | 319 | |
| 294 | 320 | if (response.result === 'SUCCESS') { |
| @@ -300,18 +326,18 @@ | ||
| 300 | 326 | showError(response.error); |
| 301 | 327 | return; |
| 302 | 328 | } |
| 303 | 329 | |
| 304 | - showError(__('Undefined error')); | |
| 330 | + showError(MainWP.I18n.t('Undefined error')); | |
| 305 | 331 | } |
| 306 | 332 | |
| 307 | 333 | function handleSuccess() { |
| 308 | - let msg = __('Add-on disabled'); | |
| 334 | + let msg = MainWP.I18n.t('Add-on disabled'); | |
| 309 | 335 | |
| 310 | 336 | if (whatAct === 'active') { |
| 311 | - msg = __('Add-on enabled'); | |
| 337 | + msg = MainWP.I18n.t('Add-on enabled'); | |
| 312 | 338 | } else if (whatAct === 'remove') { |
| 313 | - msg = __('Add-on removed'); | |
| 339 | + msg = MainWP.I18n.t('Add-on removed'); | |
| 314 | 340 | } |
| 315 | 341 | |
| 316 | 342 | loadingEl.find('.ui.text.loader').html(msg); |
| 317 | 343 | |
| @@ -333,9 +359,9 @@ | ||
| 333 | 359 | jQuery.post(ajaxurl, data, handleAddonResponse, 'json'); |
| 334 | 360 | }; |
| 335 | 361 | |
| 336 | 362 | if ('remove' === whatAct) { |
| 337 | - let msg = __('Are you sure you want to remove this add-on?'); | |
| 363 | + let msg = MainWP.I18n.t('Are you sure you want to remove this add-on?'); | |
| 338 | 364 | mainwp_confirm(msg, _callback); |
| 339 | 365 | } else { |
| 340 | 366 | _callback(); |
| 341 | 367 | } |
| @@ -361,9 +387,9 @@ | ||
| 361 | 387 | let data = false; |
| 362 | 388 | |
| 363 | 389 | if (retring) { |
| 364 | 390 | loadingEl.show(); |
| 365 | - loadingEl.find('.ui.text.loader').html(__('Connection error detected. The Verify Certificate option has been switched to NO. Retrying...')); | |
| 391 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Connection error detected. The Verify Certificate option has been switched to NO. Retrying...')); | |
| 366 | 392 | } else { |
| 367 | 393 | let extensionSlug = jQuery(apiEl).attr('extension-slug'); |
| 368 | 394 | let key = apiEl.find('input[type="text"].extension-api-key').val(); |
| 369 | 395 | let email = apiEl.find('input[type="text"].extension-api-email').val(); |
| @@ -379,9 +405,9 @@ | ||
| 379 | 405 | }); |
| 380 | 406 | } |
| 381 | 407 | |
| 382 | 408 | loadingEl.show(); |
| 383 | - loadingEl.find('.ui.text.loader').html(__('Activating license...')); | |
| 409 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Activating license...')); | |
| 384 | 410 | |
| 385 | 411 | jQuery.post(ajaxurl, data, function (response) { |
| 386 | 412 | |
| 387 | 413 | let success = false; |
| @@ -387,9 +413,9 @@ | ||
| 387 | 413 | let success = false; |
| 388 | 414 | |
| 389 | 415 | if (response) { |
| 390 | 416 | if (response.result == 'SUCCESS') { |
| 391 | - loadingEl.find('.ui.text.loader').html(__('License activated')); | |
| 417 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('License activated')); | |
| 392 | 418 | statusEl.html('<i class="green key icon"></i> Licensed'); |
| 393 | 419 | success = true; |
| 394 | 420 | } else if (response.error) { |
| 395 | 421 | loadingEl.find('.ui.text.loader').html(response.error); |
| @@ -397,15 +423,15 @@ | ||
| 397 | 423 | jQuery("#mainwp_api_sslVerifyCertificate").val(0); |
| 398 | 424 | mainwp_extensions_activate(pObj, true); |
| 399 | 425 | return false; |
| 400 | 426 | } else { |
| 401 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 427 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 402 | 428 | setTimeout(function () { |
| 403 | 429 | loadingEl.hide(); |
| 404 | 430 | }, 3000); |
| 405 | 431 | } |
| 406 | 432 | } else { |
| 407 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 433 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 408 | 434 | setTimeout(function () { |
| 409 | 435 | loadingEl.hide(); |
| 410 | 436 | }, 3000); |
| 411 | 437 | } |
| @@ -442,16 +468,16 @@ | ||
| 442 | 468 | api_key: extensionApiKey |
| 443 | 469 | }); |
| 444 | 470 | |
| 445 | 471 | loadingEl.show(); |
| 446 | - loadingEl.find('.ui.text.loader').html(__('Deactivating license...')); | |
| 472 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Deactivating license...')); | |
| 447 | 473 | |
| 448 | 474 | jQuery.post(ajaxurl, data, function (response) { |
| 449 | 475 | |
| 450 | 476 | if (response) { |
| 451 | 477 | if (response.result == 'SUCCESS') { |
| 452 | - loadingEl.find('.ui.text.loader').html(__('License deactivated')); | |
| 453 | - statusEl.html('<i class="red key icon"></i> ' + __('Activate License')); | |
| 478 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('License deactivated')); | |
| 479 | + statusEl.html('<i class="red key icon"></i> ' + MainWP.I18n.t('Activate License')); | |
| 454 | 480 | statusEl.attr('api-actived', '0'); |
| 455 | 481 | } else if (response.error) { |
| 456 | 482 | loadingEl.find('.ui.text.loader').html(response.error); |
| 457 | 483 | setTimeout(function () { |
| @@ -457,15 +483,15 @@ | ||
| 457 | 483 | setTimeout(function () { |
| 458 | 484 | loadingEl.hide(); |
| 459 | 485 | }, 3000); |
| 460 | 486 | } else { |
| 461 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 487 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 462 | 488 | setTimeout(function () { |
| 463 | 489 | loadingEl.hide(); |
| 464 | 490 | }, 3000); |
| 465 | 491 | } |
| 466 | 492 | } else { |
| 467 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 493 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 468 | 494 | setTimeout(function () { |
| 469 | 495 | loadingEl.hide(); |
| 470 | 496 | }, 3000); |
| 471 | 497 | } |
| @@ -492,12 +518,12 @@ | ||
| 492 | 518 | saveLogin: jQuery('#extensions_api_savemylogin_chk').is(':checked') ? 1 : 0 |
| 493 | 519 | }); |
| 494 | 520 | |
| 495 | 521 | if (retring) { |
| 496 | - statusEl.find('.text').html(__("Connection error detected. The Verify Certificate option has been switched to NO. Retrying...")).fadeIn(); | |
| 522 | + statusEl.find('.text').html(MainWP.I18n.t("Connection error detected. The Verify Certificate option has been switched to NO. Retrying...")).fadeIn(); | |
| 497 | 523 | } else { |
| 498 | 524 | |
| 499 | - statusEl.find('.text').html(__('Validating...')); | |
| 525 | + statusEl.find('.text').html(MainWP.I18n.t('Validating...')); | |
| 500 | 526 | } |
| 501 | 527 | |
| 502 | 528 | statusEl.show(); |
| 503 | 529 | |
| @@ -507,9 +533,9 @@ | ||
| 507 | 533 | if (response) { |
| 508 | 534 | if (response.saved) { |
| 509 | 535 | isSuccess = true; |
| 510 | 536 | if (autoTriggerInstall) { |
| 511 | - statusEl.find('.text').html(__('Loading add-ons info...')); | |
| 537 | + statusEl.find('.text').html(MainWP.I18n.t('Loading add-ons info...')); | |
| 512 | 538 | mainwp_extension_grab_purchased(false); |
| 513 | 539 | } else { |
| 514 | 540 | statusEl.find('.text').html('Your API license key has been successfully saved!'); |
| 515 | 541 | } |
| @@ -515,9 +541,9 @@ | ||
| 515 | 541 | } |
| 516 | 542 | } else if (response.result == 'SUCCESS') { |
| 517 | 543 | isSuccess = true; |
| 518 | 544 | if (autoTriggerInstall) { |
| 519 | - statusEl.find('.text').html(__('Loading add-ons info...')); | |
| 545 | + statusEl.find('.text').html(MainWP.I18n.t('Loading add-ons info...')); | |
| 520 | 546 | mainwp_extension_grab_purchased(false); |
| 521 | 547 | } else { |
| 522 | 548 | statusEl.find('.text').html('API license key verification successful!'); |
| 523 | 549 | } |
| @@ -535,9 +561,9 @@ | ||
| 535 | 561 | undefError = true; |
| 536 | 562 | } |
| 537 | 563 | |
| 538 | 564 | if (undefError) { |
| 539 | - statusEl.find('.text').html(__('Undefined error. Please try again.')); | |
| 565 | + statusEl.find('.text').html(MainWP.I18n.t('Undefined error. Please try again.')); | |
| 540 | 566 | } |
| 541 | 567 | |
| 542 | 568 | if (!autoTriggerInstall || response.error || undefError) { |
| 543 | 569 | setTimeout(function () { |
| @@ -605,9 +631,9 @@ | ||
| 605 | 631 | |
| 606 | 632 | currentActivateThreads++; |
| 607 | 633 | |
| 608 | 634 | loadingEl.show(); |
| 609 | - loadingEl.find('.ui.text.loader').html(__('Activating license...')); | |
| 635 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Activating license...')); | |
| 610 | 636 | |
| 611 | 637 | if (apiEl.attr('license-status') == 'activated') { |
| 612 | 638 | finishedActivateThreads++; |
| 613 | 639 | currentActivateThreads--; |
| @@ -625,9 +651,9 @@ | ||
| 625 | 651 | |
| 626 | 652 | if (response) { |
| 627 | 653 | if (response.result == 'SUCCESS') { |
| 628 | 654 | countSuccessActivation++; |
| 629 | - loadingEl.find('.ui.text.loader').html(__('License activated')); | |
| 655 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('License activated')); | |
| 630 | 656 | statusEl.html('<i class="green key icon"></i> Licensed'); |
| 631 | 657 | apiEl.attr('license-status', 'activated'); |
| 632 | 658 | loadingEl.hide(); |
| 633 | 659 | if (!bulkAct) { |
| @@ -640,15 +666,15 @@ | ||
| 640 | 666 | setTimeout(function () { |
| 641 | 667 | loadingEl.hide(); |
| 642 | 668 | }, 3000); |
| 643 | 669 | } else { |
| 644 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 670 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 645 | 671 | setTimeout(function () { |
| 646 | 672 | loadingEl.hide(); |
| 647 | 673 | }, 3000); |
| 648 | 674 | } |
| 649 | 675 | } else { |
| 650 | - loadingEl.find('.ui.text.loader').html(__('Undefined error')); | |
| 676 | + loadingEl.find('.ui.text.loader').html(MainWP.I18n.t('Undefined error')); | |
| 651 | 677 | setTimeout(function () { |
| 652 | 678 | loadingEl.hide(); |
| 653 | 679 | }, 3000); |
| 654 | 680 | } |
| @@ -678,21 +704,21 @@ | ||
| 678 | 704 | }); |
| 679 | 705 | |
| 680 | 706 | |
| 681 | 707 | if (api_key == '') { |
| 682 | - statusEl.find('.text').html(__("Main API Key is required.")); | |
| 708 | + statusEl.find('.text').html(MainWP.I18n.t("Main API Key is required.")); | |
| 683 | 709 | statusEl.show(); |
| 684 | 710 | setTimeout(function () { |
| 685 | 711 | statusEl.fadeOut(); |
| 686 | 712 | }, 3000); |
| 687 | 713 | } else if (retring) { |
| 688 | - statusEl.find('.text').html(__("Connection error detected. The Verify Certificate option has been switched to NO. Retrying...")); | |
| 714 | + statusEl.find('.text').html(MainWP.I18n.t("Connection error detected. The Verify Certificate option has been switched to NO. Retrying...")); | |
| 689 | 715 | setTimeout(function () { |
| 690 | 716 | statusEl.fadeOut(); |
| 691 | 717 | }, 3000); |
| 692 | 718 | } else { |
| 693 | 719 | statusEl.show(); |
| 694 | - statusEl.find('.text').html(__('Loading add-ons info...')); | |
| 720 | + statusEl.find('.text').html(MainWP.I18n.t('Loading add-ons info...')); | |
| 695 | 721 | jQuery.post(ajaxurl, data, function (response) { |
| 696 | 722 | let undefError = false; |
| 697 | 723 | if (response) { |
| 698 | 724 | if (response.result == 'SUCCESS') { |
| @@ -721,9 +747,9 @@ | ||
| 721 | 747 | } else { |
| 722 | 748 | undefError = true; |
| 723 | 749 | } |
| 724 | 750 | if (undefError) { |
| 725 | - statusEl.find('.text').html(__('Undefined error occurred. Please try again.')); | |
| 751 | + statusEl.find('.text').html(MainWP.I18n.t('Undefined error occurred. Please try again.')); | |
| 726 | 752 | } |
| 727 | 753 | setTimeout(function () { |
| 728 | 754 | statusEl.fadeOut(); |
| 729 | 755 | }, 3000); |
| @@ -754,9 +780,9 @@ | ||
| 754 | 780 | |
| 755 | 781 | statusEl.removeClass('green'); |
| 756 | 782 | statusEl.removeClass('yellow'); |
| 757 | 783 | statusEl.show(); |
| 758 | - statusEl.find('.text').html(__('Running. Please wait...')); | |
| 784 | + statusEl.find('.text').html(MainWP.I18n.t('Running. Please wait...')); | |
| 759 | 785 | jQuery.post(ajaxurl, data, function (response) { |
| 760 | 786 | let undefError = false; |
| 761 | 787 | if (response) { |
| 762 | 788 | if (response.result == 'SUCCESS') { |
| @@ -783,9 +809,9 @@ | ||
| 783 | 809 | } |
| 784 | 810 | |
| 785 | 811 | if (undefError) { |
| 786 | 812 | statusEl.addClass('red'); |
| 787 | - statusEl.find('.text').html(__('Undefined error. Please try again.')).fadeIn(); | |
| 813 | + statusEl.find('.text').html(MainWP.I18n.t('Undefined error. Please try again.')).fadeIn(); | |
| 788 | 814 | } |
| 789 | 815 | setTimeout(function () { |
| 790 | 816 | statusEl.fadeOut(); |
| 791 | 817 | }, 3000); |
| @@ -816,9 +842,9 @@ | ||
| 816 | 842 | |
| 817 | 843 | if (bulkExtensionsTotal == 0) |
| 818 | 844 | return false; |
| 819 | 845 | |
| 820 | - jQuery('.mainwp-installing-extensions input[type="checkbox"][status="queue"]:checked').closest('.extension-to-install').find('.installing-extension[status="queue"]').html('<i class="clock outline icon"></i> ' + __('Queued')); | |
| 846 | + jQuery('.mainwp-installing-extensions input[type="checkbox"][status="queue"]:checked').closest('.extension-to-install').find('.installing-extension[status="queue"]').html('<i class="clock outline icon"></i> ' + MainWP.I18n.t('Queued')); | |
| 821 | 847 | |
| 822 | 848 | mainwp_extension_bulk_install_next(); |
| 823 | 849 | } |
| 824 | 850 | |
| @@ -866,9 +892,9 @@ | ||
| 866 | 892 | response = JSON.parse(response_json); |
| 867 | 893 | } |
| 868 | 894 | |
| 869 | 895 | if (response == '') { |
| 870 | - statusEl.html('<span data-tooltip="Undefined error occured. Please try again." data-inverted="" data-position="left center"><i class="times red icon"></i></span>'); | |
| 896 | + statusEl.html('<span data-tooltip="Undefined error occurred. Please try again." data-inverted="" data-position="left center"><i class="times red icon"></i></span>'); | |
| 871 | 897 | } else if (response.result == 'SUCCESS') { |
| 872 | 898 | statusEl.html('<span data-tooltip="' + response.output + '" data-inverted="" data-position="left center"><i class="check green icon"></i></span>'); |
| 873 | 899 | jQuery('.mainwp-installing-extensions').append('<span class="extension-installed-success" slug="' + response.slug + '"></span>') |
| 874 | 900 | } else if (response.error) { |
| @@ -873,9 +899,9 @@ | ||
| 873 | 899 | jQuery('.mainwp-installing-extensions').append('<span class="extension-installed-success" slug="' + response.slug + '"></span>') |
| 874 | 900 | } else if (response.error) { |
| 875 | 901 | statusEl.html('<span data-tooltip="' + response.error + '" data-inverted="" data-position="left center"><i class="times red icon"></i></span>'); |
| 876 | 902 | } else { |
| 877 | - statusEl.html('<span data-tooltip="Undefined error occured. Please try again." data-inverted="" data-position="left center"><i class="times red icon"></i></span>'); | |
| 903 | + statusEl.html('<span data-tooltip="Undefined error occurred. Please try again." data-inverted="" data-position="left center"><i class="times red icon"></i></span>'); | |
| 878 | 904 | } |
| 879 | 905 | |
| 880 | 906 | mainwp_extension_bulk_install_next(); |
| 881 | 907 | } |
| @@ -903,14 +929,14 @@ | ||
| 903 | 929 | }); |
| 904 | 930 | |
| 905 | 931 | let statusEl = jQuery('#mainwp-bulk-activating-extensions-status'); |
| 906 | 932 | |
| 907 | - statusEl.html('<i class="notched circle loading icon"></i>' + __('Activating add-ons. Please wait...')).show(); | |
| 933 | + statusEl.html('<i class="notched circle loading icon"></i>' + MainWP.I18n.t('Activating add-ons. Please wait...')).show(); | |
| 908 | 934 | jQuery.post(ajaxurl, data, function (response) { |
| 909 | 935 | statusEl.html(''); |
| 910 | 936 | if (response == 'SUCCESS') { |
| 911 | 937 | statusEl.addClass('green'); |
| 912 | - statusEl.html(__('Add-ons have been activated successfully!')); | |
| 938 | + statusEl.html(MainWP.I18n.t('Add-ons have been activated successfully!')); | |
| 913 | 939 | statusEl.fadeOut(3000); |
| 914 | 940 | } |
| 915 | 941 | mainwp_extension_bulk_install_done(); |
| 916 | 942 | }); |
| @@ -921,9 +947,9 @@ | ||
| 921 | 947 | |
| 922 | 948 | let statusEl = jQuery('#mainwp-bulk-activating-extensions-status'); |
| 923 | 949 | |
| 924 | 950 | statusEl.addClass('green'); |
| 925 | - statusEl.html(__("Installation completed successfully. Page will reload automatically in 3 seconds.")).show(); | |
| 951 | + statusEl.html(MainWP.I18n.t("Installation completed successfully. Page will reload automatically in 3 seconds.")).show(); | |
| 926 | 952 | if (jQuery('.extension-installed-success').length == bulkExtensionsFinished) { |
| 927 | 953 | setTimeout(function () { |
| 928 | 954 | mainwp_forceReload('admin.php?page=Extensions'); |
| 929 | 955 | }, 3000); |