PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.5.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.5.1
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 3.10.3 All 149 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php +96 -107 4.0.73.5.1 View file →
@@ -11,9 +11,8 @@
11 11
12 12 namespace ThemeisleSDK\Modules;
13 13
14 14 use ThemeisleSDK\Common\Abstract_Module;
15 -use ThemeisleSDK\Loader;
16 15 use ThemeisleSDK\Product;
17 16
18 17 // Exit if accessed directly.
19 18 if ( ! defined( 'ABSPATH' ) ) {
@@ -48,24 +47,27 @@
48 47 *
49 48 * @var array $options_plugin The main options list for plugins.
50 49 */
51 50 private $options_plugin = array(
52 - 'id3' => array(
53 - 'id' => 3,
54 - 'type' => 'text',
55 -
51 + 'I found a better plugin' => array(
52 + 'id' => 3,
53 + 'type' => 'text',
54 + 'placeholder' => 'What\'s the plugin\'s name?',
56 55 ),
57 - 'id4' => array(
58 - 'type' => 'textarea',
59 - 'id' => 4,
56 + 'I could not get the plugin to work' => array(
57 + 'type' => 'textarea',
58 + 'placeholder' => 'What problem are you experiencing?',
59 + 'id' => 4,
60 60 ),
61 - 'id5' => array(
62 - 'id' => 5,
63 - 'type' => 'textarea',
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?',
64 65 ),
65 - 'id6' => array(
66 - 'type' => 'textarea',
67 - 'id' => 6,
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,
68 70 ),
69 71 );
70 72 /**
71 73 * Default options for theme.
@@ -72,23 +74,23 @@
72 74 *
73 75 * @var array $options_theme The main options list for themes.
74 76 */
75 77 private $options_theme = array(
76 - 'id7' => array(
78 + 'I don\'t know how to make it look like demo' => array(
77 79 'id' => 7,
78 80 ),
79 - 'id8' => array(
80 - 'type' => 'text',
81 - 'id' => 8,
81 + 'It lacks options' => array(
82 + 'placeholder' => 'What option is missing?',
83 + 'type' => 'text',
84 + 'id' => 8,
82 85 ),
83 - 'id9' => array(
84 - 'id' => 9,
85 - 'type' => 'text',
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',
86 90 ),
87 - 'id10' => array(
88 -
89 - 'title' => '',
90 - 'id' => 10,
91 + 'I want to try a new design, I don\'t like {theme} style' => array(
92 + 'id' => 10,
91 93 ),
92 94 );
93 95 /**
94 96 * Default other option.
@@ -95,13 +97,38 @@
95 97 *
96 98 * @var array $other The other option
97 99 */
98 100 private $other = array(
99 - 'id999' => array(
100 - 'id' => 999,
101 - 'type' => 'textarea',
101 + 'Other' => array(
102 + 'id' => 999,
103 + 'type' => 'textarea',
104 + 'placeholder' => 'What can we do better?',
102 105 ),
103 106 );
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';
104 131
105 132 /**
106 133 * Loads the additional resources
107 134 */
@@ -127,13 +154,13 @@
127 154 /**
128 155 * Render theme feedback drawer.
129 156 */
130 157 private function render_theme_feedback_popup() {
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'] );
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' );
133 160 $options = $this->options_theme;
134 161 $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $options ) );
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>';
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>';
136 163
137 164 $options += $this->other;
138 165
139 166 ?>
@@ -138,10 +165,9 @@
138 165
139 166 ?>
140 167 <div class="ti-theme-uninstall-feedback-drawer ti-feedback">
141 168 <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' ); ?>
169 + <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?> </h5>
144 170 <button class="toggle"><span>&times;</span></button>
145 171 </div><!--/.popup--header-->
146 172 <div class="popup--body">
147 173 <?php $this->render_options_list( $options ); ?>
@@ -209,9 +235,9 @@
209 235 font-size: 13px;
210 236 }
211 237
212 238 .ti-feedback .popup--form input[type="radio"] {
213 - <?php echo is_rtl() ? 'margin: 0 0 0 10px;' : 'margin: 0 10px 0 0;'; ?>
239 + <?php echo is_rtl() ? 'margin: 0 0 0 10px;' : 'margin: 0 10px 0 0;'; ?>
214 240 }
215 241
216 242 .ti-feedback .popup--form input[type="radio"]:checked ~ textarea {
217 243 display: block;
@@ -287,9 +313,9 @@
287 313 width: 100%;
288 314 }
289 315
290 316 .ti-feedback .buttons input:last-child {
291 - <?php echo is_rtl() ? 'margin-right: auto;' : 'margin-left: auto;'; ?>
317 + <?php echo is_rtl() ? 'margin-right: auto;' : 'margin-left: auto;'; ?>
292 318 }
293 319
294 320 .ti-theme-uninstall-feedback-drawer {
295 321 border-top-left-radius: 5px;
@@ -341,19 +367,19 @@
341 367 display: block;
342 368 position: absolute;
343 369 top: 50%;
344 370 transform: translateY(-50%);
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 - ?>
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 + ?>
356 382 }
357 383
358 384 .ti-plugin-uninstall-feedback-popup {
359 385 display: none;
@@ -359,9 +385,10 @@
359 385 display: none;
360 386 position: absolute;
361 387 white-space: normal;
362 388 width: 400px;
363 - <?php echo is_rtl() ? 'right: calc( 100% + 15px );' : 'left: calc( 100% + 15px );'; ?> top: -15px;
389 + <?php echo is_rtl() ? 'right: calc( 100% + 15px );' : 'left: calc( 100% + 15px );'; ?>
390 + top: -15px;
364 391 }
365 392
366 393 .ti-plugin-uninstall-feedback-popup.sending-feedback .popup--body i {
367 394 animation: rotation 2s infinite linear;
@@ -485,21 +512,8 @@
485 512 do_action( $this->product->get_key() . '_uninstall_feedback_after_js' );
486 513 }
487 514
488 515 /**
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 516 * Render the options list.
503 517 *
504 518 * @param array $options the options for the feedback form.
505 519 */
@@ -510,22 +524,17 @@
510 524 'textarea' => 2,
511 525 ];
512 526 ?>
513 527 <ul class="popup--form">
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 - ?>
528 + <?php foreach ( $options as $title => $attributes ) { ?>
519 529 <li ti-option-id="<?php echo esc_attr( $attributes['id'] ); ?>">
520 - <input type="radio" name="ti-deactivate-option"
521 - id="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
530 + <input type="radio" name="ti-deactivate-option" id="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
522 531 <label for="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
523 532 <?php echo esc_attr( str_replace( '{theme}', $this->product->get_name(), $title ) ); ?>
524 533 </label>
525 534 <?php
526 535 if ( array_key_exists( 'type', $attributes ) ) {
527 -
536 + $placeholder = array_key_exists( 'placeholder', $attributes ) ? $attributes['placeholder'] : '';
528 537 echo '<textarea width="100%" rows="' . esc_attr( $inputs_row_map[ $attributes['type'] ] ) . '" name="comments" placeholder="' . esc_attr( $placeholder ) . '"></textarea>';
529 538 }
530 539 ?>
531 540 </li>
@@ -537,20 +546,18 @@
537 546 /**
538 547 * Render plugin feedback popup.
539 548 */
540 549 private function render_plugin_feedback_popup() {
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'] );
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 );
543 552 $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $this->options_plugin ) );
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>';
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>';
545 554
546 555 $options += $this->other;
547 556 ?>
548 - <div class="ti-plugin-uninstall-feedback-popup ti-feedback"
549 - id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
557 + <div class="ti-plugin-uninstall-feedback-popup ti-feedback" id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
550 558 <div class="popup--header">
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' ); ?>
559 + <h5><?php echo wp_kses( $this->heading_plugin, array( 'span' => true ) ); ?> </h5>
553 560 </div><!--/.popup--header-->
554 561 <div class="popup--body">
555 562 <?php $this->render_options_list( $options ); ?>
556 563 </div><!--/.popup--body-->
@@ -595,16 +602,15 @@
595 602 <script type="text/javascript" id="ti-deactivate-js">
596 603 (function ($) {
597 604 $(document).ready(function () {
598 605 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');
606 + var redirectUrl = $(targetElement).attr('href');
601 607 if ($('.ti-feedback-overlay').length === 0) {
602 608 $('body').prepend('<div class="ti-feedback-overlay"></div>');
603 609 }
604 - $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($deactivateLink.parent());
610 + $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($(targetElement).parent());
605 611
606 - $deactivateLink.on('click', function (e) {
612 + $(targetElement).on('click', function (e) {
607 613 e.preventDefault();
608 614 $('<?php echo esc_attr( $popup_id ); ?> ').addClass('active');
609 615 $('body').addClass('ti-feedback-open');
610 616 $('.ti-feedback-overlay').on('click', function () {
@@ -637,9 +643,9 @@
637 643
638 644 $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-no').on('click', function (e) {
639 645 e.preventDefault();
640 646 e.stopPropagation();
641 - $deactivateLink.unbind('click');
647 + $(targetElement).unbind('click');
642 648 $('body').removeClass('ti-feedback-open');
643 649 $('<?php echo esc_attr( $popup_id ); ?>').remove();
644 650 if (redirectUrl !== '') {
645 651 location.href = redirectUrl;
@@ -648,9 +654,9 @@
648 654
649 655 $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) {
650 656 e.preventDefault();
651 657 e.stopPropagation();
652 - $deactivateLink.unbind('click');
658 + $(targetElement).unbind('click');
653 659 var selectedOption = $(
654 660 '<?php echo esc_attr( $popup_id ); ?> input[name="ti-deactivate-option"]:checked');
655 661 var data = {
656 662 'action': '<?php echo esc_attr( $key ) . '_uninstall_feedback'; ?>',
@@ -694,15 +700,13 @@
694 700 private function get_disclosure_labels() {
695 701 $disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
696 702 $disclosure_labels = array_merge(
697 703 [
698 - 'title' => Loader::$labels['uninstall']['disclosure']['title'],
704 + 'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No domain name, email address or IP addresses are transmited after you submit the survey.',
699 705 'items' => [
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>' ),
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( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
705 709 ],
706 710 ],
707 711 $disclosure_new_labels
708 712 );
@@ -780,28 +784,13 @@
780 784 *
781 785 * @return bool Is the request succesfull?
782 786 */
783 787 protected function call_api( $attributes ) {
784 - $slug = $this->product->get_slug();
785 - $version = $this->product->get_version();
786 - $attributes['slug'] = $slug;
787 - $attributes['version'] = $version;
788 - $attributes['url'] = get_site_url();
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 );
788 + $slug = $this->product->get_slug();
789 + $version = $this->product->get_version();
790 + $attributes['slug'] = $slug;
791 + $attributes['version'] = $version;
792 + $attributes['url'] = get_site_url();
804 793
805 794 $response = wp_remote_post(
806 795 self::FEEDBACK_ENDPOINT,
807 796 array(