Remove the poll on plugin deactivation
Remove the poll asking for deactivation reasons as we are no longer using the data. [MAILPOET-3705]
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Config;
|
||||
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class DeactivationSurvey {
|
||||
|
||||
/** @var Renderer */
|
||||
private $renderer;
|
||||
|
||||
public function __construct(Renderer $renderer) {
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
||||
public function init() {
|
||||
WPFunctions::get()->addAction('admin_print_scripts', [$this, 'js'], 20);
|
||||
WPFunctions::get()->addAction('admin_print_scripts', [$this, 'css']);
|
||||
WPFunctions::get()->addAction('admin_footer', [$this, 'modal']);
|
||||
}
|
||||
|
||||
private function shouldShow() {
|
||||
if (!function_exists('get_current_screen')) {
|
||||
return false;
|
||||
}
|
||||
$screen = WPFunctions::get()->getCurrentScreen();
|
||||
if (is_null($screen)) {
|
||||
return false;
|
||||
}
|
||||
return (in_array($screen->id, ['plugins', 'plugins-network'], true));
|
||||
}
|
||||
|
||||
public function js() {
|
||||
if (!$this->shouldShow()) {
|
||||
return;
|
||||
}
|
||||
$this->render('deactivationSurvey/js.html');
|
||||
|
||||
}
|
||||
|
||||
public function css() {
|
||||
if (!$this->shouldShow()) {
|
||||
return;
|
||||
}
|
||||
$this->render('deactivationSurvey/css.html');
|
||||
}
|
||||
|
||||
public function modal() {
|
||||
if (!$this->shouldShow()) {
|
||||
return;
|
||||
}
|
||||
$this->render('deactivationSurvey/index.html');
|
||||
}
|
||||
|
||||
private function render($template) {
|
||||
try {
|
||||
echo $this->renderer->render($template);
|
||||
} catch (\Exception $e) {
|
||||
// if the website fails to render we have other places to catch and display the error
|
||||
}
|
||||
}
|
||||
}
|
@@ -229,7 +229,6 @@ class Initializer {
|
||||
$this->setupPages();
|
||||
|
||||
$this->setupPermanentNotices();
|
||||
$this->setupDeactivationSurvey();
|
||||
$this->setupAutomaticEmails();
|
||||
$this->postEditorBlock->init();
|
||||
|
||||
@@ -362,11 +361,6 @@ class Initializer {
|
||||
return WPNotice::displayWarning($exception->getMessage());
|
||||
}
|
||||
|
||||
public function setupDeactivationSurvey() {
|
||||
$survey = new DeactivationSurvey($this->renderer);
|
||||
$survey->init();
|
||||
}
|
||||
|
||||
public function setupAutomaticEmails() {
|
||||
$automaticEmails = new AutomaticEmails();
|
||||
$automaticEmails->init();
|
||||
|
@@ -1,34 +0,0 @@
|
||||
<style type="text/css">
|
||||
.mailpoet-deactivate-survey-modal {
|
||||
display: none;
|
||||
table-layout: fixed;
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: rgba(0,0,0,0.8);
|
||||
}
|
||||
.mailpoet-deactivate-survey-wrap {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mailpoet-deactivate-survey {
|
||||
background-color: #f1f1f1;
|
||||
border: 0 solid #ccc;
|
||||
border-radius: 3px;
|
||||
margin: 0 auto;
|
||||
padding: 12px;
|
||||
width: 340px;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.mailpoet-deactivate-survey a.button {
|
||||
white-space: normal;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
@@ -1,11 +0,0 @@
|
||||
<div class="mailpoet-deactivate-survey-modal" id="mailpoet-deactivate-survey">
|
||||
<div class="mailpoet-deactivate-survey-wrap">
|
||||
<div class="mailpoet-deactivate-survey">
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="https://secure.polldaddy.com/p/10007098.js"></script>
|
||||
<noscript><a href="https://polldaddy.com/poll/10007098/">Why are you deactivating MailPoet?</a></noscript>
|
||||
|
||||
<a class="button" id="mailpoet-deactivate-survey-close"><%= __('Close this window and deactivate MailPoet') %> →</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -1,27 +0,0 @@
|
||||
<script type="text/javascript">
|
||||
jQuery(function($){
|
||||
var deactivateLink = $('#the-list').find('[data-slug="mailpoet"] span.deactivate a');
|
||||
var overlay = $('#mailpoet-deactivate-survey');
|
||||
var closeButton = $('#mailpoet-deactivate-survey-close');
|
||||
var formOpen = false;
|
||||
|
||||
deactivateLink.on('click', function(event) {
|
||||
event.preventDefault();
|
||||
overlay.css('display', 'table');
|
||||
formOpen = true;
|
||||
});
|
||||
|
||||
closeButton.on('click', function(event) {
|
||||
event.preventDefault();
|
||||
overlay.css('display', 'none');
|
||||
formOpen = false;
|
||||
location.href = deactivateLink.attr('href');
|
||||
});
|
||||
|
||||
$(document).on('keyup', function(event) {
|
||||
if ((event.keyCode === 27) && formOpen) {
|
||||
location.href = deactivateLink.attr('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user