wp/wp-content/plugins/portfolio/bws_menu/deactivation-form.php
changeset 16 a86126ab1dd4
parent 12 d8a8807227e4
child 19 3d72ae0968f4
--- a/wp/wp-content/plugins/portfolio/bws_menu/deactivation-form.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-content/plugins/portfolio/bws_menu/deactivation-form.php	Tue Dec 15 13:49:49 2020 +0100
@@ -17,147 +17,152 @@
 	function bws_add_deactivation_feedback_dialog_box() {
 		global $bstwbsftwppdtplgns_active_plugins;
 		if ( empty( $bstwbsftwppdtplgns_active_plugins ) )
-			return;
+			return;		
+
+		$contact_support_template = __( 'Need help? We are ready to answer your questions.', 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Contact Support', 'bestwebsoft' ) . '</a>';
+
+		$reasons = array(
+			array(
+				'id'                => 'NOT_WORKING',
+				'text'              => __( 'The plugin is not working', 'bestwebsoft' ),
+				'input_type'        => 'textarea',
+				'input_placeholder' => esc_attr__( "Kindly share what didn't work so we can fix it in future updates...", 'bestwebsoft' )
+			),
+			array(
+				'id'                => 'DIDNT_WORK_AS_EXPECTED',
+				'text'              => __( "The plugin didn't work as expected", 'bestwebsoft' ),
+				'input_type'        => 'textarea',
+				'input_placeholder' => esc_attr__( 'What did you expect?', 'bestwebsoft' )
+			),
+			array(
+				'id'                => 'SUDDENLY_STOPPED_WORKING',
+				'text'              => __( 'The plugin suddenly stopped working', 'bestwebsoft' ),
+				'input_type'        => '',
+				'input_placeholder' => '',
+				'internal_message'  => $contact_support_template
+			),
+			array(
+				'id'                => 'BROKE_MY_SITE',
+				'text'              => __( 'The plugin broke my site', 'bestwebsoft' ),
+				'input_type'        => '',
+				'input_placeholder' => '',
+				'internal_message'  => $contact_support_template
+			),
+			array(
+				'id'                => 'COULDNT_MAKE_IT_WORK',
+				'text'              => __( "I couldn't understand how to get it work", 'bestwebsoft' ),
+				'input_type'        => '',
+				'input_placeholder' => '',
+				'internal_message'  => $contact_support_template
+			),
+			array(
+				'id'                => 'FOUND_A_BETTER_PLUGIN',
+				'text'              => __( 'I found a better plugin', 'bestwebsoft' ),
+				'input_type'        => 'textfield',
+				'input_placeholder' => esc_attr__( "What's the plugin name?", 'bestwebsoft' )
+			),
+			array(
+				'id'                => 'GREAT_BUT_NEED_SPECIFIC_FEATURE',
+				'text'              => __( "The plugin is great, but I need specific feature that you don't support", 'bestwebsoft' ),
+				'input_type'        => 'textarea',
+				'input_placeholder' => esc_attr__( 'What feature?', 'bestwebsoft' )
+			),
+			array(
+				'id'                => 'NO_LONGER_NEEDED',
+				'text'              => __( 'I no longer need the plugin', 'bestwebsoft' ),
+				'input_type'        => '',
+				'input_placeholder' => ''
+			),
+			array(
+				'id'                => 'TEMPORARY_DEACTIVATION',
+				'text'              => __( "It's a temporary deactivation, I'm just debugging an issue", 'bestwebsoft' ),
+				'input_type'        => '',
+				'input_placeholder' => ''
+			),
+			array(
+				'id'                => 'OTHER',
+				'text'              => __( 'Other', 'bestwebsoft' ),
+				'input_type'        => 'textfield',
+				'input_placeholder' => ''
+			)				
+		);
+
+		$modal_html = '<div class="bws-modal bws-modal-deactivation-feedback">
+	    	<div class="bws-modal-dialog">
+	    		<div class="bws-modal-body">
+	    			<h2>' . __( 'Quick Feedback', 'bestwebsoft' ) . '</h2>
+	    			<div class="bws-modal-panel active">
+	    				<p>' . __( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ) . ":</p><ul>";
+
+		foreach ( $reasons as $reason ) {
+			$list_item_classes = 'bws-modal-reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
+
+			if ( ! empty( $reason['internal_message'] ) ) {
+				$list_item_classes .= ' has-internal-message';
+				$reason_internal_message = $reason['internal_message'];
+			} else {
+				$reason_internal_message = '';
+			}
+
+			$modal_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $reason['input_type'] . '" data-input-placeholder="' . $reason['input_placeholder'] . '">
+				<label>
+					<span>
+						<input type="radio" name="selected-reason" value="' . $reason['id'] . '"/>
+					</span>
+					<span>' . $reason['text'] . '</span>
+				</label>
+				<div class="bws-modal-internal-message">' . $reason_internal_message . '</div>
+			</li>';
+		}
+		$modal_html .= '</ul>
+		    				<label class="bws-modal-anonymous-label">
+			    				<input type="checkbox" />' .
+								__( 'Send website data and allow to contact me back', 'bestwebsoft' ) .
+							'</label>
+						</div>
+					</div>
+					<div class="bws-modal-footer">
+						<a href="#" class="button button-primary bws-modal-button-deactivate disabled">' . __( 'Submit and Deactivate', 'bestwebsoft' ) . '</a>
+						<a href="#" class="bws-modal-skip-link">' . __( 'Skip and Deactivate', 'bestwebsoft' ) . '</a>
+						<span class="bws-modal-processing hidden">' . __( 'Processing', 'bestwebsoft' ) . '...</span>
+						<div class="clear"></div>
+					</div>
+				</div>
+			</div>';
+
+		$script = '';
 
 		foreach ( $bstwbsftwppdtplgns_active_plugins as $basename => $plugin_data ) {
 
 			$slug = dirname( $basename );
 			$plugin_id = sanitize_title( $plugin_data['Name'] );
 
-			$contact_support_template = __( 'Need help? We are ready to answer your questions.', 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Contact Support', 'bestwebsoft' ) . '</a>';
-
-			$reasons = array(
-				array(
-					'id'                => 'NOT_WORKING',
-					'text'              => __( 'The plugin is not working', 'bestwebsoft' ),
-					'input_type'        => 'textarea',
-					'input_placeholder' => __( "Kindly share what didn't work so we can fix it in future updates...", 'bestwebsoft' )
-				),
-				array(
-					'id'                => 'DIDNT_WORK_AS_EXPECTED',
-					'text'              => __( "The plugin didn't work as expected", 'bestwebsoft' ),
-					'input_type'        => 'textarea',
-					'input_placeholder' => __( 'What did you expect?', 'bestwebsoft' )
-				),
-				array(
-					'id'                => 'SUDDENLY_STOPPED_WORKING',
-					'text'              => __( 'The plugin suddenly stopped working', 'bestwebsoft' ),
-					'input_type'        => '',
-					'input_placeholder' => '',
-					'internal_message'  => $contact_support_template
-				),
-				array(
-					'id'                => 'BROKE_MY_SITE',
-					'text'              => __( 'The plugin broke my site', 'bestwebsoft' ),
-					'input_type'        => '',
-					'input_placeholder' => '',
-					'internal_message'  => $contact_support_template
-				),
-				array(
-					'id'                => 'COULDNT_MAKE_IT_WORK',
-					'text'              => __( "I couldn't understand how to get it work", 'bestwebsoft' ),
-					'input_type'        => '',
-					'input_placeholder' => '',
-					'internal_message'  => $contact_support_template
-				),
-				array(
-					'id'                => 'FOUND_A_BETTER_PLUGIN',
-					'text'              => __( 'I found a better plugin', 'bestwebsoft' ),
-					'input_type'        => 'textfield',
-					'input_placeholder' => __( "What's the plugin name?", 'bestwebsoft' )
-				),
-				array(
-					'id'                => 'GREAT_BUT_NEED_SPECIFIC_FEATURE',
-					'text'              => __( "The plugin is great, but I need specific feature that you don't support", 'bestwebsoft' ),
-					'input_type'        => 'textarea',
-					'input_placeholder' => __( 'What feature?', 'bestwebsoft' )
-				),
-				array(
-					'id'                => 'NO_LONGER_NEEDED',
-					'text'              => __( 'I no longer need the plugin', 'bestwebsoft' ),
-					'input_type'        => '',
-					'input_placeholder' => ''
-				),
-				array(
-					'id'                => 'TEMPORARY_DEACTIVATION',
-					'text'              => __( "It's a temporary deactivation, I'm just debugging an issue", 'bestwebsoft' ),
-					'input_type'        => '',
-					'input_placeholder' => ''
-				),
-				array(
-					'id'                => 'OTHER',
-					'text'              => __( 'Other', 'bestwebsoft' ),
-					'input_type'        => 'textfield',
-					'input_placeholder' => ''
-				)				
-			);
-
-			$reasons_list_items_html = '';
-
-			foreach ( $reasons as $reason ) {
-				$list_item_classes = 'bws-modal-reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
-
-				if ( ! empty( $reason['internal_message'] ) ) {
-					$list_item_classes .= ' has-internal-message';
-					$reason_internal_message = $reason['internal_message'];
-				} else {
-					$reason_internal_message = '';
-				}
-
-				$reasons_list_items_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $reason['input_type'] . '" data-input-placeholder="' . $reason['input_placeholder'] . '">
-					<label>
-						<span>
-							<input type="radio" name="selected-reason" value="' . $reason['id'] . '"/>
-						</span>
-						<span>' . $reason['text'] . '</span>
-					</label>
-					<div class="bws-modal-internal-message">' . $reason_internal_message . '</div>
-				</li>';
-			} ?>
-			<script type="text/javascript">
-				(function($) {
-					var modalHtml =
-						    '<div class="bws-modal bws-modal-deactivation-feedback">'
-						    + '	<div class="bws-modal-dialog">'
-						    + '		<div class="bws-modal-body">'
-						    + '		    <h2><?php _e( 'Quick Feedback', 'bestwebsoft' ); ?></h2>'
-						    + '			<div class="bws-modal-panel active"><p><?php _e( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ); ?>:</p><ul>' + <?php echo json_encode( $reasons_list_items_html ); ?> + '</ul>'
-						    + '         <label class="bws-modal-anonymous-label">'
-							+ '				<input type="checkbox" />'
-							+ '				<?php _e( 'Send website data and allow to contact me back', 'bestwebsoft' ); ?>'
-							+ '			</label>'
-						    + '			</div>'
-						    + '		</div>'
-						    + '		<div class="bws-modal-footer">'
-						    + '			<a href="#" class="button button-primary bws-modal-button-deactivate"></a>'
-						    + '			<div class="clear"></div>'
-						    + '		</div>'
-						    + '	</div>'
-						    + '</div>',
-					    $modal                = $( modalHtml ),
-					    $deactivateLink       = $( '#the-list .active[data-plugin="<?php echo $basename; ?>"] .deactivate a' ),
-						$anonymousFeedback    = $modal.find( '.bws-modal-anonymous-label' ),
+			$script .= "(function($) {
+					var modalHtml = " . json_encode( $modal_html ) . ",
+					    \$modal                = $( modalHtml ),
+					    \$deactivateLink       = $( '#the-list .active[data-plugin=\"" . $basename . "\"] .deactivate a' ),
+						\$anonymousFeedback    = \$modal.find( '.bws-modal-anonymous-label' ),
 						selectedReasonID      = false;
 
 					/* WP added data-plugin attr after 4.5 version/ In prev version was id attr */
-					if ( 0 == $deactivateLink.length )
-						$deactivateLink = $( '#the-list .active#<?php echo $plugin_id; ?> .deactivate a' );
+					if ( 0 == \$deactivateLink.length )
+						\$deactivateLink = $( '#the-list .active#" . $plugin_id . " .deactivate a' );
 
-					$modal.appendTo( $( 'body' ) );
+					\$modal.appendTo( $( 'body' ) );
 
 					BwsModalRegisterEventHandlers();
 					
 					function BwsModalRegisterEventHandlers() {
-						$deactivateLink.click( function( evt ) {
+						\$deactivateLink.click( function( evt ) {
 							evt.preventDefault();
 
 							/* Display the dialog box.*/
 							BwsModalReset();
-							$modal.addClass( 'active' );
+							\$modal.addClass( 'active' );
 							$( 'body' ).addClass( 'has-bws-modal' );
 						});
 
-						$modal.on( 'input propertychange', '.bws-modal-reason-input input', function() {
+						\$modal.on( 'input propertychange', '.bws-modal-reason-input input', function() {
 							if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) {
 								return;
 							}
@@ -166,34 +171,30 @@
 
 							/* If reason is not empty, remove the error-message class of the message container to change the message color back to default. */
 							if ( reason.length > 0 ) {
-								$modal.find( '.message' ).removeClass( 'error-message' );
+								\$modal.find( '.message' ).removeClass( 'error-message' );
 								BwsModalEnableDeactivateButton();
 							}
 						});
 
-						$modal.on( 'blur', '.bws-modal-reason-input input', function() {
-							var $userReason = $( this );
+						\$modal.on( 'blur', '.bws-modal-reason-input input', function() {
+							var \$userReason = $( this );
 
 							setTimeout( function() {
 								if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) {
 									return;
 								}
-
-								/**
-                                 *
-                                 * @todo Remove after 01.01.2020
-                                 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo
-                                 *
-                                 */
-								/* If reason is empty, add the error-message class to the message container to change the message color to red. */
-								/*if ( 0 === $userReason.val().trim().length ) {
-									$modal.find( '.message' ).addClass( 'error-message' );
-									BwsModalDisableDeactivateButton();
-								}*/
 							}, 150 );
 						});
 
-						$modal.on( 'click', '.bws-modal-footer .button', function( evt ) {
+						\$modal.on( 'click', '.bws-modal-footer .bws-modal-skip-link', function( evt ) {
+							evt.preventDefault();
+							
+							/* If no selected reason, just deactivate the plugin. */
+							window.location.href = \$deactivateLink.attr( 'href' );
+							return;
+						});
+
+						\$modal.on( 'click', '.bws-modal-footer .button', function( evt ) {
 							evt.preventDefault();
 
 							if ( $( this ).hasClass( 'disabled' ) ) {
@@ -201,76 +202,59 @@
 							}
 
 							var _parent = $( this ).parents( '.bws-modal:first' ),
-								_this = $( this );
-
-							if ( _this.hasClass( 'allow-deactivate' ) ) {
-								var $radio = $modal.find( 'input[type="radio"]:checked' );
+								_this =  $( this );
 
-								if ( 0 === $radio.length ) {
-									/* If no selected reason, just deactivate the plugin. */
-									window.location.href = $deactivateLink.attr( 'href' );
-									return;
-								}
+							var \$radio = \$modal.find( 'input[type=\"radio\"]:checked' );
 
-								var $selected_reason = $radio.parents( 'li:first' ),
-								    $input = $selected_reason.find( 'textarea, input[type="text"]' ),
-								    userReason = ( 0 !== $input.length ) ? $input.val().trim() : '';
+							if ( 0 === \$radio.length ) {
+								/* If no selected reason */
+								BwsModalDisableDeactivateButton();
+								return;
+							}
 
-								/**
-								 *
-								 * @todo Remove after 01.01.2020
-								 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo
-								 *
-								 */
-								/*if ( BwsModalIsReasonSelected( 'OTHER' ) && '' === userReason ) {
-									return;
-								}*/
+							var \$selected_reason = \$radio.parents( 'li:first' ),
+							    \$input = \$selected_reason.find( 'textarea, input[type=\"text\"]' ),
+							    userReason = ( 0 !== \$input.length ) ? \$input.val().trim() : '';
+
+							var is_anonymous = ( \$anonymousFeedback.find( 'input' ).is( ':checked' ) ) ? 0 : 1;
 
-								var is_anonymous = ( $anonymousFeedback.find( 'input' ).is( ':checked' ) ) ? 0 : 1;
-
-								$.ajax({
-									url       : ajaxurl,
-									method    : 'POST',
-									data      : {
-										'action'			: 'bws_submit_uninstall_reason_action',
-										'plugin'			: '<?php echo $basename; ?>',
-										'reason_id'			: $radio.val(),
-										'reason_info'		: userReason,
-										'is_anonymous'		: is_anonymous,
-										'bws_ajax_nonce'	: '<?php echo wp_create_nonce( 'bws_ajax_nonce' ); ?>'
-									},
-									beforeSend: function() {
-										_parent.find( '.bws-modal-footer .button' ).addClass( 'disabled' );
-										_parent.find( '.bws-modal-footer .button-secondary' ).text( '<?php _e( 'Processing', 'bestwebsoft' ); ?>' + '...' );
-									},
-									complete  : function( message ) {
-										/* Do not show the dialog box, deactivate the plugin. */
-										window.location.href = $deactivateLink.attr( 'href' );
-									}
-								});
-							} else if ( _this.hasClass( 'bws-modal-button-deactivate' ) ) {
-								/* Change the Deactivate button's text and show the reasons panel. */
-								_parent.find( '.bws-modal-button-deactivate' ).addClass( 'allow-deactivate' );
-								BwsModalShowPanel();
-							}
+							$.ajax({
+								url       : ajaxurl,
+								method    : 'POST',
+								data      : {
+									'action'			: 'bws_submit_uninstall_reason_action',
+									'plugin'			: '" . $basename . "',
+									'reason_id'			: \$radio.val(),
+									'reason_info'		: userReason,
+									'is_anonymous'		: is_anonymous,
+									'bws_ajax_nonce'	: '" . wp_create_nonce( 'bws_ajax_nonce' ) . "'
+								},
+								beforeSend: function() {
+									_parent.find( '.bws-modal-footer .button' ).hide();
+									_parent.find( '.bws-modal-footer .bws-modal-processing' ).show();
+								},
+								complete  : function( message ) {
+									/* Do not show the dialog box, deactivate the plugin. */
+									window.location.href = \$deactivateLink.attr( 'href' );
+								}
+							});
 						});
 
-						$modal.on( 'click', 'input[type="radio"]', function() {
-							var $selectedReasonOption = $( this );
+						\$modal.on( 'click', 'input[type=\"radio\"]', function() {
+							var \$selectedReasonOption = $( this );
 
 							/* If the selection has not changed, do not proceed. */
-							if ( selectedReasonID === $selectedReasonOption.val() )
+							if ( selectedReasonID === \$selectedReasonOption.val() )
 								return;
 
-							selectedReasonID = $selectedReasonOption.val();
+							selectedReasonID = \$selectedReasonOption.val();
 
-							$anonymousFeedback.show();
+							\$anonymousFeedback.show();
 
 							var _parent = $( this ).parents( 'li:first' );
 
-							$modal.find( '.bws-modal-reason-input' ).remove();
-							$modal.find( '.bws-modal-internal-message' ).hide();
-							$modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Submit and Deactivate', 'bestwebsoft' ); ?>' );
+							\$modal.find( '.bws-modal-reason-input' ).remove();
+							\$modal.find( '.bws-modal-internal-message' ).hide();
 
 							BwsModalEnableDeactivateButton();
 
@@ -279,40 +263,33 @@
 							}
 
 							if (_parent.hasClass('has-input')) {
-								var reasonInputHtml = '<div class="bws-modal-reason-input"><span class="message"></span>' + ( ( 'textfield' === _parent.data( 'input-type' ) ) ? '<input type="text" />' : '<textarea rows="5" maxlength="200"></textarea>' ) + '</div>';
+								var reasonInputHtml = '<div class=\"bws-modal-reason-input\"><span class=\"message\"></span>' + ( ( 'textfield' === _parent.data( 'input-type' ) ) ? '<input type=\"text\" />' : '<textarea rows=\"5\" maxlength=\"200\"></textarea>' ) + '</div>';
 
 								_parent.append( $( reasonInputHtml ) );
 								_parent.find( 'input, textarea' ).attr( 'placeholder', _parent.data( 'input-placeholder' ) ).focus();
 
 								if ( BwsModalIsReasonSelected( 'OTHER' ) ) {
-									$modal.find( '.message' ).text( '<?php _e( 'Please tell us the reason so we can improve it.', 'bestwebsoft' ); ?>' ).show();
-									/**
-									 *
-									 * @todo Remove after 01.01.2020
-									 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo
-									 *
-									 */
-									//BwsModalDisableDeactivateButton();
+									\$modal.find( '.message' ).text( '" . __( 'Please tell us the reason so we can improve it.', 'bestwebsoft' ) . "' ).show();
 								}
 							}
 						});
 
 						/* If the user has clicked outside the window, cancel it. */
-						$modal.on( 'click', function( evt ) {
-							var $target = $( evt.target );
+						\$modal.on( 'click', function( evt ) {
+							var \$target = $( evt.target );
 
 							/* If the user has clicked anywhere in the modal dialog, just return. */
-							if ( $target.hasClass( 'bws-modal-body' ) || $target.hasClass( 'bws-modal-footer' ) ) {
+							if ( \$target.hasClass( 'bws-modal-body' ) || \$target.hasClass( 'bws-modal-footer' ) ) {
 								return;
 							}
 
 							/* If the user has not clicked the close button and the clicked element is inside the modal dialog, just return. */
-							if ( ! $target.hasClass( 'bws-modal-button-close' ) && ( $target.parents( '.bws-modal-body' ).length > 0 || $target.parents( '.bws-modal-footer' ).length > 0 ) ) {
+							if ( ! \$target.hasClass( 'bws-modal-button-close' ) && ( \$target.parents( '.bws-modal-body' ).length > 0 || \$target.parents( '.bws-modal-footer' ).length > 0 ) ) {
 								return;
 							}
 
 							/* Close the modal dialog */
-							$modal.removeClass( 'active' );
+							\$modal.removeClass( 'active' );
 							$( 'body' ).removeClass( 'has-bws-modal' );
 
 							return false;
@@ -321,55 +298,47 @@
 
 					function BwsModalIsReasonSelected( reasonID ) {
 						/* Get the selected radio input element.*/
-						return ( reasonID == $modal.find('input[type="radio"]:checked').val() );
+						return ( reasonID == \$modal.find('input[type=\"radio\"]:checked').val() );
 					}
 
 					function BwsModalReset() {
-						selectedReasonID = false;
-
-						BwsModalEnableDeactivateButton();
+						selectedReasonID = false;						
 
 						/* Uncheck all radio buttons.*/
-						$modal.find( 'input[type="radio"]' ).prop( 'checked', false );
+						\$modal.find( 'input[type=\"radio\"]' ).prop( 'checked', false );
 
 						/* Remove all input fields ( textfield, textarea ).*/
-						$modal.find( '.bws-modal-reason-input' ).remove();
-
-						$modal.find( '.message' ).hide();
+						\$modal.find( '.bws-modal-reason-input' ).remove();
 
-						/**
-						 *
-						 * @todo Remove after 01.01.2020
-						 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo
-						 *
-						 */
-						//$anonymousFeedback.find( 'input' ).prop( 'checked', true );
+						\$modal.find( '.message' ).hide();
 
 						/* Hide, since by default there is no selected reason.*/
-						$anonymousFeedback.hide();
+						\$anonymousFeedback.hide();
 
-						var $deactivateButton = $modal.find( '.bws-modal-button-deactivate' );
+						BwsModalDisableDeactivateButton();
 
-						$deactivateButton.addClass( 'allow-deactivate' );
 						BwsModalShowPanel();
 					}
 
 					function BwsModalEnableDeactivateButton() {
-						$modal.find( '.bws-modal-button-deactivate' ).removeClass( 'disabled' );
+						\$modal.find( '.bws-modal-button-deactivate' ).removeClass( 'disabled' ).show();
+						\$modal.find( '.bws-modal-processing' ).hide();
 					}
 
 					function BwsModalDisableDeactivateButton() {
-						$modal.find( '.bws-modal-button-deactivate' ).addClass( 'disabled' );
+						\$modal.find( '.bws-modal-button-deactivate' ).addClass( 'disabled' );
 					}
 
 					function BwsModalShowPanel() {
-						$modal.find( '.bws-modal-panel' ).addClass( 'active' );
-						/* Update the deactivate button's text */
-						$modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Skip and Deactivate', 'bestwebsoft' ); ?>' );
+						\$modal.find( '.bws-modal-panel' ).addClass( 'active' );
 					}
-				})(jQuery);
-			</script>
-		<?php }
+				})(jQuery);";
+		}
+
+		/* add script in FOOTER */
+		wp_register_script( 'bws-deactivation-feedback-dialog-boxes', '', array( 'jquery' ), false, true );
+		wp_enqueue_script( 'bws-deactivation-feedback-dialog-boxes' );
+		wp_add_inline_script( 'bws-deactivation-feedback-dialog-boxes', sprintf( $script ) );		
 	}
 }
 
@@ -384,14 +353,14 @@
 
 		wp_verify_nonce( $_REQUEST['bws_ajax_nonce'], 'bws_ajax_nonce' );
 
-		$reason_id = isset( $_REQUEST['reason_id'] ) ? stripcslashes( esc_html( $_REQUEST['reason_id'] ) ) : '';
-		$basename = isset( $_REQUEST['plugin'] ) ? stripcslashes( esc_html( $_REQUEST['plugin'] ) ) : '';
+		$reason_id = isset( $_REQUEST['reason_id'] ) ? stripcslashes( sanitize_text_field( $_REQUEST['reason_id'] ) ) : '';
+		$basename = isset( $_REQUEST['plugin'] ) ? stripcslashes( sanitize_text_field( $_REQUEST['plugin'] ) ) : '';
 
 		if ( empty( $reason_id ) || empty( $basename ) ) {
 			exit;
 		}
 
-		$reason_info = isset( $_REQUEST['reason_info'] ) ? stripcslashes( esc_html( $_REQUEST['reason_info'] ) ) : '';
+		$reason_info = isset( $_REQUEST['reason_info'] ) ? stripcslashes( sanitize_text_field( $_REQUEST['reason_info'] ) ) : '';
 		if ( ! empty( $reason_info ) ) {
 			$reason_info = substr( $reason_info, 0, 255 );
 		}
@@ -421,7 +390,7 @@
 		}
 
 		/* send data */
-		$raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/products-statistics/deactivation-feedback/', array(
+		$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/products-statistics/deactivation-feedback/', array(
 			'method'  => 'POST',
 			'body'    => $options,
 			'timeout' => 15,