Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/flexible-shipping-pro   php

Repository URL to install this package:

Version: 1.11.1 

/ wpdesk / wp-wpdesk-tracker / src / views / tracker-deactivate.php

<?php

namespace FSProVendor;

if (!\defined('ABSPATH')) {
    exit;
}
?>

<h2><?php 
echo \sprintf(\__('You are deactivating %s plugin.', 'flexible-shipping-pro'), $plugin_name);
?></h2>

<div class="wpdesk_tracker_deactivate">
	<div class="body">
		<div class="panel" data-panel-id="confirm"><p></p></div>
		<div class="panel active" data-panel-id="reasons">
			<h4><strong><?php 
\_e(' If you have a moment, please let us know why you are deactivating plugin (anonymous feedback):', 'flexible-shipping-pro');
?></strong></h4>
			<ul id="reasons-list">
                <li class="reason">
                    <label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="plugin_stopped_working">
                    </span>
                        <span><?php 
\_e('The plugin suddenly stopped working', 'flexible-shipping-pro');
?></span>
                    </label>
                </li>
                <li class="reason">
                    <label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="broke_my_site">
                    </span>
                        <span><?php 
\_e('The plugin broke my site', 'flexible-shipping-pro');
?></span>
                    </label>
                </li>
				<li class="reason has-input">
					<label>
		                <span>
		                    <input type="radio" name="selected-reason" value="found_better_plugin">
	                    </span>
						<span><?php 
\_e('I found a better plugin', 'flexible-shipping-pro');
?></span>
					</label>
					<div id="found_better_plugin" class="reason-input">
						<input type="text" name="better_plugin_name" placeholder="<?php 
\_e('What\'s the plugin\'s name?', 'flexible-shipping-pro');
?>">
					</div>
				</li>
				<li class="reason">
					<label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="plugin_for_short_period">
                    </span>
						<span><?php 
\_e('I only needed the plugin for a short period', 'flexible-shipping-pro');
?></span>
					</label>
				</li>
				<li class="reason">
					<label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="no_longer_need">
                    </span>
						<span><?php 
\_e('I no longer need the plugin', 'flexible-shipping-pro');
?></span>
					</label>
				</li>
				<li class="reason">
					<label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="temporary_deactivation">
                    </span>
						<span><?php 
\_e('It\'s a temporary deactivation. I\'m just debugging an issue.', 'flexible-shipping-pro');
?></span>
					</label>
				</li>
				<li class="reason has-input">
					<label>
	            	<span>
	            		<input type="radio" name="selected-reason" value="other">
                    </span>
						<span><?php 
\_e('Other', 'flexible-shipping-pro');
?></span>
					</label>
					<div id="other" class="reason-input">
						<input type="text" name="other" placeholder="<?php 
\_e('Kindly tell us the reason so we can improve', 'flexible-shipping-pro');
?>">
					</div>
				</li>
			</ul>
		</div>
	</div>
	<div class="footer">
        <a href="#" class="button button-secondary button-close"><?php 
\_e('Cancel', 'flexible-shipping-pro');
?></a>
        <a href="#" class="button button-primary button-deactivate allow-deactivate"><?php 
\_e('Skip &amp; Deactivate', 'flexible-shipping-pro');
?></a>
	</div>
</div>
<script type="text/javascript">
	jQuery('input[type=radio]').click(function(){
        var reason = jQuery('input[name=selected-reason]:checked').val();
        console.log(reason);
        jQuery('.reason-input').hide();
        if ( reason == 'found_better_plugin' ) {
            jQuery('#found_better_plugin').show();
        }
        if ( reason == 'other' ) {
            jQuery('#other').show();
        }
        jQuery('.wpdesk_tracker_deactivate .button-deactivate').html( '<?php 
\_e('Submit &amp; Deactivate', 'flexible-shipping-pro');
?>' );
	})
	jQuery('.button-deactivate').click(function(e){
	    e.preventDefault();
	    console.log('deactivate');
        var reason = jQuery('input[name=selected-reason]:checked').val();
        var plugin = '<?php 
echo $plugin;
?>';
        var plugin_name = '<?php 
echo $plugin_name;
?>';
        var additional_info = '';
        if ( reason == 'found_better_plugin' ) {
            additional_info = jQuery('#found_better_plugin input').val();
        }
        if ( reason == 'other' ) {
            additional_info = jQuery('#other input').val();
        }
        console.log(reason);
        if ( typeof reason != 'undefined' ) {
            console.log('not undefined');
            jQuery('.button').attr('disabled',true);
            jQuery.ajax( '<?php 
echo \admin_url('admin-ajax.php');
?>',
                {
                    type: 'POST',
                    data: {
                        action: 'wpdesk_tracker_deactivation_handler',
	                    reason: reason,
	                    plugin: plugin,
	                    plugin_name: plugin_name,
                        additional_info: additional_info,
                    }
                }
            ).always(function() {
                var url = '<?php 
echo \str_replace('&amp;', '&', \admin_url(\wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin . '&plugin_status=all&', 'deactivate-plugin_' . $plugin)));
?>';
                window.location.href = url;
            });
        }
        else {
            var url = '<?php 
echo \str_replace('&amp;', '&', \admin_url(\wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin . '&plugin_status=all&', 'deactivate-plugin_' . $plugin)));
?>';
            window.location.href = url;
        }
	})
    jQuery('.button-close').click(function(e){
        e.preventDefault();
        window.history.back();
    })
</script>
<?php