Plugin Directory

source: wp-letsencrypt-ssl/trunk/admin/le_admin.php

Last change on this file was 3483890, checked in by gowebsmarty, 12 days ago

v7.8.5.12 release

  • Property svn:eol-style set to native
File size: 83.6 KB
Line 
1<?php
2
3/**
4 * @package WP Encryption
5 *
6 * @author     WP Encryption
7 * @copyright  Copyright (C) 2019-2025, WP Encryption
8 * @license    http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
9 * @link       https://wpencryption.com
10 * @since      Class available since Release 1.0.0
11 *
12 *
13 *   This program is free software: you can redistribute it and/or modify
14 *   it under the terms of the GNU General Public License as published by
15 *   the Free Software Foundation, either version 3 of the License, or
16 *   (at your option) any later version.
17 *
18 *   This program is distributed in the hope that it will be useful,
19 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *   GNU General Public License for more details.
22 *
23 *   You should have received a copy of the GNU General Public License
24 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
25 *
26 */
27if ( !defined( 'ABSPATH' ) ) {
28    exit;
29}
30// Exit if accessed directly
31/**
32 * Autoloader
33 *
34 * @since 5.1.1
35 */
36use WPLEClient\LEFunctions;
37//since php5.3.0
38require_once WPLE_DIR . 'admin/le_ajax.php';
39require_once WPLE_DIR . 'admin/le_handlers.php';
40require_once WPLE_DIR . 'classes/le-core.php';
41require_once WPLE_DIR . 'classes/le-subdir-challenge.php';
42/**
43 * WPLE_Admin class
44 *
45 * Handles all the aspects of plugin page & cert generation form
46 * @since 1.0.0
47 */
48class WPLE_Admin {
49    public function __construct() {
50        new WPLE_Ajax();
51        new WPLE_Handler();
52        ///wple_fs()->add_filter('freemius_pricing_js_path', [$this, 'my_custom_pricing_js_path']);
53        add_action( 'admin_enqueue_scripts', array($this, 'wple_admin_styles') );
54        add_action( 'admin_menu', array($this, 'wple_admin_menu_page') );
55        add_action(
56            'before_wple_admin_form',
57            array($this, 'wple_debug_log'),
58            20,
59            1
60        );
61        add_action( 'admin_init', [$this, 'wple_basic_get_requests'] );
62        //review request
63        $show_rev = get_option( 'wple_show_review' );
64        if ( $show_rev != FALSE && $show_rev == 1 && FALSE === get_option( 'wple_show_review_disabled' ) ) {
65            add_action( 'admin_notices', array($this, 'wple_rateus') );
66        }
67        if ( FALSE !== get_option( 'wple_show_reminder' ) ) {
68            //ssl expiring in 10 days
69            add_action( 'admin_notices', [$this, 'wple_reminder_notice'] );
70        }
71        if ( FALSE !== get_option( 'wple_mixed_issues' ) && FALSE === get_option( 'wple_mixed_issues_disabled' ) ) {
72            //since 5.3.12
73            add_action( 'admin_notices', [$this, 'wple_mixed_content_notice'] );
74        }
75        if ( FALSE != get_option( 'wple_notice_trial' ) && FALSE === get_option( 'wple_notice_disabled_trial' ) ) {
76            //since 7.7.0
77            add_action( 'admin_notices', [$this, 'wple_trial_promo_notice'] );
78        }
79        if ( isset( $_GET['successnotice'] ) ) {
80            //settings saved
81            add_action( 'admin_notices', array($this, 'wple_success_notice') );
82        }
83        //since 7.8.1 discontinued since 7.8.5.10
84        // if ($this->wple_not_dismissed('advancedsecurity')) {
85        //     add_action('admin_notices', [$this, 'wple_advancedsecurity_notice']);
86        // }
87        //since 7.8.5.9
88        if ( $this->wple_not_dismissed( 'woosecurity' ) ) {
89            add_action( 'admin_notices', [$this, 'wple_woosecurity_notice'] );
90        }
91        /** Admin Notices End */
92        add_action( 'wple_show_reviewrequest', array($this, 'wple_set_review_flag') );
93        add_action( 'wple_show_mxalert', array($this, 'wple_set_mxerror_flag') );
94        add_action( 'wple_ssl_reminder_notice', [$this, 'wple_start_show_reminder'] );
95        //hide default pricing page for non-premium
96        add_action( 'admin_head', [$this, 'wple_hide_default_pricing'] );
97        add_action( 'wple_init_ssllabs', [$this, 'wple_initialize_ssllabs'] );
98        add_action( 'wple_ssl_expiry_update', [$this, 'wple_update_expiry_ssllabs'] );
99        //daily once cron
100        add_action( 'wple_remindlater_trial', array($this, 'wple_show_trial_notice') );
101        //since 7.7.0
102    }
103
104    // function my_custom_pricing_js_path($default_pricing_js_path)
105    // {
106    //   return WPLE_DIR . '/admin/pricing/dist/freemius-pricing.js';
107    // }
108    /**
109     * Enqueue admin styles
110     *
111     * @since 1.0.0
112     * @return void
113     */
114    public function wple_admin_styles() {
115        wp_enqueue_style(
116            WPLE_NAME,
117            WPLE_URL . 'admin/css/le-admin.min.css',
118            FALSE,
119            WPLE_PLUGIN_VER,
120            'all'
121        );
122        wp_enqueue_script(
123            WPLE_NAME . '-popper',
124            WPLE_URL . 'admin/js/popper.min.js',
125            array('jquery'),
126            WPLE_PLUGIN_VER,
127            true
128        );
129        wp_enqueue_script(
130            WPLE_NAME . '-tippy',
131            WPLE_URL . 'admin/js/tippy-bundle.iife.min.js',
132            array('jquery'),
133            WPLE_PLUGIN_VER,
134            true
135        );
136        wp_enqueue_script(
137            WPLE_NAME,
138            WPLE_URL . 'admin/js/le-admin.js',
139            array('jquery', WPLE_NAME . '-tippy', WPLE_NAME . '-popper'),
140            WPLE_PLUGIN_VER,
141            true
142        );
143        wp_localize_script( WPLE_NAME, 'SCAN', [
144            'base'      => site_url(),
145            'adminajax' => admin_url( 'admin-ajax.php' ),
146        ] );
147        wp_enqueue_script(
148            WPLE_NAME . '-fs',
149            'https://checkout.freemius.com/checkout.min.js',
150            array('jquery'),
151            WPLE_PLUGIN_VER,
152            false
153        );
154        // if (!wple_fs()->is__premium_only()) {
155        //     if (get_transient('wple_survey_pending')) {
156        //         wp_enqueue_script(WPLE_NAME . '-interests', WPLE_URL . 'admin/interests/dist/bundle.js', array('react', 'react-dom', 'wp-element', 'wp-i18n'), WPLE_PLUGIN_VER, false);
157        //         wp_localize_script(WPLE_NAME . '-interests', 'WPLESURVEY', [
158        //             'ajax' => admin_url('admin-ajax.php'),
159        //             'nc' => wp_create_nonce('wple-survey')
160        //         ]);
161        //     }
162        // }
163    }
164
165    /**
166     * Register plugin page
167     *
168     * @since 1.0.0
169     * @return void
170     */
171    public function wple_admin_menu_page() {
172        add_menu_page(
173            WPLE_NAME,
174            WPLE_NAME,
175            'manage_options',
176            WPLE_SLUG,
177            array($this, 'wple_menu_page'),
178            plugin_dir_url( __DIR__ ) . 'admin/assets/icon.png',
179            100
180        );
181    }
182
183    /**
184     * Plugin page HTML
185     *
186     * @since 1.0.0
187     * @return void
188     */
189    public function wple_menu_page() {
190        if ( FALSE === get_option( 'wple_version' ) ) {
191            delete_option( 'wple_plan_choose' );
192            update_option( 'wple_version', WPLE_PLUGIN_VER );
193        } else {
194            if ( version_compare( get_option( 'wple_version' ), '7.8.5.10', '<=' ) ) {
195                delete_option( 'wple_plan_choose' );
196                update_option( 'wple_version', WPLE_PLUGIN_VER );
197            }
198        }
199        ///if (array_key_exists('SERVER_ADDR', $_SERVER)) update_option('wple_sourceip', $_SERVER['SERVER_ADDR']); //Used later for LE requests
200        //show trial prom
201        if ( $activated = get_option( 'wple_activate' ) ) {
202            $after3days = strtotime( '+3 day', $activated );
203            if ( time() >= $after3days ) {
204                if ( FALSE === get_option( 'wple_notice_disabled_trial' ) && !wp_next_scheduled( 'wple_remindlater_trial' ) ) {
205                    update_option( 'wple_notice_trial', true );
206                }
207            }
208        }
209        $this->wple_subdir_ipaddress();
210        //localhost check
211        $eml = '';
212        $leopts = get_option( 'wple_opts' );
213        $eml = ( is_array( $leopts ) && isset( $leopts['email'] ) ? $leopts['email'] : '' );
214        $pluginmode = 'FREE';
215        $errorclass = '';
216        if ( !wple_fs()->is__premium_only() && wple_fs()->can_use_premium_code() ) {
217            $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>';
218            $errorclass = ' notproerror';
219        }
220        if ( wple_fs()->is__premium_only() && !wple_fs()->can_use_premium_code() ) {
221            $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>';
222            $errorclass = ' notproerror';
223        }
224        $html = '
225    <div class="wple-header">
226      <div>
227      <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . WPLE_PLUGIN_VER . ' <span class="wple-pmode' . $errorclass . '">' . $pluginmode . '</span></span>
228      </div>';
229        WPLE_Trait::wple_headernav( $html );
230        $html .= '</div>';
231        if ( isset( $_GET['error'] ) ) {
232            $this->wple_error_block( $html );
233        }
234        if ( FALSE === get_option( 'wple_plan_choose' ) || isset( $_GET['comparison'] ) || !get_transient( 'wple_plan_chosen' ) ) {
235            $this->wple_initial_quick_pricing( $html );
236            return;
237        }
238        /** verification page start */
239        $isVerifying = ( get_option( 'wple_ssl_screen' ) == 'verification' ? 1 : 0 );
240        if ( isset( $_GET['subdir'] ) || $isVerifying ) {
241            update_option( 'wple_ssl_screen', 'verification' );
242            $this->wple_subdir_challenges( $html, $leopts );
243            $this->wple_upgrade_block( $html );
244            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
245            echo $html;
246            return;
247        }
248        $isComplete = ( get_option( 'wple_ssl_screen' ) == 'complete' ? 1 : 0 );
249        if ( isset( $_GET['complete'] ) || $isComplete ) {
250            update_option( 'wple_ssl_screen', 'complete' );
251            $this->wple_complete_block( $html );
252            if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
253                $this->wple_upgrade_block( $html );
254            }
255            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
256            echo $html;
257            return;
258        }
259        //5.1.0
260        $isSuccess = ( get_option( 'wple_ssl_screen' ) == 'success' ? 1 : 0 );
261        if ( isset( $_GET['success'] ) || $isSuccess ) {
262            update_option( 'wple_ssl_screen', 'success' );
263            $html .= '<div id="wple-sslgen">';
264            $this->wple_success_block( $html );
265            $html .= '</div>';
266            if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
267                $this->wple_upgrade_block( $html );
268            }
269            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
270            echo $html;
271            return;
272        }
273        /** verification page end */
274        // $prosupport = WPLE_Trait::wple_kses(sprintf(
275        //   __('Brought to you by %sWP Encryption%s.'),
276        //   '<a href="https://wpencryption.com" target="_blank">',
277        //   '</a>'
278        // ), 'a');
279        // if (wple_fs()->is__premium_only()) {
280        //   $prosupport = 'Premium support forum - <a href="https://support.wpencryption.com" target="_blank">https://support.wpencryption.com</a>.';
281        // }
282        if ( !is_plugin_active( 'backup-bolt/backup-bolt.php' ) && FALSE === get_option( 'wple_backup_suggested' ) ) {
283            $action = 'install-plugin';
284            $slug = 'backup-bolt';
285            $pluginstallURL = wp_nonce_url( add_query_arg( array(
286                'action' => $action,
287                'plugin' => $slug,
288            ), admin_url( 'update.php' ) ), $action . '_' . $slug );
289            $html .= '
290      <div class="le-powered">
291      <span style="display: flex;align-items: center;"><strong>Recommended:-</strong> Before enforcing HTTPS, We highly recommend taking a backup of your site using some good backup plugin like <img src="' . WPLE_URL . 'admin/assets/backup-bolt.png" style="max-width:120px"> - <a href="' . $pluginstallURL . '" target="_blank">Install & Activate Backup Bolt</a> | <a href="#" class="wple-backup-skip">Ignore</a></span>   
292      </div>';
293        }
294        $mappeddomain = '';
295        $formheader = esc_html__( 'SSL INSTALL FORM - ENTER YOUR EMAIL BELOW & GENERATE SSL CERTIFICATE', 'wp-letsencrypt-ssl' );
296        $currentdomain = esc_html( str_ireplace( array('http://', 'https://'), array('', ''), site_url() ) );
297        $maindomain = $currentdomain;
298        $slashpos = stripos( $currentdomain, '/' );
299        if ( false !== $slashpos ) {
300            //subdir installation
301            $maindomain = substr( $currentdomain, 0, $slashpos );
302            $mappeddomain = '<label style="display: block; padding: 10px 5px; color: #aaa;font-size:15px;">' . esc_html__( 'PRIMARY DOMAIN', 'wp-letsencrypt-ssl' ) . '</label>
303      <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>
304    <input type="text" name="wple_domain" class="wple-domain-input" value="' . esc_attr( $maindomain ) . '" readonly><br />';
305        }
306        //since 5.3.4
307        $tempdomain = '';
308        if ( false !== stripos( $maindomain, 'temp.domains' ) || false !== stripos( $maindomain, '~' ) ) {
309            $tempdomain = '<p style="width: 800px; max-width:100%; margin: 5px auto 20px;">' . sprintf(
310                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" ),
311                "<strong>",
312                "</strong>",
313                "<strong>",
314                "</strong>",
315                "<strong>",
316                "</strong>",
317                "<strong>",
318                "</strong>"
319            ) . '</p>';
320        }
321        $html .= '<div id="wple-interests-survey"></div>
322        <div id="wple-sslgen">
323    <h2>' . $formheader . '</h2>
324    <div style="text-align: center; margin-top: -30px; font-size: 16px; display: block; width: 100%; margin-bottom: 40px;"><a style="text-decoration-style:dashed;text-decoration-thickness: from-font;" href="' . admin_url( 'admin.php?page=wp_encryption_faq#howitworks' ) . '">How it works?</a></div>';
325        if ( is_multisite() && !wple_fs()->can_use_premium_code__premium_only() ) {
326            $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>';
327        }
328        $html .= WPLE_Trait::wple_progress_bar();
329        //$cname = '';
330        //if (FALSE === stripos($currentdomain, '/')) {
331        // if (stripos($currentdomain, 'www') === FALSE) {
332        //   $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>';
333        // } else {
334        //$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>';
335        //}
336        //}
337        $bothchecked = '';
338        $leadminform = '<form method="post" class="le-genform single-genform">' . $mappeddomain . $tempdomain . '
339    <input type="email" name="wple_email" class="wple_email" value="' . esc_attr( $eml ) . '" placeholder="' . esc_attr__( 'Enter your email address', 'wp-letsencrypt-ssl' ) . '" title="' . esc_attr__( 'All email notifications are sent to this email ID', 'wp-letsencrypt-ssl' ) . '" ><br />';
340        // if (FALSE === stripos($maindomain, 'www')) {
341        //   $altdomain = 'www.' . $maindomain;
342        // } else {
343        //   $altdomain = str_ireplace('www.', '', $maindomain);
344        // }
345        // $altdomaintest = wp_remote_head('http://' . $altdomain, array('sslverify' => false, 'timeout' => 30));
346        ///if (!is_wp_error($altdomaintest) || isset($_GET['includewww'])) {
347        if ( isset( $_GET['includewww'] ) ) {
348            $bothchecked = 'checked';
349        }
350        $leadminform .= '<span class="lecheck">
351      <label class="checkbox-label">
352      <input type="checkbox" name="wple_include_www" class="wple_include_www" value="1" ' . $bothchecked . '>
353        <span class="checkbox-custom rectangular"></span>
354      </label>
355    ' . 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>
356    </span><br />';
357        ///}
358        if ( isset( $_GET['includeemail'] ) ) {
359            $leadminform .= '<span class="lecheck">
360      <label class="checkbox-label">
361      <input type="checkbox" name="wple_include_mail" class="wple_include_mail" value="1">
362        <span class="checkbox-custom rectangular"></span>
363      </label>
364    ' . 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>
365    </span><br />';
366            $webmail = 'webmail.' . $maindomain;
367            $leadminform .= '<span class="lecheck">
368      <label class="checkbox-label">
369      <input type="checkbox" name="wple_include_webmail" class="wple_include_webmail" value="1">
370        <span class="checkbox-custom rectangular"></span>
371      </label>
372    ' . 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>
373    </span><br />';
374        }
375        $leadminform .= '<span class="lecheck">
376      <label class="checkbox-label">
377      <input type="checkbox" name="wple_send_usage" value="1" checked>
378        <span class="checkbox-custom rectangular"></span>
379      </label>
380    ' . esc_html__( 'Anonymously send response data to get better support', 'wp-letsencrypt-ssl' ) . '</label>
381    </span><br />';
382        $leadminform .= '<span class="lecheck">
383    <label class="checkbox-label">
384      <input type="checkbox" name="wple_agree_le_tos" class="wple_agree_le" value="1">
385      <span class="checkbox-custom rectangular"></span>
386    </label>
387    ' . WPLE_Trait::wple_kses( sprintf(
388            __( "I agree to %sLet's Encrypt%s %sTerms of service%s", "wp-letsencrypt-ssl" ),
389            '<b>',
390            '<sup style="font-size: 10px; padding: 3px">TM</sup></b>',
391            '<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">',
392            '</a>'
393        ), 'a' ) . '
394    </span>
395    <span class="lecheck">
396    <label class="checkbox-label">
397      <input type="checkbox" name="wple_agree_gws_tos" class="wple_agree_gws" value="1">
398      <span class="checkbox-custom rectangular"></span>
399    </label>
400    ' . WPLE_Trait::wple_kses( sprintf( __( "I agree to <b>WP Encryption</b> %sTerms of service%s", "wp-letsencrypt-ssl" ), '<a href="https://wpencryption.com/terms-and-conditions/" rel="nofollow" target="_blank" style="margin-left:5px">', '</a>' ), 'a' ) . '
401    </span>       
402    ' . wp_nonce_field(
403            'legenerate',
404            'letsencrypt',
405            false,
406            false
407        ) . '
408    <button type="submit" name="generate-certs" id="singledvssl">' . esc_html__( 'Generate SSL Certificate', 'wp-letsencrypt-ssl' ) . '</button>
409    </form>
410   
411    <div id="wple-error-popper">   
412      <div class="wple-flex">
413        <img src="' . WPLE_URL . 'admin/assets/loader.png" class="wple-loader"/>
414        <div class="wple-error">Error</div>
415      </div>
416    </div>';
417        $nonwww = str_ireplace( 'www.', '', $currentdomain );
418        if ( false !== ($ps = stripos( $nonwww, '/' )) ) {
419            $nonwww = substr( $nonwww, 0, $ps );
420        }
421        $wwwdomain = 'www.' . $nonwww;
422        if ( false != stripos( $currentdomain, 'www.' ) ) {
423            //reverse the order
424            $wwwdomain = $nonwww;
425            $nonwww = 'www.' . $nonwww;
426        }
427        $showonpro = '';
428        $html .= '<div class="wple-single-dv-ssl">
429    <div class="wple-info-box">
430      <h3>' . esc_html__( 'Domains Covered', 'wp-letsencrypt-ssl' ) . '</h3>
431      <strong>' . $nonwww . '</strong>
432      <div class="wple-www' . $showonpro . '"><strong>' . $wwwdomain . '</strong></div>
433      <div class="wple-wc"><strong>*.' . $nonwww . '</strong></div>
434    </div>';
435        ob_start();
436        do_action( 'before_wple_admin_form', $html );
437        $html .= ob_get_contents();
438        ob_end_clean();
439        $html .= apply_filters( 'wple_admin_form', $leadminform );
440        ob_start();
441        do_action( 'after_wple_admin_form', $html );
442        $html .= ob_get_contents();
443        ob_end_clean();
444        $html .= '</div>';
445        $html .= '   
446    </div><!--wple-sslgen-->';
447        if ( !wple_fs()->is__premium_only() || !wple_fs()->can_use_premium_code() ) {
448            $this->wple_upgrade_block( $html );
449        } else {
450            $this->wple_expert_block( $html );
451        }
452        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
453        echo $html;
454    }
455
456    /**
457     * log process & error in debug.log file
458     *
459     * @since 1.0.0
460     * @param string $html
461     * @return void
462     */
463    public function wple_debug_log( $html ) {
464        if ( !file_exists( WPLE_DEBUGGER ) ) {
465            wp_mkdir_p( WPLE_DEBUGGER );
466            $htacs = '<Files debug.log>' . "\n" . 'Order allow,deny' . "\n" . 'Deny from all' . "\n" . '</Files>';
467            file_put_contents( WPLE_DEBUGGER . '.htaccess', $htacs );
468        }
469        //show only upon error since 4.6.0
470        if ( isset( $_GET['error'] ) ) {
471            $html = '<div class="toggle-debugger"><span class="dashicons dashicons-arrow-down-alt2"></span> ' . esc_html__( 'Show/hide full response', 'wp-letsencrypt-ssl' ) . '</div>';
472            $file = WPLE_DEBUGGER . 'debug.log';
473            if ( file_exists( $file ) ) {
474                $log = file_get_contents( $file );
475                $hideh2 = '';
476                if ( isset( $_GET['dnsverified'] ) || isset( $_GET['dnsverify'] ) ) {
477                    $hideh2 = 'hideheader';
478                }
479                $html .= '<div class="le-debugger running ' . $hideh2 . '"><h3>' . esc_html__( 'Response Log', 'wp-letsencrypt-ssl' ) . ':</h3>' . WPLE_Trait::wple_kses( nl2br( $log ) ) . '</div>';
480            } else {
481                $html .= '<div class="le-debugger">' . esc_html__( "Full response will be shown here", 'wp-letsencrypt-ssl' ) . '</div>';
482            }
483            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
484            echo $html;
485        }
486    }
487
488    /**
489     * Rate us admin notice
490     *
491     * @since 2.0.0
492     * @return void
493     */
494    public function wple_rateus() {
495        $cert = WPLE_Trait::wple_cert_directory() . 'certificate.crt';
496        if ( file_exists( $cert ) ) {
497            if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp_encryption' ) {
498                return;
499            }
500            $reviewnonce = wp_create_nonce( 'wplereview' );
501            $html = '<div class="notice notice-info wple-admin-review">
502        <div class="wple-review-box">
503          <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
504          <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>
505        </div>
506        <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>
507        <a class="wple-did-review wplerevbtn" href="#" data-nc="' . esc_attr( $reviewnonce ) . '" data-action="1">' . esc_html__( "Don't show again", 'wp-letsencrypt-ssl' ) . '</a>
508        <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>
509      </div>';
510            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
511            echo $html;
512        }
513    }
514
515    /**
516     * Check if wp install is IP or subdir based
517     *
518     * @since 2.4.0
519     * @return void
520     */
521    public function wple_subdir_ipaddress() {
522        $siteURL = str_ireplace( array('http://', 'https://', 'www.'), array('', '', ''), site_url() );
523        $flg = 0;
524        if ( filter_var( $siteURL, FILTER_VALIDATE_IP ) ) {
525            $flg = 1;
526        }
527        if ( false !== stripos( $siteURL, 'localhost' ) ) {
528            $flg = 1;
529        }
530        if ( false != stripos( $siteURL, '/' ) && is_multisite() ) {
531            $html = '<div class="wrap" id="le-wrap">
532      <div class="le-inner">
533        <div class="wple-header">
534          <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html( WPLE_PLUGIN_VER ) . '</span>
535        </div>
536        <div class="wple-warning-notice">
537        <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>
538        </div>
539      </div>
540      </div>';
541            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
542            echo $html;
543            wp_die();
544        }
545        if ( $flg ) {
546            $html = '<div class="wrap" id="le-wrap">
547      <div class="le-inner">
548        <div class="wple-header">
549          <img src="' . WPLE_URL . 'admin/assets/logo.png" class="wple-logo"/> <span class="wple-version">v' . esc_html( WPLE_PLUGIN_VER ) . '</span>
550        </div>
551        <div class="wple-warning-notice">
552        <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>
553        </div>
554      </div>
555      </div>';
556            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
557            echo $html;
558            wp_die();
559        }
560    }
561
562    /**
563     * Upgrade to PRO
564     *
565     * @param string $html
566     * @since 2.5.0
567     * @return void
568     */
569    public function wple_upgrade_block( &$html ) {
570        $upgradeurl = 'https://wpencryption.com/?utm_source=wordpress&utm_medium=upgrade&utm_campaign=wpencryption';
571        ///$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&billing_cycle_selector=responsive_list');
572        ///$nopricing = get_option('wple_no_pricing'); //always false now
573        $nopricing = false;
574        $cp = get_option( 'wple_have_cpanel' );
575        // if (FALSE === $nopricing && !$cp) { //not gdy & not cpanel
576        //   $nopricing = rand(0, 1);
577        // }
578        $automatic = esc_html__( 'Automatic', 'wp-letsencrypt-ssl' );
579        $manual = esc_html__( 'Manual', 'wp-letsencrypt-ssl' );
580        $domain = str_ireplace( array('https://', 'http://', 'www.'), '', site_url() );
581        $dverify = $automatic;
582        if ( stripos( $domain, '/' ) !== false ) {
583            //subdir site
584            $dverify = $manual;
585        }
586        $html .= '
587      <div id="wple-upgradepro">';
588        $servertype = esc_html( $_SERVER['SERVER_SOFTWARE'] );
589        if ( FALSE !== $cp && $cp ) {
590            $servertype = 'CPANEL';
591        } else {
592            if ( get_option( 'wple_have_plesk' ) ) {
593                $servertype = 'PLESK';
594            } else {
595                if ( get_option( 'wple_have_directadmin' ) ) {
596                    $servertype = 'DIRECTADMIN';
597                } else {
598                    if ( get_option( 'wple_have_siteground' ) ) {
599                        $servertype = 'SITEGROUND';
600                    }
601                }
602            }
603        }
604        $html .= '<strong style="display: block; text-align: center; color: #666;">Woot Woot! You have <b>' . esc_html( $servertype ) . '</b>! Avoid manual SSL renewals every 90 days - Enjoy automatic renewal with PRO version.</strong>';
605        $compareurl = 'https://wpencryption.com/?utm_source=wordpress&utm_medium=comparison&utm_campaign=wpencryption';
606        //$compareurl = admin_url('/admin.php?page=wp_encryption&comparison=1');
607        if ( $nopricing ) {
608            $compareurl = admin_url( '/admin.php?page=wp_encryption&comparison=1' );
609            //$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');
610            //$upgradeurl = 'https://checkout.freemius.com/mode/dialog/plugin/5090/plan/10643/'; //CDN
611            $html .= '<div class="wple-error-firewall fire-pro wple-procdn">
612        <div>
613          <img src="' . WPLE_URL . 'admin/assets/firewall-shield-pro.png"/>
614        </div>
615        <div class="wple-upgrade-features">
616          <span><b>Automatic SSL Installation</b><br>Hassle free automatic installation of SSL Certificate - Super simple DNS based setup.</span>
617          <span><b>Automatic SSL Renewal</b><br>Your SSL certificate will be automatically renewed in background without the need of any action or manual work.</span>
618          <span><b>Security</b><br>Enterprise level protection against known vulnerabilities, Bad Bots, Brute Force, DDOS, Spam & much more attack vectors.</span>
619          <span><b>Automatic CDN</b><br>Your site is served from 42 full scale edge locations for faster content delivery and fastest performance.</span>
620        </div>
621      </div>';
622        } else {
623            $html .= '<div class="wple-plans">
624            <span class="free">* ' . esc_html__( 'FREE', 'wp-letsencrypt-ssl' ) . '</span>
625            <span class="pro">* ' . esc_html__( 'PRO', 'wp-letsencrypt-ssl' ) . '</span>
626          </div>
627          <div class="wple-plan-compare">
628            <div class="wple-compare-item">
629              <img src="' . WPLE_URL . 'admin/assets/verified.png"/>
630              <h4>' . esc_html__( 'HTTP Verification', 'wp-letsencrypt-ssl' ) . '</h4>
631              <span class="wple-free">' . $manual . '</span>
632              <span class="wple-pro">' . $automatic . '</span>
633            </div>
634            <div class="wple-compare-item">
635              <img src="' . WPLE_URL . 'admin/assets/DNS.png"/>
636              <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>
637              <span class="wple-free">' . $manual . '</span>
638              <span class="wple-pro">' . $automatic . '</span>
639            </div>
640            <div class="wple-compare-item">
641              <img src="' . WPLE_URL . 'admin/assets/Install.png"/>
642              <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>
643              <span class="wple-free">' . $manual . '</span>
644              <span class="wple-pro">' . $automatic . '</span>
645            </div>
646            <div class="wple-compare-item">
647              <img src="' . WPLE_URL . 'admin/assets/renewal.png"/>
648              <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>
649              <span class="wple-free">' . $manual . '</span>
650              <span class="wple-pro">' . $automatic . '</span>
651            </div>
652            <!--<div class="wple-compare-item">
653              <img src="' . WPLE_URL . 'admin/assets/secure-mail.png"/>
654              <h4>' . esc_html__( 'Secure Mail', 'wp-letsencrypt-ssl' ) . ' <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="' . esc_attr__( 'Secure email & webmail with SSL/TLS', 'wp-letsencrypt-ssl' ) . '"></span></h4>
655              <span class="wple-free">' . esc_html__( 'Not Available', 'wp-letsencrypt-ssl' ) . '</span>
656              <span class="wple-pro">' . esc_html__( 'Available', 'wp-letsencrypt-ssl' ) . '</span>
657            </div>-->
658            <div class="wple-compare-item">
659              <img src="' . WPLE_URL . 'admin/assets/wildcard.png"/>
660              <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>
661              <span class="wple-free">' . esc_html__( 'Not Available', 'wp-letsencrypt-ssl' ) . '</span>
662              <span class="wple-pro">' . esc_html__( 'Available', 'wp-letsencrypt-ssl' ) . '</span>
663            </div>
664            <div class="wple-compare-item">
665              <img src="' . WPLE_URL . 'admin/assets/multisite.png"/>
666              <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>
667              <span class="wple-free">' . esc_html__( 'Not Available', 'wp-letsencrypt-ssl' ) . '</span>
668              <span class="wple-pro">' . esc_html__( 'Available', 'wp-letsencrypt-ssl' ) . '</span>
669            </div>           
670          </div>';
671        }
672        ///$html .= '<div style="text-align:center"><img src="' . WPLE_URL . '/admin/assets/new-year.png"></div>';
673        $html .= '<div class="wple-upgrade-pro">
674              <a href="' . $compareurl . '" target="_blank" class="wplecompare">' . esc_html__( 'COMPARE FREE & PRO VERSION', 'wp-letsencrypt-ssl' ) . '  <span class="dashicons dashicons-external"></span></a>';
675        // if (isset($_GET['success']) && FALSE == $nopricing) {
676        //   $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>
677        //             <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>';
678        // } else {
679        // if ($nopricing) {
680        //   $html .= '<a href="' . $upgradeurl . '">' . esc_html__('UPGRADE TO CDN', 'wp-letsencrypt-ssl') . '</a>';
681        // } else {
682        $html .= '<a href="' . $upgradeurl . '">' . esc_html__( 'UPGRADE TO PRO', 'wp-letsencrypt-ssl' ) . '</a>';
683        //}
684        //$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>';
685        // }
686        $html .= '</div>';
687        // $rnd = rand(0, 1);
688        // if ($rnd) {
689        //   $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>';
690        // } else {
691        //   $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>';
692        // }
693        $html .= '</div><!--wple-upgradepro-->';
694        $html .= WPLE_Trait::wple_other_plugins();
695    }
696
697    /**
698     * Complete stage block - ssl installation or enable https still pending
699     *
700     * @param string $html
701     * @since 2.5.0
702     * @return void
703     */
704    public function wple_complete_block( &$html ) {
705        $html .= '
706      <div id="wple-sslgenerator">
707      <div class="wple-success-form">';
708        $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>
709        <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>';
710        $html .= WPLE_Trait::wple_progress_bar();
711        ///$nopricing = get_option('wple_no_pricing');
712        //$colclass = FALSE != $nopricing ? 'wple-three-cols' : '';
713        $html .= '   
714
715        <div class="wple-success-flex">
716        <div class="wple-success-flex-video">
717        <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/aKvvVlAlZ14" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
718        </div>
719        <div class="wple-success-flex-final"> 
720        <ul class="download-ssl-certs">
721          <li>1. ' . sprintf( __( '%sClick here%s to login into your cPanel.', 'wp-letsencrypt-ssl' ), '<a href="' . site_url( 'cpanel' ) . '" target="_blank">', '</a>' ) . '</li>
722          <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>
723          <li>3. ' . sprintf( __( 'Click on %sManage SSL Sites%s option', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>         
724          <li>4. ' . sprintf(
725            __( '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' ),
726            '<strong>',
727            '</strong>',
728            '<strong>',
729            '</strong>',
730            '<strong>',
731            '</strong>'
732        ) . '. ' . 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>
733          <li>';
734        WPLE_Trait::wple_copy_and_download( $html );
735        $nonroot_instruction = sprintf(
736            __( "If you have root SSH access, edit your server config file and point your SSL paths to %scertificate.crt%s & %sprivate.pem%s files located in %s folder. If you don't have either cPanel or root SSH access, Upgrade to %sPRO%s version for automatic SSL installation and automatic SSL renewal.", 'wp-letsencrypt-ssl' ),
737            '<strong>',
738            '</strong>',
739            '<strong>',
740            '</strong>',
741            '<strong>' . WPLE_Trait::wple_cert_directory() . '</strong>',
742            '<a href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&billing_cycle_selector=responsive_list&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ) . '"><strong>',
743            '</strong></a>'
744        );
745        if ( !get_option( 'wple_parent_reachable' ) ) {
746            $nonroot_instruction = sprintf(
747                __( "If you have root SSH access, download certificate.crt & private.pem files from above and upload them onto a secure folder on your server. Then edit your server config file and point the SSL paths to uploaded %scertificate.crt%s & %sprivate.pem%s files. If you don't have either cPanel or root SSH access, Upgrade to %sPRO%s version for automatic SSL installation and automatic SSL renewal.", 'wp-letsencrypt-ssl' ),
748                '<strong>',
749                '</strong>',
750                '<strong>',
751                '</strong>',
752                '<a href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&billing_cycle_selector=responsive_list&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ) . '"><strong>',
753                '</strong></a>'
754            );
755        }
756        $html .= '</li>
757          <li>5. ' . sprintf( __( 'Click on %sInstall certificate%s', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>
758          <li>6. ' . sprintf( __( 'Please wait few minutes and click on %sEnable HTTPS Now%s button', 'wp-letsencrypt-ssl' ), '<strong>', '</strong>' ) . '</li>
759        </ul>
760
761        </div>
762        </div> 
763
764            <div class="wple-success-cols wple-three-cols">
765              <div>
766                <h3>' . esc_html__( "Don't have cPanel?", 'wp-letsencrypt-ssl' ) . '</h3>
767                <p>' . esc_html__( "cPanel link goes to 404 not found page?. ", 'wp-letsencrypt-ssl' ) . $nonroot_instruction . '<br><br><span style="display:none">' . 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>' ) . '</span></p>
768              </div>
769              <div>
770                <h3>' . esc_html__( "Test SSL Installation", 'wp-letsencrypt-ssl' ) . '</h3>
771                <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>
772              </div>
773              <div>
774                <h3>' . esc_html__( "By Clicking Enable HTTPS", 'wp-letsencrypt-ssl' ) . '</h3>
775                <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>
776              </div>';
777        // if (FALSE == $nopricing) {
778        //   $html .= '<div>
779        //         <h3>' . esc_html__("Looking for instant SSL solution?", 'wp-letsencrypt-ssl') . '</h3>
780        //         <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>
781        //       </div>';
782        // }
783        $html .= '</div>
784
785          <ul>         
786          <!--<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>-->
787          </ul>';
788        if ( isset( $_GET['nossl'] ) ) {
789            $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>
790        <p>' . esc_html__( 'Switching to HTTPS without properly installing the SSL certificate might break your site.', 'wp-letsencrypt-ssl' ) . '</p>';
791        }
792        $html .= '<form method="post">
793        ' . wp_nonce_field(
794            'wplehttps',
795            'sslready',
796            false,
797            false
798        ) . '
799        <button type="submit" name="wple-https">' . esc_html__( 'ENABLE HTTPS NOW', 'wp-letsencrypt-ssl' ) . '</button>
800        </form>
801        </div>
802        </div><!--wple-sslgenerator-->';
803    }
804
805    /**
806     * Error Message block
807     *
808     * @param string $html
809     * @since 2.5.0
810     * @return void
811     */
812    public function wple_error_block( &$html ) {
813        $error_code = get_option( 'wple_error' );
814        $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' );
815        $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>';
816        $firerec = sprintf( esc_html__( "We highly recommend upgrading to our %sPRO%s annual plan which works on all types of hosting platforms.", 'wp-letsencrypt-ssl' ), '<a href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&billing_cycle_selector=responsive_list&plan_id=8210&plan_name=pro&billing_cycle=annual&pricing_id=7965&currency=usd' ) . '">', '</a>' );
817        $thirdparty = esc_html__( "Your hosting server don't seem to support third party SSL.", "wp-letsencrypt-ssl" );
818        if ( $error_code == 1 || $error_code == 400 ) {
819            $generic .= '<p class="firepro">' . $thirdparty . ' ' . $firerec . '</p>';
820        } else {
821            if ( file_exists( WPLE_Trait::wple_cert_directory() . 'certificate.crt' ) ) {
822                $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' ) );
823            }
824        }
825        if ( $error_code == 429 ) {
826            $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/' );
827            $generic .= '<p class="firepro">' . $firerec . '</p>';
828            $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>';
829        }
830        $html .= '
831        <div id="wple-sslgenerator" class="error">
832          <div class="wple-error-message">
833            ' . $generic . '
834          </div>
835        </div><!--wple-sslgenerator-->';
836    }
837
838    /**
839     * Sets review flag to show review request
840     *
841     * @since 4.4.0
842     */
843    public function wple_set_review_flag() {
844        update_option( 'wple_show_review', 1 );
845    }
846
847    /**
848     * Re-enable mx issue admin notice as per remind later action
849     *
850     * @since 6.3.2
851     * @return void
852     */
853    public function wple_set_mxerror_flag() {
854        update_option( 'wple_mixed_issues', 1 );
855    }
856
857    /**
858     * Handle the reset keys action
859     *
860     * @since 4.5.0
861     * @return void
862     */
863    public function wple_reset_handler() {
864        if ( isset( $_GET['wplereset'] ) ) {
865            if ( !current_user_can( 'manage_options' ) ) {
866                exit( 'No Trespassing Allowed' );
867            }
868            if ( !wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['wplereset'] ) ), 'restartwple' ) ) {
869                exit( 'No Trespassing Allowed' );
870            }
871            $keys = WPLE_Trait::wple_cert_directory();
872            $files = array(
873                $keys . 'public.pem',
874                $keys . 'private.pem',
875                $keys . 'order',
876                $keys . 'fullchain.crt',
877                $keys . 'certificate.crt',
878                $keys . '__account/private.pem',
879                $keys . '__account/public.pem'
880            );
881            foreach ( $files as $file ) {
882                if ( file_exists( $file ) ) {
883                    unlink( $file );
884                }
885            }
886            //clean ACME
887            $acmePath = ABSPATH . '.well-known/acme-challenge/';
888            if ( is_dir( $acmePath ) ) {
889                $acmefiles = glob( $acmePath . '*', GLOB_MARK );
890                foreach ( $acmefiles as $acmefile ) {
891                    unlink( $acmefile );
892                }
893            }
894            delete_option( 'wple_error' );
895            //error code
896            delete_option( 'wple_ssl_screen' );
897            //screen stage
898            delete_option( 'wple_backend' );
899            //forced completion
900            delete_option( 'wple_hold_cron' );
901            delete_option( 'wple_order_refreshed' );
902            delete_transient( 'wple_ssllabs' );
903            add_action( 'admin_notices', array($this, 'wple_reset_success') );
904        }
905    }
906
907    /**
908     * Reset success notice
909     *
910     * @since 4.5.0
911     */
912    public function wple_reset_success() {
913        echo '<div class="notice notice-success is-dismissable">
914    <p>' . esc_html( 'Reset successful!. You can start with the SSL install process again.', 'wp-letsencrypt-ssl' ) . '</p>
915    </div>';
916    }
917
918    /**
919     * Set wple_show_reminder and also mail reminder to admin
920     *
921     * @see 4.6.0
922     * @return void
923     */
924    public function wple_start_show_reminder() {
925        // if (!WPLE_Trait::wple_ssl_recheck_expiry()) { //rechecked in daily scan
926        //     return;
927        // }
928        update_option( 'wple_show_reminder', 1 );
929        update_option( 'wple_renewal_failed_notice', 1 );
930        if ( FALSE !== get_option( 'wple_ssl_monitoring' ) ) {
931            $opts = get_option( 'wple_opts' );
932            $to = ( isset( $opts['email'] ) && !empty( $opts['email'] ) ? sanitize_email( $opts['email'] ) : get_option( 'admin_email' ) );
933            $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() ) );
934            $headers = array('Content-Type: text/html; charset=UTF-8');
935            $body = '<p>' . sprintf( __( '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 />';
936            $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="https://wpencryption.com/?utm_source=email&utm_medium=tendays&utm_campaign=wpencryption" 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 />';
937            if ( function_exists( 'wp_mail' ) ) {
938                wp_mail(
939                    $to,
940                    $subject,
941                    $body,
942                    $headers
943                );
944            }
945        }
946    }
947
948    public function wple_reminder_notice() {
949        $already_did = wp_nonce_url( admin_url( 'admin.php?page=wp_encryption' ), 'wple_renewed', 'wplesslrenew' );
950        $html = '<div class="notice notice-info wple-admin-review">
951        <div class="wple-review-box wple-reminder-notice">
952          <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
953          <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 SSL renewal with automatic SSL installation.', 'wp-letsencrypt-ssl' ) ) . '</p></span>
954        </div>
955        <a class="wple-lets-review wplerevbtn" href="' . admin_url( '/admin.php?page=wp_encryption-pricing&checkout=true&billing_cycle_selector=responsive_list&plan_id=8210&plan_name=pro&billing_cycle=lifetime&pricing_id=7965&currency=usd' ) . '">' . esc_html__( 'Upgrade to Pro', 'wp-letsencrypt-ssl' ) . '</a>
956        <a class="already-renewed wplerevbtn" href="' . $already_did . '">' . esc_html__( 'I already renewed', 'wp-letsencrypt-ssl' ) . '&nbsp;<span class="dashicons dashicons-smiley"></span></a>
957      </div>';
958        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
959        echo $html;
960    }
961
962    /**
963     * show manual verification challenges
964     *
965     * @since 4.7.0
966     * @param string $html
967     * @param array $opts
968     * @return string
969     */
970    public function wple_subdir_challenges( &$html, $opts ) {
971        update_option( 'wple_ssl_screen', 'verification' );
972        $html .= '
973      <div id="wple-sslgenerator">
974      <div class="wple-success-form">
975          ' . WPLE_Subdir_Challenge_Helper::show_challenges( $opts ) . '
976      </div>
977      </div><!--wple-sslgenerator-->';
978    }
979
980    /**
981     * Simple success notice for admin
982     *
983     * @since 4.7.2
984     * @return void
985     */
986    public function wple_success_notice() {
987        $html = '<div class="notice notice-success">
988        <p>' . esc_html__( 'Success', 'wp-letsencrypt-ssl' ) . '!</p>
989      </div>';
990        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
991        echo $html;
992    }
993
994    /**
995     * Show Pricing table once on activation
996     *
997     * @since 5.0.0
998     * @param string $html
999     * @return $html
1000     */
1001    public function wple_initial_quick_pricing( &$html ) {
1002        $cpanel = WPLE_Trait::wple_cpanel_identity( true );
1003        $html .= '<div id="wple-sslgen">';
1004        $cppricing = ( false !== stripos( ABSPATH, 'srv/htdocs' ) ? true : false );
1005        if ( $cpanel || $cppricing ) {
1006            $html .= $this->wple_cpanel_pricing_table( 1 );
1007        } else {
1008            // if (isset($_SERVER['GD_PHP_HANDLER'])) {
1009            //   if ($_SERVER['SERVER_SOFTWARE'] == 'Apache' && isset($_SERVER['GD_PHP_HANDLER']) && $_SERVER['DOCUMENT_ROOT'] == '/var/www') {
1010            $html .= $this->wple_firewall_pricing_table();
1011            //   }
1012            // } else {
1013            //   $html .= $this->wple_cpanel_pricing_table('');
1014            // }
1015        }
1016        $html .= '</div>';
1017        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
1018        echo $html;
1019    }
1020
1021    /**
1022     * Pricing table html
1023     *
1024     * @since 5.0.0
1025     * @return $table
1026     */
1027    public function wple_cpanel_pricing_table( $cpanel = '' ) {
1028        ob_start();
1029        ?>
1030
1031        <h2 class="pricing-intro-head"><?php 
1032        esc_html_e( 'SAVE MORE THAN $90+ EVERY YEAR IN SSL CERTIFICATE FEE', 'wp-letsencrypt-ssl' );
1033        ?></h2>
1034
1035        <h4 class="pricing-intro-subhead">Purchase once and use for lifetime - Trusted Globally by <b>250,000+</b> WordPress Users (Looking for <a href="<?php 
1036        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gopro=3' ), 'choose_plan' ) );
1037        ?>">Annual</a> | <a href="<?php 
1038        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gopro=2' ), 'choose_plan' ) );
1039        ?>">Unlimited Sites License?</a>)</h4>
1040
1041        <div style="text-align:center">
1042            <img src="<?php 
1043        echo esc_url_raw( WPLE_URL );
1044        ?>admin/assets/limited-offer.png" style="max-width:650px" />
1045        </div>
1046
1047        <!-- <div class="plan-toggler" style="margin:60px 0 -20px !important">
1048        <span>Annual</span><label class="toggle">
1049          <input class="toggle-checkbox initplan-switch" type="checkbox" <?php 
1050        // if ($cpanel == 1) {
1051        //                                                                       echo 'checked';
1052        //                                                                     }
1053        ?>>
1054          <div class="toggle-switch"></div>
1055          <span class="toggle-label">Lifetime</span>
1056        </label>
1057      </div> -->
1058
1059        <div id="quick-pricing-table">
1060            <div class="free-pricing-col wplepricingcol">
1061                <div class="quick-pricing-head free">
1062                    <h3>FREE</h3>
1063                    <large>$0</large>
1064                </div>
1065                <ul>
1066                    <li><strong>Manual</strong> domain verification</li>
1067                    <li><strong>Manual</strong> SSL installation</li>
1068                    <li><strong>Manual</strong> SSL renewal <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="You will manually need to re-generate SSL certificate every 90 days once using WP Encryption"></span></li>
1069                    <li><strong>Mixed</strong> Content Scanner <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Scan your site to detect which insecure assets are causing browser padlock to not show"></span></li>
1070                    <!-- <li><strong>Expires</strong> in 90 days <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="You will manually need to re-generate SSL certificate every 90 days using WP Encryption"></span></li> -->
1071                    <li><strong>Basic</strong> support</li>
1072                </ul>
1073                <div class="pricing-btn-block">
1074                    <a href="<?php 
1075        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gofree=1' ), 'choose_plan' ) );
1076        ?>" class="pricingbtn free">Select Plan</a>
1077                </div>
1078            </div>
1079
1080            <div class="pro-pricing-col wplepricingcol proplan">
1081                <div class="quick-pricing-head pro">
1082                    <span class="wple-trending">Popular</span>
1083                    <h3>PRO</h3>
1084                    <div class="quick-price-row">
1085                        <large>$49<sup></sup></large>
1086                        <small>/lifetime</small>
1087                    </div>
1088                </div>
1089                <ul>
1090                    <li><strong>Automatic</strong> domain verification</li>
1091                    <li><strong>Automatic</strong> SSL installation</li>
1092                    <li><strong>Automatic</strong> SSL renewal</li>
1093                    <li><strong>Wildcard</strong> SSL support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="One SSL certificate to cover all your sub-domains"></span></li>
1094                    <li><strong>Multisite</strong> mapped domains <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Install SSL for different domains mapped to your multisite network with MU domain mapping plugin"></span></li>
1095                    <li><strong>DNS</strong> Automation <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Automatic Domain verification with DNS if HTTP domain verification fails"></span></li>
1096                    <li><strong>Woocommerce & Elementor</strong> support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="We will help resolve insecure padlock issues for Elementor & Woocommerce sites for free"></span></li>
1097                    <li><strong>Vulnerability & Malware</strong> Scanner <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Automate daily scanning of your site for known vulnerabilities and get notified instantly"></span></li>
1098                    <li><strong>Secure</strong> Passkey Login <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Passwordless MFA login with WebAuthn - Powered by your browser and protected by Face ID, Fingerprint or device PIN."></span></li>
1099                    <li><strong>Never</strong> expires <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Never worry about SSL again - Your SSL certificate will be automatically renewed in background 30 days prior to its expiry dates"></span></li>
1100                    <li><strong>Priority</strong> support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="support.wpencryption.com"></span></li>
1101                </ul>
1102                <div class="pricing-btn-block">
1103                    <a href="<?php 
1104        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gopro=1' ), 'choose_plan' ) );
1105        ?>" class="pricingbtn free">Select Plan</a>
1106                </div>
1107            </div>
1108
1109        </div>
1110
1111        <br />
1112        <?php 
1113        if ( $cpanel != '' ) {
1114            ?>
1115            <div class="quick-refund-policy">
1116                <strong>7 Days Refund Policy</strong>
1117                <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 WP Encryption fail to work on your site.</p>
1118            </div>
1119        <?php 
1120        }
1121        ?>
1122
1123    <?php 
1124        $table = ob_get_clean();
1125        return $table;
1126    }
1127
1128    public function wple_firewall_pricing_table() {
1129        ob_start();
1130        ?>
1131
1132        <h2 class="pricing-intro-head">FLAWLESS SSL SOLUTION FOR LOWEST PRICE EVER <small>(Activation Offer)</small></h2>
1133        <h4 class="pricing-intro-subhead">Trusted Globally by <b>300,000+</b> WordPress Users</h4>
1134
1135        <div style="text-align:center">
1136            <img src="<?php 
1137        echo esc_url_raw( WPLE_URL );
1138        ?>admin/assets/limited-offer.png" style="max-width:650px" />
1139        </div>
1140
1141        <div id="quick-pricing-table" class="non-cpanel-plans">
1142            <div class="free-pricing-col wplepricingcol">
1143                <div class="quick-pricing-head free">
1144                    <h3>FREE</h3>
1145                    <large>$0</large>
1146                </div>
1147                <ul>
1148                    <li><strong>Manual</strong> domain verification</li>
1149                    <li><strong>Manual</strong> SSL installation</li>
1150                    <li><strong>Manual</strong> SSL renewal <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="You will manually need to re-generate SSL certificate every 90 days once using WP Encryption"></span></li>
1151                    <li><strong>Basic</strong> support</li>
1152                </ul>
1153                <div class="pricing-btn-block">
1154                    <a href="<?php 
1155        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gofree=1' ), 'choose_plan' ) );
1156        ?>" class="pricingbtn free">Select Plan</a>
1157                </div>
1158            </div>
1159
1160            <div class="pro-pricing-col wplepricingcol firewallplan">
1161                <div class="quick-pricing-head pro">
1162                    <span class="wple-trending">Popular</span>
1163                    <h3>PRO</h3>
1164                    <div class="quick-price-row">
1165                        <large>$29</large>
1166                        <small>/year</small>
1167                    </div>
1168                </div>
1169                <ul>
1170                    <li><strong>Automatic</strong> Domain Verification</li>
1171                    <li><strong>Automatic</strong> SSL Installation</li>
1172                    <li><strong>Automatic</strong> SSL Renewal</li>
1173                    <li><strong>Wildcard</strong> SSL support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="One SSL certificate to cover all your sub-domains"></span></li>
1174                    <li><strong>Multisite</strong> mapped domains <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Install SSL for different domains mapped to your multisite network with MU domain mapping plugin"></span></li>
1175                    <li><strong>Woocommerce & Elementor</strong> support <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="We will help resolve insecure padlock issues for Elementor & Woocommerce sites for free"></span></li>
1176                    <li><strong>Vulnerability</strong> Scanner <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Automated daily scanning of your site for known vulnerabilities and get notified instantly"></span></li>
1177                    <li><strong>Malware & Integrity</strong> Scanner <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Automated daily scanning of your site for malware and integrity issues"></span></li>
1178                    <li><strong>Secure</strong> Passkey Login <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="Passwordless MFA login with WebAuthn - Powered by your browser and protected by Face ID, Fingerprint or device PIN."></span></li>
1179                    <li><strong>100%</strong> Compatible <span class="dashicons dashicons-editor-help wple-tooltip" data-tippy="We will help deploying SSL for ANY hosting platform"></span></li>
1180                    <li><strong>One Year</strong> Support & Updates</li>
1181                </ul>
1182                <div class="pricing-btn-block">
1183                    <a href="<?php 
1184        echo esc_url_raw( wp_nonce_url( admin_url( '/admin.php?page=wp_encryption&gofirewall=1' ), 'choose_plan' ) );
1185        ?>" class="pricingbtn free">Select Plan</a>
1186                </div>
1187            </div>
1188
1189        </div>
1190        <!-- <div class="intro-pricing-refund">
1191        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>
1192      </div> -->
1193
1194<?php 
1195        $table = ob_get_clean();
1196        return $table;
1197    }
1198
1199    /**
1200     * Final success block
1201     *
1202     * @param string $html
1203     * @return void
1204     */
1205    public function wple_success_block( &$html ) {
1206        $html .= WPLE_Trait::wple_progress_bar();
1207        $leopts = get_option( 'wple_opts' );
1208        $future = strtotime( $leopts['expiry'] );
1209        //Future date.
1210        $activecertexpiry = $leopts['expiry'];
1211        $activecertexpirytime = strtotime( $activecertexpiry );
1212        $timefromdb = time();
1213        $timeleft = $activecertexpirytime - $timefromdb;
1214        $daysleft = round( $timeleft / 24 / 60 / 60 );
1215        $wple_support = get_option( 'wple_backend' );
1216        $renewtext = esc_html__( 'Click Here To Renew SSL Certificate', 'wp-letsencrypt-ssl' );
1217        // $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>';
1218        // if ($daysleft <= 30) {
1219        $renewlink = '<a href="' . admin_url( '/admin.php?page=wp_encryption&restart=' . wp_create_nonce( 'restart_ssl' ) ) . '" class="letsrenew">' . $renewtext . '</a>';
1220        // }
1221        if ( $wple_support ) {
1222            //forced completion
1223            $renewlink = '';
1224        }
1225        $headline = esc_html__( 'Woohoo! WP Encryption just saved you $$$ in SSL Certificate Fee.', 'wp-letsencrypt-ssl' );
1226        $sharetitle = urlencode( 'Generated & Installed free SSL certificate using WP ENCRYPTION WordPress plugin within minutes! Thanks for the great plugin.' );
1227        $html .= '<div id="wple-completed">
1228        <div class="wple-completed-review">
1229          <h2>' . $headline . '</h2>
1230          <p>' . sprintf(
1231            __( 'Can you please do us a BIG favor by leaving a %s%s%s%s%s rating on WordPress.org', 'wp-letsencrypt-ssl' ),
1232            '<span class="dashicons dashicons-star-filled"></span>',
1233            '<span class="dashicons dashicons-star-filled"></span>',
1234            '<span class="dashicons dashicons-star-filled"></span>',
1235            '<span class="dashicons dashicons-star-filled"></span>',
1236            '<span class="dashicons dashicons-star-filled"></span>'
1237        ) . ' <span class="wple-share-success">' . sprintf(
1238            __( "or spread the word on %s %s %s %s", "wp-letsencrypt-ssl" ),
1239            '<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>',
1240            '<a href="https://www.facebook.com/sharer.php?u=wpencryption.com" target="_blank" title="Facebook" class="fb">F</a>',
1241            '<a href="https://reddit.com/submit?url=wpencryption.com&title=' . $sharetitle . '" target="_blank" title="Reddit" class="rd">R</a>',
1242            '<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>'
1243        ) . '</span></p>
1244          <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>
1245          ' . $renewlink . '
1246          <small>' . esc_html__( 'Just takes a moment', 'wp-letsencrypt-ssl' ) . '</small>
1247
1248          <div class="wple-ssl-next">
1249            <b>NEXT:</b> Enable important security headers and achieve <b>"A/A+"</b> grade with SSL Scan via <a href="https://plugins.trac.wordpress.org/wp-admin/admin.php?page=wp_encryption_ssl_health">SSL HEALTH</a>.
1250          </div>
1251
1252        </div>';
1253        if ( !$wple_support ) {
1254            $current_ssl = esc_html__( 'Your generated SSL certificate expires on', 'wp-letsencrypt-ssl' );
1255            $html .= '<div class="wple-completed-remaining">
1256          <div class="progress--circle progress--' . esc_attr( $daysleft ) . '">
1257            <div class="progress__number"><strong>' . esc_html( $daysleft ) . '</strong><br><small>' . esc_html__( 'Days', 'wp-letsencrypt-ssl' ) . '</small></div>
1258          </div> 
1259          <div class="wple-circle-expires"> 
1260          <strong>' . $current_ssl . ': <br><b>' . esc_html( $activecertexpiry ) . '</b></strong>
1261          <p>' . WPLE_Trait::wple_kses( __( "Let's Encrypt® SSL Certificate expires in 90 days by default. You can easily re-generate 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. Please clear your browser cache once.', 'wp-letsencrypt-ssl' ) ) . '</p>
1262          <div class="pro-renewal-note"><strong>PLEASE NOTE:</strong> If you are using PRO version - Ignore the above expiry date as your SSL certificates will be auto renewed in background 30 days prior to expiry date.</span>         
1263          </div>
1264        </div>';
1265        }
1266        $html .= '</div>';
1267    }
1268
1269    public function wple_expert_block( &$html, $spmode = 0 ) {
1270    }
1271
1272    /**
1273     * This site have mixed content issues
1274     *
1275     * @since 5.3.12
1276     * @return void
1277     */
1278    public function wple_mixed_content_notice() {
1279        $desc = __( 'Mixed content issues cause browser padlock to show as insecure even if you have installed SSL certificate perfectly. Upgrade to PRO for automatic mixed content fixing.', 'wp-letsencrypt-ssl' );
1280        $upgradebutton = '<a class="wple-lets-review wplerevbtn" href="' . admin_url( '/admin.php?page=wp_encryption-pricing' ) . '">' . esc_html__( 'Upgrade to Pro', 'wp-letsencrypt-ssl' ) . '</a>';
1281        $remindlater = '<a class="wple-mx-ignore wplerevbtn wple-hire-later" href="#">' . esc_html__( "Remind me later", 'wp-letsencrypt-ssl' ) . '</a>';
1282        $html = '<div class="notice notice-info wple-admin-review wple-mx-prom">
1283      <div class="wple-review-box">
1284        <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1285        <span><strong>Warning: ' . esc_html__( 'Your site have mixed content issues!', 'wp-letsencrypt-ssl' ) . '</strong><p>' . WPLE_Trait::wple_kses( $desc ) . '</p></span>
1286      </div>
1287      ' . $upgradebutton . '
1288      <a class="wple-mx-ignore wplerevbtn" href="#">' . esc_html__( "Don't show again", 'wp-letsencrypt-ssl' ) . '</a>
1289      ' . $remindlater . '
1290    </div>';
1291        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
1292        echo $html;
1293    }
1294
1295    public function wple_oneyearprom( $reasons ) {
1296        $reasons['long-term'][] = $reasons['short-term'][] = array(
1297            'id'                => 20,
1298            'text'              => '<a href="' . admin_url( '/admin.php?page=wp_encryption_setup_wizard' ) . '"><img src="' . WPLE_URL . 'admin/assets/1-year-ssl.png"/></a>',
1299            'input_type'        => '',
1300            'input_placeholder' => 'oneyearssl',
1301        );
1302        return $reasons;
1303    }
1304
1305    // public function cdn_termination_alert__premium_only()
1306    // {
1307    //   $html = '<div class="notice notice-error wple-alert-box">
1308    //   <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1309    //   <h3>WP Encryption</h3>
1310    //   <p><b>IMPORTANT ALERT:</b> We see that your site is pointed towards our SSL proxy(151.139.128.10) which is no longer available. As an alternative solution, Please click on the button below to generate Premium Comodo SSL certificate and install the certificate, private key directly on your hosting panel. You\'re required to complete this action before <strong>March 10, 2023</strong> to avoid site disruption after the SSL proxy service shutdown. This popup will go away once after you complete setup & revert the DNS records back to your hosting server IP address.</p>
1311    //   <a class="wplerevbtn generate-certpanel" href="' . admin_url('/admin.php?page=wp_encryption&certpanel=1') . '">Generate Premium Certificate</a>
1312    //   <a class="wplerevbtn readmore-certpanel" href="https://wpencryption.com/introducing-wpencryption-certpanel" target="_blank">Read the Instructions</a>
1313    //   </div>';
1314    //   echo $html;
1315    // }
1316    public function wple_basic_get_requests() {
1317        //since 5.1.0
1318        if ( isset( $_GET['restart'] ) ) {
1319            //click to restart from beginning
1320            if ( !current_user_can( 'manage_options' ) ) {
1321                exit( 'Unauthorized request' );
1322            }
1323            if ( !wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['restart'] ) ), 'restart_ssl' ) ) {
1324                exit( 'Unauthorized request' );
1325            }
1326            delete_option( 'wple_ssl_screen' );
1327            wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
1328            exit;
1329        }
1330        //since 4.6.0
1331        //ssl already renewed selection in reminder notice
1332        if ( isset( $_GET['wplesslrenew'] ) ) {
1333            if ( !wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['wplesslrenew'] ) ), 'wple_renewed' ) ) {
1334                exit( 'Unauthorized' );
1335            }
1336            delete_option( 'wple_show_reminder' );
1337            wp_redirect( admin_url( '/admin.php?page=wp_encryption' ), 302 );
1338        }
1339        WPLE_Subdir_Challenge_Helper::download_challenge_files();
1340        //subdir_chfile
1341        $this->wple_reset_handler();
1342        //wplereset
1343        // $estage = get_option('wple_error');
1344        // //redirections
1345        // 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']) && !isset($_GET['annual'])) {
1346        //   wp_redirect(admin_url('/admin.php?page=wp_encryption&subdir=1'), 302);
1347        //   exit();
1348        // }
1349        // if (wple_fs()->can_use_premium_code__premium_only()) {
1350        //   if (FALSE !== $estage && $estage == 4 && !isset($_GET['subdir']) && !isset($_GET['error']) && !isset($_GET['includewww']) && !isset($_GET['wpleauto']) && isset($_GET['page']) && $_GET['page'] == 'wp_encryption' && !isset($_GET['success']) && !isset($_GET['resume']) && !isset($_GET['nossl']) && !isset($_GET['wplereset']) && !isset($_GET['comparison']) && !isset($_GET['customdns']) && !isset($_GET['nocpanel']) && !isset($_GET['lasterror']) && !isset($_GET['annual'])) {
1351        //     wp_redirect(admin_url('/admin.php?page=wp_encryption&nocpanel=1'), 302);
1352        //     exit();
1353        //   }
1354        // }
1355        // 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']) && !isset($_GET['annual'])) {
1356        //   wp_redirect(admin_url('/admin.php?page=wp_encryption&success=1&resume=1'), 302);
1357        //   exit();
1358        // }
1359        //6.1.0 - update sourceip for LE if not already set
1360        ///if (array_key_exists('SERVER_ADDR', $_SERVER) && !get_option('wple_sourceip')) update_option('wple_sourceip', $_SERVER['SERVER_ADDR']); //Used later for LE requests
1361    }
1362
1363    public function wple_initialize_ssllabs() {
1364        WPLE_Trait::wple_ssllabs_scan( true );
1365    }
1366
1367    /**
1368     * Daily once SSL check cron
1369     *
1370     * @param string $param
1371     * @return void
1372     */
1373    public function wple_update_expiry_ssllabs( $param = '' ) {
1374        //init new scan daily once
1375        WPLE_Trait::wple_ssllabs_scan_daily( $param );
1376    }
1377
1378    public function wple_trial_promo_notice() {
1379        $upgradebutton = '<a class="wple-lets-review wplerevbtn" href="' . network_admin_url( '/plugin-install.php?fs_allow_updater_and_dialog=true&tab=plugin-information&parent_plugin_id=5090&plugin=wpen-certpanel&section=description' ) . '" target="_blank">' . esc_html__( 'View Details', 'wp-letsencrypt-ssl' ) . '</a>';
1380        $html = '<div class="notice notice-info wple-admin-review wple-notice-trial">
1381        <div class="wple-review-box">
1382            <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1383            <span><strong>Secure Your Website with a Premium SSL Certificate - Try It Free for 7 Days!</strong>
1384            <p>We truly appreciate your unwavering support as a loyal user of our WordPress plugin! To express our gratitude, we\'re excited to offer you an <b>exclusive 7-day free trial</b> of our premium SSL add-on through which you can generate premium SSL certificate and install it on your hosting server.</p></span>
1385        </div>
1386        ' . $upgradebutton . '
1387        <a class="wple-dont-show-btn" data-context="trial" href="#">' . esc_html__( "Don't show again", 'wp-letsencrypt-ssl' ) . '</a>
1388        <a class="wple-ignore-btn" data-context="trial" href="#">' . esc_html__( "Remind me later", 'wp-letsencrypt-ssl' ) . '</a>
1389        </div>';
1390        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
1391        echo $html;
1392    }
1393
1394    public function wple_show_trial_notice() {
1395        update_option( 'wple_notice_trial', true );
1396    }
1397
1398    public function wple_hide_default_pricing() {
1399        echo '<style>a[href="admin.php?page=wp_encryption-pricing"] {
1400            display: none !important;
1401        }</style>';
1402    }
1403
1404    public function wple_advancedsecurity_notice() {
1405        $desc = 'Checkout our brand new Advanced Security page with most important security features and scanners including Malware & integrity scanner, Vulnerability scanner.';
1406        $html = '<div class="notice notice-info wple-admin-review advancedsecurity">
1407      <div class="wple-review-box">
1408        <span class="wple-notice-dismiss" data-context="advancedsecurity" title="dismiss">X Dismiss</span>
1409        <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1410        <span><strong>[NEW] Introducing Advanced Security Page with Security Score</strong><p>' . WPLE_Trait::wple_kses( $desc ) . '</p></span> 
1411      </div>     
1412        <a class="wple-lets-review wplerevbtn" href="' . admin_url( '/admin.php?page=wp_encryption_security' ) . '">' . esc_html__( 'View Details', 'wp-letsencrypt-ssl' ) . '</a>
1413     
1414    </div>';
1415        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
1416        echo $html;
1417    }
1418
1419    /**
1420     *
1421     * The notice is conditional, dismissible, and informational. Pro features are presented as optional enhancements and do not disable free functionality
1422     *
1423     * @since 7.8.5.9
1424     */
1425    public function wple_woosecurity_notice() {
1426        // Admins only
1427        if ( !current_user_can( 'manage_options' ) ) {
1428            return;
1429        }
1430        $activated = get_option( 'wple_activate' );
1431        if ( $activated !== false ) {
1432            $activated = intval( $activated );
1433            // show this notice only if more than 5 minutes have passed since activation
1434            if ( time() - $activated < 5 * MINUTE_IN_SECONDS ) {
1435                return;
1436            }
1437        }
1438        if ( class_exists( 'WooCommerce' ) ) {
1439            $title = 'Woocommerce Store Detected';
1440            $desc = 'For WooCommerce stores, mixed‑content issues on checkout, cart, and account pages can trigger browser security warnings or disrupt payment flows. We strongly recommend running a mixed‑content scan and promptly resolving any issues to ensure a secure and seamless shopping experience.';
1441        } else {
1442            if ( is_plugin_active( 'elementor/elementor.php' ) ) {
1443                $title = 'Elementor Detected';
1444                $desc = 'For Elementor sites, mixed-content issues are quite common after switching to HTTPS. We strongly recommend running a mixed‑content scan and resolving any detected problems to ensure the secure padlock appears consistently on the frontend.';
1445            } else {
1446                return;
1447            }
1448        }
1449        $html = '<div class="notice notice-info wple-admin-review woosecurity">
1450      <div class="wple-review-box">
1451        <span class="wple-notice-dismiss" data-context="woosecurity" title="dismiss">X Dismiss</span>
1452        <img src="' . WPLE_URL . 'admin/assets/symbol.png"/>
1453        <span><strong>' . esc_html( $title ) . '</strong><p>' . WPLE_Trait::wple_kses( $desc ) . '</p></span>
1454      </div>
1455        <a class="wple-lets-review wplerevbtn" href="' . admin_url( '/admin.php?page=wp_encryption_mixed_scanner' ) . '">' . esc_html__( 'Run Scan', 'wp-letsencrypt-ssl' ) . '</a>     
1456    </div>';
1457        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe because all dynamic data is escaped
1458        echo $html;
1459    }
1460
1461    private function wple_not_dismissed( $context ) {
1462        $dismissed = get_option( 'wple_dismissed_notices' );
1463        $dismissed = ( is_array( $dismissed ) ? $dismissed : array() );
1464        if ( array_search( $context, $dismissed ) === false ) {
1465            return true;
1466        }
1467        return false;
1468    }
1469
1470}
Note: See TracBrowser for help on using the repository browser.