← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php
+6
-37
4.0.7
→
3.11.8
View file →
| @@ -138,10 +138,9 @@ | ||
| 138 | 138 | |
| 139 | 139 | ?> |
| 140 | 140 | <div class="ti-theme-uninstall-feedback-drawer ti-feedback"> |
| 141 | 141 | <div class="popup--header"> |
| 142 | - <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?></h5> | |
| 143 | - <?php $this->do_popup_header_after_heading_action( 'theme' ); ?> | |
| 142 | + <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?> </h5> | |
| 144 | 143 | <button class="toggle"><span>×</span></button> |
| 145 | 144 | </div><!--/.popup--header--> |
| 146 | 145 | <div class="popup--body"> |
| 147 | 146 | <?php $this->render_options_list( $options ); ?> |
| @@ -485,21 +484,8 @@ | ||
| 485 | 484 | do_action( $this->product->get_key() . '_uninstall_feedback_after_js' ); |
| 486 | 485 | } |
| 487 | 486 | |
| 488 | 487 | /** |
| 489 | - * Fires after the popup header heading, allowing products to output extra markup. | |
| 490 | - * | |
| 491 | - * @param string $context Popup context. Either `theme` or `plugin`. | |
| 492 | - */ | |
| 493 | - private function do_popup_header_after_heading_action( $context ) { | |
| 494 | - do_action( | |
| 495 | - $this->product->get_key() . '_uninstall_feedback_popup_header_after_heading', | |
| 496 | - $this->product, | |
| 497 | - $context | |
| 498 | - ); | |
| 499 | - } | |
| 500 | - | |
| 501 | - /** | |
| 502 | 488 | * Render the options list. |
| 503 | 489 | * |
| 504 | 490 | * @param array $options the options for the feedback form. |
| 505 | 491 | */ |
| @@ -548,9 +534,8 @@ | ||
| 548 | 534 | <div class="ti-plugin-uninstall-feedback-popup ti-feedback" |
| 549 | 535 | id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>"> |
| 550 | 536 | <div class="popup--header"> |
| 551 | 537 | <h5><?php echo wp_kses( Loader::$labels['uninstall']['heading_plugin'], array( 'span' => true ) ); ?> </h5> |
| 552 | - <?php $this->do_popup_header_after_heading_action( 'plugin' ); ?> | |
| 553 | 538 | </div><!--/.popup--header--> |
| 554 | 539 | <div class="popup--body"> |
| 555 | 540 | <?php $this->render_options_list( $options ); ?> |
| 556 | 541 | </div><!--/.popup--body--> |
| @@ -595,16 +580,15 @@ | ||
| 595 | 580 | <script type="text/javascript" id="ti-deactivate-js"> |
| 596 | 581 | (function ($) { |
| 597 | 582 | $(document).ready(function () { |
| 598 | 583 | var targetElement = 'tr[data-plugin^="<?php echo esc_attr( $this->product->get_slug() ); ?>/"] span.deactivate a'; |
| 599 | - var $deactivateLink = $(targetElement); | |
| 600 | - var redirectUrl = $deactivateLink.attr('href'); | |
| 584 | + var redirectUrl = $(targetElement).attr('href'); | |
| 601 | 585 | if ($('.ti-feedback-overlay').length === 0) { |
| 602 | 586 | $('body').prepend('<div class="ti-feedback-overlay"></div>'); |
| 603 | 587 | } |
| 604 | - $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($deactivateLink.parent()); | |
| 588 | + $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($(targetElement).parent()); | |
| 605 | 589 | |
| 606 | - $deactivateLink.on('click', function (e) { | |
| 590 | + $(targetElement).on('click', function (e) { | |
| 607 | 591 | e.preventDefault(); |
| 608 | 592 | $('<?php echo esc_attr( $popup_id ); ?> ').addClass('active'); |
| 609 | 593 | $('body').addClass('ti-feedback-open'); |
| 610 | 594 | $('.ti-feedback-overlay').on('click', function () { |
| @@ -637,9 +621,9 @@ | ||
| 637 | 621 | |
| 638 | 622 | $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-no').on('click', function (e) { |
| 639 | 623 | e.preventDefault(); |
| 640 | 624 | e.stopPropagation(); |
| 641 | - $deactivateLink.unbind('click'); | |
| 625 | + $(targetElement).unbind('click'); | |
| 642 | 626 | $('body').removeClass('ti-feedback-open'); |
| 643 | 627 | $('<?php echo esc_attr( $popup_id ); ?>').remove(); |
| 644 | 628 | if (redirectUrl !== '') { |
| 645 | 629 | location.href = redirectUrl; |
| @@ -648,9 +632,9 @@ | ||
| 648 | 632 | |
| 649 | 633 | $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) { |
| 650 | 634 | e.preventDefault(); |
| 651 | 635 | e.stopPropagation(); |
| 652 | - $deactivateLink.unbind('click'); | |
| 636 | + $(targetElement).unbind('click'); | |
| 653 | 637 | var selectedOption = $( |
| 654 | 638 | '<?php echo esc_attr( $popup_id ); ?> input[name="ti-deactivate-option"]:checked'); |
| 655 | 639 | var data = { |
| 656 | 640 | 'action': '<?php echo esc_attr( $key ) . '_uninstall_feedback'; ?>', |
| @@ -700,9 +684,8 @@ | ||
| 700 | 684 | sprintf( Loader::$labels['uninstall']['disclosure']['version'], '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ), |
| 701 | 685 | sprintf( Loader::$labels['uninstall']['disclosure']['website'], '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ), |
| 702 | 686 | sprintf( Loader::$labels['uninstall']['disclosure']['usage'], '<strong>', '</strong>', '<code>', ( time() - $this->product->get_install_time() ), 's</code>' ), |
| 703 | 687 | sprintf( Loader::$labels['uninstall']['disclosure']['reason'], '<strong>', '</strong>', '<i>', '</i>' ), |
| 704 | - sprintf( Loader::$labels['uninstall']['disclosure']['diagnostics'], '<strong>', '</strong>' ), | |
| 705 | 688 | ], |
| 706 | 689 | ], |
| 707 | 690 | $disclosure_new_labels |
| 708 | 691 | ); |
| @@ -786,22 +769,8 @@ | ||
| 786 | 769 | $attributes['slug'] = $slug; |
| 787 | 770 | $attributes['version'] = $version; |
| 788 | 771 | $attributes['url'] = get_site_url(); |
| 789 | 772 | $attributes['active_time'] = ( time() - $this->product->get_install_time() ); |
| 790 | - | |
| 791 | - /** | |
| 792 | - * Piggyback the compact crash summary on the same request, regardless | |
| 793 | - * of the logging consent — disclosed in the survey data collection | |
| 794 | - * notice. Only crashes attributed to this product are ever stored. | |
| 795 | - */ | |
| 796 | - if ( class_exists( 'ThemeisleSDK\Modules\Crash_Reporter' ) ) { | |
| 797 | - $crashes = Crash_Reporter::get_uninstall_summary( $this->product ); | |
| 798 | - if ( ! empty( $crashes ) ) { | |
| 799 | - $attributes['crashes'] = wp_json_encode( $crashes ); | |
| 800 | - } | |
| 801 | - } | |
| 802 | - | |
| 803 | - $attributes = apply_filters( 'themeisle_sdk_uninstall_feedback_data', $attributes, $this->product ); | |
| 804 | 773 | |
| 805 | 774 | $response = wp_remote_post( |
| 806 | 775 | self::FEEDBACK_ENDPOINT, |
| 807 | 776 | array( |