| @@ -36,8 +36,11 @@ | ||
| 36 | 36 | * @param string|null $type Optional. Unused for now. |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | 39 | public function send_plugin_data() { |
| 40 | + if ( ! check_ajax_referer( 'ultp_deactive_plugin', 'wpnonce', false ) ) { | |
| 41 | + wp_die(); | |
| 42 | + } | |
| 40 | 43 | DurbinClient::send( DurbinClient::DEACTIVATE_ACTION ); |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | 46 | /** |
| @@ -58,34 +61,34 @@ | ||
| 58 | 61 | */ |
| 59 | 62 | public function get_deactive_settings() { |
| 60 | 63 | return array( |
| 61 | 64 | array( |
| 62 | - 'id' => 'not-working', | |
| 63 | - 'input' => false, | |
| 64 | - 'text' => __( "The plugin isn’t working properly.", "product-blocks" ) | |
| 65 | - ), | |
| 66 | - array( | |
| 67 | - 'id' => 'limited-features', | |
| 68 | - 'input' => false, | |
| 69 | - 'text' => __( "Limited features on the free version.", "product-blocks" ) | |
| 70 | - ), | |
| 71 | - array( | |
| 72 | - 'id' => 'better-plugin', | |
| 73 | - 'input' => true, | |
| 74 | - 'text' => __( "I found a better plugin.", "product-blocks" ), | |
| 75 | - 'placeholder' => __( "Please share which plugin.", "product-blocks" ), | |
| 76 | - ), | |
| 77 | - array( | |
| 78 | - 'id' => 'temporary-deactivation', | |
| 79 | - 'input' => false, | |
| 80 | - 'text' => __( "It's a temporary deactivation.", "product-blocks" ) | |
| 81 | - ), | |
| 82 | - array( | |
| 83 | - 'id' => 'other', | |
| 84 | - 'input' => true, | |
| 85 | - 'text' => __( "Other.", "product-blocks" ), | |
| 86 | - 'placeholder' => __( "Please share the reason.", "product-blocks" ), | |
| 87 | - ), | |
| 65 | + 'id' => 'not-working', | |
| 66 | + 'input' => false, | |
| 67 | + 'text' => __( 'The plugin isn’t working properly.', 'ultimate-post' ), | |
| 68 | + ), | |
| 69 | + array( | |
| 70 | + 'id' => 'limited-features', | |
| 71 | + 'input' => false, | |
| 72 | + 'text' => __( 'Limited features on the free version.', 'ultimate-post' ), | |
| 73 | + ), | |
| 74 | + array( | |
| 75 | + 'id' => 'better-plugin', | |
| 76 | + 'input' => true, | |
| 77 | + 'text' => __( 'I found a better plugin.', 'ultimate-post' ), | |
| 78 | + 'placeholder' => __( 'Please share which plugin.', 'ultimate-post' ), | |
| 79 | + ), | |
| 80 | + array( | |
| 81 | + 'id' => 'temporary-deactivation', | |
| 82 | + 'input' => false, | |
| 83 | + 'text' => __( "It's a temporary deactivation.", 'ultimate-post' ), | |
| 84 | + ), | |
| 85 | + array( | |
| 86 | + 'id' => 'other', | |
| 87 | + 'input' => true, | |
| 88 | + 'text' => __( 'Other.', 'ultimate-post' ), | |
| 89 | + 'placeholder' => __( 'Please share the reason.', 'ultimate-post' ), | |
| 90 | + ), | |
| 88 | 91 | ); |
| 89 | 92 | } |
| 90 | 93 | |
| 91 | 94 | /** |
| @@ -111,9 +114,9 @@ | ||
| 111 | 114 | <label> |
| 112 | 115 | <input type="radio" <?php echo 0 == $key ? 'checked="checked"' : ''; ?> id="<?php echo esc_attr( $setting['id'] ); ?>" name="<?php echo esc_attr( $this->plugin_slug ); ?>" value="<?php echo esc_attr( $setting['text'] ); ?>"> |
| 113 | 116 | <div class="ultp-reason-text"><?php echo esc_html( $setting['text'] ); ?></div> |
| 114 | 117 | <?php if ( isset( $setting['input'] ) && $setting['input'] ) { ?> |
| 115 | - <textarea placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>" class="ultp-reason-input <?php echo $key == 0 ? 'ultp-active' : ''; ?> <?php echo esc_html( $setting['id'] ); ?>"></textarea> | |
| 118 | + <textarea placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>" class="ultp-reason-input <?php echo esc_attr( 0 == $key ? 'ultp-active' : '' ); ?> <?php echo esc_attr( $setting['id'] ); ?>"></textarea> | |
| 116 | 119 | <?php } ?> |
| 117 | 120 | </label> |
| 118 | 121 | </li> |
| 119 | 122 | <?php } ?> |
| @@ -355,8 +358,9 @@ | ||
| 355 | 358 | url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>', |
| 356 | 359 | type: 'POST', |
| 357 | 360 | data: { |
| 358 | 361 | action: 'ultp_deactive_plugin', |
| 362 | + wpnonce: '<?php echo esc_js( wp_create_nonce( 'ultp_deactive_plugin' ) ); ?>', | |
| 359 | 363 | cause_id: $('#ultp-deactive-modal input[type=radio]:checked').attr('id'), |
| 360 | 364 | cause_title: $('#ultp-deactive-modal .ultp-modal-input input[type=radio]:checked').val(), |
| 361 | 365 | cause_details: $('#ultp-deactive-modal .ultp-reason-input.ultp-active').val() |
| 362 | 366 | }, |