PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.9
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.9
4.0.9 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 All 150 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php +101 -92 3.10.2 → 4.0.9 View file →
@@ -11,8 +11,9 @@
11 11
12 12 namespace ThemeisleSDK\Modules;
13 13
14 14 use ThemeisleSDK\Common\Abstract_Module;
15 +use ThemeisleSDK\Loader;
15 16 use ThemeisleSDK\Product;
16 17
17 18 // Exit if accessed directly.
18 19 if ( ! defined( 'ABSPATH' ) ) {
@@ -47,27 +48,24 @@
47 48 *
48 49 * @var array $options_plugin The main options list for plugins.
49 50 */
50 51 private $options_plugin = array(
51 - 'I found a better plugin' => array(
52 - 'id' => 3,
53 - 'type' => 'text',
54 - 'placeholder' => 'What\'s the plugin\'s name?',
52 + 'id3' => array(
53 + 'id' => 3,
54 + 'type' => 'text',
55 +
55 56 ),
56 - 'I could not get the plugin to work' => array(
57 - 'type' => 'textarea',
58 - 'placeholder' => 'What problem are you experiencing?',
59 - 'id' => 4,
57 + 'id4' => array(
58 + 'type' => 'textarea',
59 + 'id' => 4,
60 60 ),
61 - 'I no longer need the plugin' => array(
62 - 'id' => 5,
63 - 'type' => 'textarea',
64 - 'placeholder' => 'If you could improve one thing about our product, what would it be?',
61 + 'id5' => array(
62 + 'id' => 5,
63 + 'type' => 'textarea',
65 64 ),
66 - 'It\'s a temporary deactivation. I\'m just debugging an issue.' => array(
67 - 'type' => 'textarea',
68 - 'placeholder' => 'What problem are you experiencing?',
69 - 'id' => 6,
65 + 'id6' => array(
66 + 'type' => 'textarea',
67 + 'id' => 6,
70 68 ),
71 69 );
72 70 /**
73 71 * Default options for theme.
@@ -74,23 +72,23 @@
74 72 *
75 73 * @var array $options_theme The main options list for themes.
76 74 */
77 75 private $options_theme = array(
78 - 'I don\'t know how to make it look like demo' => array(
76 + 'id7' => array(
79 77 'id' => 7,
80 78 ),
81 - 'It lacks options' => array(
82 - 'placeholder' => 'What option is missing?',
83 - 'type' => 'text',
84 - 'id' => 8,
79 + 'id8' => array(
80 + 'type' => 'text',
81 + 'id' => 8,
85 82 ),
86 - 'Is not working with a plugin that I need' => array(
87 - 'id' => 9,
88 - 'type' => 'text',
89 - 'placeholder' => 'What is the name of the plugin',
83 + 'id9' => array(
84 + 'id' => 9,
85 + 'type' => 'text',
90 86 ),
91 - 'I want to try a new design, I don\'t like {theme} style' => array(
92 - 'id' => 10,
87 + 'id10' => array(
88 +
89 + 'title' => '',
90 + 'id' => 10,
93 91 ),
94 92 );
95 93 /**
96 94 * Default other option.
@@ -97,38 +95,13 @@
97 95 *
98 96 * @var array $other The other option
99 97 */
100 98 private $other = array(
101 - 'Other' => array(
102 - 'id' => 999,
103 - 'type' => 'textarea',
104 - 'placeholder' => 'What can we do better?',
99 + 'id999' => array(
100 + 'id' => 999,
101 + 'type' => 'textarea',
105 102 ),
106 103 );
107 - /**
108 - * Default heading for plugin.
109 - *
110 - * @var string $heading_plugin The heading of the modal
111 - */
112 - private $heading_plugin = 'What\'s wrong?';
113 - /**
114 - * Default heading for theme.
115 - *
116 - * @var string $heading_theme The heading of the modal
117 - */
118 - private $heading_theme = 'What does not work for you in {theme}?';
119 - /**
120 - * Default submit button action text.
121 - *
122 - * @var string $button_submit The text of the deactivate button
123 - */
124 - private $button_submit = 'Submit & Deactivate';
125 - /**
126 - * Default cancel button.
127 - *
128 - * @var string $button_cancel The text of the cancel button
129 - */
130 - private $button_cancel = 'Skip & Deactivate';
131 104
132 105 /**
133 106 * Loads the additional resources
134 107 */
@@ -154,13 +127,13 @@
154 127 /**
155 128 * Render theme feedback drawer.
156 129 */
157 130 private function render_theme_feedback_popup() {
158 - $heading = str_replace( '{theme}', $this->product->get_name(), $this->heading_theme );
159 - $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', 'Submit' );
131 + $heading = str_replace( '{theme}', $this->product->get_name(), Loader::$labels['uninstall']['heading_theme'] );
132 + $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', Loader::$labels['uninstall']['submit'] );
160 133 $options = $this->options_theme;
161 134 $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $options ) );
162 - $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', 'What info do we collect?' ) . '</a>';
135 + $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', Loader::$labels['uninstall']['cta_info'] ) . '</a>';
163 136
164 137 $options += $this->other;
165 138
166 139 ?>
@@ -165,9 +138,10 @@
165 138
166 139 ?>
167 140 <div class="ti-theme-uninstall-feedback-drawer ti-feedback">
168 141 <div class="popup--header">
169 - <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?> </h5>
142 + <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?></h5>
143 + <?php $this->do_popup_header_after_heading_action( 'theme' ); ?>
170 144 <button class="toggle"><span>&times;</span></button>
171 145 </div><!--/.popup--header-->
172 146 <div class="popup--body">
173 147 <?php $this->render_options_list( $options ); ?>
@@ -235,9 +209,9 @@
235 209 font-size: 13px;
236 210 }
237 211
238 212 .ti-feedback .popup--form input[type="radio"] {
239 - <?php echo is_rtl() ? 'margin: 0 0 0 10px;' : 'margin: 0 10px 0 0;'; ?>
213 + <?php echo is_rtl() ? 'margin: 0 0 0 10px;' : 'margin: 0 10px 0 0;'; ?>
240 214 }
241 215
242 216 .ti-feedback .popup--form input[type="radio"]:checked ~ textarea {
243 217 display: block;
@@ -313,9 +287,9 @@
313 287 width: 100%;
314 288 }
315 289
316 290 .ti-feedback .buttons input:last-child {
317 - <?php echo is_rtl() ? 'margin-right: auto;' : 'margin-left: auto;'; ?>
291 + <?php echo is_rtl() ? 'margin-right: auto;' : 'margin-left: auto;'; ?>
318 292 }
319 293
320 294 .ti-theme-uninstall-feedback-drawer {
321 295 border-top-left-radius: 5px;
@@ -367,19 +341,19 @@
367 341 display: block;
368 342 position: absolute;
369 343 top: 50%;
370 344 transform: translateY(-50%);
371 - <?php
372 - echo is_rtl() ?
373 - 'right: -10px;
374 - border-top: 20px solid transparent;
375 - border-left: 20px solid #23A1CE;
376 - border-bottom: 20px solid transparent;' :
377 - 'left: -10px;
378 - border-top: 20px solid transparent;
379 - border-right: 20px solid #23A1CE;
380 - border-bottom: 20px solid transparent;';
381 - ?>
345 + <?php
346 + echo is_rtl() ?
347 + 'right: -10px;
348 + border-top: 20px solid transparent;
349 + border-left: 20px solid #23A1CE;
350 + border-bottom: 20px solid transparent;' :
351 + 'left: -10px;
352 + border-top: 20px solid transparent;
353 + border-right: 20px solid #23A1CE;
354 + border-bottom: 20px solid transparent;';
355 + ?>
382 356 }
383 357
384 358 .ti-plugin-uninstall-feedback-popup {
385 359 display: none;
@@ -385,10 +359,9 @@
385 359 display: none;
386 360 position: absolute;
387 361 white-space: normal;
388 362 width: 400px;
389 - <?php echo is_rtl() ? 'right: calc( 100% + 15px );' : 'left: calc( 100% + 15px );'; ?>
390 - top: -15px;
363 + <?php echo is_rtl() ? 'right: calc( 100% + 15px );' : 'left: calc( 100% + 15px );'; ?> top: -15px;
391 364 }
392 365
393 366 .ti-plugin-uninstall-feedback-popup.sending-feedback .popup--body i {
394 367 animation: rotation 2s infinite linear;
@@ -512,8 +485,21 @@
512 485 do_action( $this->product->get_key() . '_uninstall_feedback_after_js' );
513 486 }
514 487
515 488 /**
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 + /**
516 502 * Render the options list.
517 503 *
518 504 * @param array $options the options for the feedback form.
519 505 */
@@ -524,17 +510,22 @@
524 510 'textarea' => 2,
525 511 ];
526 512 ?>
527 513 <ul class="popup--form">
528 - <?php foreach ( $options as $title => $attributes ) { ?>
514 + <?php
515 + foreach ( $options as $idx => $attributes ) {
516 + $title = Loader::$labels['uninstall']['options'][ $idx ]['title'];
517 + $placeholder = array_key_exists( 'placeholder', Loader::$labels['uninstall']['options'][ $idx ] ) ? Loader::$labels['uninstall']['options'][ $idx ]['placeholder'] : '';
518 + ?>
529 519 <li ti-option-id="<?php echo esc_attr( $attributes['id'] ); ?>">
530 - <input type="radio" name="ti-deactivate-option" id="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
520 + <input type="radio" name="ti-deactivate-option"
521 + id="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
531 522 <label for="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
532 523 <?php echo esc_attr( str_replace( '{theme}', $this->product->get_name(), $title ) ); ?>
533 524 </label>
534 525 <?php
535 526 if ( array_key_exists( 'type', $attributes ) ) {
536 - $placeholder = array_key_exists( 'placeholder', $attributes ) ? $attributes['placeholder'] : '';
527 +
537 528 echo '<textarea width="100%" rows="' . esc_attr( $inputs_row_map[ $attributes['type'] ] ) . '" name="comments" placeholder="' . esc_attr( $placeholder ) . '"></textarea>';
538 529 }
539 530 ?>
540 531 </li>
@@ -546,18 +537,20 @@
546 537 /**
547 538 * Render plugin feedback popup.
548 539 */
549 540 private function render_plugin_feedback_popup() {
550 - $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', $this->button_cancel );
551 - $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', $this->button_submit );
541 + $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', Loader::$labels['uninstall']['button_cancel'] );
542 + $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', Loader::$labels['uninstall']['button_submit'] );
552 543 $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $this->options_plugin ) );
553 - $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', 'What info do we collect?' ) . '</a>';
544 + $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', Loader::$labels['uninstall']['cta_info'] ) . '</a>';
554 545
555 546 $options += $this->other;
556 547 ?>
557 - <div class="ti-plugin-uninstall-feedback-popup ti-feedback" id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
548 + <div class="ti-plugin-uninstall-feedback-popup ti-feedback"
549 + id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
558 550 <div class="popup--header">
559 - <h5><?php echo wp_kses( $this->heading_plugin, array( 'span' => true ) ); ?> </h5>
551 + <h5><?php echo wp_kses( Loader::$labels['uninstall']['heading_plugin'], array( 'span' => true ) ); ?> </h5>
552 + <?php $this->do_popup_header_after_heading_action( 'plugin' ); ?>
560 553 </div><!--/.popup--header-->
561 554 <div class="popup--body">
562 555 <?php $this->render_options_list( $options ); ?>
563 556 </div><!--/.popup--body-->
@@ -602,15 +595,16 @@
602 595 <script type="text/javascript" id="ti-deactivate-js">
603 596 (function ($) {
604 597 $(document).ready(function () {
605 598 var targetElement = 'tr[data-plugin^="<?php echo esc_attr( $this->product->get_slug() ); ?>/"] span.deactivate a';
606 - var redirectUrl = $(targetElement).attr('href');
599 + var $deactivateLink = $(targetElement);
600 + var redirectUrl = $deactivateLink.attr('href');
607 601 if ($('.ti-feedback-overlay').length === 0) {
608 602 $('body').prepend('<div class="ti-feedback-overlay"></div>');
609 603 }
610 - $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($(targetElement).parent());
604 + $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($deactivateLink.parent());
611 605
612 - $(targetElement).on('click', function (e) {
606 + $deactivateLink.on('click', function (e) {
613 607 e.preventDefault();
614 608 $('<?php echo esc_attr( $popup_id ); ?> ').addClass('active');
615 609 $('body').addClass('ti-feedback-open');
616 610 $('.ti-feedback-overlay').on('click', function () {
@@ -643,9 +637,9 @@
643 637
644 638 $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-no').on('click', function (e) {
645 639 e.preventDefault();
646 640 e.stopPropagation();
647 - $(targetElement).unbind('click');
641 + $deactivateLink.unbind('click');
648 642 $('body').removeClass('ti-feedback-open');
649 643 $('<?php echo esc_attr( $popup_id ); ?>').remove();
650 644 if (redirectUrl !== '') {
651 645 location.href = redirectUrl;
@@ -654,9 +648,9 @@
654 648
655 649 $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) {
656 650 e.preventDefault();
657 651 e.stopPropagation();
658 - $(targetElement).unbind('click');
652 + $deactivateLink.unbind('click');
659 653 var selectedOption = $(
660 654 '<?php echo esc_attr( $popup_id ); ?> input[name="ti-deactivate-option"]:checked');
661 655 var data = {
662 656 'action': '<?php echo esc_attr( $key ) . '_uninstall_feedback'; ?>',
@@ -700,14 +694,15 @@
700 694 private function get_disclosure_labels() {
701 695 $disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
702 696 $disclosure_labels = array_merge(
703 697 [
704 - 'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
698 + 'title' => Loader::$labels['uninstall']['disclosure']['title'],
705 699 'items' => [
706 - sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
707 - sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
708 - sprintf( '%sUsage time:%s %s %s%s', '<strong>', '</strong>', '<code>', ( time() - $this->product->get_install_time() ), 's</code>' ),
709 - sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
700 + sprintf( Loader::$labels['uninstall']['disclosure']['version'], '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
701 + sprintf( Loader::$labels['uninstall']['disclosure']['website'], '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
702 + sprintf( Loader::$labels['uninstall']['disclosure']['usage'], '<strong>', '</strong>', '<code>', ( time() - $this->product->get_install_time() ), 's</code>' ),
703 + sprintf( Loader::$labels['uninstall']['disclosure']['reason'], '<strong>', '</strong>', '<i>', '</i>' ),
704 + sprintf( Loader::$labels['uninstall']['disclosure']['diagnostics'], '<strong>', '</strong>' ),
710 705 ],
711 706 ],
712 707 $disclosure_new_labels
713 708 );
@@ -791,8 +786,22 @@
791 786 $attributes['slug'] = $slug;
792 787 $attributes['version'] = $version;
793 788 $attributes['url'] = get_site_url();
794 789 $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 );
795 804
796 805 $response = wp_remote_post(
797 806 self::FEEDBACK_ENDPOINT,
798 807 array(