| 1 |
<?php |
| 2 |
/* add the modal on the plugin screen and embed a polldaddy form in it */ |
| 3 |
add_action( 'admin_footer', 'wppb_add_feedback_modal' ); |
| 4 |
function wppb_add_feedback_modal(){ |
| 5 |
global $current_screen; |
| 6 |
if( $current_screen->base == 'plugins' ){ |
| 7 |
?> |
| 8 |
<div id="wppb-feedback-modal" style="display:none;"> |
| 9 |
<h1 style="padding-left:10px;padding-top:15px;"><?php _e('Quick Feedback', 'profile-builder'); ?></h1> |
| 10 |
<script type="text/javascript" charset="utf-8" src="https://secure.polldaddy.com/p/9985202.js"></script> |
| 11 |
<noscript><a href="https://polldaddy.com/poll/9985202/"><?php _e( 'Because we care about our clients, please leave us feedback on why you are no longer using our plugin.', 'profile-builder'); ?></a></noscript> |
| 12 |
<a href="#" class="button secondary wppb-feedback-skip"><?php _e('Skip and Deactivate', 'profile-builder'); ?></a> |
| 13 |
</div> |
| 14 |
<?php |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
/* add the scripts for the modal on the plugin screen */ |
| 19 |
add_action( 'admin_footer', 'wppb_add_feedback_script' ); |
| 20 |
function wppb_add_feedback_script(){ |
| 21 |
global $current_screen; |
| 22 |
if( $current_screen->base == 'plugins' ) { |
| 23 |
?> |
| 24 |
<script> |
| 25 |
jQuery(function () { |
| 26 |
pluginSlug = 'profile-builder';// define the plugin slug here |
| 27 |
|
| 28 |
if (jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').length != 0) { |
| 29 |
|
| 30 |
deactivationLink = jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').attr('href'); |
| 31 |
|
| 32 |
jQuery('tr[data-slug="' + pluginSlug + '"] .deactivate a').click(function (e){ |
| 33 |
e . preventDefault(); |
| 34 |
e . stopPropagation(); |
| 35 |
tb_show("Profile Builder Quick Feedback", "#TB_inline?width=740&height=500&inlineId=wppb-feedback-modal"); |
| 36 |
jQuery('#TB_ajaxContent').closest('#TB_window').css({ height : "auto", top: "50%", marginTop: "-300px" }); |
| 37 |
}); |
| 38 |
|
| 39 |
jQuery('.pds-vote-button').on('click', function(e){ |
| 40 |
if(jQuery('.pds-radiobutton').is(':checked')) { |
| 41 |
self.parent.tb_remove(); |
| 42 |
window.location.href = deactivationLink; |
| 43 |
} |
| 44 |
}); |
| 45 |
|
| 46 |
jQuery('.wppb-feedback-skip').on('click', function(e){ |
| 47 |
e.preventDefault(); |
| 48 |
self.parent.tb_remove(); |
| 49 |
window.location.href = deactivationLink; |
| 50 |
}); |
| 51 |
|
| 52 |
} |
| 53 |
}); |
| 54 |
</script> |
| 55 |
<?php |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
/* add styling for the modal */ |
| 60 |
add_action( 'admin_footer', 'wppb_add_feedback_style' ); |
| 61 |
function wppb_add_feedback_style(){ |
| 62 |
global $current_screen; |
| 63 |
if( $current_screen->base == 'plugins' ) { |
| 64 |
?> |
| 65 |
<style type="text/css"> |
| 66 |
#TB_window .pds-box{ |
| 67 |
border:0 !important; |
| 68 |
} |
| 69 |
#TB_window .pds-links{ |
| 70 |
display:none; |
| 71 |
} |
| 72 |
#TB_window .pds-question-top{ |
| 73 |
font-size:13px; |
| 74 |
font-weight:normal; |
| 75 |
} |
| 76 |
#TB_window .pds-answer{ |
| 77 |
border:0; |
| 78 |
} |
| 79 |
#TB_window .pds-vote-button span{ |
| 80 |
display:none; |
| 81 |
} |
| 82 |
#TB_window .pds-vote-button:after{ |
| 83 |
content:"<?php _e('Submit and Deactivate', 'profile-builder')?>"; |
| 84 |
} |
| 85 |
#TB_window .pds-vote-button{ |
| 86 |
padding: 6px 14px; |
| 87 |
line-height: normal; |
| 88 |
font-size: 14px; |
| 89 |
font-weight: normal; |
| 90 |
vertical-align: middle; |
| 91 |
height: auto; |
| 92 |
margin-bottom: 4px; |
| 93 |
background: #0085ba; |
| 94 |
border-color: #0073aa #006799 #006799; |
| 95 |
box-shadow: 0 1px 0 #006799; |
| 96 |
color: #fff; |
| 97 |
text-decoration: none; |
| 98 |
text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799; |
| 99 |
cursor: pointer; |
| 100 |
border-width: 1px; |
| 101 |
border-style: solid; |
| 102 |
-webkit-appearance: none; |
| 103 |
border-radius: 3px; |
| 104 |
} |
| 105 |
|
| 106 |
.wppb-feedback-skip{ |
| 107 |
float: right; |
| 108 |
margin-top: -55px !important; |
| 109 |
margin-right: 10px !important; |
| 110 |
} |
| 111 |
</style> |
| 112 |
<?php |
| 113 |
} |
| 114 |
} |