WP Encryption – One Click Free SSL Certificate & SSL / HTTPS Redirect to fix Insecure Content - Version 5.7.3

Version Description

Download this release

Release Info

Developer gowebsmarty
Plugin Icon wp plugin WP Encryption – One Click Free SSL Certificate & SSL / HTTPS Redirect to fix Insecure Content
Version 5.7.3
Comparing to
See all releases

Code changes from version 5.7.2 to 5.7.3

admin/assets/limited-offer.png CHANGED
Binary file
admin/le_admin.php CHANGED
@@ -29,10 +29,8 @@
29
  *
30
  * @since 5.1.1
31
  */
32
- require_once plugin_dir_path(__DIR__) . 'vendor/autoload.php';
33
-
34
- use WPLEClient\LEFunctions;
35
-
36
  require_once WPLE_DIR . 'classes/le-core.php';
37
  require_once WPLE_DIR . 'classes/le-subdir-challenge.php';
38
  /**
@@ -43,326 +41,328 @@ require_once WPLE_DIR . 'classes/le-subdir-challenge.php';
43
  */
44
  class WPLE_Admin
45
  {
46
- private $FIREWALL;
47
- public function __construct()
48
- {
49
- add_action('admin_enqueue_scripts', array($this, 'wple_admin_styles'));
50
- add_action('admin_menu', array($this, 'wple_admin_menu_page'));
51
- add_action(
52
- 'before_wple_admin_form',
53
- array($this, 'wple_debug_log'),
54
- 20,
55
- 1
56
- );
57
- add_action('admin_init', array($this, 'wple_admin_init_hooks'));
58
- add_action('plugins_loaded', array($this, 'wple_load_plugin_textdomain'));
59
- $show_rev = get_option('wple_show_review');
60
- if ($show_rev != FALSE && $show_rev == 1) {
61
- add_action('admin_notices', array($this, 'wple_rateus'));
62
- }
63
- if (FALSE !== get_option('wple_show_reminder')) {
64
- add_action('admin_notices', [$this, 'wple_reminder_notice']);
65
- }
66
- if (FALSE !== get_option('wple_mixed_issues')) {
67
- //since 5.3.12
68
- add_action('admin_notices', [$this, 'wple_mixed_content_notice']);
69
- }
70
- if (isset($_GET['successnotice'])) {
71
- add_action('admin_notices', array($this, 'wple_success_notice'));
72
- }
73
- add_action('wple_show_reviewrequest', array($this, 'wple_set_review_flag'));
74
- add_action('wp_ajax_wple_dismiss', array($this, 'wple_dismiss_notice'));
75
- add_action('wp_ajax_wple_admin_dnsverify', [$this, 'wple_ajx_verify_dns']);
76
- add_action('wple_ssl_reminder_notice', [$this, 'wple_start_show_reminder']);
77
- add_action('wp_ajax_wple_admin_httpverify', [$this, 'wple_ajx_verify_http']);
78
- add_action('wp_ajax_wple_validate_ssl', [$this, 'wple_validate_nocp_ssl']);
79
- add_action('wp_ajax_wple_getcert_for_copy', [$this, 'wple_retrieve_certs_forcopy']);
80
- add_action('wp_ajax_wple_include_www', [$this, 'wple_include_www_check']);
81
- }
82
-
83
- /**
84
- * Enqueue admin styles
85
- *
86
- * @since 1.0.0
87
- * @return void
88
- */
89
- public function wple_admin_styles()
90
- {
91
- wp_enqueue_style(
92
- WPLE_NAME,
93
- WPLE_URL . 'admin/css/le-admin.min.css',
94
- FALSE,
95
- WPLE_PLUGIN_VERSION,
96
- 'all'
97
- );
98
- wp_enqueue_script(
99
- WPLE_NAME . '-popper',
100
- WPLE_URL . 'admin/js/popper.min.js',
101
- array('jquery'),
102
- WPLE_PLUGIN_VERSION,
103
- true
104
- );
105
- wp_enqueue_script(
106
- WPLE_NAME . '-tippy',
107
- WPLE_URL . 'admin/js/tippy-bundle.iife.min.js',
108
- array('jquery'),
109
- WPLE_PLUGIN_VERSION,
110
- true
111
- );
112
- wp_enqueue_script(
113
- WPLE_NAME,
114
- WPLE_URL . 'admin/js/le-admin.js',
115
- array('jquery', WPLE_NAME . '-tippy', WPLE_NAME . '-popper'),
116
- WPLE_PLUGIN_VERSION,
117
- true
118
- );
119
- wp_enqueue_script(
120
- WPLE_NAME . '-fs',
121
- 'https://checkout.freemius.com/checkout.min.js',
122
- array('jquery'),
123
- WPLE_PLUGIN_VERSION,
124
- false
125
- );
126
- wp_localize_script(WPLE_NAME, 'SCAN', array(
127
- 'adminajax' => admin_url('/admin-ajax.php'),
128
- 'base' => site_url('/', 'https'),
129
- ));
130
- }
131
-
132
- /**
133
- * Register plugin page
134
- *
135
- * @since 1.0.0
136
- * @return void
137
- */
138
- public function wple_admin_menu_page()
139
- {
140
- add_menu_page(
141
- WPLE_NAME,
142
- WPLE_NAME,
143
- 'manage_options',
144
- WPLE_SLUG,
145
- array($this, 'wple_menu_page'),
146
- plugin_dir_url(__DIR__) . 'admin/assets/icon.png',
147
- 100
148
- );
149
- }
150
-
151
- public function wple_load_plugin_textdomain()
152
- {
153
- load_plugin_textdomain('wp-letsencrypt-ssl', FALSE, basename(dirname(__FILE__)) . '/languages/');
154
- }
155
-
156
- /**
157
- * Plugin page HTML
158
- *
159
- * @since 1.0.0
160
- * @return void
161
- */
162
- public function wple_menu_page()
163
- {
164
-
165
- if (FALSE === get_option('wple_version')) {
166
- delete_option('wple_plan_choose');
167
- update_option('wple_version', WPLE_PLUGIN_VERSION);
168
- } else {
169
-
170
- if (version_compare(get_option('wple_version'), '5.7.0', '<=')) {
171
- delete_option('wple_plan_choose');
172
- update_option('wple_version', WPLE_PLUGIN_VERSION);
173
- }
174
  }
175
-
176
- $this->wple_subdir_ipaddress();
177
- $eml = '';
178
- $leopts = get_option('wple_opts');
179
- if ($opts = get_option('wple_opts')) {
180
- $eml = (isset($opts['email']) ? $opts['email'] : '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
182
- $pluginmode = 'FREE';
183
- $errorclass = '';
184
-
185
- if (!wple_fs()->is__premium_only() && wple_fs()->can_use_premium_code()) {
186
- $pluginmode = 'FREE plugin with PRO License <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Please upload and activate PRO plugin file via PLUGINS page"></span>';
187
- $errorclass = ' notproerror';
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
189
-
190
-
191
- if (wple_fs()->is__premium_only() && !wple_fs()->can_use_premium_code()) {
192
- $pluginmode = 'PRO plugin with FREE License <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Please activate PRO license key via Account page or Activate License option under the plugin on PLUGINS page"></span>';
193
- $errorclass = ' notproerror';
194
  }
195
-
196
- $html = '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  <div class="wple-header">
198
  <div>
199
  <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . WPLE_PLUGIN_VERSION . ' <span class="wple-pmode' . $errorclass . '">' . $pluginmode . '</span></span>
200
  </div>';
201
- WPLE_Trait::wple_headernav($html);
202
- $html .= '</div>';
203
-
204
- if (FALSE === get_option('wple_plan_choose') || isset($_GET['comparison'])) {
205
- $this->wple_initial_quick_pricing($html);
206
- return;
207
- }
208
-
209
- //5.1.0
210
- $complete = (FALSE !== get_option('wple_complete') ? 1 : 0);
211
-
212
- if ($complete) {
213
- $html .= '<div id="wple-sslgen">';
214
- $this->wple_completed_block($html);
215
- $html .= '</div>';
216
- if (!wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code()) {
217
- $this->wple_upgrade_block($html);
218
- }
219
- echo $html;
220
- return;
221
- }
222
-
223
- $this->wple_success_block($html);
224
- $this->wple_error_block($html);
225
- if (!isset($_GET['wpleauto']) && isset($_GET['subdir'])) {
226
- $this->wple_subdir_challenges($html, $leopts);
227
- }
228
-
229
- if (!wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code()) {
230
-
231
- if (isset($_GET['subdir'])) {
232
- $this->wple_upgrade_block($html);
233
- echo $html;
234
- return;
235
- }
236
-
237
-
238
- if (isset($_GET['success'])) {
239
- $this->wple_upgrade_block($html);
240
- echo $html;
241
- return;
242
- }
243
- }
244
-
245
- $mappeddomain = '';
246
- $formheader = esc_html__('SSL INSTALL FORM - ENTER YOUR EMAIL BELOW & GENERATE SSL CERTIFICATE', 'wp-letsencrypt-ssl');
247
- $currentdomain = esc_html(str_ireplace(array('http://', 'https://'), array('', ''), site_url()));
248
- $maindomain = $currentdomain;
249
- $slashpos = stripos($currentdomain, '/');
250
-
251
- if (FALSE !== $slashpos) {
252
- //subdir installation
253
- $maindomain = substr($currentdomain, 0, $slashpos);
254
- $mappeddomain = '<label style="display: block; padding: 10px 5px; color: #aaa;font-size:15px;">' . esc_html__('PRIMARY DOMAIN', 'wp-letsencrypt-ssl') . '</label>
255
- <p style="width: 800px; max-width:100%; margin: 5px auto 20px;">' . WPLE_Trait::wple_kses(sprintf(__('<strong>NOTE:</strong> Since you are willing to install SSL certificate for sub-directory site, SSL certificate will be generated for your primary domain <strong>%s</strong> which will cover your primary domain + ALL sub-directory sites.', 'wp-letsencrypt-ssl'), $maindomain)) . '</p>
256
- <input type="text" name="wple_domain" class="wple-domain-input" value="' . esc_attr($maindomain) . '" readonly><br />';
257
- }
258
-
259
- //since 5.3.4
260
- $tempdomain = '';
261
- if (FALSE !== stripos($maindomain, 'temp.domains') || FALSE !== stripos($maindomain, '~')) {
262
- $tempdomain = '<p style="width: 800px; max-width:100%; margin: 5px auto 20px;">' . sprintf(
263
- esc_html__("%sWARNING:%s You are trying to install SSL for %stemporary domain%s which is not possible. Please point your real domain like wpencryption.com to your site and update your site url in %ssettings%s > %sgeneral%s before you could generate SSL.", "wp-letsencrypt-ssl"),
264
- "<strong>",
265
- "</strong>",
266
- "<strong>",
267
- "</strong>",
268
- "<strong>",
269
- "</strong>",
270
- "<strong>",
271
- "</strong>"
272
- ) . '</p>';
273
- }
274
- if (isset($leopts['type']) && $leopts['type'] == 'wildcard') {
275
- $html .= '<script>
 
276
  jQuery(document).ready(function(){
277
  jQuery(".single-wildcard-switch").trigger("click");
278
  });
279
  </script>';
280
- }
281
- $html .= '<div id="wple-sslgen">
282
  <h2>' . $formheader . '</h2>';
283
- if (is_multisite() && !wple_fs()->can_use_premium_code__premium_only()) {
284
- $html .= '<p class="wple-multisite">' . WPLE_Trait::wple_kses(__('Upgrade to <strong>PRO</strong> version to avail Wildcard SSL support for multisite and ability to install SSL for mapped domains (different domain names).', 'wp-letsencrypt-ssl')) . '</p>';
285
- }
286
- $html .= WPLE_Trait::wple_progress_bar();
287
- //$cname = '';
288
- //if (FALSE === stripos($currentdomain, '/')) {
289
- // if (stripos($currentdomain, 'www') === FALSE) {
290
- // $cname = '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__("Add a CNAME with name 'www' pointing to your non-www domain", 'wp-letsencrypt-ssl') . '. ' . esc_attr__("Refer FAQ if you want to generate SSL for both www & non-www domain.", 'wp-letsencrypt-ssl') . '"></span>';
291
- // } else {
292
- //$cname = '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__("Refer FAQ if you want to generate SSL for both www & non-www domain.", 'wp-letsencrypt-ssl') . '"></span>';
293
- //}
294
- //}
295
- $bothchecked = '';
296
- $leadminform = '<form method="post" class="le-genform single-genform">' . $mappeddomain . $tempdomain . '
297
- <input type="email" name="wple_email" class="wple_email" value="' . esc_attr($eml) . '" placeholder="' . esc_attr__('Enter your email address', 'wp-letsencrypt-ssl') . '" ><br />';
298
- // if (FALSE === stripos('www', $maindomain)) {
299
- // $altdomain = 'www.' . $maindomain;
300
- // } else {
301
- // $altdomain = str_ireplace('www.', '', $maindomain);
302
- // }
303
- // $altdomaintest = wp_remote_head('http://' . $altdomain, array('sslverify' => false, 'timeout' => 30));
304
- ///if (!is_wp_error($altdomaintest) || isset($_GET['includewww'])) {
305
- $leadminform .= '<span class="lecheck">
306
  <label class="checkbox-label">
307
  <input type="checkbox" name="wple_include_www" class="wple_include_www" value="1" ' . $bothchecked . '>
308
  <span class="checkbox-custom rectangular"></span>
309
  </label>
310
- ' . esc_html__('Generate SSL Certificate for both www & non-www version of domain', 'wp-letsencrypt-ssl') . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__("Before enabling this - please make sure both www & non-www version of your domain works!. Add a CNAME with name 'www' pointing to your non-www domain in your domain DNS zone editor", 'wp-letsencrypt-ssl') . '"></span></label>
311
  </span><br />';
312
- ///}
313
-
314
- if (isset($_GET['includeemail'])) {
315
- $leadminform .= '<span class="lecheck">
316
  <label class="checkbox-label">
317
  <input type="checkbox" name="wple_include_mail" class="wple_include_mail" value="1">
318
  <span class="checkbox-custom rectangular"></span>
319
  </label>
320
- ' . esc_html__('Secure POP/IMAP email server', 'wp-letsencrypt-ssl') . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . sprintf(esc_attr__("This option will secure %s but DNS based domain verification is MANDATORY", 'wp-letsencrypt-ssl'), 'mail.' . $maindomain) . '"></span></label>
321
  </span><br />';
322
- $webmail = 'webmail.' . $maindomain;
323
- $leadminform .= '<span class="lecheck">
324
  <label class="checkbox-label">
325
  <input type="checkbox" name="wple_include_webmail" class="wple_include_webmail" value="1">
326
  <span class="checkbox-custom rectangular"></span>
327
  </label>
328
- ' . sprintf(esc_html__('Secure %s', 'wp-letsencrypt-ssl'), $webmail) . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . sprintf(esc_attr__("This option will secure %s but DNS based domain verification is MANDATORY", 'wp-letsencrypt-ssl'), $webmail) . '"></span></label>
329
  </span><br />';
330
- }
331
-
332
- $leadminform .= '<span class="lecheck">
333
  <label class="checkbox-label">
334
  <input type="checkbox" name="wple_send_usage" value="1" checked>
335
  <span class="checkbox-custom rectangular"></span>
336
  </label>
337
- ' . esc_html__('Anonymously send response data to get better support', 'wp-letsencrypt-ssl') . '</label>
338
  </span><br />';
339
- $leadminform .= '<span class="lecheck">
340
  <label class="checkbox-label">
341
  <input type="checkbox" name="wple_agree_le_tos" class="wple_agree_le" value="1">
342
  <span class="checkbox-custom rectangular"></span>
343
  </label>
344
- ' . WPLE_Trait::wple_kses(sprintf(
345
- __("I agree to %sLet's Encrypt%s %sTerms of service%s", "wp-letsencrypt-ssl"),
346
- '<b>',
347
- '<sup style="font-size: 10px; padding: 3px">TM</sup></b>',
348
- '<a href="' . esc_attr__('https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf', 'wp-letsencrypt-ssl') . '" rel="nofollow" target="_blank" style="margin-left:5px">',
349
- '</a>'
350
- ), 'a') . '
351
  </span>
352
  <span class="lecheck">
353
  <label class="checkbox-label">
354
  <input type="checkbox" name="wple_agree_gws_tos" class="wple_agree_gws" value="1">
355
  <span class="checkbox-custom rectangular"></span>
356
  </label>
357
- ' . WPLE_Trait::wple_kses(sprintf(__("I agree to <b>WP Encryption</b> %sTerms of service%s", "wp-letsencrypt-ssl"), '<a href="https://gowebsmarty.com/terms-and-conditions/" rel="nofollow" target="_blank" style="margin-left:5px">', '</a>'), 'a') . '
358
  </span>
359
  ' . wp_nonce_field(
360
- 'legenerate',
361
- 'letsencrypt',
362
- false,
363
- false
364
- ) . '
365
- <button type="submit" name="generate-certs" id="singledvssl">' . esc_html__('Generate SSL Certificate', 'wp-letsencrypt-ssl') . '</button>
366
  </form>
367
 
368
  <div id="wple-error-popper">
@@ -371,333 +371,337 @@ class WPLE_Admin
371
  <div class="wple-error">Error</div>
372
  </div>
373
  </div>';
374
- $nonwww = str_ireplace('www.', '', $currentdomain);
375
- if (FALSE !== ($ps = stripos($nonwww, '/'))) {
376
- $nonwww = substr($nonwww, 0, $ps);
377
- }
378
- $wwwdomain = 'www.' . $nonwww;
379
-
380
- if (FALSE != stripos($currentdomain, 'www.')) {
381
- $wwwdomain = $nonwww;
382
- $nonwww = 'www.' . $nonwww;
383
- }
384
-
385
- $showonpro = '';
386
- $html .= '<div class="wple-single-dv-ssl">
387
  <div class="wple-info-box">
388
- <h3>' . esc_html__('Domains Covered', 'wp-letsencrypt-ssl') . '</h3>
389
  <strong>' . $nonwww . '</strong>
390
  <div class="wple-www' . $showonpro . '"><strong>' . $wwwdomain . '</strong></div>
391
  <div class="wple-wc"><strong>*.' . $nonwww . '</strong></div>
392
  </div>';
393
- ob_start();
394
- do_action('before_wple_admin_form', $html);
395
- $html .= ob_get_contents();
396
- ob_end_clean();
397
- $html .= apply_filters('wple_admin_form', $leadminform);
398
- ob_start();
399
- do_action('after_wple_admin_form', $html);
400
- $html .= ob_get_contents();
401
- ob_end_clean();
402
- $html .= '</div>';
403
- $prosupport = WPLE_Trait::wple_kses(sprintf(__('Brought to you by %sWP Encryption%s.'), '<a href="https://wpencryption.com" target="_blank">', '</a>'), 'a');
404
- $html .= '
405
  <div class="le-powered">
406
- <span>' . $prosupport . ' ' . WPLE_Trait::wple_kses(sprintf('SSL Certificate will be generated by %s (An open certificate authority).', "<b>Let's Encrypt<sup style=\"font-size: 10px; padding: 3px\">TM</sup></b>")) . '</span>
407
  </div>';
408
- $html .= '
409
  </div><!--wple-sslgen-->';
410
-
411
- if (!wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code()) {
412
- $this->wple_upgrade_block($html);
413
- } else {
414
- $this->wple_expert_block($html);
415
- }
416
-
417
- echo $html;
418
- }
419
-
420
- /**
421
- * log process & error in debug.log file
422
- *
423
- * @since 1.0.0
424
- * @param string $html
425
- * @return void
426
- */
427
- public function wple_debug_log($html)
428
- {
429
-
430
- if (!file_exists(WPLE_DEBUGGER)) {
431
- wp_mkdir_p(WPLE_DEBUGGER);
432
- $htacs = '<Files debug.log>' . "\n" . 'Order allow,deny' . "\n" . 'Deny from all' . "\n" . '</Files>';
433
- file_put_contents(WPLE_DEBUGGER . '.htaccess', $htacs);
434
- }
435
-
436
- //show only upon error since 4.6.0
437
-
438
- if (isset($_GET['error'])) {
439
- $html = '<div class="toggle-debugger"><span class="dashicons dashicons-arrow-down-alt2"></span> ' . esc_html__('Show/hide full response', 'wp-letsencrypt-ssl') . '</div>';
440
- $file = WPLE_DEBUGGER . 'debug.log';
441
-
442
- if (file_exists($file)) {
443
- $log = file_get_contents($file);
444
- $hideh2 = '';
445
- if (isset($_GET['dnsverified']) || isset($_GET['dnsverify'])) {
446
- $hideh2 = 'hideheader';
447
- }
448
- $html .= '<div class="le-debugger running ' . $hideh2 . '"><h3>' . esc_html__('Response Log', 'wp-letsencrypt-ssl') . ':</h3>' . WPLE_Trait::wple_kses(nl2br($log)) . '</div>';
449
- } else {
450
- $html .= '<div class="le-debugger">' . esc_html__("Full response will be shown here", 'wp-letsencrypt-ssl') . '</div>';
451
- }
452
-
453
- echo $html;
454
  }
455
- }
456
-
457
- /**
458
- * Save email & proceed upon clicking install SSL
459
- *
460
- * @since 1.0.0
461
- * @return void
462
- */
463
- public function wple_save_email_generate_certs()
464
- {
465
- //since 2.4.0
466
- //force https upon success
467
-
468
- if (isset($_POST['wple-https'])) {
469
- if (!wp_verify_nonce($_POST['sslready'], 'wplehttps') || !current_user_can('manage_options')) {
470
- exit('Unauthorized access');
471
- }
472
- $basedomain = str_ireplace(array('http://', 'https://'), array('', ''), addslashes(site_url()));
473
- //4.7
474
- if (FALSE != stripos($basedomain, '/')) {
475
- $basedomain = substr($basedomain, 0, stripos($basedomain, '/'));
476
- }
477
- $client = WPLE_Trait::wple_verify_ssl($basedomain);
478
-
479
- if (!$client && !is_ssl()) {
480
- wp_redirect(admin_url('/admin.php?page=wp_encryption&success=1&nossl=1', 'http'));
481
- exit;
482
- }
483
-
484
- // $SSLCheck = @fsockopen("ssl://" . $basedomain, 443, $errno, $errstr, 30);
485
- // if (!$SSLCheck) {
486
- // wp_redirect(admin_url('/admin.php?page=wp_encryption&success=1&nossl=1', 'http'));
487
- // exit();
488
- // }
489
- $reverter = uniqid('wple');
490
- $savedopts = get_option('wple_opts');
491
- $savedopts['force_ssl'] = 1;
492
- $savedopts['revertnonce'] = $reverter;
493
- ///WPLE_Trait::wple_send_reverter_secret($reverter);
494
- update_option('wple_opts', $savedopts);
495
- delete_option('wple_error');
496
- //complete
497
- update_option('wple_complete', 1);
498
- update_option('siteurl', str_ireplace('http:', 'https:', get_option('siteurl')));
499
- update_option('home', str_ireplace('http:', 'https:', get_option('home')));
500
- wp_redirect(admin_url('/admin.php?page=wp_encryption', 'https'));
501
- exit;
502
  }
503
-
504
- //single domain ssl
505
-
506
- if (isset($_POST['generate-certs'])) {
507
- if (!wp_verify_nonce($_POST['letsencrypt'], 'legenerate') || !current_user_can('manage_options')) {
508
- die('Unauthorized request');
509
- }
510
- if (empty($_POST['wple_email'])) {
511
- wp_die(esc_html__('Please input valid email address', 'wp-letsencrypt-ssl'));
512
- }
513
- $leopts = array(
514
- 'email' => sanitize_email($_POST['wple_email']),
515
- 'date' => date('d-m-Y'),
516
- 'expiry' => '',
517
- 'type' => 'single',
518
- 'send_usage' => (isset($_POST['wple_send_usage']) ? 1 : 0),
519
- 'include_www' => (isset($_POST['wple_include_www']) ? 1 : 0),
520
- 'include_mail' => (isset($_POST['wple_include_mail']) ? 1 : 0),
521
- 'include_webmail' => (isset($_POST['wple_include_webmail']) ? 1 : 0),
522
- 'agree_gws_tos' => (isset($_POST['wple_agree_gws_tos']) ? 1 : 0),
523
- 'agree_le_tos' => (isset($_POST['wple_agree_le_tos']) ? 1 : 0),
524
- );
525
-
526
- if (isset($_POST['wple_domain']) && !is_multisite()) {
527
- $leopts['subdir'] = 1;
528
- $leopts['domain'] = sanitize_text_field($_POST['wple_domain']);
529
- }
530
-
531
- update_option('wple_opts', $leopts);
532
- new WPLE_Core($leopts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  }
534
- }
535
-
536
- /**
537
- * Download cert files based on clicked link
538
- *
539
- * certs for multisite mapped domains cannot be downloaded yet
540
- * @since 1.0.0
541
- * @return void
542
- */
543
- public function wple_download_files()
544
- {
545
-
546
- if (isset($_GET['le']) && current_user_can('manage_options')) {
547
- switch ($_GET['le']) {
548
- case '1':
549
- $file = uniqid() . '-cert.crt';
550
- file_put_contents($file, file_get_contents(ABSPATH . 'keys/certificate.crt'));
551
- break;
552
- case '2':
553
- $file = uniqid() . '-key.pem';
554
- file_put_contents($file, file_get_contents(ABSPATH . 'keys/private.pem'));
555
- break;
556
- case '3':
557
- $file = uniqid() . '-cabundle.crt';
558
-
559
- if (file_exists(ABSPATH . 'keys/cabundle.crt')) {
560
- $cabundlefile = file_get_contents(ABSPATH . 'keys/cabundle.crt');
561
- } else {
562
- $cabundlefile = file_get_contents(WPLE_DIR . 'cabundle/ca.crt');
563
- }
564
-
565
- file_put_contents($file, $cabundlefile);
566
- break;
567
- }
568
- header('Content-Description: File Transfer');
569
- header('Content-Type: text/plain');
570
- header('Content-Length: ' . filesize($file));
571
- header('Content-Disposition: attachment; filename=' . basename($file));
572
- readfile($file);
573
- if (file_exists($file)) {
574
- unlink($file);
575
- }
576
- exit;
 
577
  }
578
- }
579
-
580
- /**
581
- * Rate us admin notice
582
- *
583
- * @since 2.0.0
584
- * @return void
585
- */
586
- public function wple_rateus()
587
- {
588
- $cert = ABSPATH . 'keys/certificate.crt';
589
-
590
- if (file_exists($cert)) {
591
- if (isset($_GET['page']) && $_GET['page'] == 'wp_encryption') {
592
- return;
593
- }
594
- $reviewnonce = wp_create_nonce('wplereview');
595
- $html = '<div class="notice notice-info wple-admin-review">
596
  <div class="wple-review-box">
597
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
598
- <span><strong>' . esc_html__('Congratulations!', 'wp-letsencrypt-ssl') . '</strong><p>' . WPLE_Trait::wple_kses(__('SSL certificate generated successfully!. <b>WP Encryption</b> just saved you several $$$ by generating free SSL certificate in record time!. Could you please do us a BIG favor & rate us with 5 star review to support further development of this plugin.', 'wp-letsencrypt-ssl')) . '</p></span>
599
  </div>
600
- <a class="wple-lets-review wplerevbtn" href="https://wordpress.org/support/plugin/wp-letsencrypt-ssl/reviews/#new-post" rel="nofollow noopener" target="_blank">' . esc_html__('Rate plugin', 'wp-letsencrypt-ssl') . '</a>
601
- <a class="wple-did-review wplerevbtn" href="#" data-nc="' . esc_attr($reviewnonce) . '" data-action="1">' . esc_html__('I already did', 'wp-letsencrypt-ssl') . '&nbsp;<span class="dashicons dashicons-smiley"></span></a>
602
- <a class="wple-later-review wplerevbtn" href="#" data-nc="' . esc_attr($reviewnonce) . '" data-action="2">' . esc_html__('Remind me later', 'wp-letsencrypt-ssl') . '&nbsp;<span class="dashicons dashicons-clock"></span></a>
603
  </div>';
604
- echo $html;
605
- }
606
- }
607
-
608
- /**
609
- * Check if wp install is IP or subdir based
610
- *
611
- * @since 2.4.0
612
- * @return void
613
- */
614
- public function wple_subdir_ipaddress()
615
- {
616
- $siteURL = str_ireplace(array('http://', 'https://', 'www.'), array('', '', ''), site_url());
617
- $flg = 0;
618
- if (filter_var($siteURL, FILTER_VALIDATE_IP)) {
619
- $flg = 1;
620
- }
621
- if (FALSE !== stripos($siteURL, 'localhost')) {
622
- $flg = 1;
623
  }
624
-
625
- if (FALSE != stripos($siteURL, '/') && is_multisite()) {
626
- $html = '<div class="wrap" id="le-wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
627
  <div class="le-inner">
628
  <div class="wple-header">
629
- <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html(WPLE_PLUGIN_VERSION) . '</span>
630
  </div>
631
  <div class="wple-warning-notice">
632
- <h2>' . esc_html__('You do not need to install SSL for each sub-directory site in multisite, Please install SSL for your primary domain and it will cover ALL sub directory sites too.', 'wp-letsencrypt-ssl') . '</h2>
633
  </div>
634
  </div>
635
  </div>';
636
- echo $html;
637
- wp_die();
638
- }
639
-
640
-
641
- if ($flg) {
642
- $html = '<div class="wrap" id="le-wrap">
643
  <div class="le-inner">
644
  <div class="wple-header">
645
- <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html(WPLE_PLUGIN_VERSION) . '</span>
646
  </div>
647
  <div class="wple-warning-notice">
648
- <h2>' . esc_html__('SSL Certificates cannot be issued for localhost and IP address based WordPress site. Please use this on your real domain based WordPress site.', 'wp-letsencrypt-ssl') . ' ' . esc_html__('This restriction is not implemented by WP Encryption but its how SSL certificates work.', 'wp-letsencrypt-ssl') . '</h2>
649
  </div>
650
  </div>
651
  </div>';
652
- echo $html;
653
- wp_die();
654
- }
655
- }
656
-
657
- /**
658
- * Upgrade to PRO
659
- *
660
- * @param string $html
661
- * @since 2.5.0
662
- * @return void
663
- */
664
- public function wple_upgrade_block(&$html)
665
- {
666
- $upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing');
667
- ///$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd&coupon=FIRSTBUY');
668
- $nopricing = get_option('wple_no_pricing');
669
- //gdy
670
- $cp = get_option('wple_have_cpanel');
671
- if (FALSE === $nopricing && !$cp) {
672
- //not gdy & not cpanel
673
- //$nopricing = rand( 0, 1 );
674
- $nopricing = 0;
675
- }
676
- $automatic = esc_html__('Automatic', 'wp-letsencrypt-ssl');
677
- $manual = esc_html__('Manual', 'wp-letsencrypt-ssl');
678
- $domain = str_ireplace(array('https://', 'http://', 'www.'), '', site_url());
679
- $dverify = $automatic;
680
- if (stripos($domain, '/') != FALSE) {
681
- //subdir site
682
- $dverify = $manual;
683
  }
684
- $html .= '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
685
  <div id="wple-upgradepro">';
686
-
687
- if (FALSE !== $cp && $cp) {
688
- $html .= '<strong style="display: block; text-align: center; color: #666;">Woot Woot! You have <b>CPANEL</b>! Why struggle with manual SSL renewal every 90 days? - Enjoy 100% automation with PRO version.</strong>';
689
- ///$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd');
690
- }
691
-
692
- $compareurl = 'https://wpencryption.com?utm_source=wordpress&utm_medium=comparison&utm_campaign=wpencryption';
693
- //$compareurl = admin_url('/admin.php?page=wp_encryption&comparison=1');
694
-
695
- if ($nopricing) {
696
- $compareurl = admin_url('/admin.php?page=wp_encryption&comparison=1');
697
- //$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=11394&plan_name=pro&billing_cycle=annual&pricing_id=11717&currency=usd');
698
- $upgradeurl = 'https://checkout.freemius.com/mode/dialog/plugin/5090/plan/10643/';
699
- //CDN
700
- $html .= '<div class="wple-error-firewall fire-pro wple-procdn">
701
  <div>
702
  <img src="' . WPLE_URL . 'admin/assets/firewall-shield-pro.png"/>
703
  </div>
@@ -708,105 +712,105 @@ class WPLE_Admin
708
  <span><b>Automatic CDN</b><br>Your site is served from 42 full scale edge locations for faster content delivery and fastest performance.</span>
709
  </div>
710
  </div>';
711
- } else {
712
- $html .= '<div class="wple-plans">
713
- <span class="free">* ' . esc_html__('FREE', 'wp-letsencrypt-ssl') . '</span>
714
- <span class="pro">* ' . esc_html__('PRO', 'wp-letsencrypt-ssl') . '</span>
715
  </div>
716
  <div class="wple-plan-compare">
717
  <div class="wple-compare-item">
718
  <img src="' . WPLE_URL . 'admin/assets/verified.png"/>
719
- <h4>' . esc_html__('HTTP Verification', 'wp-letsencrypt-ssl') . '</h4>
720
  <span class="wple-free">' . $manual . '</span>
721
  <span class="wple-pro">' . $automatic . '</span>
722
  </div>
723
  <div class="wple-compare-item">
724
  <img src="' . WPLE_URL . 'admin/assets/DNS.png"/>
725
- <h4>' . esc_html__('DNS Verification', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__('In case of HTTP verification fail / not possible', 'wp-letsencrypt-ssl') . '"></span></h4>
726
  <span class="wple-free">' . $manual . '</span>
727
  <span class="wple-pro">' . $automatic . '</span>
728
  </div>
729
  <div class="wple-compare-item">
730
  <img src="' . WPLE_URL . 'admin/assets/Install.png"/>
731
- <h4>' . esc_html__('SSL Installation', 'wp-letsencrypt-ssl') . ' <!--<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__('PRO - We offer one time free manual support for non-cPanel based sites', 'wp-letsencrypt-ssl') . '"></span>--></h4>
732
  <span class="wple-free">' . $manual . '</span>
733
  <span class="wple-pro">' . $automatic . '</span>
734
  </div>
735
  <div class="wple-compare-item">
736
  <img src="' . WPLE_URL . 'admin/assets/renewal.png"/>
737
- <h4>' . esc_html__('SSL Renewal', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__('Free users must manually renew / re-generate SSL certificate every 90 days.', 'wp-letsencrypt-ssl') . '"></span></h4>
738
  <span class="wple-free">' . $manual . '</span>
739
  <span class="wple-pro">' . $automatic . '</span>
740
  </div>
741
  <div class="wple-compare-item">
742
  <img src="' . WPLE_URL . 'admin/assets/wildcard.png"/>
743
- <h4>' . esc_html__('Wildcard SSL', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__('PRO - Your domain DNS must be managed by cPanel or Godaddy for full automation', 'wp-letsencrypt-ssl') . '"></span></h4>
744
- <span class="wple-free">' . esc_html__('Not Available', 'wp-letsencrypt-ssl') . '</span>
745
- <span class="wple-pro">' . esc_html__('Available', 'wp-letsencrypt-ssl') . '</span>
746
  </div>
747
  <div class="wple-compare-item">
748
  <img src="' . WPLE_URL . 'admin/assets/multisite.png"/>
749
- <h4>' . esc_html__('Multisite Support', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__('PRO - Support for Multisite + Mapped domains', 'wp-letsencrypt-ssl') . '"></span></h4>
750
- <span class="wple-free">' . esc_html__('Not Available', 'wp-letsencrypt-ssl') . '</span>
751
- <span class="wple-pro">' . esc_html__('Available', 'wp-letsencrypt-ssl') . '</span>
752
  </div>
753
  </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
  }
755
-
756
- ///$html .= '<div style="text-align:center"><img src="' . WPLE_URL . '/admin/assets/new-year.png"></div>';
757
- $html .= '<div class="wple-upgrade-pro">
758
- <a href="' . $compareurl . '" target="_blank" class="wplecompare">' . esc_html__('COMPARE FREE & PRO VERSION', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-external"></span></a>';
759
- // if (isset($_GET['success']) && FALSE == $nopricing) {
760
- // $html .= '<a href="' . $upgradeurl . '">' . esc_html__('UPGRADE TO PRO', 'wp-letsencrypt-ssl') . '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Requires cPanel or root SSH access"></span></a>
761
- // <a href="https://wpencryption.com/#firewall" target="_blank">' . esc_html__('UPGRADE TO FIREWALL', 'wp-letsencrypt-ssl') . '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Why buy an SSL alone when you can get Premium SSL + CDN + Firewall Security for even lower cost."></span></a>';
762
- // } else {
763
-
764
- if ($nopricing) {
765
- $html .= '<a href="' . $upgradeurl . '">' . esc_html__('UPGRADE TO CDN', 'wp-letsencrypt-ssl') . '</a>';
766
- } else {
767
- $html .= '<a href="' . $upgradeurl . '">' . esc_html__('UPGRADE TO PRO', 'wp-letsencrypt-ssl') . '</a>';
768
- }
769
-
770
- //$html .= '<a href="https://checkout.freemius.com/mode/dialog/plugin/5090/plan/10643/" target="_blank" id="upgradetocdn">' . esc_html__('UPGRADE TO CDN', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Sky rocket your WordPress site performance with Fastest Content Delivery Network + Premium Sectigo SSL"></span></a>';
771
- // }
772
- $html .= '</div>';
773
- // $rnd = rand(0, 1);
774
- // if ($rnd) {
775
- // $html .= '<div class="wple-hire-expert"><a href="https://wpencryption.com/cdn-firewall/?utm_campaign=wpencryptionsite&utm_medium=checkoutcdn&utm_source=upgradeblock" target="_blank">Sky Rocket your site speed with our <strong>CDN</strong> plan (<strong>Includes SSL + Performance</strong>) <span class="dashicons dashicons-external"></span></a></div>';
776
- // } else {
777
- // $html .= '<div class="wple-hire-expert"><a href="https://wpencryption.com/hire-ssl-expert/?utm_campaign=wpencryptionsite&utm_medium=hiresslexpert&utm_source=upgradeblock" target="_blank">Too busy? <b>Hire an expert</b> for secure migration to HTTPS (<b>ONE YEAR PRO LICENSE FREE</b>) <span class="dashicons dashicons-external"></span></a></div>';
778
- // }
779
- $html .= '</div><!--wple-upgradepro-->';
780
- $html .= '<div id="ourotherplugin">Check out our another awesome plugin <a href="https://wordpress.org/plugins/go-viral/" target="_blank"><img src="' . WPLE_URL . 'admin/assets/goviral-logo.png"/> - All in one social toolkit</a></div>';
781
- }
782
-
783
- /**
784
- * Success Message block
785
- *
786
- * @param string $html
787
- * @since 2.5.0
788
- * @return void
789
- */
790
- public function wple_success_block(&$html)
791
- {
792
- //since 2.4.0
793
-
794
- if (isset($_GET['success'])) {
795
- $this->wple_wellknown_htaccess();
796
- update_option('wple_error', 5);
797
- //all success
798
- $html .= '
799
  <div id="wple-sslgenerator">
800
  <div class="wple-success-form">';
801
- // if (!isset($_GET['resume']) && !isset($_GET['nossl'])) {
802
- // $this->wple_send_success_mail();
803
- // }
804
- $html .= '<h2><span class="dashicons dashicons-yes"></span>&nbsp;' . WPLE_Trait::wple_kses(__('<b>Congrats! SSL Certificate have been successfully generated.</b>', 'wp-letsencrypt-ssl')) . '</h2>
805
- <h3 style="width: 87%; margin: 0px auto; color: #7b8279; font-weight:400;">' . WPLE_Trait::wple_kses(__('We just completed major task of generating SSL certificate! Now we have ONE final step to complete.', 'wp-letsencrypt-ssl')) . '</h3>';
806
- $html .= WPLE_Trait::wple_progress_bar();
807
- ///$nopricing = get_option('wple_no_pricing');
808
- //$colclass = FALSE != $nopricing ? 'wple-three-cols' : '';
809
- $html .= '
810
 
811
  <div class="wple-success-flex">
812
  <div class="wple-success-flex-video">
@@ -814,23 +818,23 @@ class WPLE_Admin
814
  </div>
815
  <div class="wple-success-flex-final">
816
  <ul class="download-ssl-certs">
817
- <li>1. ' . sprintf(__('%sClick here%s to login into your cPanel.', 'wp-letsencrypt-ssl'), '<a href="' . site_url('cpanel') . '" target="_blank">', '</a>') . '</li>
818
- <li>2. ' . sprintf(__('Open %sSSL/TLS%s option on your cPanel', 'wp-letsencrypt-ssl'), '<strong><img src="' . WPLE_URL . '/admin/assets/tls.png" style="width: 20px;margin-bottom: -5px;">&nbsp;', '</strong>') . '</li>
819
- <li>3. ' . sprintf(__('Click on %sManage SSL Sites%s option', 'wp-letsencrypt-ssl'), '<strong>', '</strong>') . '</li>
820
  <li>4. ' . sprintf(
821
- __('Copy the contents of %sCertificate.crt%s, %sPrivate.pem%s, %sCABundle.crt%s files from below & paste them into its appropriate fields on cPanel', 'wp-letsencrypt-ssl'),
822
- '<strong>',
823
- '</strong>',
824
- '<strong>',
825
- '</strong>',
826
- '<strong>',
827
- '</strong>'
828
- ) . '. ' . esc_html("You can also download the cert files to your local computer, right click > open with notepad to view/copy", "wp-letsencrypt-ssl") . '</li>
829
  <li>';
830
- WPLE_Trait::wple_copy_and_download($html);
831
- $html .= '</li>
832
- <li>5. ' . sprintf(__('Click on %sInstall certificate%s', 'wp-letsencrypt-ssl'), '<strong>', '</strong>') . '</li>
833
- <li>6. ' . sprintf(__('Please wait few minutes and click on %sEnable HTTPS Now%s button', 'wp-letsencrypt-ssl'), '<strong>', '</strong>') . '</li>
834
  </ul>
835
 
836
  </div>
@@ -838,598 +842,613 @@ class WPLE_Admin
838
 
839
  <div class="wple-success-cols wple-three-cols">
840
  <div>
841
- <h3>' . esc_html__("Don't have cPanel?", 'wp-letsencrypt-ssl') . '</h3>
842
- <p>' . esc_html__("cPanel link goes to 404 not found page?. ", 'wp-letsencrypt-ssl') . sprintf(
843
- __('If you have root SSH access, edit your server config file and point your SSL paths to %scertificate.crt%s & %sprivate.pem%s files in %skeys/%s folder. Alternatively, Upgrade to %sPRO%s version for automatic SSL installation and automatic SSL renewal.', 'wp-letsencrypt-ssl'),
844
- '<strong>',
845
- '</strong>',
846
- '<strong>',
847
- '</strong>',
848
- '<strong>',
849
- '</strong>',
850
- '<a href="' . admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd') . '"><strong>',
851
- '</strong></a>'
852
- ) . '</p>
853
  </div>
854
  <div>
855
- <h3>' . esc_html__("Test SSL Installation", 'wp-letsencrypt-ssl') . '</h3>
856
- <p>' . esc_html__("After installing SSL certs on your cPanel, open your site in https:// and click on padlock to see if valid certificate exists. You can also test your site's SSL on SSLLabs.com", "wp-letsencrypt-ssl") . '</p>
857
  </div>
858
  <div>
859
- <h3>' . esc_html__("By Clicking Enable HTTPS", 'wp-letsencrypt-ssl') . '</h3>
860
- <p>' . esc_html__('Your site & admin url will be changed to https:// and all assets, js, css, images will strictly load over https:// to avoid mixed content errors.', 'wp-letsencrypt-ssl') . '</p>
861
  </div>';
862
- // if (FALSE == $nopricing) {
863
- // $html .= '<div>
864
- // <h3>' . esc_html__("Looking for instant SSL solution?", 'wp-letsencrypt-ssl') . '</h3>
865
- // <p>' . sprintf(__('Why pay for an SSL certificate alone when you can get %sPremium Sectigo SSL%s + %sCDN Performance%s + %sSecurity Firewall%s for even lower cost with our %sCDN%s Service.', 'wp-letsencrypt-ssl'), '<strong>', '</strong>', '<strong>', '</strong>', '<strong>', '</strong>', '<a href="https://wpencryption.com/cdn-firewall/?utm_campaign=wpencryption&utm_source=wordpress&utm_medium=gocdn" target="_blank">', '</a>') . '!.</p>
866
- // </div>';
867
- // }
868
- $html .= '</div>
869
 
870
  <ul>
871
- <!--<li>' . WPLE_Trait::wple_kses(__('<b>Note:</b> Use below "Enable HTTPS" button ONLY after SSL certificate is successfully installed on your cPanel', 'wp-letsencrypt-ssl')) . '</li>-->
872
  </ul>';
873
- if (isset($_GET['nossl'])) {
874
- $html .= '<h3 style="color:#ff4343;margin-bottom:10px;margin: 0 auto 10px; max-width: 800px;">' . esc_html__('We could not detect valid SSL certificate installed on your site!. Please try after some time. You can also try opening wp-admin via https:// and click on enable https button.', 'wp-letsencrypt-ssl') . '</h3>
875
- <p>' . esc_html__('Switching to HTTPS without properly installing the SSL certificate might break your site.', 'wp-letsencrypt-ssl') . '</p>';
876
- }
877
- $html .= '<form method="post">
878
  ' . wp_nonce_field(
879
- 'wplehttps',
880
- 'sslready',
881
- false,
882
- false
883
- ) . '
884
- <button type="submit" name="wple-https">' . esc_html__('ENABLE HTTPS NOW', 'wp-letsencrypt-ssl') . '</button>
885
  </form>
886
  </div>
887
  </div><!--wple-sslgenerator-->';
 
 
888
  }
889
- }
890
-
891
- /**
892
- * Show pending challenges
893
- *
894
- * @return void
895
- */
896
- public function wple_domain_verification()
897
- {
898
- //since 5.1.0
899
-
900
- if (isset($_GET['restart'])) {
901
- //click to restart from beginning
902
- delete_option('wple_error');
903
- delete_option('wple_complete');
904
- wp_redirect(admin_url('/admin.php?page=wp_encryption'), 302);
905
- exit;
906
- }
907
-
908
-
909
- if (isset($_GET['complete'])) {
910
- //Forced SSL completion flag
911
- delete_option('wple_error');
912
- update_option('wple_complete', 1);
913
- update_option('wple_backend', 1);
914
- if (wp_next_scheduled('wple_ssl_renewal')) {
915
- wp_clear_scheduled_hook('wple_ssl_renewal');
916
- }
917
- wp_redirect(admin_url('/admin.php?page=wp_encryption'), 302);
918
- exit;
919
- }
920
-
921
- $estage = get_option('wple_error');
922
- //redirections
923
-
924
- if (FALSE !== $estage && $estage == 2 && !isset($_GET['subdir']) && !isset($_GET['error']) && !isset($_GET['includewww']) && !isset($_GET['wpleauto']) && isset($_GET['page']) && $_GET['page'] == 'wp_encryption' && !isset($_GET['success']) && !isset($_GET['wplereset']) && !isset($_GET['comparison']) && !isset($_GET['lasterror'])) {
925
- wp_redirect(admin_url('/admin.php?page=wp_encryption&subdir=1'), 302);
926
- exit;
927
- }
928
-
929
-
930
- if (FALSE !== $estage && $estage == 5 && !isset($_GET['subdir']) && !isset($_GET['error']) && !isset($_GET['includewww']) && !isset($_GET['wpleauto']) && isset($_GET['page']) && $_GET['page'] == 'wp_encryption' && !isset($_GET['resume']) && !isset($_GET['nossl']) && !isset($_GET['wplereset']) && !isset($_GET['comparison']) && !isset($_GET['nocpanel'])) {
931
- wp_redirect(admin_url('/admin.php?page=wp_encryption&success=1&resume=1'), 302);
932
- exit;
933
- }
934
- }
935
-
936
- /**
937
- * Error Message block
938
- *
939
- * @param string $html
940
- * @since 2.5.0
941
- * @return void
942
- */
943
- public function wple_error_block(&$html)
944
- {
945
- if (!isset($_GET['subdir']) && !isset($_GET['success'])) {
946
-
947
- if (isset($_GET['sperror'])) { } else {
948
-
949
- if (isset($_GET['error']) || FALSE != ($error_code = get_option('wple_error'))) {
950
- $error_code = get_option('wple_error');
951
- $generic = esc_html__('There was some issue while generating SSL for your site. Please check debug log or try Reset option once.', 'wp-letsencrypt-ssl');
952
- $generic .= '<p style="font-size:16px;color:#888">' . sprintf(esc_html__('Feel free to open support ticket at %s for any help.', 'wp-letsencrypt-ssl'), 'https://wordpress.org/support/plugin/wp-letsencrypt-ssl/#new-topic-0') . '</p>';
953
- $firerec = sprintf(
954
- esc_html__("We highly recommend upgrading to our %sPRO%s annual plan for %sPremium SSL%s with automatic %sCDN%s + %sFirewall Security%s that works on ANY host.", 'wp-letsencrypt-ssl'),
955
- '<a href="' . admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd') . '">',
956
- '</a>',
957
- '<strong>',
958
- '</strong>',
959
- '<strong>',
960
- '</strong>',
961
- '<strong>',
962
- '</strong>'
963
- );
964
- $thirdparty = esc_html__("Your hosting server don't seem to support third party SSL.", "wp-letsencrypt-ssl");
965
-
966
- if (FALSE !== $error_code && ($error_code == 1 || $error_code == 400)) {
967
- $generic .= '<p class="firepro">' . $thirdparty . ' ' . $firerec . '</p>';
968
- } else {
969
- if (file_exists(ABSPATH . 'keys/certificate.crt')) {
970
- $generic .= '<br><br>' . WPLE_Trait::wple_kses(__('You already seem to have certificate generated and stored. Please try downloading certs from <strong>Download SSL Certificates</strong> page and open in a text editor like notepad to check if certificate is not empty.', 'wp-letsencrypt-ssl'));
971
  }
972
- }
973
-
974
-
975
- if (FALSE !== $error_code && $error_code == 429) {
976
- $generic = sprintf(esc_html__('Too many registration attempts from your IP address (%s). Please try after 2-3 hours.', 'wp-letsencrypt-ssl'), 'https://letsencrypt.org/docs/rate-limits/');
977
- $generic .= '<p class="firepro">' . $firerec . '</p>';
978
- $generic .= '<p style="font-size:17px;color:#888">' . sprintf(esc_html__('Feel free to open support ticket at %s for any help.', 'wp-letsencrypt-ssl'), 'https://wordpress.org/support/plugin/wp-letsencrypt-ssl/#new-topic-0') . '</p>';
979
- }
980
-
981
- if ($error_code != 5) {
982
- $html .= '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
983
  <div id="wple-sslgenerator" class="error">
984
  <div class="wple-error-message">
985
  ' . $generic . '
986
  </div>
987
  </div><!--wple-sslgenerator-->';
988
- }
 
 
 
 
989
  }
990
- }
991
  }
992
- }
993
-
994
- /**
995
- * Handles review box actions
996
- *
997
- * @since 4.4.0
998
- * @return void
999
- */
1000
- public function wple_review_handler()
1001
- {
1002
- //since 5.0.0
1003
- $this->wple_intro_pricing_handler();
1004
- }
1005
-
1006
- /**
1007
- * Sets review flag to show review request
1008
- *
1009
- * @since 4.4.0
1010
- */
1011
- public function wple_set_review_flag()
1012
- {
1013
- update_option('wple_show_review', 1);
1014
- }
1015
-
1016
- /**
1017
- * Handle the reset keys action
1018
- *
1019
- * @since 4.5.0
1020
- * @return void
1021
- */
1022
- public function wple_reset_handler()
1023
- {
1024
-
1025
- if (isset($_GET['wplereset'])) {
1026
- if (!current_user_can('manage_options')) {
1027
- exit('No Trespassing Allowed');
1028
- }
1029
- if (!wp_verify_nonce($_GET['wplereset'], 'restartwple')) {
1030
- exit('No Trespassing Allowed');
1031
- }
1032
- $keys = ABSPATH . 'keys/';
1033
- $files = array(
1034
- $keys . 'public.pem',
1035
- $keys . 'private.pem',
1036
- $keys . 'order',
1037
- $keys . 'fullchain.crt',
1038
- $keys . 'certificate.crt',
1039
- $keys . '__account/private.pem',
1040
- $keys . '__account/public.pem'
1041
- );
1042
- foreach ($files as $file) {
1043
- if (file_exists($file)) {
1044
- unlink($file);
1045
- }
1046
- }
1047
- delete_option('wple_error');
1048
- delete_option('wple_complete');
1049
- delete_option('wple_backend');
1050
- ///if (wple_fs()->can_use_premium_code__premium_only()) {
1051
- delete_option('wple_firewall_stage');
1052
- delete_option('wple_spmode_dns');
1053
- delete_option('wple_spmode_activated');
1054
- ///}
1055
- add_action('admin_notices', array($this, 'wple_reset_success'));
1056
  }
1057
-
1058
- //since 4.6.0
1059
-
1060
- if (isset($_GET['wplesslrenew'])) {
1061
- if (!wp_verify_nonce($_GET['wplesslrenew'], 'wple_renewed')) {
1062
- exit('Unauthorized');
1063
- }
1064
- delete_option('wple_show_reminder');
1065
- wp_redirect(admin_url('/admin.php?page=wp_encryption'), 302);
1066
  }
1067
- }
1068
-
1069
- /**
1070
- * Reset success notice
1071
- *
1072
- * @since 4.5.0
1073
- */
1074
- public function wple_reset_success()
1075
- {
1076
- echo '<div class="notice notice-success is-dismissable">
1077
- <p>' . esc_html('Reset successful!. You can start with the SSL install process again.', 'wp-letsencrypt-ssl') . '</p>
1078
- </div>';
1079
- }
1080
-
1081
- /**
1082
- * Local check DNS records via Ajax
1083
- *
1084
- * @since 4.6.0
1085
- * @return void
1086
- */
1087
- public function wple_ajx_verify_dns()
1088
- {
1089
-
1090
- if (isset($_POST['nc'])) {
1091
- if (!wp_verify_nonce($_POST['nc'], 'verifydnsrecords')) {
1092
- exit('Unauthorized');
1093
- }
1094
- $toVerify = get_option('wple_opts');
1095
-
1096
- if (array_key_exists('dns_challenges', $toVerify) && !empty($toVerify['dns_challenges'])) {
1097
- $toVerify = $dnspendings = $toVerify['dns_challenges'];
1098
- //array
1099
- foreach ($toVerify as $index => $item) {
1100
- $domain_code = explode('||', $item);
1101
- $acme = '_acme-challenge.' . esc_html($domain_code[0]);
1102
- $requestURL = 'https://dns.google.com/resolve?name=' . addslashes($acme) . '&type=TXT';
1103
- $handle = curl_init();
1104
- curl_setopt($handle, CURLOPT_URL, $requestURL);
1105
- curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
1106
- curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
1107
- $response = json_decode(trim(curl_exec($handle)));
1108
-
1109
- if ($response->Status === 0 && isset($response->Answer)) {
1110
- //if ($answer->type == 16) {
1111
- $found = 'Pending';
1112
- foreach ($response->Answer as $answer) {
1113
- $livecode = str_ireplace('"', '', $answer->data);
1114
-
1115
- if ($livecode == $domain_code[1]) {
1116
- unset($dnspendings[$index]);
1117
- $found = 'OK';
1118
- }
1119
  }
1120
- WPLE_Trait::wple_logger("\n" . esc_html($requestURL . ' should return ' . $domain_code[1] . ' -> ' . $found) . "\n");
1121
- } else {
1122
- $ledebug = WPLE_Trait::wple_lets_debug('dns-01');
1123
-
1124
- if ($ledebug != false) {
1125
- echo $ledebug;
1126
- exit;
1127
  }
1128
-
1129
- echo 'fail';
1130
- exit;
1131
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1132
  }
1133
-
1134
- if (empty($dnspendings)) {
1135
- WPLE_Trait::wple_logger(
1136
- "Local check - All DNS challenges verified\n",
1137
- 'success',
1138
- 'a',
1139
- false
1140
- );
1141
- echo 1;
1142
- exit;
1143
- } else {
1144
- $ledebug = WPLE_Trait::wple_lets_debug('dns-01');
1145
-
1146
- if ($ledebug != false) {
1147
- echo $ledebug;
1148
- exit;
1149
- }
1150
-
1151
- echo 'fail';
1152
- exit;
1153
  }
1154
- } else {
1155
-
1156
- if (empty($toVerify['dns_challenges'])) {
1157
- WPLE_Trait::wple_logger(
1158
- "Local check - DNS challenges empty\n",
1159
- 'success',
1160
- 'a',
1161
- false
1162
- );
1163
- echo 1;
1164
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1165
  }
1166
- }
 
 
1167
  }
1168
-
1169
- echo 'fail';
1170
- exit;
1171
- }
1172
-
1173
- /**
1174
- * Show expiry reminder in admin notice
1175
- *
1176
- * @see 4.6.0
1177
- * @return void
1178
- */
1179
- public function wple_start_show_reminder()
1180
- {
1181
- update_option('wple_show_reminder', 1);
1182
- $opts = get_option('wple_opts');
1183
- $to = sanitize_email($opts['email']);
1184
- $subject = sprintf(esc_html__('ATTENTION - SSL Certificate of %s expires in just 10 days', 'wp-letsencrypt-ssl'), str_ireplace(array('https://', 'http://'), array('', ''), site_url()));
1185
- $headers = array('Content-Type: text/html; charset=UTF-8');
1186
- $body = '<p>' . sprintf(esc_html__('Your SSL Certificate is expiring soon!. Please make sure to re-generate new SSL Certificate using %sWP Encryption%s and install it on your hosting server to avoid site showing insecure warning with expired certificate.', 'wp-letsencrypt-ssl'), '<a href="' . admin_url('/admin.php?page=wp_encryption', 'http') . '">', '</a>') . '</p><br /><br />';
1187
- $body .= '<b>' . esc_html__('Tired of manual SSL renewal every 90 days?, Upgrade to PRO version for automatic SSL installation and automatic SSL renewal', 'wp-letsencrypt-ssl') . '. <br><a href="' . admin_url('/admin.php?page=wp_encryption-pricing', 'http') . '" style="background: #0073aa; text-decoration: none; color: #fff; padding: 12px 20px; display: inline-block; margin: 10px 0; font-weight: bold;">' . esc_html__('UPGRADE TO PREMIUM', 'wp-letsencrypt-ssl') . '</a></b><br /><br />';
1188
- wp_mail(
1189
- $to,
1190
- $subject,
1191
- $body,
1192
- $headers
1193
- );
1194
- }
1195
-
1196
- public function wple_reminder_notice()
1197
- {
1198
- $already_did = wp_nonce_url(admin_url('admin.php?page=wp_encryption'), 'wple_renewed', 'wplesslrenew');
1199
- $html = '<div class="notice notice-info wple-admin-review">
1200
  <div class="wple-review-box wple-reminder-notice">
1201
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1202
- <span><strong>WP ENCRYPTION: ' . esc_html__('Your SSL certificate expires in less than 10 days', 'wp-letsencrypt-ssl') . '</strong><p>' . WPLE_Trait::wple_kses(__('Renew your SSL certificate today to avoid your site from showing as insecure. Please support our contribution by upgrading to <strong>Pro</strong> and avail automatic renewal with automatic installation.', 'wp-letsencrypt-ssl')) . '</p></span>
1203
  </div>
1204
- <a class="wple-lets-review wplerevbtn" href="' . admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd') . '">' . esc_html__('Upgrade to Pro', 'wp-letsencrypt-ssl') . '</a>
1205
- <a class="already-renewed wplerevbtn" href="' . $already_did . '">' . esc_html__('I already renewed', 'wp-letsencrypt-ssl') . '&nbsp;<span class="dashicons dashicons-smiley"></span></a>
1206
  </div>';
1207
- echo $html;
1208
- }
1209
-
1210
- /**
1211
- * Manual HTTP challenges for subdir sites
1212
- *
1213
- * @since 4.7.0
1214
- * @param string $html
1215
- * @param array $opts
1216
- * @return string
1217
- */
1218
- public function wple_subdir_challenges(&$html, $opts)
1219
- {
1220
- if (isset($_GET['subdir'])) {
1221
- $html .= '
1222
  <div id="wple-sslgenerator">
1223
  <div class="wple-success-form">
1224
- ' . WPLE_Subdir_Challenge_Helper::show_challenges($opts) . '
1225
  </div>
1226
  </div><!--wple-sslgenerator-->';
1227
- }
1228
- }
1229
-
1230
- /**
1231
- * Local check HTTP records via Ajax for subdir sites
1232
- *
1233
- * @since 4.7.0
1234
- * @return void
1235
- */
1236
- public function wple_ajx_verify_http()
1237
- {
1238
-
1239
- if (isset($_POST['nc'])) {
1240
- if (!wp_verify_nonce($_POST['nc'], 'verifyhttprecords')) {
1241
- exit('Unauthorized');
1242
- }
1243
- $domain = str_ireplace(array('https://', 'http://'), '', site_url());
1244
- if (stripos($domain, '/') != FALSE) {
1245
- //subdir site
1246
- $domain = substr($domain, 0, stripos($domain, '/'));
1247
- }
1248
- $opts = get_option('wple_opts');
1249
- $httpch = $opts['challenge_files'];
1250
-
1251
- if (empty($httpch)) {
1252
- echo 1;
1253
- exit;
1254
- }
1255
-
1256
- $counter = get_option('wple_failed_verification');
1257
- foreach ($httpch as $index => $ch) {
1258
-
1259
- if ($counter >= 8) {
1260
- $fpath = ABSPATH . '.well-known/acme-challenge/';
1261
- if (!file_exists($fpath)) {
1262
- mkdir($fpath, 0775, true);
1263
- }
1264
- WPLE_Trait::wple_logger('Helping with HTTP challenge file', 'success', 'a');
1265
- file_put_contents($fpath . $ch['file'], trim($ch['value']));
1266
  }
1267
-
1268
- $check = LEFunctions::checkHTTPChallenge($domain, $ch['file'], $ch['value']);
1269
-
1270
- if (!$check) {
1271
-
1272
- if (FALSE === $counter) {
1273
- update_option('wple_failed_verification', 1);
1274
- } else {
1275
- update_option('wple_failed_verification', $counter + 1);
1276
- }
1277
-
1278
- WPLE_Trait::wple_logger(
1279
- "HTTP challenge file checked locally - found invalid",
1280
- 'success',
1281
- 'a',
1282
- false
1283
- );
1284
- $ledebug = WPLE_Trait::wple_lets_debug('http-01');
1285
-
1286
- if ($ledebug != false) {
1287
- echo $ledebug;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288
  exit;
1289
- }
1290
-
1291
- echo 'fail';
1292
- exit;
1293
- }
1294
- }
1295
- WPLE_Trait::wple_logger(
1296
- "Local check - All HTTP challenges verified\n",
1297
- 'success',
1298
- 'a',
1299
- false
1300
- );
1301
- delete_option('wple_failed_verification');
1302
- echo 1;
1303
- exit;
1304
  }
1305
- }
1306
-
1307
- /**
1308
- * Continue process on wpleauto param
1309
- *
1310
- * @return void
1311
- */
1312
- public function wple_continue_certification()
1313
- {
1314
-
1315
- if (isset($_GET['wpleauto'])) {
1316
- $leopts = get_option('wple_opts');
1317
-
1318
- if ($_GET['wpleauto'] == 'http') {
1319
- new WPLE_Core($leopts);
1320
- } else {
1321
- //DNS
1322
- new WPLE_Core(
1323
- $leopts,
1324
- true,
1325
- false,
1326
- true
1327
- );
1328
- }
 
 
1329
  }
1330
- }
1331
-
1332
- /**
1333
- * Simple success notice for admin
1334
- *
1335
- * @since 4.7.2
1336
- * @return void
1337
- */
1338
- public function wple_success_notice()
1339
- {
1340
- $html = '<div class="notice notice-success">
1341
- <p>' . esc_html__('Success', 'wp-letsencrypt-ssl') . '!</p>
1342
  </div>';
1343
- echo $html;
1344
- }
1345
-
1346
- /**
1347
- * Show Pricing table once on activation
1348
- *
1349
- * @since 5.0.0
1350
- * @param string $html
1351
- * @return $html
1352
- */
1353
- public function wple_initial_quick_pricing(&$html)
1354
- {
1355
- $host = site_url();
1356
- if (FALSE != ($slashpos = stripos($host, '/', 9))) {
1357
- $host = substr($host, 0, $slashpos);
1358
  }
1359
- $cp = $host . ':2083';
1360
- if (FALSE === stripos($host, 'https')) {
1361
- $cp = $host . ':2082';
1362
- }
1363
- $response = wp_remote_get($cp, [
1364
- 'headers' => [
1365
- 'Connection' => 'close',
1366
- ],
1367
- 'sslverify' => false,
1368
- 'timeout' => 30,
1369
- ]);
1370
- $cpanel = true;
1371
- if (is_wp_error($response)) {
1372
- $cpanel = false;
1373
- }
1374
- $html .= '<div id="wple-sslgen">';
1375
- $cppricing = (FALSE !== stripos(ABSPATH, 'srv/htdocs') ? true : false);
1376
-
1377
- if ($cpanel || $cppricing) {
1378
- $show_rp = '';
1379
- if (!$cppricing) {
1380
- $show_rp = 1;
1381
- }
1382
- update_option('wple_have_cpanel', $show_rp);
1383
- $html .= $this->wple_cpanel_pricing_table(1);
1384
- } else {
1385
- update_option('wple_have_cpanel', 0);
1386
- // if (isset($_SERVER['GD_PHP_HANDLER'])) {
1387
- // if ($_SERVER['SERVER_SOFTWARE'] == 'Apache' && isset($_SERVER['GD_PHP_HANDLER']) && $_SERVER['DOCUMENT_ROOT'] == '/var/www') {
1388
- $html .= $this->wple_firewall_pricing_table();
1389
- // }
1390
- // } else {
1391
- // $html .= $this->wple_cpanel_pricing_table('');
1392
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1393
  }
 
 
 
 
 
 
 
 
 
 
 
1394
 
1395
- $html .= '</div>';
1396
- echo $html;
1397
- }
1398
-
1399
- /**
1400
- * Pricing table html
1401
- *
1402
- * @since 5.0.0
1403
- * @return $table
1404
- */
1405
- public function wple_cpanel_pricing_table($cpanel = '')
1406
- {
1407
- ob_start();
1408
- ?>
1409
-
1410
- <h2 class="pricing-intro-head"><?php
1411
- esc_html_e('SAVE MORE THAN $80+ EVERY YEAR IN SSL CERTIFICATE FEE', 'wp-letsencrypt-ssl');
1412
- ?></h2>
1413
 
1414
- <h4 class="pricing-intro-subhead">Purchase once and use for lifetime - Trusted Globally by <b>110,000+</b> WordPress Users (Looking for <a href="<?php
1415
- echo admin_url('/admin.php?page=wp_encryption&gopro=3');
1416
- ?>">Annual</a> | <a href="<?php
1417
- echo admin_url('/admin.php?page=wp_encryption&gopro=2');
1418
- ?>">Unlimited Sites License?</a>)</h4>
1419
 
1420
  <div style="text-align:center">
1421
- <img src="<?php
1422
- echo WPLE_URL;
1423
- ?>/admin/assets/limited-offer.png" style="max-width:650px" />
1424
  </div>
1425
 
1426
  <!-- <div class="plan-toggler" style="margin:60px 0 -20px !important">
1427
  <span>Annual</span><label class="toggle">
1428
- <input class="toggle-checkbox initplan-switch" type="checkbox" <?php
1429
- // if ($cpanel == 1) {
1430
- // echo 'checked';
1431
- // }
1432
- ?>>
1433
  <div class="toggle-switch"></div>
1434
  <span class="toggle-label">Lifetime</span>
1435
  </label>
@@ -1450,9 +1469,9 @@ class WPLE_Admin
1450
  <li><strong>Basic</strong> support</li>
1451
  </ul>
1452
  <div class="pricing-btn-block">
1453
- <a href="<?php
1454
- echo admin_url('/admin.php?page=wp_encryption&gofree=1');
1455
- ?>" class="pricingbtn free">Select Plan</a>
1456
  </div>
1457
  </div>
1458
 
@@ -1476,33 +1495,33 @@ class WPLE_Admin
1476
  <li><strong>Priority</strong> support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="gowebsmarty.in"></span></li>
1477
  </ul>
1478
  <div class="pricing-btn-block">
1479
- <a href="<?php
1480
- echo admin_url('/admin.php?page=wp_encryption&gopro=1');
1481
- ?>" class="pricingbtn free">Select Plan</a>
1482
  </div>
1483
  </div>
1484
 
1485
  </div>
1486
 
1487
  <br />
1488
- <?php
1489
- if ($cpanel != '') {
1490
  ?>
1491
  <div class="quick-refund-policy">
1492
  <strong>7 Days Refund Policy</strong>
1493
  <p>We're showing this recommendation because you have cPanel hosting where our PRO plugin is 100% guaranteed to work. Your purchase will be completely refunded if our plugin fail to work on your site.</p>
1494
  </div>
1495
- <?php
1496
- }
1497
- ?>
1498
 
1499
- <?php
1500
  $table = ob_get_clean();
1501
  return $table;
1502
- }
1503
-
1504
- public function wple_firewall_pricing_table()
1505
- {
1506
  ob_start();
1507
  ?>
1508
 
@@ -1510,9 +1529,9 @@ class WPLE_Admin
1510
  <h4 class="pricing-intro-subhead">Upgrade to PRO today for <strong>Fully automatic SSL</strong> & get automatic <strong>CDN + Security</strong> for FREE! - Trusted Globally by <b>110,000+</b> WordPress Users <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="A complete bundle worth $360!"></span></h4>
1511
 
1512
  <div style="text-align:center">
1513
- <img src="<?php
1514
- echo WPLE_URL;
1515
- ?>/admin/assets/limited-offer.png" style="max-width:650px" />
1516
  </div>
1517
 
1518
  <div id="quick-pricing-table" class="non-cpanel-plans">
@@ -1528,9 +1547,9 @@ class WPLE_Admin
1528
  <li><strong>Basic</strong> support</li>
1529
  </ul>
1530
  <div class="pricing-btn-block">
1531
- <a href="<?php
1532
- echo admin_url('/admin.php?page=wp_encryption&gofree=1');
1533
- ?>" class="pricingbtn free">Select Plan</a>
1534
  </div>
1535
  </div>
1536
 
@@ -1555,9 +1574,9 @@ class WPLE_Admin
1555
  <li><strong>Priority</strong> Support</li>
1556
  </ul>
1557
  <div class="pricing-btn-block">
1558
- <a href="<?php
1559
- echo admin_url('/admin.php?page=wp_encryption&gofirewall=1');
1560
- ?>" class="pricingbtn free">Select Plan</a>
1561
  </div>
1562
  </div>
1563
 
@@ -1566,114 +1585,118 @@ class WPLE_Admin
1566
  7 days money back guarantee <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="If you are not satisfied with the service within 7 days of purchase, We will refund your purchase no questions asked"></span>
1567
  </div> -->
1568
 
1569
- <?php
1570
  $table = ob_get_clean();
1571
  return $table;
1572
- }
1573
-
1574
- /**
1575
- * Intro pricing table handler
1576
- *
1577
- * @since 5.0.0
1578
- * @return void
1579
- */
1580
- public function wple_intro_pricing_handler()
1581
- {
1582
  $goplan = '';
1583
-
1584
- if (isset($_GET['gofree'])) {
1585
- update_option('wple_plan_choose', 1);
1586
- wp_redirect(admin_url('/admin.php?page=wp_encryption'), 302);
1587
- exit;
1588
  } else {
1589
-
1590
- if (isset($_GET['gopro'])) {
1591
- update_option('wple_plan_choose', 1);
1592
-
1593
- if ($_GET['gopro'] == 2) {
1594
- //unlimited
1595
- wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=10873&currency=usd'), 302);
 
 
 
 
 
 
 
 
 
 
 
 
 
1596
  } else {
1597
-
1598
- if ($_GET['gopro'] == 3) {
1599
- //annual
1600
- wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd'), 302);
1601
- } else {
1602
- //single lifetime
1603
- wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd'), 302);
1604
- }
1605
- }
1606
-
1607
- exit;
1608
- } else {
1609
-
1610
- if (isset($_GET['gofirewall'])) {
1611
- update_option('wple_plan_choose', 1);
1612
- ///wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=11394&plan_name=pro&billing_cycle=annual&pricing_id=11717&currency=usd'), 302);
1613
- wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd'), 302);
1614
- exit;
1615
  }
1616
- }
1617
  }
1618
- }
1619
-
1620
- /**
1621
- * After all stages completion
1622
- *
1623
- * @param string $html
1624
- * @return void
1625
- */
1626
- public function wple_completed_block(&$html)
1627
- {
 
1628
  $html .= WPLE_Trait::wple_progress_bar();
1629
  $cert = ABSPATH . 'keys/certificate.crt';
1630
- $leopts = get_option('wple_opts');
1631
- $future = strtotime($leopts['expiry']);
1632
  //Future date.
1633
  $timefromdb = time();
1634
  $timeleft = $future - $timefromdb;
1635
- $daysleft = round($timeleft / 24 / 60 / 60);
1636
- $wple_support = get_option('wple_backend');
1637
- $renewtext = esc_html__('Click Here To Renew SSL Certificate', 'wp-letsencrypt-ssl');
1638
- $renewlink = '<a href="#" class="letsrenew wple-tooltip disabled" data-tippy="' . esc_html__('This renew button will get enabled during last 30 days of current SSL certificate expiry', 'wp-letsencrypt-ssl') . ' ' . esc_html__('You can also click on STEP 1 in above progress bar to renew/re-generate SSL Certificate again.', 'wp-letsencrypt-ssl') . '">' . $renewtext . '</a>';
1639
- if ($daysleft <= 30) {
1640
- $renewlink = '<a href="' . admin_url('/admin.php?page=wp_encryption&restart=1') . '" class="letsrenew">' . $renewtext . '</a>';
1641
- }
1642
- if ($wple_support) {
1643
- //forced completion
1644
- $renewlink = '';
1645
- }
1646
- $headline = esc_html__('Woohoo! WP Encryption just saved you $$$ in SSL Certificate Fee.', 'wp-letsencrypt-ssl');
1647
- $sharetitle = urlencode('Generated & Installed free SSL certificate using WP ENCRYPTION WordPress plugin within minutes! Thanks for the great plugin');
1648
  $html .= '<div id="wple-completed">
1649
  <div class="wple-completed-review">
1650
  <h2>' . $headline . '</h2>
1651
  <p>' . sprintf(
1652
- __('Can you please do us a BIG favor by leaving a %s%s%s%s%s rating on WordPress.org', 'wp-letsencrypt-ssl'),
1653
- '<span class="dashicons dashicons-star-filled"></span>',
1654
- '<span class="dashicons dashicons-star-filled"></span>',
1655
- '<span class="dashicons dashicons-star-filled"></span>',
1656
- '<span class="dashicons dashicons-star-filled"></span>',
1657
- '<span class="dashicons dashicons-star-filled"></span>'
1658
  ) . ' <span class="wple-share-success">' . sprintf(
1659
- __("or spread the word on %s %s %s %s", "wp-letsencrypt-ssl"),
1660
- '<a href="https://twitter.com/share?url=https://wpencryption.com&text=' . $sharetitle . '&hashtags=wp_encryption,wordpress_ssl,wordpress_https" target="_blank" title="Twitter" class="tw">T</a>',
1661
- '<a href="https://www.facebook.com/sharer.php?u=wpencryption.com" target="_blank" title="Facebook" class="fb">F</a>',
1662
- '<a href="https://reddit.com/submit?url=wpencryption.com&title=' . $sharetitle . '" target="_blank" title="Reddit" class="rd">R</a>',
1663
- '<a href="https://pinterest.com/pin/create/bookmarklet/?media=https://wpencryption.com/wp-content/uploads/2021/08/banner-772x250-1.png&url=wpencryption.com&description=' . $sharetitle . '" target="_blank" title="Pinterest" class="pt">P</a>'
1664
  ) . '</span></p>
1665
- <a href="https://wordpress.org/support/plugin/wp-letsencrypt-ssl/reviews/#new-post" target="_blank" class="letsrate">' . esc_html__('LEAVE A RATING', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-external"></span></a>
1666
  ' . $renewlink . '
1667
- <small>' . esc_html__('Just takes a moment', 'wp-letsencrypt-ssl') . '</small>
1668
  </div>';
1669
- if (file_exists($cert) && isset($leopts['expiry']) && !$wple_support) {
1670
- $html .= '<div class="wple-completed-remaining">
1671
- <div class="progress--circle progress--' . esc_attr($daysleft) . '">
1672
- <div class="progress__number"><strong>' . esc_html($daysleft) . '</strong><br><small>' . esc_html__('Days', 'wp-letsencrypt-ssl') . '</small></div>
1673
  </div>
1674
  <div class="wple-circle-expires">
1675
- <strong>' . esc_html__('Your current SSL certificate expires on', 'wp-letsencrypt-ssl') . ': <br><b>' . esc_html($leopts['expiry']) . '</b></strong>
1676
- <p>' . WPLE_Trait::wple_kses(__("Let's Encrypt® SSL Certificate expires in 90 days by default. You can easily regenerate new SSL certificate using <strong>RENEW SSL CERTIFICATE</strong> option found on left or by clicking on <strong>STEP 1</strong> in progress bar.", "wp-letsencrypt-ssl")) . '<br /><br />' . WPLE_Trait::wple_kses(__('Major browsers like Chrome will start showing insecure site warning IF you fail to renew / re-generate certs before this expiry date. <strong>If you are using PRO version - SSL certificates will be auto renewed in background 30 days prior to expiry date.</strong>', 'wp-letsencrypt-ssl')) . ' Please clear your browser cache once.</p>
1677
  </div>
1678
  </div>';
1679
  }
@@ -1719,42 +1742,43 @@ class WPLE_Admin
1719
  // </div>';
1720
  // }
1721
  // }
1722
- }
1723
-
1724
- /**
1725
- * Make verificiation possible with broken cert
1726
- *
1727
- * @return void
1728
- */
1729
- public function wple_wellknown_htaccess()
1730
- {
1731
  $dir = ABSPATH . '.well-known/acme-challenge/.htaccess';
1732
-
1733
- if (!file_exists($dir)) {
1734
- $file = @touch($dir);
1735
  } else {
1736
- $file = true;
1737
  }
1738
-
1739
-
1740
- if (is_writable($dir) && $file !== FALSE) {
1741
- $ruleset = "<IfModule mod_rewrite.c>" . "\n";
1742
- $ruleset .= "RewriteEngine on" . "\n";
1743
- $ruleset .= "RewriteCond %{HTTPS} =on [NC]" . "\n";
1744
- $ruleset .= "RewriteRule ^(.*)\$ http://%{HTTP_HOST}%{REQUEST_FILENAME} [R=301,L]" . "\n";
1745
- $ruleset .= "</IfModule>" . "\n";
1746
- insert_with_markers($dir, 'WP_Encryption', $ruleset);
1747
- }
1748
- }
1749
-
1750
- /**
1751
- * Grouped admin init hooks
1752
- *
1753
- * @since 5.2.4
1754
- * @return void
1755
- */
1756
- public function wple_admin_init_hooks()
1757
- {
 
1758
  WPLE_Subdir_Challenge_Helper::download_challenge_files();
1759
  $this->wple_save_email_generate_certs();
1760
  $this->wple_download_files();
@@ -1763,139 +1787,141 @@ class WPLE_Admin
1763
  $this->wple_continue_certification();
1764
  $this->wple_domain_verification();
1765
  //redirects handler
1766
- }
1767
-
1768
- /**
1769
- * Validate SSL button for non-cpanel
1770
- *
1771
- * @since 5.2.6
1772
- * @return void
1773
- */
1774
- public function wple_validate_nocp_ssl()
1775
- {
1776
- if (!current_user_can('manage_options')) {
1777
- exit('Unauthorized');
1778
- }
1779
- $basedomain = str_ireplace(array('http://', 'https://'), array('', ''), addslashes(site_url()));
1780
  //4.7
1781
- if (FALSE != stripos($basedomain, '/')) {
1782
- $basedomain = substr($basedomain, 0, stripos($basedomain, '/'));
1783
  }
1784
- $client = WPLE_Trait::wple_verify_ssl($basedomain);
1785
-
1786
- if ($client || is_ssl()) {
1787
- $reverter = uniqid('wple');
1788
- $savedopts = get_option('wple_opts');
1789
- $savedopts['force_ssl'] = 1;
1790
- $savedopts['revertnonce'] = $reverter;
1791
- WPLE_Trait::wple_send_reverter_secret($reverter);
1792
- update_option('wple_opts', $savedopts);
1793
- delete_option('wple_error');
1794
- //complete
1795
- update_option('wple_complete', 1);
1796
- update_option('siteurl', str_ireplace('http:', 'https:', get_option('siteurl')));
1797
- update_option('home', str_ireplace('http:', 'https:', get_option('home')));
1798
- echo 1;
1799
  } else {
1800
- echo 0;
1801
  }
1802
-
1803
  exit;
1804
- }
1805
-
1806
- public function wple_expert_block(&$html, $spmode = 0)
1807
- { }
1808
-
1809
- /**
1810
- * This site have mixed content issues
1811
- *
1812
- * @since 5.3.12
1813
- * @return void
1814
- */
1815
- public function wple_mixed_content_notice()
1816
- {
 
1817
  $html = '<div class="notice notice-info wple-admin-review wple-mx-prom">
1818
  <div class="wple-review-box">
1819
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1820
- <span><strong>Warning: ' . esc_html__('Your site have mixed content issues!', 'wp-letsencrypt-ssl') . '</strong><p>' . WPLE_Trait::wple_kses(__('Mixed content issues cause browser padlock to show as insecure even if you have installed SSL certificate perfectly. Hire an SSL Expert today to get rid of all SSL issues once and for all.', 'wp-letsencrypt-ssl')) . '</p></span>
1821
  </div>
1822
- <a class="wple-lets-review wplerevbtn" href="https://checkout.freemius.com/mode/dialog/plugin/7616/plan/12469/licenses/1/" target="_blank">' . esc_html__('Hire SSL Expert', 'wp-letsencrypt-ssl') . '</a>
1823
- <a class="wple-mx-ignore wplerevbtn" href="#">' . esc_html__('Ignore', 'wp-letsencrypt-ssl') . '</a>
1824
  </div>';
1825
- echo $html;
1826
- }
1827
-
1828
- /**
1829
- * Ajax Get cert contents for copy
1830
- *
1831
- * @since 5.3.16
1832
- * @return void
1833
- */
1834
- public function wple_retrieve_certs_forcopy()
1835
- {
1836
- if (!wp_verify_nonce($_GET['nc'], 'copycerts') || !current_user_can('manage_options')) {
1837
- exit('Authorization Failure');
1838
  }
1839
  $ftype = $_GET['gettype'];
1840
  $output = '';
1841
  $keypath = ABSPATH . 'keys/';
1842
- switch ($ftype) {
1843
- case 'cert':
1844
- if (file_exists($keypath . 'certificate.crt')) {
1845
- $output = file_get_contents($keypath . 'certificate.crt');
1846
- }
1847
- break;
1848
- case 'key':
1849
- if (file_exists($keypath . 'private.pem')) {
1850
- $output = file_get_contents($keypath . 'private.pem');
1851
- }
1852
- break;
1853
- case 'cabundle':
1854
-
1855
- if (file_exists(ABSPATH . 'keys/cabundle.crt')) {
1856
- $output = file_get_contents(ABSPATH . 'keys/cabundle.crt');
1857
- } else {
1858
- $output = file_get_contents(WPLE_DIR . 'cabundle/ca.crt');
1859
- }
1860
-
1861
- break;
1862
  }
1863
- echo esc_html($output);
1864
  exit;
1865
- }
1866
-
1867
- /**
1868
- * Ajax check if both www & non-www domain accessible
1869
- *
1870
- * @since 5.6.2
1871
- * @return void
1872
- */
1873
- public function wple_include_www_check()
1874
- {
1875
- if (!current_user_can('manage_options') || !wp_verify_nonce($_GET['nc'], 'legenerate')) {
1876
- exit('Unauthorized request');
1877
- }
1878
- $maindomain = WPLE_Trait::get_root_domain(false);
1879
  $errcode = 'www';
1880
-
1881
- if (FALSE === stripos('www', $maindomain)) {
1882
- $altdomain = 'www.' . $maindomain;
1883
  } else {
1884
- $errcode = 'nonwww';
1885
- $altdomain = str_ireplace('www.', '', $maindomain);
1886
  }
1887
-
1888
- $altdomaintest = wp_remote_head('http://' . $altdomain, array(
1889
- 'sslverify' => false,
1890
- 'timeout' => 30,
1891
- ));
1892
-
1893
- if (!is_wp_error($altdomaintest)) {
1894
- echo 1;
1895
- exit;
1896
  }
1897
-
1898
- echo $errcode;
1899
  exit;
1900
- }
1901
  }
 
 
29
  *
30
  * @since 5.1.1
31
  */
32
+ require_once plugin_dir_path( __DIR__ ) . 'vendor/autoload.php';
33
+ use WPLEClient\LEFunctions ;
 
 
34
  require_once WPLE_DIR . 'classes/le-core.php';
35
  require_once WPLE_DIR . 'classes/le-subdir-challenge.php';
36
  /**
41
  */
42
  class WPLE_Admin
43
  {
44
+ private $FIREWALL ;
45
+ public function __construct()
46
+ {
47
+ add_action( 'admin_enqueue_scripts', array( $this, 'wple_admin_styles' ) );
48
+ add_action( 'admin_menu', array( $this, 'wple_admin_menu_page' ) );
49
+ add_action(
50
+ 'before_wple_admin_form',
51
+ array( $this, 'wple_debug_log' ),
52
+ 20,
53
+ 1
54
+ );
55
+ add_action( 'admin_init', array( $this, 'wple_admin_init_hooks' ) );
56
+ add_action( 'plugins_loaded', array( $this, 'wple_load_plugin_textdomain' ) );
57
+ $show_rev = get_option( 'wple_show_review' );
58
+ if ( $show_rev != FALSE && $show_rev == 1 ) {
59
+ add_action( 'admin_notices', array( $this, 'wple_rateus' ) );
60
+ }
61
+ if ( FALSE !== get_option( 'wple_show_reminder' ) ) {
62
+ add_action( 'admin_notices', [ $this, 'wple_reminder_notice' ] );
63
+ }
64
+ if ( FALSE !== get_option( 'wple_mixed_issues' ) ) {
65
+ //since 5.3.12
66
+ add_action( 'admin_notices', [ $this, 'wple_mixed_content_notice' ] );
67
+ }
68
+ if ( isset( $_GET['successnotice'] ) ) {
69
+ add_action( 'admin_notices', array( $this, 'wple_success_notice' ) );
70
+ }
71
+ add_action( 'wple_show_reviewrequest', array( $this, 'wple_set_review_flag' ) );
72
+ add_action( 'wp_ajax_wple_dismiss', array( $this, 'wple_dismiss_notice' ) );
73
+ add_action( 'wp_ajax_wple_admin_dnsverify', [ $this, 'wple_ajx_verify_dns' ] );
74
+ add_action( 'wple_ssl_reminder_notice', [ $this, 'wple_start_show_reminder' ] );
75
+ add_action( 'wp_ajax_wple_admin_httpverify', [ $this, 'wple_ajx_verify_http' ] );
76
+ add_action( 'wp_ajax_wple_validate_ssl', [ $this, 'wple_validate_nocp_ssl' ] );
77
+ add_action( 'wp_ajax_wple_getcert_for_copy', [ $this, 'wple_retrieve_certs_forcopy' ] );
78
+ add_action( 'wp_ajax_wple_include_www', [ $this, 'wple_include_www_check' ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
+
81
+ /**
82
+ * Enqueue admin styles
83
+ *
84
+ * @since 1.0.0
85
+ * @return void
86
+ */
87
+ public function wple_admin_styles()
88
+ {
89
+ wp_enqueue_style(
90
+ WPLE_NAME,
91
+ WPLE_URL . 'admin/css/le-admin.min.css',
92
+ FALSE,
93
+ WPLE_PLUGIN_VERSION,
94
+ 'all'
95
+ );
96
+ wp_enqueue_script(
97
+ WPLE_NAME . '-popper',
98
+ WPLE_URL . 'admin/js/popper.min.js',
99
+ array( 'jquery' ),
100
+ WPLE_PLUGIN_VERSION,
101
+ true
102
+ );
103
+ wp_enqueue_script(
104
+ WPLE_NAME . '-tippy',
105
+ WPLE_URL . 'admin/js/tippy-bundle.iife.min.js',
106
+ array( 'jquery' ),
107
+ WPLE_PLUGIN_VERSION,
108
+ true
109
+ );
110
+ wp_enqueue_script(
111
+ WPLE_NAME,
112
+ WPLE_URL . 'admin/js/le-admin.js',
113
+ array( 'jquery', WPLE_NAME . '-tippy', WPLE_NAME . '-popper' ),
114
+ WPLE_PLUGIN_VERSION,
115
+ true
116
+ );
117
+ wp_enqueue_script(
118
+ WPLE_NAME . '-fs',
119
+ 'https://checkout.freemius.com/checkout.min.js',
120
+ array( 'jquery' ),
121
+ WPLE_PLUGIN_VERSION,
122
+ false
123
+ );
124
+ wp_localize_script( WPLE_NAME, 'SCAN', array(
125
+ 'adminajax' => admin_url( '/admin-ajax.php' ),
126
+ 'base' => site_url( '/', 'https' ),
127
+ ) );
128
  }
129
+
130
+ /**
131
+ * Register plugin page
132
+ *
133
+ * @since 1.0.0
134
+ * @return void
135
+ */
136
+ public function wple_admin_menu_page()
137
+ {
138
+ add_menu_page(
139
+ WPLE_NAME,
140
+ WPLE_NAME,
141
+ 'manage_options',
142
+ WPLE_SLUG,
143
+ array( $this, 'wple_menu_page' ),
144
+ plugin_dir_url( __DIR__ ) . 'admin/assets/icon.png',
145
+ 100
146
+ );
147
  }
148
+
149
+ public function wple_load_plugin_textdomain()
150
+ {
151
+ load_plugin_textdomain( 'wp-letsencrypt-ssl', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
 
152
  }
153
+
154
+ /**
155
+ * Plugin page HTML
156
+ *
157
+ * @since 1.0.0
158
+ * @return void
159
+ */
160
+ public function wple_menu_page()
161
+ {
162
+
163
+ if ( FALSE === get_option( 'wple_version' ) ) {
164
+ delete_option( 'wple_plan_choose' );
165
+ update_option( 'wple_version', WPLE_PLUGIN_VERSION );
166
+ } else {
167
+
168
+ if ( version_compare( get_option( 'wple_version' ), '5.7.2', '<=' ) ) {
169
+ delete_option( 'wple_plan_choose' );
170
+ update_option( 'wple_version', WPLE_PLUGIN_VERSION );
171
+ }
172
+
173
+ }
174
+
175
+ $this->wple_subdir_ipaddress();
176
+ $eml = '';
177
+ $leopts = get_option( 'wple_opts' );
178
+ if ( $opts = get_option( 'wple_opts' ) ) {
179
+ $eml = ( isset( $opts['email'] ) ? $opts['email'] : '' );
180
+ }
181
+ $pluginmode = 'FREE';
182
+ $errorclass = '';
183
+
184
+ if ( !wple_fs()->is__premium_only() && wple_fs()->can_use_premium_code() ) {
185
+ $pluginmode = 'FREE plugin with PRO License <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Please upload and activate PRO plugin file via PLUGINS page"></span>';
186
+ $errorclass = ' notproerror';
187
+ }
188
+
189
+
190
+ if ( wple_fs()->is__premium_only() && !wple_fs()->can_use_premium_code() ) {
191
+ $pluginmode = 'PRO plugin with FREE License <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Please activate PRO license key via Account page or Activate License option under the plugin on PLUGINS page"></span>';
192
+ $errorclass = ' notproerror';
193
+ }
194
+
195
+ $html = '
196
  <div class="wple-header">
197
  <div>
198
  <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . WPLE_PLUGIN_VERSION . ' <span class="wple-pmode' . $errorclass . '">' . $pluginmode . '</span></span>
199
  </div>';
200
+ WPLE_Trait::wple_headernav( $html );
201
+ $html .= '</div>';
202
+
203
+ if ( FALSE === get_option( 'wple_plan_choose' ) || isset( $_GET['comparison'] ) ) {
204
+ $this->wple_initial_quick_pricing( $html );
205
+ return;
206
+ }
207
+
208
+ //5.1.0
209
+ $complete = ( FALSE !== get_option( 'wple_complete' ) ? 1 : 0 );
210
+
211
+ if ( $complete ) {
212
+ $html .= '<div id="wple-sslgen">';
213
+ $this->wple_completed_block( $html );
214
+ $html .= '</div>';
215
+ if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
216
+ $this->wple_upgrade_block( $html );
217
+ }
218
+ echo $html ;
219
+ return;
220
+ }
221
+
222
+ $this->wple_success_block( $html );
223
+ $this->wple_error_block( $html );
224
+ if ( !isset( $_GET['wpleauto'] ) && isset( $_GET['subdir'] ) ) {
225
+ $this->wple_subdir_challenges( $html, $leopts );
226
+ }
227
+
228
+ if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
229
+
230
+ if ( isset( $_GET['subdir'] ) ) {
231
+ $this->wple_upgrade_block( $html );
232
+ echo $html ;
233
+ return;
234
+ }
235
+
236
+
237
+ if ( isset( $_GET['success'] ) ) {
238
+ $this->wple_upgrade_block( $html );
239
+ echo $html ;
240
+ return;
241
+ }
242
+
243
+ }
244
+
245
+ $mappeddomain = '';
246
+ $formheader = esc_html__( 'SSL INSTALL FORM - ENTER YOUR EMAIL BELOW & GENERATE SSL CERTIFICATE', 'wp-letsencrypt-ssl' );
247
+ $currentdomain = esc_html( str_ireplace( array( 'http://', 'https://' ), array( '', '' ), site_url() ) );
248
+ $maindomain = $currentdomain;
249
+ $slashpos = stripos( $currentdomain, '/' );
250
+
251
+ if ( FALSE !== $slashpos ) {
252
+ //subdir installation
253
+ $maindomain = substr( $currentdomain, 0, $slashpos );
254
+ $mappeddomain = '<label style="display: block; padding: 10px 5px; color: #aaa;font-size:15px;">' . esc_html__( 'PRIMARY DOMAIN', 'wp-letsencrypt-ssl' ) . '</label>
255
+ <p style="width: 800px; max-width:100%; margin: 5px auto 20px;">' . WPLE_Trait::wple_kses( sprintf( __( '<strong>NOTE:</strong> Since you are willing to install SSL certificate for sub-directory site, SSL certificate will be generated for your primary domain <strong>%s</strong> which will cover your primary domain + ALL sub-directory sites.', 'wp-letsencrypt-ssl' ), $maindomain ) ) . '</p>
256
+ <input type="text" name="wple_domain" class="wple-domain-input" value="' . esc_attr( $maindomain ) . '" readonly><br />';
257
+ }
258
+
259
+ //since 5.3.4
260
+ $tempdomain = '';
261
+ if ( FALSE !== stripos( $maindomain, 'temp.domains' ) || FALSE !== stripos( $maindomain, '~' ) ) {
262
+ $tempdomain = '<p style="width: 800px; max-width:100%; margin: 5px auto 20px;">' . sprintf(
263
+ esc_html__( "%sWARNING:%s You are trying to install SSL for %stemporary domain%s which is not possible. Please point your real domain like wpencryption.com to your site and update your site url in %ssettings%s > %sgeneral%s before you could generate SSL.", "wp-letsencrypt-ssl" ),
264
+ "<strong>",
265
+ "</strong>",
266
+ "<strong>",
267
+ "</strong>",
268
+ "<strong>",
269
+ "</strong>",
270
+ "<strong>",
271
+ "</strong>"
272
+ ) . '</p>';
273
+ }
274
+ if ( isset( $leopts['type'] ) && $leopts['type'] == 'wildcard' ) {
275
+ $html .= '<script>
276
  jQuery(document).ready(function(){
277
  jQuery(".single-wildcard-switch").trigger("click");
278
  });
279
  </script>';
280
+ }
281
+ $html .= '<div id="wple-sslgen">
282
  <h2>' . $formheader . '</h2>';
283
+ if ( is_multisite() && !wple_fs()->can_use_premium_code__premium_only() ) {
284
+ $html .= '<p class="wple-multisite">' . WPLE_Trait::wple_kses( __( 'Upgrade to <strong>PRO</strong> version to avail Wildcard SSL support for multisite and ability to install SSL for mapped domains (different domain names).', 'wp-letsencrypt-ssl' ) ) . '</p>';
285
+ }
286
+ $html .= WPLE_Trait::wple_progress_bar();
287
+ //$cname = '';
288
+ //if (FALSE === stripos($currentdomain, '/')) {
289
+ // if (stripos($currentdomain, 'www') === FALSE) {
290
+ // $cname = '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__("Add a CNAME with name 'www' pointing to your non-www domain", 'wp-letsencrypt-ssl') . '. ' . esc_attr__("Refer FAQ if you want to generate SSL for both www & non-www domain.", 'wp-letsencrypt-ssl') . '"></span>';
291
+ // } else {
292
+ //$cname = '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__("Refer FAQ if you want to generate SSL for both www & non-www domain.", 'wp-letsencrypt-ssl') . '"></span>';
293
+ //}
294
+ //}
295
+ $bothchecked = '';
296
+ $leadminform = '<form method="post" class="le-genform single-genform">' . $mappeddomain . $tempdomain . '
297
+ <input type="email" name="wple_email" class="wple_email" value="' . esc_attr( $eml ) . '" placeholder="' . esc_attr__( 'Enter your email address', 'wp-letsencrypt-ssl' ) . '" ><br />';
298
+ // if (FALSE === stripos('www', $maindomain)) {
299
+ // $altdomain = 'www.' . $maindomain;
300
+ // } else {
301
+ // $altdomain = str_ireplace('www.', '', $maindomain);
302
+ // }
303
+ // $altdomaintest = wp_remote_head('http://' . $altdomain, array('sslverify' => false, 'timeout' => 30));
304
+ ///if (!is_wp_error($altdomaintest) || isset($_GET['includewww'])) {
305
+ $leadminform .= '<span class="lecheck">
306
  <label class="checkbox-label">
307
  <input type="checkbox" name="wple_include_www" class="wple_include_www" value="1" ' . $bothchecked . '>
308
  <span class="checkbox-custom rectangular"></span>
309
  </label>
310
+ ' . esc_html__( 'Generate SSL Certificate for both www & non-www version of domain', 'wp-letsencrypt-ssl' ) . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( "Before enabling this - please make sure both www & non-www version of your domain works!. Add a CNAME with name 'www' pointing to your non-www domain in your domain DNS zone editor", 'wp-letsencrypt-ssl' ) . '"></span></label>
311
  </span><br />';
312
+ ///}
313
+
314
+ if ( isset( $_GET['includeemail'] ) ) {
315
+ $leadminform .= '<span class="lecheck">
316
  <label class="checkbox-label">
317
  <input type="checkbox" name="wple_include_mail" class="wple_include_mail" value="1">
318
  <span class="checkbox-custom rectangular"></span>
319
  </label>
320
+ ' . esc_html__( 'Secure POP/IMAP email server', 'wp-letsencrypt-ssl' ) . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . sprintf( esc_attr__( "This option will secure %s but DNS based domain verification is MANDATORY", 'wp-letsencrypt-ssl' ), 'mail.' . $maindomain ) . '"></span></label>
321
  </span><br />';
322
+ $webmail = 'webmail.' . $maindomain;
323
+ $leadminform .= '<span class="lecheck">
324
  <label class="checkbox-label">
325
  <input type="checkbox" name="wple_include_webmail" class="wple_include_webmail" value="1">
326
  <span class="checkbox-custom rectangular"></span>
327
  </label>
328
+ ' . sprintf( esc_html__( 'Secure %s', 'wp-letsencrypt-ssl' ), $webmail ) . '&nbsp; <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . sprintf( esc_attr__( "This option will secure %s but DNS based domain verification is MANDATORY", 'wp-letsencrypt-ssl' ), $webmail ) . '"></span></label>
329
  </span><br />';
330
+ }
331
+
332
+ $leadminform .= '<span class="lecheck">
333
  <label class="checkbox-label">
334
  <input type="checkbox" name="wple_send_usage" value="1" checked>
335
  <span class="checkbox-custom rectangular"></span>
336
  </label>
337
+ ' . esc_html__( 'Anonymously send response data to get better support', 'wp-letsencrypt-ssl' ) . '</label>
338
  </span><br />';
339
+ $leadminform .= '<span class="lecheck">
340
  <label class="checkbox-label">
341
  <input type="checkbox" name="wple_agree_le_tos" class="wple_agree_le" value="1">
342
  <span class="checkbox-custom rectangular"></span>
343
  </label>
344
+ ' . WPLE_Trait::wple_kses( sprintf(
345
+ __( "I agree to %sLet's Encrypt%s %sTerms of service%s", "wp-letsencrypt-ssl" ),
346
+ '<b>',
347
+ '<sup style="font-size: 10px; padding: 3px">TM</sup></b>',
348
+ '<a href="' . esc_attr__( 'https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf', 'wp-letsencrypt-ssl' ) . '" rel="nofollow" target="_blank" style="margin-left:5px">',
349
+ '</a>'
350
+ ), 'a' ) . '
351
  </span>
352
  <span class="lecheck">
353
  <label class="checkbox-label">
354
  <input type="checkbox" name="wple_agree_gws_tos" class="wple_agree_gws" value="1">
355
  <span class="checkbox-custom rectangular"></span>
356
  </label>
357
+ ' . WPLE_Trait::wple_kses( sprintf( __( "I agree to <b>WP Encryption</b> %sTerms of service%s", "wp-letsencrypt-ssl" ), '<a href="https://gowebsmarty.com/terms-and-conditions/" rel="nofollow" target="_blank" style="margin-left:5px">', '</a>' ), 'a' ) . '
358
  </span>
359
  ' . wp_nonce_field(
360
+ 'legenerate',
361
+ 'letsencrypt',
362
+ false,
363
+ false
364
+ ) . '
365
+ <button type="submit" name="generate-certs" id="singledvssl">' . esc_html__( 'Generate SSL Certificate', 'wp-letsencrypt-ssl' ) . '</button>
366
  </form>
367
 
368
  <div id="wple-error-popper">
371
  <div class="wple-error">Error</div>
372
  </div>
373
  </div>';
374
+ $nonwww = str_ireplace( 'www.', '', $currentdomain );
375
+ if ( FALSE !== ($ps = stripos( $nonwww, '/' )) ) {
376
+ $nonwww = substr( $nonwww, 0, $ps );
377
+ }
378
+ $wwwdomain = 'www.' . $nonwww;
379
+
380
+ if ( FALSE != stripos( $currentdomain, 'www.' ) ) {
381
+ $wwwdomain = $nonwww;
382
+ $nonwww = 'www.' . $nonwww;
383
+ }
384
+
385
+ $showonpro = '';
386
+ $html .= '<div class="wple-single-dv-ssl">
387
  <div class="wple-info-box">
388
+ <h3>' . esc_html__( 'Domains Covered', 'wp-letsencrypt-ssl' ) . '</h3>
389
  <strong>' . $nonwww . '</strong>
390
  <div class="wple-www' . $showonpro . '"><strong>' . $wwwdomain . '</strong></div>
391
  <div class="wple-wc"><strong>*.' . $nonwww . '</strong></div>
392
  </div>';
393
+ ob_start();
394
+ do_action( 'before_wple_admin_form', $html );
395
+ $html .= ob_get_contents();
396
+ ob_end_clean();
397
+ $html .= apply_filters( 'wple_admin_form', $leadminform );
398
+ ob_start();
399
+ do_action( 'after_wple_admin_form', $html );
400
+ $html .= ob_get_contents();
401
+ ob_end_clean();
402
+ $html .= '</div>';
403
+ $prosupport = WPLE_Trait::wple_kses( sprintf( __( 'Brought to you by %sWP Encryption%s.' ), '<a href="https://wpencryption.com" target="_blank">', '</a>' ), 'a' );
404
+ $html .= '
405
  <div class="le-powered">
406
+ <span>' . $prosupport . ' ' . WPLE_Trait::wple_kses( sprintf( 'SSL Certificate will be generated by %s (An open certificate authority).', "<b>Let's Encrypt<sup style=\"font-size: 10px; padding: 3px\">TM</sup></b>" ) ) . '</span>
407
  </div>';
408
+ $html .= '
409
  </div><!--wple-sslgen-->';
410
+
411
+ if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
412
+ $this->wple_upgrade_block( $html );
413
+ } else {
414
+ $this->wple_expert_block( $html );
415
+ }
416
+
417
+ echo $html ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
  }
419
+
420
+ /**
421
+ * log process & error in debug.log file
422
+ *
423
+ * @since 1.0.0
424
+ * @param string $html
425
+ * @return void
426
+ */
427
+ public function wple_debug_log( $html )
428
+ {
429
+
430
+ if ( !file_exists( WPLE_DEBUGGER ) ) {
431
+ wp_mkdir_p( WPLE_DEBUGGER );
432
+ $htacs = '<Files debug.log>' . "\n" . 'Order allow,deny' . "\n" . 'Deny from all' . "\n" . '</Files>';
433
+ file_put_contents( WPLE_DEBUGGER . '.htaccess', $htacs );
434
+ }
435
+
436
+ //show only upon error since 4.6.0
437
+
438
+ if ( isset( $_GET['error'] ) ) {
439
+ $html = '<div class="toggle-debugger"><span class="dashicons dashicons-arrow-down-alt2"></span> ' . esc_html__( 'Show/hide full response', 'wp-letsencrypt-ssl' ) . '</div>';
440
+ $file = WPLE_DEBUGGER . 'debug.log';
441
+
442
+ if ( file_exists( $file ) ) {
443
+ $log = file_get_contents( $file );
444
+ $hideh2 = '';
445
+ if ( isset( $_GET['dnsverified'] ) || isset( $_GET['dnsverify'] ) ) {
446
+ $hideh2 = 'hideheader';
447
+ }
448
+ $html .= '<div class="le-debugger running ' . $hideh2 . '"><h3>' . esc_html__( 'Response Log', 'wp-letsencrypt-ssl' ) . ':</h3>' . WPLE_Trait::wple_kses( nl2br( $log ) ) . '</div>';
449
+ } else {
450
+ $html .= '<div class="le-debugger">' . esc_html__( "Full response will be shown here", 'wp-letsencrypt-ssl' ) . '</div>';
451
+ }
452
+
453
+ echo $html ;
454
+ }
455
+
 
 
 
 
 
 
 
 
 
 
456
  }
457
+
458
+ /**
459
+ * Save email & proceed upon clicking install SSL
460
+ *
461
+ * @since 1.0.0
462
+ * @return void
463
+ */
464
+ public function wple_save_email_generate_certs()
465
+ {
466
+ //since 2.4.0
467
+ //force https upon success
468
+
469
+ if ( isset( $_POST['wple-https'] ) ) {
470
+ if ( !wp_verify_nonce( $_POST['sslready'], 'wplehttps' ) || !current_user_can( 'manage_options' ) ) {
471
+ exit( 'Unauthorized access' );
472
+ }
473
+ $basedomain = str_ireplace( array( 'http://', 'https://' ), array( '', '' ), addslashes( site_url() ) );
474
+ //4.7
475
+ if ( FALSE != stripos( $basedomain, '/' ) ) {
476
+ $basedomain = substr( $basedomain, 0, stripos( $basedomain, '/' ) );
477
+ }
478
+ $client = WPLE_Trait::wple_verify_ssl( $basedomain );
479
+
480
+ if ( !$client && !is_ssl() ) {
481
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption&success=1&nossl=1', 'http' ) );
482
+ exit;
483
+ }
484
+
485
+ // $SSLCheck = @fsockopen("ssl://" . $basedomain, 443, $errno, $errstr, 30);
486
+ // if (!$SSLCheck) {
487
+ // wp_redirect(admin_url('/admin.php?page=wp_encryption&success=1&nossl=1', 'http'));
488
+ // exit();
489
+ // }
490
+ $reverter = uniqid( 'wple' );
491
+ $savedopts = get_option( 'wple_opts' );
492
+ $savedopts['force_ssl'] = 1;
493
+ $savedopts['revertnonce'] = $reverter;
494
+ ///WPLE_Trait::wple_send_reverter_secret($reverter);
495
+ update_option( 'wple_opts', $savedopts );
496
+ delete_option( 'wple_error' );
497
+ //complete
498
+ update_option( 'wple_complete', 1 );
499
+ update_option( 'siteurl', str_ireplace( 'http:', 'https:', get_option( 'siteurl' ) ) );
500
+ update_option( 'home', str_ireplace( 'http:', 'https:', get_option( 'home' ) ) );
501
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption', 'https' ) );
502
+ exit;
503
+ }
504
+
505
+ //single domain ssl
506
+
507
+ if ( isset( $_POST['generate-certs'] ) ) {
508
+ if ( !wp_verify_nonce( $_POST['letsencrypt'], 'legenerate' ) || !current_user_can( 'manage_options' ) ) {
509
+ die( 'Unauthorized request' );
510
+ }
511
+ if ( empty($_POST['wple_email']) ) {
512
+ wp_die( esc_html__( 'Please input valid email address', 'wp-letsencrypt-ssl' ) );
513
+ }
514
+ $leopts = array(
515
+ 'email' => sanitize_email( $_POST['wple_email'] ),
516
+ 'date' => date( 'd-m-Y' ),
517
+ 'expiry' => '',
518
+ 'type' => 'single',
519
+ 'send_usage' => ( isset( $_POST['wple_send_usage'] ) ? 1 : 0 ),
520
+ 'include_www' => ( isset( $_POST['wple_include_www'] ) ? 1 : 0 ),
521
+ 'include_mail' => ( isset( $_POST['wple_include_mail'] ) ? 1 : 0 ),
522
+ 'include_webmail' => ( isset( $_POST['wple_include_webmail'] ) ? 1 : 0 ),
523
+ 'agree_gws_tos' => ( isset( $_POST['wple_agree_gws_tos'] ) ? 1 : 0 ),
524
+ 'agree_le_tos' => ( isset( $_POST['wple_agree_le_tos'] ) ? 1 : 0 ),
525
+ );
526
+
527
+ if ( isset( $_POST['wple_domain'] ) && !is_multisite() ) {
528
+ $leopts['subdir'] = 1;
529
+ $leopts['domain'] = sanitize_text_field( $_POST['wple_domain'] );
530
+ }
531
+
532
+ update_option( 'wple_opts', $leopts );
533
+ new WPLE_Core( $leopts );
534
+ }
535
+
536
  }
537
+
538
+ /**
539
+ * Download cert files based on clicked link
540
+ *
541
+ * certs for multisite mapped domains cannot be downloaded yet
542
+ * @since 1.0.0
543
+ * @return void
544
+ */
545
+ public function wple_download_files()
546
+ {
547
+
548
+ if ( isset( $_GET['le'] ) && current_user_can( 'manage_options' ) ) {
549
+ switch ( $_GET['le'] ) {
550
+ case '1':
551
+ $file = uniqid() . '-cert.crt';
552
+ file_put_contents( $file, file_get_contents( ABSPATH . 'keys/certificate.crt' ) );
553
+ break;
554
+ case '2':
555
+ $file = uniqid() . '-key.pem';
556
+ file_put_contents( $file, file_get_contents( ABSPATH . 'keys/private.pem' ) );
557
+ break;
558
+ case '3':
559
+ $file = uniqid() . '-cabundle.crt';
560
+
561
+ if ( file_exists( ABSPATH . 'keys/cabundle.crt' ) ) {
562
+ $cabundlefile = file_get_contents( ABSPATH . 'keys/cabundle.crt' );
563
+ } else {
564
+ $cabundlefile = file_get_contents( WPLE_DIR . 'cabundle/ca.crt' );
565
+ }
566
+
567
+ file_put_contents( $file, $cabundlefile );
568
+ break;
569
+ }
570
+ header( 'Content-Description: File Transfer' );
571
+ header( 'Content-Type: text/plain' );
572
+ header( 'Content-Length: ' . filesize( $file ) );
573
+ header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
574
+ readfile( $file );
575
+ if ( file_exists( $file ) ) {
576
+ unlink( $file );
577
+ }
578
+ exit;
579
+ }
580
+
581
  }
582
+
583
+ /**
584
+ * Rate us admin notice
585
+ *
586
+ * @since 2.0.0
587
+ * @return void
588
+ */
589
+ public function wple_rateus()
590
+ {
591
+ $cert = ABSPATH . 'keys/certificate.crt';
592
+
593
+ if ( file_exists( $cert ) ) {
594
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp_encryption' ) {
595
+ return;
596
+ }
597
+ $reviewnonce = wp_create_nonce( 'wplereview' );
598
+ $html = '<div class="notice notice-info wple-admin-review">
 
599
  <div class="wple-review-box">
600
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
601
+ <span><strong>' . esc_html__( 'Congratulations!', 'wp-letsencrypt-ssl' ) . '</strong><p>' . WPLE_Trait::wple_kses( __( 'SSL certificate generated successfully!. <b>WP Encryption</b> just saved you several $$$ by generating free SSL certificate in record time!. Could you please do us a BIG favor & rate us with 5 star review to support further development of this plugin.', 'wp-letsencrypt-ssl' ) ) . '</p></span>
602
  </div>
603
+ <a class="wple-lets-review wplerevbtn" href="https://wordpress.org/support/plugin/wp-letsencrypt-ssl/reviews/#new-post" rel="nofollow noopener" target="_blank">' . esc_html__( 'Rate plugin', 'wp-letsencrypt-ssl' ) . '</a>
604
+ <a class="wple-did-review wplerevbtn" href="#" data-nc="' . esc_attr( $reviewnonce ) . '" data-action="1">' . esc_html__( 'I already did', 'wp-letsencrypt-ssl' ) . '&nbsp;<span class="dashicons dashicons-smiley"></span></a>
605
+ <a class="wple-later-review wplerevbtn" href="#" data-nc="' . esc_attr( $reviewnonce ) . '" data-action="2">' . esc_html__( 'Remind me later', 'wp-letsencrypt-ssl' ) . '&nbsp;<span class="dashicons dashicons-clock"></span></a>
606
  </div>';
607
+ echo $html ;
608
+ }
609
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  }
611
+
612
+ /**
613
+ * Check if wp install is IP or subdir based
614
+ *
615
+ * @since 2.4.0
616
+ * @return void
617
+ */
618
+ public function wple_subdir_ipaddress()
619
+ {
620
+ $siteURL = str_ireplace( array( 'http://', 'https://', 'www.' ), array( '', '', '' ), site_url() );
621
+ $flg = 0;
622
+ if ( filter_var( $siteURL, FILTER_VALIDATE_IP ) ) {
623
+ $flg = 1;
624
+ }
625
+ if ( FALSE !== stripos( $siteURL, 'localhost' ) ) {
626
+ $flg = 1;
627
+ }
628
+
629
+ if ( FALSE != stripos( $siteURL, '/' ) && is_multisite() ) {
630
+ $html = '<div class="wrap" id="le-wrap">
631
  <div class="le-inner">
632
  <div class="wple-header">
633
+ <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html( WPLE_PLUGIN_VERSION ) . '</span>
634
  </div>
635
  <div class="wple-warning-notice">
636
+ <h2>' . esc_html__( 'You do not need to install SSL for each sub-directory site in multisite, Please install SSL for your primary domain and it will cover ALL sub directory sites too.', 'wp-letsencrypt-ssl' ) . '</h2>
637
  </div>
638
  </div>
639
  </div>';
640
+ echo $html ;
641
+ wp_die();
642
+ }
643
+
644
+
645
+ if ( $flg ) {
646
+ $html = '<div class="wrap" id="le-wrap">
647
  <div class="le-inner">
648
  <div class="wple-header">
649
+ <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html( WPLE_PLUGIN_VERSION ) . '</span>
650
  </div>
651
  <div class="wple-warning-notice">
652
+ <h2>' . esc_html__( 'SSL Certificates cannot be issued for localhost and IP address based WordPress site. Please use this on your real domain based WordPress site.', 'wp-letsencrypt-ssl' ) . ' ' . esc_html__( 'This restriction is not implemented by WP Encryption but its how SSL certificates work.', 'wp-letsencrypt-ssl' ) . '</h2>
653
  </div>
654
  </div>
655
  </div>';
656
+ echo $html ;
657
+ wp_die();
658
+ }
659
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  }
661
+
662
+ /**
663
+ * Upgrade to PRO
664
+ *
665
+ * @param string $html
666
+ * @since 2.5.0
667
+ * @return void
668
+ */
669
+ public function wple_upgrade_block( &$html )
670
+ {
671
+ $upgradeurl = admin_url( '/admin.php?page=wp_encryption-pricing' );
672
+ ///$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd&coupon=FIRSTBUY');
673
+ $nopricing = get_option( 'wple_no_pricing' );
674
+ //gdy
675
+ $cp = get_option( 'wple_have_cpanel' );
676
+ if ( FALSE === $nopricing && !$cp ) {
677
+ //not gdy & not cpanel
678
+ $nopricing = rand( 0, 1 );
679
+ }
680
+ $automatic = esc_html__( 'Automatic', 'wp-letsencrypt-ssl' );
681
+ $manual = esc_html__( 'Manual', 'wp-letsencrypt-ssl' );
682
+ $domain = str_ireplace( array( 'https://', 'http://', 'www.' ), '', site_url() );
683
+ $dverify = $automatic;
684
+ if ( stripos( $domain, '/' ) != FALSE ) {
685
+ //subdir site
686
+ $dverify = $manual;
687
+ }
688
+ $html .= '
689
  <div id="wple-upgradepro">';
690
+
691
+ if ( FALSE !== $cp && $cp ) {
692
+ $html .= '<strong style="display: block; text-align: center; color: #666;">Woot Woot! You have <b>CPANEL</b>! Why struggle with manual SSL renewal every 90 days? - Enjoy 100% automation with PRO version.</strong>';
693
+ ///$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd');
694
+ }
695
+
696
+ $compareurl = 'https://wpencryption.com?utm_source=wordpress&utm_medium=comparison&utm_campaign=wpencryption';
697
+ //$compareurl = admin_url('/admin.php?page=wp_encryption&comparison=1');
698
+
699
+ if ( $nopricing ) {
700
+ $compareurl = admin_url( '/admin.php?page=wp_encryption&comparison=1' );
701
+ //$upgradeurl = admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=11394&plan_name=pro&billing_cycle=annual&pricing_id=11717&currency=usd');
702
+ $upgradeurl = 'https://checkout.freemius.com/mode/dialog/plugin/5090/plan/10643/';
703
+ //CDN
704
+ $html .= '<div class="wple-error-firewall fire-pro wple-procdn">
705
  <div>
706
  <img src="' . WPLE_URL . 'admin/assets/firewall-shield-pro.png"/>
707
  </div>
712
  <span><b>Automatic CDN</b><br>Your site is served from 42 full scale edge locations for faster content delivery and fastest performance.</span>
713
  </div>
714
  </div>';
715
+ } else {
716
+ $html .= '<div class="wple-plans">
717
+ <span class="free">* ' . esc_html__( 'FREE', 'wp-letsencrypt-ssl' ) . '</span>
718
+ <span class="pro">* ' . esc_html__( 'PRO', 'wp-letsencrypt-ssl' ) . '</span>
719
  </div>
720
  <div class="wple-plan-compare">
721
  <div class="wple-compare-item">
722
  <img src="' . WPLE_URL . 'admin/assets/verified.png"/>
723
+ <h4>' . esc_html__( 'HTTP Verification', 'wp-letsencrypt-ssl' ) . '</h4>
724
  <span class="wple-free">' . $manual . '</span>
725
  <span class="wple-pro">' . $automatic . '</span>
726
  </div>
727
  <div class="wple-compare-item">
728
  <img src="' . WPLE_URL . 'admin/assets/DNS.png"/>
729
+ <h4>' . esc_html__( 'DNS Verification', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'In case of HTTP verification fail / not possible', 'wp-letsencrypt-ssl' ) . '"></span></h4>
730
  <span class="wple-free">' . $manual . '</span>
731
  <span class="wple-pro">' . $automatic . '</span>
732
  </div>
733
  <div class="wple-compare-item">
734
  <img src="' . WPLE_URL . 'admin/assets/Install.png"/>
735
+ <h4>' . esc_html__( 'SSL Installation', 'wp-letsencrypt-ssl' ) . ' <!--<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'PRO - We offer one time free manual support for non-cPanel based sites', 'wp-letsencrypt-ssl' ) . '"></span>--></h4>
736
  <span class="wple-free">' . $manual . '</span>
737
  <span class="wple-pro">' . $automatic . '</span>
738
  </div>
739
  <div class="wple-compare-item">
740
  <img src="' . WPLE_URL . 'admin/assets/renewal.png"/>
741
+ <h4>' . esc_html__( 'SSL Renewal', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'Free users must manually renew / re-generate SSL certificate every 90 days.', 'wp-letsencrypt-ssl' ) . '"></span></h4>
742
  <span class="wple-free">' . $manual . '</span>
743
  <span class="wple-pro">' . $automatic . '</span>
744
  </div>
745
  <div class="wple-compare-item">
746
  <img src="' . WPLE_URL . 'admin/assets/wildcard.png"/>
747
+ <h4>' . esc_html__( 'Wildcard SSL', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'PRO - Your domain DNS must be managed by cPanel or Godaddy for full automation', 'wp-letsencrypt-ssl' ) . '"></span></h4>
748
+ <span class="wple-free">' . esc_html__( 'Not Available', 'wp-letsencrypt-ssl' ) . '</span>
749
+ <span class="wple-pro">' . esc_html__( 'Available', 'wp-letsencrypt-ssl' ) . '</span>
750
  </div>
751
  <div class="wple-compare-item">
752
  <img src="' . WPLE_URL . 'admin/assets/multisite.png"/>
753
+ <h4>' . esc_html__( 'Multisite Support', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'PRO - Support for Multisite + Mapped domains', 'wp-letsencrypt-ssl' ) . '"></span></h4>
754
+ <span class="wple-free">' . esc_html__( 'Not Available', 'wp-letsencrypt-ssl' ) . '</span>
755
+ <span class="wple-pro">' . esc_html__( 'Available', 'wp-letsencrypt-ssl' ) . '</span>
756
  </div>
757
  </div>';
758
+ }
759
+
760
+ ///$html .= '<div style="text-align:center"><img src="' . WPLE_URL . '/admin/assets/new-year.png"></div>';
761
+ $html .= '<div class="wple-upgrade-pro">
762
+ <a href="' . $compareurl . '" target="_blank" class="wplecompare">' . esc_html__( 'COMPARE FREE & PRO VERSION', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-external"></span></a>';
763
+ // if (isset($_GET['success']) && FALSE == $nopricing) {
764
+ // $html .= '<a href="' . $upgradeurl . '">' . esc_html__('UPGRADE TO PRO', 'wp-letsencrypt-ssl') . '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Requires cPanel or root SSH access"></span></a>
765
+ // <a href="https://wpencryption.com/#firewall" target="_blank">' . esc_html__('UPGRADE TO FIREWALL', 'wp-letsencrypt-ssl') . '<span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Why buy an SSL alone when you can get Premium SSL + CDN + Firewall Security for even lower cost."></span></a>';
766
+ // } else {
767
+
768
+ if ( $nopricing ) {
769
+ $html .= '<a href="' . $upgradeurl . '">' . esc_html__( 'UPGRADE TO CDN', 'wp-letsencrypt-ssl' ) . '</a>';
770
+ } else {
771
+ $html .= '<a href="' . $upgradeurl . '">' . esc_html__( 'UPGRADE TO PRO', 'wp-letsencrypt-ssl' ) . '</a>';
772
+ }
773
+
774
+ //$html .= '<a href="https://checkout.freemius.com/mode/dialog/plugin/5090/plan/10643/" target="_blank" id="upgradetocdn">' . esc_html__('UPGRADE TO CDN', 'wp-letsencrypt-ssl') . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Sky rocket your WordPress site performance with Fastest Content Delivery Network + Premium Sectigo SSL"></span></a>';
775
+ // }
776
+ $html .= '</div>';
777
+ // $rnd = rand(0, 1);
778
+ // if ($rnd) {
779
+ // $html .= '<div class="wple-hire-expert"><a href="https://wpencryption.com/cdn-firewall/?utm_campaign=wpencryptionsite&utm_medium=checkoutcdn&utm_source=upgradeblock" target="_blank">Sky Rocket your site speed with our <strong>CDN</strong> plan (<strong>Includes SSL + Performance</strong>) <span class="dashicons dashicons-external"></span></a></div>';
780
+ // } else {
781
+ // $html .= '<div class="wple-hire-expert"><a href="https://wpencryption.com/hire-ssl-expert/?utm_campaign=wpencryptionsite&utm_medium=hiresslexpert&utm_source=upgradeblock" target="_blank">Too busy? <b>Hire an expert</b> for secure migration to HTTPS (<b>ONE YEAR PRO LICENSE FREE</b>) <span class="dashicons dashicons-external"></span></a></div>';
782
+ // }
783
+ $html .= '</div><!--wple-upgradepro-->';
784
+ $html .= '<div id="ourotherplugin">Check out our another awesome plugin <a href="https://wordpress.org/plugins/go-viral/" target="_blank"><img src="' . WPLE_URL . 'admin/assets/goviral-logo.png"/> - All in one social toolkit</a></div>';
785
  }
786
+
787
+ /**
788
+ * Success Message block
789
+ *
790
+ * @param string $html
791
+ * @since 2.5.0
792
+ * @return void
793
+ */
794
+ public function wple_success_block( &$html )
795
+ {
796
+ //since 2.4.0
797
+
798
+ if ( isset( $_GET['success'] ) ) {
799
+ $this->wple_wellknown_htaccess();
800
+ update_option( 'wple_error', 5 );
801
+ //all success
802
+ $html .= '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
  <div id="wple-sslgenerator">
804
  <div class="wple-success-form">';
805
+ // if (!isset($_GET['resume']) && !isset($_GET['nossl'])) {
806
+ // $this->wple_send_success_mail();
807
+ // }
808
+ $html .= '<h2><span class="dashicons dashicons-yes"></span>&nbsp;' . WPLE_Trait::wple_kses( __( '<b>Congrats! SSL Certificate have been successfully generated.</b>', 'wp-letsencrypt-ssl' ) ) . '</h2>
809
+ <h3 style="width: 87%; margin: 0px auto; color: #7b8279; font-weight:400;">' . WPLE_Trait::wple_kses( __( 'We just completed major task of generating SSL certificate! Now we have ONE final step to complete.', 'wp-letsencrypt-ssl' ) ) . '</h3>';
810
+ $html .= WPLE_Trait::wple_progress_bar();
811
+ ///$nopricing = get_option('wple_no_pricing');
812
+ //$colclass = FALSE != $nopricing ? 'wple-three-cols' : '';
813
+ $html .= '
814
 
815
  <div class="wple-success-flex">
816
  <div class="wple-success-flex-video">
818
  </div>
819
  <div class="wple-success-flex-final">
820
  <ul class="download-ssl-certs">
821
+ <li>1. ' . sprintf( __( '%sClick here%s to login into your cPanel.', 'wp-letsencrypt-ssl' ), '<a href="' . site_url( 'cpanel' ) . '" target="_blank">', '</a>' ) . '</li>
822
+ <li>2. ' . sprintf( __( 'Open %sSSL/TLS%s option on your cPanel', 'wp-letsencrypt-ssl' ), '<strong><img src="' . WPLE_URL . '/admin/assets/tls.png" style="width: 20px;margin-bottom: -5px;">&nbsp;', '</strong>' ) . '</li>
823
+ <li>3. ' . sprintf( __( 'Click on %sManage SSL Sites%s option', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>
824
  <li>4. ' . sprintf(
825
+ __( 'Copy the contents of %sCertificate.crt%s, %sPrivate.pem%s, %sCABundle.crt%s files from below & paste them into its appropriate fields on cPanel', 'wp-letsencrypt-ssl' ),
826
+ '<strong>',
827
+ '</strong>',
828
+ '<strong>',
829
+ '</strong>',
830
+ '<strong>',
831
+ '</strong>'
832
+ ) . '. ' . esc_html( "You can also download the cert files to your local computer, right click > open with notepad to view/copy", "wp-letsencrypt-ssl" ) . '</li>
833
  <li>';
834
+ WPLE_Trait::wple_copy_and_download( $html );
835
+ $html .= '</li>
836
+ <li>5. ' . sprintf( __( 'Click on %sInstall certificate%s', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>
837
+ <li>6. ' . sprintf( __( 'Please wait few minutes and click on %sEnable HTTPS Now%s button', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>
838
  </ul>
839
 
840
  </div>
842
 
843
  <div class="wple-success-cols wple-three-cols">
844
  <div>
845
+ <h3>' . esc_html__( "Don't have cPanel?", 'wp-letsencrypt-ssl' ) . '</h3>
846
+ <p>' . esc_html__( "cPanel link goes to 404 not found page?. ", 'wp-letsencrypt-ssl' ) . sprintf(
847
+ __( 'If you have root SSH access, edit your server config file and point your SSL paths to %scertificate.crt%s & %sprivate.pem%s files in %skeys/%s folder. Alternatively, Upgrade to %sPRO%s version for automatic SSL installation and automatic SSL renewal.', 'wp-letsencrypt-ssl' ),
848
+ '<strong>',
849
+ '</strong>',
850
+ '<strong>',
851
+ '</strong>',
852
+ '<strong>',
853
+ '</strong>',
854
+ '<a href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ) . '"><strong>',
855
+ '</strong></a>'
856
+ ) . '<br><br>' . sprintf( __( 'You can also upgrade to our %sCDN%s plan to avail fully automatic SSL + Fastest CDN + Firewall Security.', 'wp-letsencrypt-ssl' ), '<a href="https://wpencryption.com/cdn-firewall/" target="_blank">', '</a>' ) . '</p>
857
  </div>
858
  <div>
859
+ <h3>' . esc_html__( "Test SSL Installation", 'wp-letsencrypt-ssl' ) . '</h3>
860
+ <p>' . esc_html__( "After installing SSL certs on your cPanel, open your site in https:// and click on padlock to see if valid certificate exists. You can also test your site's SSL on SSLLabs.com", "wp-letsencrypt-ssl" ) . '</p>
861
  </div>
862
  <div>
863
+ <h3>' . esc_html__( "By Clicking Enable HTTPS", 'wp-letsencrypt-ssl' ) . '</h3>
864
+ <p>' . esc_html__( 'Your site & admin url will be changed to https:// and all assets, js, css, images will strictly load over https:// to avoid mixed content errors.', 'wp-letsencrypt-ssl' ) . '</p>
865
  </div>';
866
+ // if (FALSE == $nopricing) {
867
+ // $html .= '<div>
868
+ // <h3>' . esc_html__("Looking for instant SSL solution?", 'wp-letsencrypt-ssl') . '</h3>
869
+ // <p>' . sprintf(__('Why pay for an SSL certificate alone when you can get %sPremium Sectigo SSL%s + %sCDN Performance%s + %sSecurity Firewall%s for even lower cost with our %sCDN%s Service.', 'wp-letsencrypt-ssl'), '<strong>', '</strong>', '<strong>', '</strong>', '<strong>', '</strong>', '<a href="https://wpencryption.com/cdn-firewall/?utm_campaign=wpencryption&utm_source=wordpress&utm_medium=gocdn" target="_blank">', '</a>') . '!.</p>
870
+ // </div>';
871
+ // }
872
+ $html .= '</div>
873
 
874
  <ul>
875
+ <!--<li>' . WPLE_Trait::wple_kses( __( '<b>Note:</b> Use below "Enable HTTPS" button ONLY after SSL certificate is successfully installed on your cPanel', 'wp-letsencrypt-ssl' ) ) . '</li>-->
876
  </ul>';
877
+ if ( isset( $_GET['nossl'] ) ) {
878
+ $html .= '<h3 style="color:#ff4343;margin-bottom:10px;margin: 0 auto 10px; max-width: 800px;">' . esc_html__( 'We could not detect valid SSL certificate installed on your site!. Please try after some time. You can also try opening wp-admin via https:// and click on enable https button.', 'wp-letsencrypt-ssl' ) . '</h3>
879
+ <p>' . esc_html__( 'Switching to HTTPS without properly installing the SSL certificate might break your site.', 'wp-letsencrypt-ssl' ) . '</p>';
880
+ }
881
+ $html .= '<form method="post">
882
  ' . wp_nonce_field(
883
+ 'wplehttps',
884
+ 'sslready',
885
+ false,
886
+ false
887
+ ) . '
888
+ <button type="submit" name="wple-https">' . esc_html__( 'ENABLE HTTPS NOW', 'wp-letsencrypt-ssl' ) . '</button>
889
  </form>
890
  </div>
891
  </div><!--wple-sslgenerator-->';
892
+ }
893
+
894
  }
895
+
896
+ /**
897
+ * Show pending challenges
898
+ *
899
+ * @return void
900
+ */
901
+ public function wple_domain_verification()
902
+ {
903
+ //since 5.1.0
904
+
905
+ if ( isset( $_GET['restart'] ) ) {
906
+ //click to restart from beginning
907
+ delete_option( 'wple_error' );
908
+ delete_option( 'wple_complete' );
909
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
910
+ exit;
911
+ }
912
+
913
+
914
+ if ( isset( $_GET['complete'] ) ) {
915
+ //Forced SSL completion flag
916
+ delete_option( 'wple_error' );
917
+ update_option( 'wple_complete', 1 );
918
+ update_option( 'wple_backend', 1 );
919
+ if ( wp_next_scheduled( 'wple_ssl_renewal' ) ) {
920
+ wp_clear_scheduled_hook( 'wple_ssl_renewal' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  }
922
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
923
+ exit;
924
+ }
925
+
926
+ $estage = get_option( 'wple_error' );
927
+ //redirections
928
+
929
+ if ( FALSE !== $estage && $estage == 2 && !isset( $_GET['subdir'] ) && !isset( $_GET['error'] ) && !isset( $_GET['includewww'] ) && !isset( $_GET['wpleauto'] ) && isset( $_GET['page'] ) && $_GET['page'] == 'wp_encryption' && !isset( $_GET['success'] ) && !isset( $_GET['wplereset'] ) && !isset( $_GET['comparison'] ) && !isset( $_GET['lasterror'] ) ) {
930
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption&subdir=1' ), 302 );
931
+ exit;
932
+ }
933
+
934
+
935
+ if ( FALSE !== $estage && $estage == 5 && !isset( $_GET['subdir'] ) && !isset( $_GET['error'] ) && !isset( $_GET['includewww'] ) && !isset( $_GET['wpleauto'] ) && isset( $_GET['page'] ) && $_GET['page'] == 'wp_encryption' && !isset( $_GET['resume'] ) && !isset( $_GET['nossl'] ) && !isset( $_GET['wplereset'] ) && !isset( $_GET['comparison'] ) && !isset( $_GET['nocpanel'] ) ) {
936
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption&success=1&resume=1' ), 302 );
937
+ exit;
938
+ }
939
+
940
+ }
941
+
942
+ /**
943
+ * Error Message block
944
+ *
945
+ * @param string $html
946
+ * @since 2.5.0
947
+ * @return void
948
+ */
949
+ public function wple_error_block( &$html )
950
+ {
951
+ if ( !isset( $_GET['subdir'] ) && !isset( $_GET['success'] ) ) {
952
+
953
+ if ( isset( $_GET['sperror'] ) ) {
954
+ } else {
955
+
956
+ if ( isset( $_GET['error'] ) || FALSE != ($error_code = get_option( 'wple_error' )) ) {
957
+ $error_code = get_option( 'wple_error' );
958
+ $generic = esc_html__( 'There was some issue while generating SSL for your site. Please check debug log or try Reset option once.', 'wp-letsencrypt-ssl' );
959
+ $generic .= '<p style="font-size:16px;color:#888">' . sprintf( esc_html__( 'Feel free to open support ticket at %s for any help.', 'wp-letsencrypt-ssl' ), 'https://wordpress.org/support/plugin/wp-letsencrypt-ssl/#new-topic-0' ) . '</p>';
960
+ $firerec = sprintf(
961
+ esc_html__( "We highly recommend upgrading to our %sPRO%s annual plan for %sPremium SSL%s with automatic %sCDN%s + %sFirewall Security%s that works on ANY host.", 'wp-letsencrypt-ssl' ),
962
+ '<a href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ) . '">',
963
+ '</a>',
964
+ '<strong>',
965
+ '</strong>',
966
+ '<strong>',
967
+ '</strong>',
968
+ '<strong>',
969
+ '</strong>'
970
+ );
971
+ $thirdparty = esc_html__( "Your hosting server don't seem to support third party SSL.", "wp-letsencrypt-ssl" );
972
+
973
+ if ( FALSE !== $error_code && ($error_code == 1 || $error_code == 400) ) {
974
+ $generic .= '<p class="firepro">' . $thirdparty . ' ' . $firerec . '</p>';
975
+ } else {
976
+ if ( file_exists( ABSPATH . 'keys/certificate.crt' ) ) {
977
+ $generic .= '<br><br>' . WPLE_Trait::wple_kses( __( 'You already seem to have certificate generated and stored. Please try downloading certs from <strong>Download SSL Certificates</strong> page and open in a text editor like notepad to check if certificate is not empty.', 'wp-letsencrypt-ssl' ) );
978
+ }
979
+ }
980
+
981
+
982
+ if ( FALSE !== $error_code && $error_code == 429 ) {
983
+ $generic = sprintf( esc_html__( 'Too many registration attempts from your IP address (%s). Please try after 2-3 hours.', 'wp-letsencrypt-ssl' ), 'https://letsencrypt.org/docs/rate-limits/' );
984
+ $generic .= '<p class="firepro">' . $firerec . '</p>';
985
+ $generic .= '<p style="font-size:17px;color:#888">' . sprintf( esc_html__( 'Feel free to open support ticket at %s for any help.', 'wp-letsencrypt-ssl' ), 'https://wordpress.org/support/plugin/wp-letsencrypt-ssl/#new-topic-0' ) . '</p>';
986
+ }
987
+
988
+ if ( $error_code != 5 ) {
989
+ $html .= '
990
  <div id="wple-sslgenerator" class="error">
991
  <div class="wple-error-message">
992
  ' . $generic . '
993
  </div>
994
  </div><!--wple-sslgenerator-->';
995
+ }
996
+ }
997
+
998
+ }
999
+
1000
  }
 
1001
  }
1002
+
1003
+ /**
1004
+ * Handles review box actions
1005
+ *
1006
+ * @since 4.4.0
1007
+ * @return void
1008
+ */
1009
+ public function wple_review_handler()
1010
+ {
1011
+ //since 5.0.0
1012
+ $this->wple_intro_pricing_handler();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013
  }
1014
+
1015
+ /**
1016
+ * Sets review flag to show review request
1017
+ *
1018
+ * @since 4.4.0
1019
+ */
1020
+ public function wple_set_review_flag()
1021
+ {
1022
+ update_option( 'wple_show_review', 1 );
1023
  }
1024
+
1025
+ /**
1026
+ * Handle the reset keys action
1027
+ *
1028
+ * @since 4.5.0
1029
+ * @return void
1030
+ */
1031
+ public function wple_reset_handler()
1032
+ {
1033
+
1034
+ if ( isset( $_GET['wplereset'] ) ) {
1035
+ if ( !current_user_can( 'manage_options' ) ) {
1036
+ exit( 'No Trespassing Allowed' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1037
  }
1038
+ if ( !wp_verify_nonce( $_GET['wplereset'], 'restartwple' ) ) {
1039
+ exit( 'No Trespassing Allowed' );
 
 
 
 
 
1040
  }
1041
+ $keys = ABSPATH . 'keys/';
1042
+ $files = array(
1043
+ $keys . 'public.pem',
1044
+ $keys . 'private.pem',
1045
+ $keys . 'order',
1046
+ $keys . 'fullchain.crt',
1047
+ $keys . 'certificate.crt',
1048
+ $keys . '__account/private.pem',
1049
+ $keys . '__account/public.pem'
1050
+ );
1051
+ foreach ( $files as $file ) {
1052
+ if ( file_exists( $file ) ) {
1053
+ unlink( $file );
1054
+ }
1055
+ }
1056
+ delete_option( 'wple_error' );
1057
+ delete_option( 'wple_complete' );
1058
+ delete_option( 'wple_backend' );
1059
+ ///if (wple_fs()->can_use_premium_code__premium_only()) {
1060
+ delete_option( 'wple_firewall_stage' );
1061
+ delete_option( 'wple_spmode_dns' );
1062
+ delete_option( 'wple_spmode_activated' );
1063
+ ///}
1064
+ add_action( 'admin_notices', array( $this, 'wple_reset_success' ) );
1065
  }
1066
+
1067
+ //since 4.6.0
1068
+
1069
+ if ( isset( $_GET['wplesslrenew'] ) ) {
1070
+ if ( !wp_verify_nonce( $_GET['wplesslrenew'], 'wple_renewed' ) ) {
1071
+ exit( 'Unauthorized' );
1072
+ }
1073
+ delete_option( 'wple_show_reminder' );
1074
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
 
 
 
 
 
 
 
 
 
 
 
1075
  }
1076
+
1077
+ }
1078
+
1079
+ /**
1080
+ * Reset success notice
1081
+ *
1082
+ * @since 4.5.0
1083
+ */
1084
+ public function wple_reset_success()
1085
+ {
1086
+ echo '<div class="notice notice-success is-dismissable">
1087
+ <p>' . esc_html( 'Reset successful!. You can start with the SSL install process again.', 'wp-letsencrypt-ssl' ) . '</p>
1088
+ </div>' ;
1089
+ }
1090
+
1091
+ /**
1092
+ * Local check DNS records via Ajax
1093
+ *
1094
+ * @since 4.6.0
1095
+ * @return void
1096
+ */
1097
+ public function wple_ajx_verify_dns()
1098
+ {
1099
+
1100
+ if ( isset( $_POST['nc'] ) ) {
1101
+ if ( !wp_verify_nonce( $_POST['nc'], 'verifydnsrecords' ) ) {
1102
+ exit( 'Unauthorized' );
1103
+ }
1104
+ $toVerify = get_option( 'wple_opts' );
1105
+
1106
+ if ( array_key_exists( 'dns_challenges', $toVerify ) && !empty($toVerify['dns_challenges']) ) {
1107
+ $toVerify = $dnspendings = $toVerify['dns_challenges'];
1108
+ //array
1109
+ foreach ( $toVerify as $index => $item ) {
1110
+ $domain_code = explode( '||', $item );
1111
+ $acme = '_acme-challenge.' . esc_html( $domain_code[0] );
1112
+ $requestURL = 'https://dns.google.com/resolve?name=' . addslashes( $acme ) . '&type=TXT';
1113
+ $handle = curl_init();
1114
+ curl_setopt( $handle, CURLOPT_URL, $requestURL );
1115
+ curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
1116
+ curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
1117
+ $response = json_decode( trim( curl_exec( $handle ) ) );
1118
+
1119
+ if ( $response->Status === 0 && isset( $response->Answer ) ) {
1120
+ //if ($answer->type == 16) {
1121
+ $found = 'Pending';
1122
+ foreach ( $response->Answer as $answer ) {
1123
+ $livecode = str_ireplace( '"', '', $answer->data );
1124
+
1125
+ if ( $livecode == $domain_code[1] ) {
1126
+ unset( $dnspendings[$index] );
1127
+ $found = 'OK';
1128
+ }
1129
+
1130
+ }
1131
+ WPLE_Trait::wple_logger( "\n" . esc_html( $requestURL . ' should return ' . $domain_code[1] . ' -> ' . $found ) . "\n" );
1132
+ } else {
1133
+ $ledebug = WPLE_Trait::wple_lets_debug( 'dns-01' );
1134
+
1135
+ if ( $ledebug != false ) {
1136
+ echo $ledebug ;
1137
+ exit;
1138
+ }
1139
+
1140
+ echo 'fail' ;
1141
+ exit;
1142
+ }
1143
+
1144
+ }
1145
+
1146
+ if ( empty($dnspendings) ) {
1147
+ WPLE_Trait::wple_logger(
1148
+ "Local check - All DNS challenges verified\n",
1149
+ 'success',
1150
+ 'a',
1151
+ false
1152
+ );
1153
+ echo 1 ;
1154
+ exit;
1155
+ } else {
1156
+ $ledebug = WPLE_Trait::wple_lets_debug( 'dns-01' );
1157
+
1158
+ if ( $ledebug != false ) {
1159
+ echo $ledebug ;
1160
+ exit;
1161
+ }
1162
+
1163
+ echo 'fail' ;
1164
+ exit;
1165
+ }
1166
+
1167
+ } else {
1168
+
1169
+ if ( empty($toVerify['dns_challenges']) ) {
1170
+ WPLE_Trait::wple_logger(
1171
+ "Local check - DNS challenges empty\n",
1172
+ 'success',
1173
+ 'a',
1174
+ false
1175
+ );
1176
+ echo 1 ;
1177
+ exit;
1178
+ }
1179
+
1180
+ }
1181
+
1182
  }
1183
+
1184
+ echo 'fail' ;
1185
+ exit;
1186
  }
1187
+
1188
+ /**
1189
+ * Show expiry reminder in admin notice
1190
+ *
1191
+ * @see 4.6.0
1192
+ * @return void
1193
+ */
1194
+ public function wple_start_show_reminder()
1195
+ {
1196
+ update_option( 'wple_show_reminder', 1 );
1197
+ $opts = get_option( 'wple_opts' );
1198
+ $to = sanitize_email( $opts['email'] );
1199
+ $subject = sprintf( esc_html__( 'ATTENTION - SSL Certificate of %s expires in just 10 days', 'wp-letsencrypt-ssl' ), str_ireplace( array( 'https://', 'http://' ), array( '', '' ), site_url() ) );
1200
+ $headers = array( 'Content-Type: text/html; charset=UTF-8' );
1201
+ $body = '<p>' . sprintf( esc_html__( 'Your SSL Certificate is expiring soon!. Please make sure to re-generate new SSL Certificate using %sWP Encryption%s and install it on your hosting server to avoid site showing insecure warning with expired certificate.', 'wp-letsencrypt-ssl' ), '<a href="' . admin_url( '/admin.php?page=wp_encryption', 'http' ) . '">', '</a>' ) . '</p><br /><br />';
1202
+ $body .= '<b>' . esc_html__( 'Tired of manual SSL renewal every 90 days?, Upgrade to PRO version for automatic SSL installation and automatic SSL renewal', 'wp-letsencrypt-ssl' ) . '. <br><a href="' . admin_url( '/admin.php?page=wp_encryption-pricing', 'http' ) . '" style="background: #0073aa; text-decoration: none; color: #fff; padding: 12px 20px; display: inline-block; margin: 10px 0; font-weight: bold;">' . esc_html__( 'UPGRADE TO PREMIUM', 'wp-letsencrypt-ssl' ) . '</a></b><br /><br />';
1203
+ wp_mail(
1204
+ $to,
1205
+ $subject,
1206
+ $body,
1207
+ $headers
1208
+ );
1209
+ }
1210
+
1211
+ public function wple_reminder_notice()
1212
+ {
1213
+ $already_did = wp_nonce_url( admin_url( 'admin.php?page=wp_encryption' ), 'wple_renewed', 'wplesslrenew' );
1214
+ $html = '<div class="notice notice-info wple-admin-review">
 
 
 
 
1215
  <div class="wple-review-box wple-reminder-notice">
1216
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1217
+ <span><strong>WP ENCRYPTION: ' . esc_html__( 'Your SSL certificate expires in less than 10 days', 'wp-letsencrypt-ssl' ) . '</strong><p>' . WPLE_Trait::wple_kses( __( 'Renew your SSL certificate today to avoid your site from showing as insecure. Please support our contribution by upgrading to <strong>Pro</strong> and avail automatic renewal with automatic installation.', 'wp-letsencrypt-ssl' ) ) . '</p></span>
1218
  </div>
1219
+ <a class="wple-lets-review wplerevbtn" href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd' ) . '">' . esc_html__( 'Upgrade to Pro', 'wp-letsencrypt-ssl' ) . '</a>
1220
+ <a class="already-renewed wplerevbtn" href="' . $already_did . '">' . esc_html__( 'I already renewed', 'wp-letsencrypt-ssl' ) . '&nbsp;<span class="dashicons dashicons-smiley"></span></a>
1221
  </div>';
1222
+ echo $html ;
1223
+ }
1224
+
1225
+ /**
1226
+ * Manual HTTP challenges for subdir sites
1227
+ *
1228
+ * @since 4.7.0
1229
+ * @param string $html
1230
+ * @param array $opts
1231
+ * @return string
1232
+ */
1233
+ public function wple_subdir_challenges( &$html, $opts )
1234
+ {
1235
+ if ( isset( $_GET['subdir'] ) ) {
1236
+ $html .= '
1237
  <div id="wple-sslgenerator">
1238
  <div class="wple-success-form">
1239
+ ' . WPLE_Subdir_Challenge_Helper::show_challenges( $opts ) . '
1240
  </div>
1241
  </div><!--wple-sslgenerator-->';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1242
  }
1243
+ }
1244
+
1245
+ /**
1246
+ * Local check HTTP records via Ajax for subdir sites
1247
+ *
1248
+ * @since 4.7.0
1249
+ * @return void
1250
+ */
1251
+ public function wple_ajx_verify_http()
1252
+ {
1253
+
1254
+ if ( isset( $_POST['nc'] ) ) {
1255
+ if ( !wp_verify_nonce( $_POST['nc'], 'verifyhttprecords' ) ) {
1256
+ exit( 'Unauthorized' );
1257
+ }
1258
+ $domain = str_ireplace( array( 'https://', 'http://' ), '', site_url() );
1259
+ if ( stripos( $domain, '/' ) != FALSE ) {
1260
+ //subdir site
1261
+ $domain = substr( $domain, 0, stripos( $domain, '/' ) );
1262
+ }
1263
+ $opts = get_option( 'wple_opts' );
1264
+ $httpch = $opts['challenge_files'];
1265
+
1266
+ if ( empty($httpch) ) {
1267
+ echo 1 ;
1268
+ exit;
1269
+ }
1270
+
1271
+ $counter = get_option( 'wple_failed_verification' );
1272
+ foreach ( $httpch as $index => $ch ) {
1273
+
1274
+ if ( $counter >= 8 ) {
1275
+ $fpath = ABSPATH . '.well-known/acme-challenge/';
1276
+ if ( !file_exists( $fpath ) ) {
1277
+ mkdir( $fpath, 0775, true );
1278
+ }
1279
+ WPLE_Trait::wple_logger( 'Helping with HTTP challenge file', 'success', 'a' );
1280
+ file_put_contents( $fpath . $ch['file'], trim( $ch['value'] ) );
1281
+ }
1282
+
1283
+ $check = LEFunctions::checkHTTPChallenge( $domain, $ch['file'], $ch['value'] );
1284
+
1285
+ if ( !$check ) {
1286
+
1287
+ if ( FALSE === $counter ) {
1288
+ update_option( 'wple_failed_verification', 1 );
1289
+ } else {
1290
+ update_option( 'wple_failed_verification', $counter + 1 );
1291
+ }
1292
+
1293
+ WPLE_Trait::wple_logger(
1294
+ "HTTP challenge file checked locally - found invalid",
1295
+ 'success',
1296
+ 'a',
1297
+ false
1298
+ );
1299
+ $ledebug = WPLE_Trait::wple_lets_debug( 'http-01' );
1300
+
1301
+ if ( $ledebug != false ) {
1302
+ echo $ledebug ;
1303
+ exit;
1304
+ }
1305
+
1306
+ echo 'fail' ;
1307
+ exit;
1308
+ }
1309
+
1310
+ }
1311
+ WPLE_Trait::wple_logger(
1312
+ "Local check - All HTTP challenges verified\n",
1313
+ 'success',
1314
+ 'a',
1315
+ false
1316
+ );
1317
+ delete_option( 'wple_failed_verification' );
1318
+ echo 1 ;
1319
  exit;
1320
+ }
1321
+
 
 
 
 
 
 
 
 
 
 
 
 
 
1322
  }
1323
+
1324
+ /**
1325
+ * Continue process on wpleauto param
1326
+ *
1327
+ * @return void
1328
+ */
1329
+ public function wple_continue_certification()
1330
+ {
1331
+
1332
+ if ( isset( $_GET['wpleauto'] ) ) {
1333
+ $leopts = get_option( 'wple_opts' );
1334
+
1335
+ if ( $_GET['wpleauto'] == 'http' ) {
1336
+ new WPLE_Core( $leopts );
1337
+ } else {
1338
+ //DNS
1339
+ new WPLE_Core(
1340
+ $leopts,
1341
+ true,
1342
+ false,
1343
+ true
1344
+ );
1345
+ }
1346
+
1347
+ }
1348
+
1349
  }
1350
+
1351
+ /**
1352
+ * Simple success notice for admin
1353
+ *
1354
+ * @since 4.7.2
1355
+ * @return void
1356
+ */
1357
+ public function wple_success_notice()
1358
+ {
1359
+ $html = '<div class="notice notice-success">
1360
+ <p>' . esc_html__( 'Success', 'wp-letsencrypt-ssl' ) . '!</p>
 
1361
  </div>';
1362
+ echo $html ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1363
  }
1364
+
1365
+ /**
1366
+ * Show Pricing table once on activation
1367
+ *
1368
+ * @since 5.0.0
1369
+ * @param string $html
1370
+ * @return $html
1371
+ */
1372
+ public function wple_initial_quick_pricing( &$html )
1373
+ {
1374
+ $host = site_url();
1375
+ if ( FALSE != ($slashpos = stripos( $host, '/', 9 )) ) {
1376
+ $host = substr( $host, 0, $slashpos );
1377
+ }
1378
+ $cp = $host . ':2083';
1379
+ if ( FALSE === stripos( $host, 'https' ) ) {
1380
+ $cp = $host . ':2082';
1381
+ }
1382
+ $response = wp_remote_get( $cp, [
1383
+ 'headers' => [
1384
+ 'Connection' => 'close',
1385
+ ],
1386
+ 'sslverify' => false,
1387
+ 'timeout' => 30,
1388
+ ] );
1389
+ $cpanel = true;
1390
+ if ( is_wp_error( $response ) ) {
1391
+ $cpanel = false;
1392
+ }
1393
+ $html .= '<div id="wple-sslgen">';
1394
+ $cppricing = ( FALSE !== stripos( ABSPATH, 'srv/htdocs' ) ? true : false );
1395
+
1396
+ if ( $cpanel || $cppricing ) {
1397
+ $show_rp = '';
1398
+ if ( !$cppricing ) {
1399
+ $show_rp = 1;
1400
+ }
1401
+ update_option( 'wple_have_cpanel', $show_rp );
1402
+ $html .= $this->wple_cpanel_pricing_table( 1 );
1403
+ } else {
1404
+ update_option( 'wple_have_cpanel', 0 );
1405
+ // if (isset($_SERVER['GD_PHP_HANDLER'])) {
1406
+ // if ($_SERVER['SERVER_SOFTWARE'] == 'Apache' && isset($_SERVER['GD_PHP_HANDLER']) && $_SERVER['DOCUMENT_ROOT'] == '/var/www') {
1407
+ $html .= $this->wple_firewall_pricing_table();
1408
+ // }
1409
+ // } else {
1410
+ // $html .= $this->wple_cpanel_pricing_table('');
1411
+ // }
1412
+ }
1413
+
1414
+ $html .= '</div>';
1415
+ echo $html ;
1416
  }
1417
+
1418
+ /**
1419
+ * Pricing table html
1420
+ *
1421
+ * @since 5.0.0
1422
+ * @return $table
1423
+ */
1424
+ public function wple_cpanel_pricing_table( $cpanel = '' )
1425
+ {
1426
+ ob_start();
1427
+ ?>
1428
 
1429
+ <h2 class="pricing-intro-head"><?php
1430
+ esc_html_e( 'SAVE MORE THAN $80+ EVERY YEAR IN SSL CERTIFICATE FEE', 'wp-letsencrypt-ssl' );
1431
+ ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1432
 
1433
+ <h4 class="pricing-intro-subhead">Purchase once and use for lifetime - Trusted Globally by <b>110,000+</b> WordPress Users (Looking for <a href="<?php
1434
+ echo admin_url( '/admin.php?page=wp_encryption&gopro=3' ) ;
1435
+ ?>">Annual</a> | <a href="<?php
1436
+ echo admin_url( '/admin.php?page=wp_encryption&gopro=2' ) ;
1437
+ ?>">Unlimited Sites License?</a>)</h4>
1438
 
1439
  <div style="text-align:center">
1440
+ <img src="<?php
1441
+ echo WPLE_URL ;
1442
+ ?>/admin/assets/limited-offer.png" style="max-width:650px" />
1443
  </div>
1444
 
1445
  <!-- <div class="plan-toggler" style="margin:60px 0 -20px !important">
1446
  <span>Annual</span><label class="toggle">
1447
+ <input class="toggle-checkbox initplan-switch" type="checkbox" <?php
1448
+ // if ($cpanel == 1) {
1449
+ // echo 'checked';
1450
+ // }
1451
+ ?>>
1452
  <div class="toggle-switch"></div>
1453
  <span class="toggle-label">Lifetime</span>
1454
  </label>
1469
  <li><strong>Basic</strong> support</li>
1470
  </ul>
1471
  <div class="pricing-btn-block">
1472
+ <a href="<?php
1473
+ echo admin_url( '/admin.php?page=wp_encryption&gofree=1' ) ;
1474
+ ?>" class="pricingbtn free">Select Plan</a>
1475
  </div>
1476
  </div>
1477
 
1495
  <li><strong>Priority</strong> support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="gowebsmarty.in"></span></li>
1496
  </ul>
1497
  <div class="pricing-btn-block">
1498
+ <a href="<?php
1499
+ echo admin_url( '/admin.php?page=wp_encryption&gopro=1' ) ;
1500
+ ?>" class="pricingbtn free">Select Plan</a>
1501
  </div>
1502
  </div>
1503
 
1504
  </div>
1505
 
1506
  <br />
1507
+ <?php
1508
+ if ( $cpanel != '' ) {
1509
  ?>
1510
  <div class="quick-refund-policy">
1511
  <strong>7 Days Refund Policy</strong>
1512
  <p>We're showing this recommendation because you have cPanel hosting where our PRO plugin is 100% guaranteed to work. Your purchase will be completely refunded if our plugin fail to work on your site.</p>
1513
  </div>
1514
+ <?php
1515
+ }
1516
+ ?>
1517
 
1518
+ <?php
1519
  $table = ob_get_clean();
1520
  return $table;
1521
+ }
1522
+
1523
+ public function wple_firewall_pricing_table()
1524
+ {
1525
  ob_start();
1526
  ?>
1527
 
1529
  <h4 class="pricing-intro-subhead">Upgrade to PRO today for <strong>Fully automatic SSL</strong> & get automatic <strong>CDN + Security</strong> for FREE! - Trusted Globally by <b>110,000+</b> WordPress Users <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="A complete bundle worth $360!"></span></h4>
1530
 
1531
  <div style="text-align:center">
1532
+ <img src="<?php
1533
+ echo WPLE_URL ;
1534
+ ?>/admin/assets/limited-offer.png" style="max-width:650px" />
1535
  </div>
1536
 
1537
  <div id="quick-pricing-table" class="non-cpanel-plans">
1547
  <li><strong>Basic</strong> support</li>
1548
  </ul>
1549
  <div class="pricing-btn-block">
1550
+ <a href="<?php
1551
+ echo admin_url( '/admin.php?page=wp_encryption&gofree=1' ) ;
1552
+ ?>" class="pricingbtn free">Select Plan</a>
1553
  </div>
1554
  </div>
1555
 
1574
  <li><strong>Priority</strong> Support</li>
1575
  </ul>
1576
  <div class="pricing-btn-block">
1577
+ <a href="<?php
1578
+ echo admin_url( '/admin.php?page=wp_encryption&gofirewall=1' ) ;
1579
+ ?>" class="pricingbtn free">Select Plan</a>
1580
  </div>
1581
  </div>
1582
 
1585
  7 days money back guarantee <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="If you are not satisfied with the service within 7 days of purchase, We will refund your purchase no questions asked"></span>
1586
  </div> -->
1587
 
1588
+ <?php
1589
  $table = ob_get_clean();
1590
  return $table;
1591
+ }
1592
+
1593
+ /**
1594
+ * Intro pricing table handler
1595
+ *
1596
+ * @since 5.0.0
1597
+ * @return void
1598
+ */
1599
+ public function wple_intro_pricing_handler()
1600
+ {
1601
  $goplan = '';
1602
+
1603
+ if ( isset( $_GET['gofree'] ) ) {
1604
+ update_option( 'wple_plan_choose', 1 );
1605
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
1606
+ exit;
1607
  } else {
1608
+
1609
+ if ( isset( $_GET['gopro'] ) ) {
1610
+ update_option( 'wple_plan_choose', 1 );
1611
+
1612
+ if ( $_GET['gopro'] == 2 ) {
1613
+ //unlimited
1614
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=10873&currency=usd' ), 302 );
1615
+ } else {
1616
+
1617
+ if ( $_GET['gopro'] == 3 ) {
1618
+ //annual
1619
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ), 302 );
1620
+ } else {
1621
+ //single lifetime
1622
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd' ), 302 );
1623
+ }
1624
+
1625
+ }
1626
+
1627
+ exit;
1628
  } else {
1629
+
1630
+ if ( isset( $_GET['gofirewall'] ) ) {
1631
+ update_option( 'wple_plan_choose', 1 );
1632
+ ///wp_redirect(admin_url('/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=11394&plan_name=pro&billing_cycle=annual&pricing_id=11717&currency=usd'), 302);
1633
+ wp_redirect( admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ), 302 );
1634
+ exit;
1635
+ }
1636
+
 
 
 
 
 
 
 
 
 
 
1637
  }
1638
+
1639
  }
1640
+
1641
+ }
1642
+
1643
+ /**
1644
+ * After all stages completion
1645
+ *
1646
+ * @param string $html
1647
+ * @return void
1648
+ */
1649
+ public function wple_completed_block( &$html )
1650
+ {
1651
  $html .= WPLE_Trait::wple_progress_bar();
1652
  $cert = ABSPATH . 'keys/certificate.crt';
1653
+ $leopts = get_option( 'wple_opts' );
1654
+ $future = strtotime( $leopts['expiry'] );
1655
  //Future date.
1656
  $timefromdb = time();
1657
  $timeleft = $future - $timefromdb;
1658
+ $daysleft = round( $timeleft / 24 / 60 / 60 );
1659
+ $wple_support = get_option( 'wple_backend' );
1660
+ $renewtext = esc_html__( 'Click Here To Renew SSL Certificate', 'wp-letsencrypt-ssl' );
1661
+ $renewlink = '<a href="#" class="letsrenew wple-tooltip disabled" data-tippy="' . esc_html__( 'This renew button will get enabled during last 30 days of current SSL certificate expiry', 'wp-letsencrypt-ssl' ) . ' ' . esc_html__( 'You can also click on STEP 1 in above progress bar to renew/re-generate SSL Certificate again.', 'wp-letsencrypt-ssl' ) . '">' . $renewtext . '</a>';
1662
+ if ( $daysleft <= 30 ) {
1663
+ $renewlink = '<a href="' . admin_url( '/admin.php?page=wp_encryption&restart=1' ) . '" class="letsrenew">' . $renewtext . '</a>';
1664
+ }
1665
+ if ( $wple_support ) {
1666
+ //forced completion
1667
+ $renewlink = '';
1668
+ }
1669
+ $headline = esc_html__( 'Woohoo! WP Encryption just saved you $$$ in SSL Certificate Fee.', 'wp-letsencrypt-ssl' );
1670
+ $sharetitle = urlencode( 'Generated & Installed free SSL certificate using WP ENCRYPTION WordPress plugin within minutes! Thanks for the great plugin' );
1671
  $html .= '<div id="wple-completed">
1672
  <div class="wple-completed-review">
1673
  <h2>' . $headline . '</h2>
1674
  <p>' . sprintf(
1675
+ __( 'Can you please do us a BIG favor by leaving a %s%s%s%s%s rating on WordPress.org', 'wp-letsencrypt-ssl' ),
1676
+ '<span class="dashicons dashicons-star-filled"></span>',
1677
+ '<span class="dashicons dashicons-star-filled"></span>',
1678
+ '<span class="dashicons dashicons-star-filled"></span>',
1679
+ '<span class="dashicons dashicons-star-filled"></span>',
1680
+ '<span class="dashicons dashicons-star-filled"></span>'
1681
  ) . ' <span class="wple-share-success">' . sprintf(
1682
+ __( "or spread the word on %s %s %s %s", "wp-letsencrypt-ssl" ),
1683
+ '<a href="https://twitter.com/share?url=https://wpencryption.com&text=' . $sharetitle . '&hashtags=wp_encryption,wordpress_ssl,wordpress_https" target="_blank" title="Twitter" class="tw">T</a>',
1684
+ '<a href="https://www.facebook.com/sharer.php?u=wpencryption.com" target="_blank" title="Facebook" class="fb">F</a>',
1685
+ '<a href="https://reddit.com/submit?url=wpencryption.com&title=' . $sharetitle . '" target="_blank" title="Reddit" class="rd">R</a>',
1686
+ '<a href="https://pinterest.com/pin/create/bookmarklet/?media=https://wpencryption.com/wp-content/uploads/2021/08/banner-772x250-1.png&url=wpencryption.com&description=' . $sharetitle . '" target="_blank" title="Pinterest" class="pt">P</a>'
1687
  ) . '</span></p>
1688
+ <a href="https://wordpress.org/support/plugin/wp-letsencrypt-ssl/reviews/#new-post" target="_blank" class="letsrate">' . esc_html__( 'LEAVE A RATING', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-external"></span></a>
1689
  ' . $renewlink . '
1690
+ <small>' . esc_html__( 'Just takes a moment', 'wp-letsencrypt-ssl' ) . '</small>
1691
  </div>';
1692
+ if ( file_exists( $cert ) && isset( $leopts['expiry'] ) && !$wple_support ) {
1693
+ $html .= '<div class="wple-completed-remaining">
1694
+ <div class="progress--circle progress--' . esc_attr( $daysleft ) . '">
1695
+ <div class="progress__number"><strong>' . esc_html( $daysleft ) . '</strong><br><small>' . esc_html__( 'Days', 'wp-letsencrypt-ssl' ) . '</small></div>
1696
  </div>
1697
  <div class="wple-circle-expires">
1698
+ <strong>' . esc_html__( 'Your current SSL certificate expires on', 'wp-letsencrypt-ssl' ) . ': <br><b>' . esc_html( $leopts['expiry'] ) . '</b></strong>
1699
+ <p>' . WPLE_Trait::wple_kses( __( "Let's Encrypt® SSL Certificate expires in 90 days by default. You can easily regenerate new SSL certificate using <strong>RENEW SSL CERTIFICATE</strong> option found on left or by clicking on <strong>STEP 1</strong> in progress bar.", "wp-letsencrypt-ssl" ) ) . '<br /><br />' . WPLE_Trait::wple_kses( __( 'Major browsers like Chrome will start showing insecure site warning IF you fail to renew / re-generate certs before this expiry date. <strong>If you are using PRO version - SSL certificates will be auto renewed in background 30 days prior to expiry date.</strong>', 'wp-letsencrypt-ssl' ) ) . ' Please clear your browser cache once.</p>
1700
  </div>
1701
  </div>';
1702
  }
1742
  // </div>';
1743
  // }
1744
  // }
1745
+ }
1746
+
1747
+ /**
1748
+ * Make verificiation possible with broken cert
1749
+ *
1750
+ * @return void
1751
+ */
1752
+ public function wple_wellknown_htaccess()
1753
+ {
1754
  $dir = ABSPATH . '.well-known/acme-challenge/.htaccess';
1755
+
1756
+ if ( !file_exists( $dir ) ) {
1757
+ $file = @touch( $dir );
1758
  } else {
1759
+ $file = true;
1760
  }
1761
+
1762
+
1763
+ if ( is_writable( $dir ) && $file !== FALSE ) {
1764
+ $ruleset = "<IfModule mod_rewrite.c>" . "\n";
1765
+ $ruleset .= "RewriteEngine on" . "\n";
1766
+ $ruleset .= "RewriteCond %{HTTPS} =on [NC]" . "\n";
1767
+ $ruleset .= "RewriteRule ^(.*)\$ http://%{HTTP_HOST}%{REQUEST_FILENAME} [R=301,L]" . "\n";
1768
+ $ruleset .= "</IfModule>" . "\n";
1769
+ insert_with_markers( $dir, 'WP_Encryption', $ruleset );
1770
+ }
1771
+
1772
+ }
1773
+
1774
+ /**
1775
+ * Grouped admin init hooks
1776
+ *
1777
+ * @since 5.2.4
1778
+ * @return void
1779
+ */
1780
+ public function wple_admin_init_hooks()
1781
+ {
1782
  WPLE_Subdir_Challenge_Helper::download_challenge_files();
1783
  $this->wple_save_email_generate_certs();
1784
  $this->wple_download_files();
1787
  $this->wple_continue_certification();
1788
  $this->wple_domain_verification();
1789
  //redirects handler
1790
+ }
1791
+
1792
+ /**
1793
+ * Validate SSL button for non-cpanel
1794
+ *
1795
+ * @since 5.2.6
1796
+ * @return void
1797
+ */
1798
+ public function wple_validate_nocp_ssl()
1799
+ {
1800
+ if ( !current_user_can( 'manage_options' ) ) {
1801
+ exit( 'Unauthorized' );
1802
+ }
1803
+ $basedomain = str_ireplace( array( 'http://', 'https://' ), array( '', '' ), addslashes( site_url() ) );
1804
  //4.7
1805
+ if ( FALSE != stripos( $basedomain, '/' ) ) {
1806
+ $basedomain = substr( $basedomain, 0, stripos( $basedomain, '/' ) );
1807
  }
1808
+ $client = WPLE_Trait::wple_verify_ssl( $basedomain );
1809
+
1810
+ if ( $client || is_ssl() ) {
1811
+ $reverter = uniqid( 'wple' );
1812
+ $savedopts = get_option( 'wple_opts' );
1813
+ $savedopts['force_ssl'] = 1;
1814
+ $savedopts['revertnonce'] = $reverter;
1815
+ WPLE_Trait::wple_send_reverter_secret( $reverter );
1816
+ update_option( 'wple_opts', $savedopts );
1817
+ delete_option( 'wple_error' );
1818
+ //complete
1819
+ update_option( 'wple_complete', 1 );
1820
+ update_option( 'siteurl', str_ireplace( 'http:', 'https:', get_option( 'siteurl' ) ) );
1821
+ update_option( 'home', str_ireplace( 'http:', 'https:', get_option( 'home' ) ) );
1822
+ echo 1 ;
1823
  } else {
1824
+ echo 0 ;
1825
  }
1826
+
1827
  exit;
1828
+ }
1829
+
1830
+ public function wple_expert_block( &$html, $spmode = 0 )
1831
+ {
1832
+ }
1833
+
1834
+ /**
1835
+ * This site have mixed content issues
1836
+ *
1837
+ * @since 5.3.12
1838
+ * @return void
1839
+ */
1840
+ public function wple_mixed_content_notice()
1841
+ {
1842
  $html = '<div class="notice notice-info wple-admin-review wple-mx-prom">
1843
  <div class="wple-review-box">
1844
  <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1845
+ <span><strong>Warning: ' . esc_html__( 'Your site have mixed content issues!', 'wp-letsencrypt-ssl' ) . '</strong><p>' . WPLE_Trait::wple_kses( __( 'Mixed content issues cause browser padlock to show as insecure even if you have installed SSL certificate perfectly. Hire an SSL Expert today to get rid of all SSL issues once and for all.', 'wp-letsencrypt-ssl' ) ) . '</p></span>
1846
  </div>
1847
+ <a class="wple-lets-review wplerevbtn" href="https://checkout.freemius.com/mode/dialog/plugin/7616/plan/12469/licenses/1/" target="_blank">' . esc_html__( 'Hire SSL Expert', 'wp-letsencrypt-ssl' ) . '</a>
1848
+ <a class="wple-mx-ignore wplerevbtn" href="#">' . esc_html__( 'Ignore', 'wp-letsencrypt-ssl' ) . '</a>
1849
  </div>';
1850
+ echo $html ;
1851
+ }
1852
+
1853
+ /**
1854
+ * Ajax Get cert contents for copy
1855
+ *
1856
+ * @since 5.3.16
1857
+ * @return void
1858
+ */
1859
+ public function wple_retrieve_certs_forcopy()
1860
+ {
1861
+ if ( !wp_verify_nonce( $_GET['nc'], 'copycerts' ) || !current_user_can( 'manage_options' ) ) {
1862
+ exit( 'Authorization Failure' );
1863
  }
1864
  $ftype = $_GET['gettype'];
1865
  $output = '';
1866
  $keypath = ABSPATH . 'keys/';
1867
+ switch ( $ftype ) {
1868
+ case 'cert':
1869
+ if ( file_exists( $keypath . 'certificate.crt' ) ) {
1870
+ $output = file_get_contents( $keypath . 'certificate.crt' );
1871
+ }
1872
+ break;
1873
+ case 'key':
1874
+ if ( file_exists( $keypath . 'private.pem' ) ) {
1875
+ $output = file_get_contents( $keypath . 'private.pem' );
1876
+ }
1877
+ break;
1878
+ case 'cabundle':
1879
+
1880
+ if ( file_exists( ABSPATH . 'keys/cabundle.crt' ) ) {
1881
+ $output = file_get_contents( ABSPATH . 'keys/cabundle.crt' );
1882
+ } else {
1883
+ $output = file_get_contents( WPLE_DIR . 'cabundle/ca.crt' );
1884
+ }
1885
+
1886
+ break;
1887
  }
1888
+ echo esc_html( $output ) ;
1889
  exit;
1890
+ }
1891
+
1892
+ /**
1893
+ * Ajax check if both www & non-www domain accessible
1894
+ *
1895
+ * @since 5.6.2
1896
+ * @return void
1897
+ */
1898
+ public function wple_include_www_check()
1899
+ {
1900
+ if ( !current_user_can( 'manage_options' ) || !wp_verify_nonce( $_GET['nc'], 'legenerate' ) ) {
1901
+ exit( 'Unauthorized request' );
1902
+ }
1903
+ $maindomain = WPLE_Trait::get_root_domain( false );
1904
  $errcode = 'www';
1905
+
1906
+ if ( FALSE === stripos( 'www', $maindomain ) ) {
1907
+ $altdomain = 'www.' . $maindomain;
1908
  } else {
1909
+ $errcode = 'nonwww';
1910
+ $altdomain = str_ireplace( 'www.', '', $maindomain );
1911
  }
1912
+
1913
+ $altdomaintest = wp_remote_head( 'http://' . $altdomain, array(
1914
+ 'sslverify' => false,
1915
+ 'timeout' => 30,
1916
+ ) );
1917
+
1918
+ if ( !is_wp_error( $altdomaintest ) ) {
1919
+ echo 1 ;
1920
+ exit;
1921
  }
1922
+
1923
+ echo $errcode ;
1924
  exit;
 
1925
  }
1926
+
1927
+ }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.2
5
  License: GPL3
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
- Stable tag: 5.7.2
9
 
10
  SSL for lifetime - Install free SSL certificate & enable SSL / HTTPS sitewide, secure mail w/ HTTPS, HSTS, insecure content scanner, SSL health meter, fix mixed content issues easily. HTTPS redirect & download SSL certificate.
11
 
5
  License: GPL3
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
+ Stable tag: 5.7.3
9
 
10
  SSL for lifetime - Install free SSL certificate & enable SSL / HTTPS sitewide, secure mail w/ HTTPS, HSTS, insecure content scanner, SSL health meter, fix mixed content issues easily. HTTPS redirect & download SSL certificate.
11
 
wp-letsencrypt.php CHANGED
@@ -7,7 +7,7 @@
7
  * Plugin Name: WP Encryption - One Click SSL & Force HTTPS
8
  * Plugin URI: https://wpencryption.com
9
  * Description: Secure your WordPress site with free SSL certificate and force HTTPS throughout the site. Just activating this plugin won't help! - Please run the SSL install form of WP Encryption found on left panel.
10
- * Version: 5.7.2
11
  * Author: Go Web Smarty
12
  * Author URI: https://wpencryption.com
13
  * License: GNU General Public License v3.0
@@ -33,7 +33,7 @@ if ( !defined( 'ABSPATH' ) ) {
33
  /**
34
  * Definitions
35
  */
36
- define( 'WPLE_PLUGIN_VERSION', '5.7.2' );
37
  define( 'WPLE_BASE', plugin_basename( __FILE__ ) );
38
  define( 'WPLE_DIR', plugin_dir_path( __FILE__ ) );
39
  define( 'WPLE_URL', plugin_dir_url( __FILE__ ) );
7
  * Plugin Name: WP Encryption - One Click SSL & Force HTTPS
8
  * Plugin URI: https://wpencryption.com
9
  * Description: Secure your WordPress site with free SSL certificate and force HTTPS throughout the site. Just activating this plugin won't help! - Please run the SSL install form of WP Encryption found on left panel.
10
+ * Version: 5.7.3
11
  * Author: Go Web Smarty
12
  * Author URI: https://wpencryption.com
13
  * License: GNU General Public License v3.0
33
  /**
34
  * Definitions
35
  */
36
+ define( 'WPLE_PLUGIN_VERSION', '5.7.3' );
37
  define( 'WPLE_BASE', plugin_basename( __FILE__ ) );
38
  define( 'WPLE_DIR', plugin_dir_path( __FILE__ ) );
39
  define( 'WPLE_URL', plugin_dir_url( __FILE__ ) );