fresh-install.php
13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
if (!defined('WORDFENCE_VERSION')) { exit; }
/**
* Presents the fresh install modal.
*/
?>
<div id="wf-onboarding-fresh-install" class="wf-onboarding-modal">
<div id="wf-onboarding-fresh-install-1" class="wf-onboarding-modal-content"<?php if (wfConfig::get('onboardingAttempt1') == wfOnboardingController::ONBOARDING_FIRST_EMAILS) { echo ' style="display: none;"'; } ?>>
<div class="wf-onboarding-logo"><img src="<?php echo esc_attr(wfUtils::getBaseURL() . 'images/wf-horizontal.svg'); ?>" alt="<?php esc_html_e('Wordfence - Securing your WordPress Website', 'wordfence'); ?>"></div>
<h3><?php printf(/* translators: Wordfence version. */ esc_html__('You have successfully installed Wordfence %s', 'wordfence'), WORDFENCE_VERSION); ?></h3>
<h4><?php esc_html_e('Please tell us where Wordfence should send you security alerts for your website:', 'wordfence'); ?></h4>
<input type="text" id="wf-onboarding-alerts" placeholder="you@example.com" value="<?php echo esc_attr(implode(',', wfConfig::getAlertEmails())); ?>">
<p id="wf-onboarding-alerts-disclaimer"><?php esc_html_e('We do not use this email address for any other purpose unless you opt-in to receive other mailings. You can turn off alerts in the options.', 'wordfence'); ?></p>
<div id="wf-onboarding-subscribe">
<label for="wf-onboarding-email-list"><?php esc_html_e('Would you also like to join our WordPress security mailing list to receive WordPress security alerts and Wordfence news?', 'wordfence'); ?></label>
<div id="wf-onboarding-subscribe-controls">
<ul id="wf-onboarding-email-list" class="wf-switch">
<li data-option-value="1"><?php esc_html_e('Yes', 'wordfence'); ?></li>
<li data-option-value="0"><?php esc_html_e('No', 'wordfence'); ?></li>
</ul>
<p><?php esc_html_e('(Choose One)', 'wordfence'); ?></p>
</div>
</div>
<div id="wf-onboarding-footer">
<ul>
<li>
<input type="checkbox" class="wf-option-checkbox wf-small" id="wf-onboarding-agree"> <label for="wf-onboarding-agree"><?php echo wp_kses(__('I have read and agree to the <a href="https://www.wordfence.com/license-terms-and-conditions/" target="_blank" rel="noopener noreferrer">Wordfence License Terms and Conditions<span class="screen-reader-text"> (opens in new tab)</span></a> and <a href="https://www.wordfence.com/terms-of-service/" target="_blank" rel="noopener noreferrer">Terms of Service</a> and have read and acknowledge the <a href="https://www.wordfence.com/privacy-policy/" target="_blank" rel="noopener noreferrer">Wordfence Privacy Policy<span class="screen-reader-text"> (opens in new tab)</span></a>.', 'wordfence'), array('a'=>array('href'=>array(), 'target'=>array(), 'rel'=>array()), 'span'=>array('class'=>array()))); ?></label>
</li>
<li><a href="#" class="wf-onboarding-btn wf-onboarding-btn-primary wf-disabled" id="wf-onboarding-continue" role="button"><?php esc_html_e('Continue', 'wordfence'); ?></a></li>
</ul>
</div>
</div>
<div id="wf-onboarding-fresh-install-2" class="wf-onboarding-modal-content"<?php if (wfConfig::get('onboardingAttempt1') != wfOnboardingController::ONBOARDING_FIRST_EMAILS) { echo ' style="display: none;"'; } ?>>
<div class="wf-onboarding-logo"><img src="<?php echo esc_attr(wfUtils::getBaseURL() . 'images/wf-horizontal.svg'); ?>" alt="<?php esc_html_e('Wordfence - Securing your WordPress Website', 'wordfence'); ?>"></div>
<h3><?php esc_html_e('Enter Premium License Key', 'wordfence'); ?></h3>
<p><?php esc_html_e('Enter your premium license key to enable real-time protection for your website.', 'wordfence'); ?></p>
<div id="wf-onboarding-license"><input type="text" placeholder="<?php esc_html_e('Enter Premium Key', 'wordfence'); ?>"><a href="#" class="wf-onboarding-btn wf-onboarding-btn-primary wf-disabled" id="wf-onboarding-license-install" role="button"><?php esc_html_e('Install', 'wordfence'); ?></a></div>
<div id="wf-onboarding-or"><span><?php esc_html_e('or', 'wordfence') ?></span></div>
<p><?php esc_html_e('If you don\'t have one, you can purchase one now.', 'wordfence'); ?></p>
<div id="wf-onboarding-license-footer">
<ul>
<li><a href="https://www.wordfence.com/gnl1onboardingOverlayGet/wordfence-signup/#premium-order-form" class="wf-onboarding-btn wf-onboarding-btn-primary" id="wf-onboarding-get" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade to Premium', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a></li>
<li><a href="https://www.wordfence.com/gnl1onboardingOverlayLearn/wordfence-signup/" class="wf-onboarding-btn wf-onboarding-btn-default" id="wf-onboarding-learn" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Learn More', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a></li>
<li><a href="#" id="wf-onboarding-no-thanks" role="button"><?php esc_html_e('No Thanks', 'wordfence'); ?></a></li>
</ul>
</div>
</div>
</div>
<script type="application/javascript">
(function($) {
$(function() {
setTimeout(function() {
$('#wf-onboarding-subscribe-controls > p').show();
}, 30000);
$('#wf-onboarding-subscribe .wf-switch > li').each(function(index, element) {
$(element).on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var control = $(this).closest('.wf-switch');
control.find('li').removeClass('wf-active');
$(this).addClass('wf-active');
$('#wf-onboarding-continue').toggleClass('wf-disabled', wordfenceExt.parseEmails($('#wf-onboarding-alerts').val()).length == 0 || !($('#wf-onboarding-agree').is(':checked')) || $('#wf-onboarding-subscribe .wf-switch > li.wf-active').length == 0);
});
});
$('#wf-onboarding-agree').on('change', function() {
$('#wf-onboarding-continue').toggleClass('wf-disabled', wordfenceExt.parseEmails($('#wf-onboarding-alerts').val()).length == 0 || !($('#wf-onboarding-agree').is(':checked')) || $('#wf-onboarding-subscribe .wf-switch > li.wf-active').length == 0);
});
$('#wf-onboarding-alerts').on('change paste keyup', function() {
setTimeout(function() {
$('#wf-onboarding-continue').toggleClass('wf-disabled', wordfenceExt.parseEmails($('#wf-onboarding-alerts').val()).length == 0 || !($('#wf-onboarding-agree').is(':checked')) || $('#wf-onboarding-subscribe .wf-switch > li.wf-active').length == 0);
}, 100);
}).trigger('change');
$('#wf-onboarding-continue').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var touppAgreed = !!$('#wf-onboarding-agree').is(':checked');
if (!touppAgreed) {
return;
}
var emails = wordfenceExt.parseEmails($('#wf-onboarding-alerts').val());
if (emails.length > 0) {
var subscribe = !!parseInt($('#wf-onboarding-subscribe .wf-switch > li.wf-active').data('optionValue'));
wordfenceExt.onboardingProcessEmails(emails, subscribe, touppAgreed);
<?php if (wfConfig::get('isPaid')): ?>
$('#wf-onboarding-dismiss').trigger('click');
wordfenceExt.setOption('onboardingAttempt1', '<?php echo esc_attr(wfOnboardingController::ONBOARDING_FIRST_LICENSE); ?>');
$('#wf-onboarding-plugin-header').slideUp();
var html = '<div class="wf-modal wf-modal-success"><div class="wf-model-success-wrapper"><div class="wf-modal-header"><div class="wf-modal-header-content"><div class="wf-modal-title"><?php esc_html_e('Configuration Complete', 'wordfence'); ?></div></div></div><div class="wf-modal-content"><?php esc_html_e('Congratulations! Configuration is complete and Wordfence Premium is active on your website.', 'wordfence'); ?></div></div><div class="wf-modal-footer"><ul class="wf-onboarding-flex-horizontal wf-onboarding-flex-align-right wf-onboarding-full-width"><li><a href="<?php echo esc_url(network_admin_url('admin.php?page=Wordfence')); ?>" class="wf-onboarding-btn wf-onboarding-btn-primary"><?php esc_html_e('Go To Dashboard', 'wordfence'); ?></a></li><li class="wf-padding-add-left-small"><a href="#" class="wf-onboarding-btn wf-onboarding-btn-default" onclick="jQuery.wfcolorbox.close(); return false;" role="button"><?php esc_html_e('Close', 'wordfence'); ?></a></li></ul></div></div>';
$.wfcolorbox({
width: (wordfenceExt.isSmallScreen ? '300px' : '500px'),
html: html,
overlayClose: true,
closeButton: false,
className: 'wf-modal'
});
<?php else: ?>
wordfenceExt.setOption('onboardingAttempt1', '<?php echo esc_attr(wfOnboardingController::ONBOARDING_FIRST_EMAILS); ?>');
$('#wf-onboarding-fresh-install-1').fadeOut(400, function() {
$('#wf-onboarding-fresh-install-2').fadeIn();
});
<?php endif; ?>
}
});
$('#wf-onboarding-license input').on('change paste keyup', function() {
setTimeout(function() {
$('#wf-onboarding-license-install').toggleClass('wf-disabled', $('#wf-onboarding-license input').val().length == 0);
}, 100);
}).trigger('change');
$('#wf-onboarding-license-install').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var license = $('#wf-onboarding-license input').val();
wordfenceExt.onboardingInstallLicense(license,
function(res) { //Success
if (res.isPaid) {
$('#wf-onboarding-dismiss').trigger('click');
var html = '<div class="wf-modal wf-modal-success"><div class="wf-model-success-wrapper"><div class="wf-modal-header"><div class="wf-modal-header-content"><div class="wf-modal-title"><?php esc_html_e('Premium License Installed', 'wordfence'); ?></div></div></div><div class="wf-modal-content"><?php esc_html_e('Congratulations! Wordfence Premium is now active on your website. Please note that some Premium features are not enabled by default.', 'wordfence'); ?></div></div><div class="wf-modal-footer"><ul class="wf-onboarding-flex-horizontal wf-onboarding-flex-align-right wf-onboarding-full-width"><li><a href="<?php echo esc_url(network_admin_url('admin.php?page=Wordfence')); ?>" class="wf-onboarding-btn wf-onboarding-btn-primary"><?php esc_html_e('Go To Dashboard', 'wordfence'); ?></a></li><li class="wf-padding-add-left-small"><a href="#" class="wf-onboarding-btn wf-onboarding-btn-default" onclick="jQuery.wfcolorbox.close(); return false;" role="button"><?php esc_html_e('Close', 'wordfence'); ?></a></li></ul></div></div>';
$.wfcolorbox({
width: (wordfenceExt.isSmallScreen ? '300px' : '500px'),
html: html,
overlayClose: true,
closeButton: false,
className: 'wf-modal'
});
<?php
//Congratulations! Wordfence Premium is now active on your website. Please note that some Premium features are not enabled by default. Read this brief article to learn more about <a href="#todo" target="_blank" rel="noopener noreferrer">getting the most out of Wordfence Premium</a>.
?>
}
else { //Unlikely to happen but possible
var html = '<div class="wf-modal"><div class="wf-modal-header"><div class="wf-modal-header-content"><div class="wf-modal-title"><strong><?php esc_html_e('Free License Installed', 'wordfence'); ?></strong></div></div></div><div class="wf-modal-content"><?php esc_html_e('Free License Installed', 'wordfence'); ?></div><div class="wf-modal-footer"><ul class="wf-onboarding-flex-horizontal wf-onboarding-flex-align-right wf-onboarding-full-width"><li><a href="<?php echo esc_url(network_admin_url('admin.php?page=Wordfence')); ?>" class="wf-onboarding-btn wf-onboarding-btn-primary"><?php esc_html_e('Go To Dashboard', 'wordfence'); ?></a></li><li class="wf-padding-add-left-small"><a href="#" class="wf-onboarding-btn wf-onboarding-btn-default" onclick="jQuery.wfcolorbox.close(); return false;" role="button"><?php esc_html_e('Close', 'wordfence'); ?></a></li></ul></div></div>';
$.wfcolorbox({
width: (wordfenceExt.isSmallScreen ? '300px' : '500px'),
html: html,
overlayClose: true,
closeButton: false,
className: 'wf-modal'
});
}
},
function(res) { //Error
var html = '<div class="wf-modal"><div class="wf-modal-header"><div class="wf-modal-header-content"><div class="wf-modal-title"><strong><?php esc_html_e('Error Installing License', 'wordfence'); ?></strong></div></div></div><div class="wf-modal-content">' + res.error + '</div><div class="wf-modal-footer"><ul class="wf-onboarding-flex-horizontal wf-onboarding-flex-align-right wf-onboarding-full-width"><li><a href="#" class="wf-onboarding-btn wf-onboarding-btn-primary" onclick="jQuery.wfcolorbox.close(); return false;" role="button"><?php esc_html_e('Close', 'wordfence'); ?></a></li></ul></div></div>';
$.wfcolorbox({
width: (wordfenceExt.isSmallScreen ? '300px' : '500px'),
html: html,
overlayClose: true,
closeButton: false,
className: 'wf-modal'
});
});
});
$('#wf-onboarding-no-thanks').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$('#wf-onboarding-dismiss').trigger('click');
});
$('#wf-onboarding-fresh-install').on('click', function(e) {
e.stopPropagation();
});
$(window).on('wfOnboardingDismiss', function() {
if ($('#wf-onboarding-fresh-install-1').is(':visible')) {
wordfenceExt.setOption('onboardingAttempt1', '<?php echo esc_attr(wfOnboardingController::ONBOARDING_FIRST_SKIPPED); ?>');
}
else {
wordfenceExt.setOption('onboardingAttempt1', '<?php echo esc_attr(wfOnboardingController::ONBOARDING_FIRST_LICENSE); ?>');
$('#wf-onboarding-plugin-header').slideUp();
}
});
});
})(jQuery);
</script>