ï»¿Ã¿Ã˜Ã¿Ã  JFIF      Ã¿Ã› â€ž 	 ( %!1"%)+...383-7(-.+



-%%--------+------------/----------------------------Ã¿Ã€  Â¶" Ã¿Ã„               Ã¿Ã„ @       !1AQaqÂ�â€˜Â¡"Â±Ã�Ã‘Ã°2â€™BRrÃ¡Sâ€šÃ±3bÂ¢CTÂ²Ã’ #cÃ¿Ã„             Ã¿Ã„ '        1!AQ2a"â€˜Â±#Ã¿Ãš   ? Ã²(/pâ€˜â€”â€“Â¢Â·,M|Â¯GÂ»RÂ£Ã¼eÅ¡T. Ã´Å¸EoCFÃ±â€¡ 4Ã”kÃ¥Ã³xR|Â�Â�ÂµÃ�Â¨Ã“DÃ !Ã‡Â´ÂµËœâ€¡p Ã�Qâ€¹Â§!Ã¾Å¾^ÃµWsÅ’y Â Ã¥Ã�Â§$Ã¡Â«%ÂºqËœâ„¢JyyÃ‹0yÂ�Â«^Ã�Â�
-3ÃƒÃ�Ã‹ÃˆÂ£Ã†\Pâ€™Ã¤â€žs&â€¢â€¹Ãœs Ã¼Ã´'Ã WtÂ¹pÃ±Cp$bÃšF`Â·7.^)Â¾!)Ã’Ã™Ëœâ€“Ã…Ã�Å¡^hÂ¾Ã¸Â³Â·Ã¬eÂ±Å’aeÃ–â€”Ã�,e=B}JÃ©ÃŸÂ¦$$Â½â€”Å¡Ã™ÃœCCÂ¯Â¶Ã¨8ÃŽÂ²â€“Ã…kÃ¨wx
LÃ‰ngTÂ±Ã¦Â¹Â£Ã“cÅ“Â¿Ã�/Â©Ã‰Ã¿ â€°ÃšCÃ’Â­mq;TtÂ¶â€“}0"zÃ–Pcd1Å¡Â­Â¤tË†â€žÃ�Ã“Ã¢qÃº[â„¢Ã¶UCÅ 2ÃžÂ¿Ã˜Â¯Â­Ã‰(Â¸ÃŸÃºÃ§Å¡mW,Ã’ Âºfâ€¹Ã…nâ„¢Ã„LÃªÃƒÂ�8Ã¼Ã�kÃ�â‚¬LÂ¥Ã�uJ1Å“Ã´rÃ‚SÅ’Ã“Ã¶tÂ�!7EUÃ­Ã¯b)Â�AÃ‹iÂ¬Ã¢-Ã™Hk8Ã²Ã�iXYwÃ…)OÂ�^"Ã‡Ã˜riÃ›Ã´{Â»wRUKÃ™Ã�ÃšlÃ“Â¬â‚¬â€šâ€™Ã—Â©T]
Âªbâ€”ÃŠÃ®KC^Ã—Mâ€œxÃ¹Ã¤Ã±zÂ¬zJÃ—{4[Â¹M'IÃ†eH1LCWÃ•]Å“Ã»ÂºÂ WDÃ¦Ã Â°OÃ…â€šÂ¹cÂ²ÃžuAâ€“rL`HÅ¡pCezâ€¡Vâ€™â€”Â Å½â€šÃ‹â€žâ€“Ã±Â­'ÂµR0Ã•Ã–=Ã€:Â±GÂ»C\nÃ†Ã‰5*Â¢Â â€ Â�3Å¡hQ4Ã½Ã’i$Ã•1"Ãœ]Â¢p-q3zcQ$ÂªÃ¶Â¨Â¥Ã¦fâ€ºâ€˜Â»Â´Ã�ÃšHÃ¡â€žeÂ²JÃ‡â€“iÃŠ:Â·Ã Â¬Ã˜c5Ã…kÂ»LaÂª*wiÂ�
[0Ã“wk Â¦aÂ¦0Ã•Â²Ã…Ã…â€šTÂ¸â€™Â³q:Ã†<Â¹Ãº	Ã’ËœÃ†}2VEâ€¢Ã�â‚¬pÂ¡Ã”3ÃšÂº â€¦hÂ³^Ã‡â€¡ÂºÃ§Ã¬Â¥Ã�nÃ³|ËœÃ–Ë†ÃŽË†+Â«Â¦dÃ¸â€˜MÂºâ€“d\ÂªDÃ°Ã›â€žÃŒÃ—LÃ�â€”â€”Ã�9Ã‡|â€¢FÃ¨Ã§Vmâ„¢Â¨â‚¬â„¢3ÃµSâ€“9Ã„Ã¥Â¢<ÃŒâ€°ÃŒmÂ¢Â±`Â·ÂºËœ&ZÂ²Å¾ Ã‹Â®DÂ«Â¶Â»6â„¢â€°Â©Â­HÃˆÃ€Ã¡Â«hÂ­iÂ³04Ã¦â€™hxÅ“i3Ã¯Â¨(Ã“LÂ·â€ â€¹Â¶Ã‹pÅ’
Æ’ÃœÃ’?	:ÃµdsÃ€â€“3Ã¦Ã“Â·ÃœjÃ¢Â¬9â€”]8nÂ¼&]I FÂ£Â¼â€¦Ã¬â€“â€”Å’0vÂ°LÃ‡Â�Ã…fÃ›2TÃ–â€™aÂµËœN@Ã–BSÃ�^Ã Â´4-Â±Â°bÃ—nÃˆÃˆÅ“Ã†D=KdÅ’Ã¸â€¦Ã„ÃˆK,â€ºÃ–RÂ§fjÃ¼$^Ã”ÃŽ!â€ž6^ s:Ãœun\Ã´kCÃžÃ²Ã·<â€”LÃºl
Ã�â€ºGÂ¹Ã€PÃ¡Â¼NcÂ¡Å¡Ã’â€¦Ã™WÃ�Â³Å“Â±vÃŠÃ¡Ã�â€žÃ—9â€¹Pâ€°cEÃ˜â€˜â„¢â€ºÂµÅ¸P<Ã—g1
ÂºÂ©Ã˜Â¬wiÂ�Ã�^l5Ã—I/';Ã‹+Â´Zâ€¡Ã“Ã„FÃ•p[ÃˆÃ°â€™
HÃ„	Ã³
9Â¬Dl4â€œÃ©Â±Ã�â€�V=^HÃ°;Å¾LÃ¤dÃ‰aâ€šÂ°Ã‹,#/Å½~Â²BÃ”Ã›
QÃ£Ã±QtIeÃ³rVB,Ã�Ã‚fâ€¹4#ÃŽÅ“câ€¹Ã‰3ZIÃ–Â Å’Â¢Â¥Â·Ã¼xaâ€¡ÃƒÃ§Ã¨â€žjÅ [5 Ã„!U?,3Å¾ÃŽÃ—â€¦Ã°dÃ“Ã·hÃ¡Å Aâ€°Ã¬Â�Ã„4Ã·ÃƒÃœZÃƒE{â€°Â®+W\ZÃ�E[â€°Â»ÂµkÂ»MÃ�Â­`Â¢Â©â€ ËœÃƒVâ€¹-fÂ¢Â¡â€ Â¢aÂ«eÅ %Â«YÂ¨Â©q%jÃ¢d,Ã”q`) Â¤Â¦â€¦Å¡Ë† Â¦E>0Ã™bÂ²tâ€“Å¸Â�
Ã·jsÃ�â€šÃ’â€™KÃˆcÃ¸(Ã©â€º;k(â€™#Ã´Å’Q
â„¢Â�C>
ÃµÂ³M9Ã³ÂºÃ†ÂµÂ¤Ã§Ã¢;uÃ€Â�)5>RÃ”Â¸fÃ“~ÃˆÂ¦â€”â€™-$feÂ«"FÃ¢UË†ÃŠwÂµPÃ�u
w+"Ã¥Ã‰oÃŒÂ�Â¨6sâ„¢Ã›9Â�Â�(Ã€Â¨Ã¹Â©hEÂ°Â½â€ n`m~â€œ@Â©Â�â€ºp!VkhÂµÂ Ã�1Å¡bEqqÃŠ@ÂºÃ¨lâ€º2 â€“YÃ£%â€˜â€šhÃ›{aÂ¶â€¡Ã…ÃžMÂ²Â¬Ã§L34Â®Ã‡l]Â®â€¹Å½Ã˜Å’m'RÃœe35Ã¦Ã¶Ë†Â­Ã�Â­ cP9Å¡eÃ�kÃ¶oÂ´LÂ³ÃŒ=Â�p8]â€�â€¡BÂ¶,Å¡Âº|Ã‰Â�dzXË†Ã˜k*Ã‡Ãš{#Ã±â€°pÃ£(â‚¬Â¶â€¡9Ã½'Å¡ÃœÂ³Â½Â¯kÆ’â€ Ã‚â€™Ã«SOÆ’â€¢Ã…Â®H6+aÂ¢ÂµË†Â�â€¹YÂ¨bËœb+XË†Ã–!Â°u!Â¢"ÂµË†Â�Ë†n2Ë† Ã…0Ã„`Ã… Ã”Â®c(Â�Ã“ÃœGÂºâ€¢Ã„Â»Å’Â Ã¢WÃ®%q.Ã¡Ã�Ã„Ã·Ã®%umÃ�Â£+ÃœQ,VnÂ¦-GphUÂ¸Â¢XÂ­&,Gt
Â·KÂ¢Ã…Ã…Â·Â¥RÃ„ÃŠÃ‰bKn
NÂ­R2g$VÂµÃ•Ã³
Qr#â€“Ã“ZUÃ�Ã°0ÃŽtÃ™Ã€Å“z
Ã«Ã¶oâ€œÃŽkÂ¯nâ€žTÂ°"SÃž+Â³/â€¦â‚¬Â½"iÂ�Å¾Ã£O%Ã�%&ÃŽâ€�Ã¢â€˜Ã‹Ã˜Â´IË†Ã“Â°Ã‹â€°ÃžM<Jâ€¢â€ºC=Ã¬u*ÃœÂ§â€žÃƒÂ¤GÃ‹Å Ã´;5Â�Å’Ã�Â£Ã±Ã¹Ã¤Â¬6ÃŒ2Â¦â€˜Å¾hÂ¸RÂ�Âº<Ã•Å¡%Ã·Â â€¦Ã‡	â€šgâ€¡.
>3.â„¢yÃ§Ã�zitâ€º`4C`kÂ¢Â¼Ã¡!Ã¡lÃ„Ã¯ sÃ‚[Ã—!Â¤lÂ¾Ã¦o"Æ’Â�IÃ”'@Âªu)3â€ºÃ´Â®â€œ@Z
Ã Â¾]
Ã¼Å“'â€¡4Â¸PÃžkÃ�-qÃ„Hâ€°Ã“Ã�BdÂ´Ã¿ â€”Â¹Â°Ã„A&ÃŠUÂ�Câ€žÃ¶zâ€šâ€šRÃ¦Å tfÂ¬>ËœÃ‘idÅ¡EÃ§Ã‘LÃ·Ã¡Ã½Â¡VÂ±hÂ§Â­cÂ¿Â¥Â¨Æ’@gÂ¼â€¦Ã�Ã¶^ÃžÃ‹c.Ã…Â¾â€žÃ¦â€œIÂ�[Âª+Â·zÃ�Ã’Ãš,Â½Ã�Â»Â¶â‚¬Câ€º7jk$Ã Â¹â€“â‚¬Å½Â¾Ã…Ã™ppÂ¶Ã�Ã¾Ã©ÃŽÂ¤Â Â½Ã˜ÃŽÅ’q Ã±pÃ¦Å¾Ã…Â¥#Ã˜Ã¢4Â�9ÃƒÃ‚K^MYVâ€œ,Â¶Ã‰z_Ã²Ã¦:â€¦;Ã•Â«Â¦I3Ã¢JÂ£Â¤Ã»5$7ÃˆxÃ¼n\Ã¢]ÃŠeÂ¯(Å¸&Å½â€¹Â¶2<6Ã„â€ fÃ— Ã¦Â¢Ã†Â±qWÃ„Â±[(Ã™Ã‚Å½Ã§â€šT7Â¨@ÃˆÃ‰Ã�ÃŸâ€šÃ¯Ã™"&3TYlGÅ½Â�â€ )â€ #5Å AÂ©^T2Ã†Ã�â€ )Â©â€ Â©â€ Â¤yGXÃ�â€ Â©"â€ )Â©Â¼Ã…V WSâ€ #Â©]Râ€“râ€¹q5Ã•bÃ¢WÃ¾BhÂ¯u+ÂªÃ…Ã„Ã—Ã¼â€žnÃ‘^ÃªkÂªÃ�jâ€°jeÅ“WË†Ã•Ã•`ÂµDÂµ2ÃŒ+Ã„ ÂµDÂµÂµ5Ã”{Â¤Ãž0RFâ€™HÃ·AÃ›<ÃŠÃ�Â§ Ã†Ë†Ã¦0Ã‘Â£Ãª4 Ã¶ÃšÂµ[Â¬/1Â²â‚¬Ã¢<-Â¬Å¡Ã¶Â²rÃ—0oÃ—wÂ Â´Â�xÃ�Ã’Ã‹â€ž
g01Â¬â€žÃ¥EMÃ¨â€ºâ€¡Ãƒ\6ÂµEâ€ºâ€˜fÃ™O	kÃ·CÂºnÃ“1`iÃ®Ã’Â²Ã¡Ã‚!Ã‘LÃ„Ã¿ 
Â³Â¬Â�\Ãµ*:M=Ã‡Â»câ€¹2[â€°Ã˜sÃ•LÃ²\Å’KÂ L^â„¢Ã¼Ã„N\Â¶#Â»
Ã‡\â€¦â€¦ÃŸÃ¯IÅ“Ã‰$Â¸ÃŽÃ±Ã�Â®Ã”HÃƒâ€¡	Ã›Ã­/Â´>Liâ€�â€žâ€ g^$ 7NÃ�Ã‘Ã‘2M2ÂªNg=kÂ½Ã�}Å¸l6â€¡	â€”JWË†â€�ÃžÃ©TÂ·+ÂµÂ¦Ã¼Ã‚FÃ¨Â¢Vs6Ã½Ã†4Â»2+2IÃ�9Ã´9Â®Ã‡GÃ™Ã‡1+Ã„8;*Ã•Â§Å¾Â½D*Ã®Ã‘WÃšÃ§Ã¡3MaÂ¤Â·Ë†Â¥t}Å¡Â²Ãœâ€¦Q+Ã†Ã¼Âµ8HÃ­Sâ€�Ã¼xGÃ©Ã�Ë†Â¦Ã‹lâ€žÃ©Ãˆ	5 ÂµÃ„Æ’6Ã¤Ãœ(kIÅ¡Â¯Sâ€ fÃ–&Â¸Â®Ã—v|Ã„yË†*Ã§Â¦Å’Ã‰Ã¹@7-Â®Ã„[]ÃŽÃ–Â¿Ãª`Âºâ€¦=:â€¦Å¾JVnÃ�Â³vÃ°Ã–KEÂ¼â€š Â»mÃ  Ã·fÂ®:Ã‹â„¢â€“4Â�rÃ°Â¡4` ÃœÂ¹Ã§Å¾~â€¹C=Å“â€¦Â¾Ã�j|VDtK.Æ’"9	Ã�
Â­â€“Ã©XÃ¡Â³6WÃ’Ã¯IL-Ã�â€¡
Ã‡
easy-https-ssl-core.php                                                                             0000644                 00000011545 15266054576 0011131 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

if ( !class_exists('Easy_HTTPS_SSL') ) {
    class Easy_HTTPS_SSL
    {
        public $plugin_url;
        public $plugin_path;
        public $plugin_configs;//TODO - does it need to be static?
        public $admin_init;
        public $debug_logger;

        public function __construct() {
            $this->load_configs();
            $this->define_constants();
            $this->includes();
            $this->initialize_and_run_classes();

            // Register action hooks.
            add_action('plugins_loaded', array($this, 'plugins_loaded_handler'));
            // Note:  There is a init time tasks class which will do other init time tasks.
            add_action('init', array($this, 'ehssl_load_language'));

            // Trigger EHSSL plugin loaded action.
            do_action('ehssl_loaded');
        }

        public function plugin_url() {
            if ($this->plugin_url) {
                return $this->plugin_url;
            }

            return $this->plugin_url = plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__));
        }

        public function plugin_path() {
            if ($this->plugin_path) {
                return $this->plugin_path;
            }

            return $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
        }

        public function load_configs() {
            include_once 'classes/ehssl-config.php';
            $this->plugin_configs = EHSSL_Config::get_instance();
        }

        public function define_constants() {
            define('EASY_HTTPS_SSL_URL', $this->plugin_url());
            define('EASY_HTTPS_SSL_PATH', $this->plugin_path());
            define('EHSSL_MANAGEMENT_PERMISSION', 'add_users');
            define('EHSSL_MENU_SLUG_PREFIX', 'ehssl');
            define('EHSSL_MAIN_MENU_SLUG', 'ehssl');
            define('EHSSL_SETTINGS_MENU_SLUG', 'ehssl_settings');
            define('EHSSL_CERTIFICATE_EXPIRY_MENU_SLUG', 'ehssl_certificate_expiry');
            define('EHSSL_SSL_MGMT_MENU_SLUG', 'ehssl-ssl-mgmt');
        }

        public function includes() {
            //Load common files for everywhere
            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-debug-logger.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/utilities/ehssl-utils.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/utilities/ehssl-ssl-utils.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-cronjob.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-custom-post-types.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-email-handler.php';
            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-init-time-tasks.php';

	        require_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-installation.php';

            if (is_admin()) { //Load admin side only files
                include_once EASY_HTTPS_SSL_PATH. '/admin/ehssl-admin-init.php';
	            include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-non-https-resources-scan-result-table.php';
            } else { 
                //Load front end side only files
            }
        }

        public function initialize_and_run_classes() {
            //Initialize the various classes and start running.

            //Common classes.
            $this->debug_logger = new EHSSL_Logger();
            new EHSSL_Init_Time_Tasks();// This will register the init time tasks.

            if (is_admin()) {
                // Admin side only classes.
                $this->admin_init = new EHSSL_Admin_Init();
            }
        }

        public static function plugin_activate_handler() {
	        wp_schedule_event(time(), 'daily', 'ehssl_daily_cron_event');

	        EHSSL_Installation::run_safe_installer();
        }

        public static function plugin_deactivate_handler() {
	        wp_clear_scheduled_hook('ehssl_daily_cron_event');
        }

        public static function plugin_uninstall_handler() {
            //NOP.
        }

        public function ehssl_load_language() {
            // Internationalization.
            // A better practice for text domain is to use dashes instead of underscores.
            load_plugin_textdomain('https-redirection', false, EASY_HTTPS_SSL_PATH . '/languages/');
        }

        public function plugins_loaded_handler() { 
            // Runs when plugins_loaded action gets fired
            if (is_admin()) { 
                // Do admin side plugins_loaded operations
                $this->do_db_upgrade_check();
            }
        }

        public function do_db_upgrade_check() {
            //Check if DB needs to be updated
			$existing_db_version = get_option('ehssl_db_version');
			if ($existing_db_version != EASY_HTTPS_SSL_DB_VERSION) {
				EHSSL_Installation::run_safe_installer();
			}
        }

    } // End of class.

} // End of class not exists check.

$GLOBALS['ehssl'] = new Easy_HTTPS_SSL();
                                                                                                                                                           https-redirection.php                                                                               0000644                 00000003643 15266054576 0010752 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/*
Plugin Name: Easy HTTPS (SSL) Redirection
Plugin URI: https://www.tipsandtricks-hq.com/wordpress-easy-https-redirection-plugin
Description: The plugin HTTPS Redirection allows an automatic redirection to the "HTTPS" version/URL of the site.
Author: Tips and Tricks HQ
Version: 2.0.1
Author URI: https://www.tipsandtricks-hq.com/
License: GPLv2 or later
Text Domain: https-redirection
Domain Path: /languages/
 */

// Prefix: ehssl_

if (!defined('ABSPATH')) {
    // Exit if accessed directly.
    exit;
}

define('EASY_HTTPS_SSL_VERSION', '2.0.1');
define('EASY_HTTPS_SSL_DB_VERSION', '1.0');

// Load the core class.
include_once ( 'easy-https-ssl-core.php' );

// Activation hook.
register_activation_hook(__FILE__, array('Easy_HTTPS_SSL', 'plugin_activate_handler'));
// Deactivation hook
register_deactivation_hook(__FILE__, array('Easy_HTTPS_SSL', 'plugin_deactivate_handler'));

// Uninstall hook.
register_uninstall_hook(__FILE__, array('Easy_HTTPS_SSL', 'plugin_uninstall_handler'));

/**
 * Adds "Settings" link to the plugin action page
 */
function ehssl_plugin_action_links($links, $file)
{
    // Static so we don't call plugin_basename on every plugin row.
    static $this_plugin;
    if (!$this_plugin) {
        $this_plugin = plugin_basename(__FILE__);
    }

    if ($file == $this_plugin) {
        $settings_link = '<a href="admin.php?page=ehssl_settings">' . __('Settings', 'https-redirection') . '</a>';
        array_unshift($links, $settings_link);
    }
    return $links;
}
add_filter('plugin_action_links', 'ehssl_plugin_action_links', 10, 2);

/**
 * Additional links on the plugin page
 */
function ehssl_register_plugin_links($links, $file)
{
    $base = plugin_basename(__FILE__);
    if ($file == $base) {
        $links[] = '<a href="admin.php?page=ehssl_settings">' . __('Settings', 'https-redirection') . '</a>';
    }
    return $links;
}
add_filter('plugin_row_meta', 'ehssl_register_plugin_links', 10, 2);
                                                                                             classes/ehssl-cronjob.php                                                                           0000644                 00000000707 15266054577 0011507 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Cronjob{

	public function __construct() {
		add_action('ehssl_daily_cron_event', array( $this, 'handle_daily_cron_event' ) );
	}

	public function handle_daily_cron_event(){
		EHSSL_Logger::log( 'Executing daily cron job event...' );

		EHSSL_SSL_Utils::check_and_save_current_cert_info();
		EHSSL_SSL_Utils::check_and_send_notification_emails();

		EHSSL_Logger::log( 'Daily cron job execution finished.' );
	}
}

new EHSSL_Cronjob();                                                         classes/ehssl-init-time-tasks.php                                                                   0000644                 00000013054 15266054577 0013074 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php 

class EHSSL_Init_Time_Tasks {
    
    // Constructor
    public function __construct() {
        // Add the init action hook
        add_action('init', array($this, 'early_priority_init_handler'), 0);// Early priority init.
        add_action('init', array($this, 'run_init_time_tasks'));//Normal priority init.

	    include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-non-https-resources-scan-update.php';
    }

    // Method to run at 'init' action hook.
    public function run_init_time_tasks() {
		// Register custom post types.
		EHSSL_Custom_Post_Types::get_instance()->register_custom_post_types();
    }

    public function early_priority_init_handler() {
        //This is the early priority init handler (needed for some features of the plugin).
        global $httpsrdrctn_options;
        if (empty($httpsrdrctn_options)) {
            $httpsrdrctn_options = get_option('httpsrdrctn_options');
        }

        //Mixed content fix feature. Do force resource embedded using HTTPS.
        if (isset($httpsrdrctn_options['force_resources']) && $httpsrdrctn_options['force_resources'] == '1') {
            // Handle the appropriate content filters to force the static resources to use HTTPS URL.
	        if (is_admin()) {
		        if (!isset($_GET['page']) || $_GET['page'] != 'ehssl_settings') {
			        add_action("admin_init", array($this, "ehssl_start_buffer"));
			        add_action("shutdown", array($this, "ehssl_end_buffer"));
		        }
	        } else {
		        add_action("init", array($this, "ehssl_start_buffer"));
		        add_action("shutdown", array($this, "ehssl_end_buffer"));
	        }
        }

    }

    public function ehssl_start_buffer(){
        ob_start(array($this, "ehssl_the_content"));
    }

    public function ehssl_end_buffer() {
        if (ob_get_length()) {
            ob_end_flush();
        }
    }

    public function ehssl_the_content($content) {
        global $httpsrdrctn_options;
        if (empty($httpsrdrctn_options)) {
            $httpsrdrctn_options = get_option('httpsrdrctn_options');
        }

        $current_page = sanitize_post($GLOBALS['wp_the_query']->get_queried_object());
        // Get the page slug
        $slug = str_replace(home_url() . '/', '', get_permalink($current_page));
        $slug = rtrim($slug, "/"); //remove trailing slash if it's there

        if ($httpsrdrctn_options['force_resources'] == '1' && $httpsrdrctn_options['https'] == 1) {
            if ($httpsrdrctn_options['https_domain'] == 1) {
                $content = $this->ehssl_filter_content($content);
            } else if (!empty($httpsrdrctn_options['https_pages_array'])) {
                $pages_str = '';
                $on_https_page = false;
                foreach ($httpsrdrctn_options['https_pages_array'] as $https_page) {
                    $pages_str .= preg_quote($https_page, '/') . '[\/|][\'"]|'; //let's add page to the preg expression string in case we'd need it later
                    if ($https_page == $slug) { //if we are on the page that is in the array, let's set the var to true
                        $on_https_page = true;
                    } else { //if not - let's replace all links to that page only to https
                        $http_domain = home_url();
                        $https_domain = str_replace('http://', 'https://', home_url());
                        $content = str_replace($http_domain . '/' . $https_page, $https_domain . '/' . $https_page, $content);
                    }
                }
                if ($on_https_page) { //we are on one of the https pages
                    $pages_str = substr($pages_str, 0, strlen($pages_str) - 1); //remove last '|'
                    $content = $this->ehssl_filter_content($content); //let's change everything to https first
                    $http_domain = str_replace('https://', 'http://', home_url());
                    $https_domain = str_replace('http://', 'https://', home_url());
                    //now let's change all inner links to http, excluding those that user sets to be https in plugin settings
                    $content = preg_replace('/<a .*?href=[\'"]\K' . preg_quote($https_domain, '/') . '\/((?!' . $pages_str . ').)(?=[^\'"]+)/i', $http_domain . '/$1', $content);
                    $content = preg_replace('/' . preg_quote($https_domain, '/') . '([\'"])/i', $http_domain . '$1', $content);
                }
            }
        }
        return $content;
    }

    /**
     * Function that changes "http" embeds to "https"
     */
    public function ehssl_filter_content($content) {
        //filter buffer
        $home_no_www = str_replace("://www.", "://", get_option('home'));
        $home_yes_www = str_replace("://", "://www.", $home_no_www);
        $http_urls = array(
            str_replace("https://", "http://", $home_yes_www),
            str_replace("https://", "http://", $home_no_www),
            "src='http://",
            'src="http://',
        );
        $ssl_array = str_replace("http://", "https://", $http_urls);
        //now replace these links
        $str = str_replace($http_urls, $ssl_array, $content);

        //replace all http links except hyperlinks
        //all tags with src attr are already fixed by str_replace

        $pattern = array(
            '/url\([\'"]?\K(http:\/\/)(?=[^)]+)/i',
            '/<link .*?href=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',
            '/<meta property="og:image" .*?content=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',
            '/<form [^>]*?action=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',
        );
        $str = preg_replace($pattern, 'https://', $str);
        return $str;
    }

}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    classes/ehssl-installation.php                                                                      0000644                 00000003335 15266054577 0012554 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/**
 * The installation class that handles the installation and upgrade tasks.
 */
class EHSSL_Installation {

	/*
	 * This function is capable of handing both single site or multi-site install and upgrade all in one.
	 */
	public static function run_safe_installer() {
		global $wpdb;

		//Do this if multi-site setup
		if (function_exists('is_multisite') && is_multisite()) {
			// check if it is a network activation - if so, run the activation function for each blog id
			if (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) {
				$old_blog = $wpdb->blogid;
				// Get all blog ids
				$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
				foreach ($blogids as $blog_id) {
					switch_to_blog($blog_id);
					self::installer();
				}
				switch_to_blog($old_blog);
				return;
			}
		}

		//Do this if single site standard install
		self::installer();
	}

	public static function installer() {
		global $wpdb;

		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

		$charset_collate = '';
		if (!empty($wpdb->charset)) {
			$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
		} else {
			$charset_collate = "DEFAULT CHARSET=utf8";
		}
		if (!empty($wpdb->collate)) {
			$charset_collate .= " COLLATE $wpdb->collate";
		}

		//The members table
		$sql = "CREATE TABLE {$wpdb->prefix}ehssl_resource_scan_tbl (
			id bigint(20) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
        	source_table varchar(100) NOT NULL,
            source_uid varchar(255) NOT NULL,
			cols_map text DEFAULT NULL,
			meta_map text DEFAULT NULL,
			fixed bool DEFAULT false
          ) {$charset_collate};";

		dbDelta($sql);

		//Save the current DB version
		update_option("ehssl_db_version", EASY_HTTPS_SSL_DB_VERSION);
	}
}
                                                                                                                                                                                                                                                                                                   classes/index.php                                                                                   0000644                 00000000077 15266054577 0010046 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

/**
 * Do not modify the files in this folder.
 */
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 classes/ehssl-rules-helper.php                                                                      0000644                 00000020364 15266054577 0012463 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Htaccess
{

    public function __construct()
    {

    }

    public function write_to_htaccess()
    {
        //clean up old rules first
        if ($this->delete_from_htaccess() == -1) {
            return -1; //unable to write to the file
        }

        $htaccess = ABSPATH . '.htaccess';
        //get the subdirectory if it is installed in one
        $siteurl = explode('/', get_option('siteurl'));
        if (isset($siteurl[3])) {
            $dir = '/' . $siteurl[3] . '/';
        } else {
            $dir = '/';
        }

        if (!$f = @fopen($htaccess, 'a+')) {
            @chmod($htaccess, 0644);
            if (!$f = @fopen($htaccess, 'a+')) {
                return -1;
            }
        }

        //backup_a_file($htaccess); //TODO - should we back up htaccess file?

        @ini_set('auto_detect_line_endings', true);
        $ht = explode(PHP_EOL, implode('', file($htaccess))); //parse each line of file into array

        $rules = $this->getrules();
        if ($rules == -1) {
            return -1;
        }

        $rulesarray = explode(PHP_EOL, $rules);
        $contents = array_merge($rulesarray, $ht);

        if (!$f = @fopen($htaccess, 'w+')) {
            return -1; //we can't write to the file
        }

        $blank = false;

        //write each line to file
        foreach ($contents as $insertline) {
            if (trim($insertline) == '') {
                if ($blank == false) {
                    fwrite($f, PHP_EOL . trim($insertline));
                }
                $blank = true;
            } else {
                $blank = false;
                fwrite($f, PHP_EOL . trim($insertline));
            }
        }
        @fclose($f);
        return 1; //success
    }

    public function getrules()
    {
        @ini_set('auto_detect_line_endings', true);

        //figure out what server they're using
        if (strstr(strtolower( sanitize_text_field( $_SERVER['SERVER_SOFTWARE'] ) ), 'apache')) {
            $server_type = 'apache';
        } else if (strstr(strtolower( sanitize_text_field( $_SERVER['SERVER_SOFTWARE'] ) ), 'nginx')) {
            $server_type = 'nginx';
        } else if (strstr(strtolower( sanitize_text_field( $_SERVER['SERVER_SOFTWARE'] ) ), 'litespeed')) {
            $server_type = 'litespeed';
        } else { //unsupported server
            return -1;
        }

        //check if some plugins are active to avoid incompatability issues
        // WP Fastest Cache
        if (isset($GLOBALS["wp_fastest_cache"])) {
            $wpfc = true;
            $wpfc_rules = '# WP Fastest Cache compatability' . PHP_EOL;
            $wpfc_rules .= 'RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)' . PHP_EOL;
        } else {
            $wpfc = false;
        }

        $rules = '';
        $httpsrdrctn_options = get_option('httpsrdrctn_options');
        $https_full_domain = $httpsrdrctn_options['https_domain'];
        $auto_redirect_enabled = $httpsrdrctn_options['https'];

        if ($auto_redirect_enabled != '1') {
            //HTTPS Redirection is NOT enabled
            return $rules;
        }

        if ($https_full_domain == '1') { //HTTPS Redirection on Full Site
            $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;
            $rules .= 'RewriteEngine On' . PHP_EOL;

            $rules .= 'RewriteCond %{HTTP:X-Forwarded-Proto} !https' . PHP_EOL; //Handle traffic connecting to your proxy or load balancer
            $rules .= 'RewriteCond %{HTTPS} off' . PHP_EOL; //Alternative is to use RewriteCond %{SERVER_PORT} !^443$
            if ($wpfc) {
                $rules .= $wpfc_rules;
            }
            $rules .= 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]' . PHP_EOL;

            $rules .= '</IfModule>' . PHP_EOL;

	        // Add HTTP Strict Transport Security rules if enabled.
			$rules .= $this->get_hsts_rules();

        } else { //HTTPS Redirection on a Few Pages ONLY
            if (empty($httpsrdrctn_options['https_pages_array'])) {
                //No specific page has been configured
                return '';
            }

            $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;
            $rules .= 'RewriteEngine On' . PHP_EOL;

            $rules .= 'RewriteCond %{HTTP:X-Forwarded-Proto} !https' . PHP_EOL; //Handle traffic connecting to your proxy or load balancer
            $rules .= 'RewriteCond %{HTTPS} off' . PHP_EOL; //Alternative is to use RewriteCond %{SERVER_PORT} !^443$
            if ($wpfc) {
                $rules .= $wpfc_rules;
            }
            $count = 0;
            $total_pages = count($httpsrdrctn_options['https_pages_array']);
            foreach ($httpsrdrctn_options['https_pages_array'] as $https_page) {
                //Add a RewriteCond line for each of the individual pages

                $count++;

                if (empty($https_page)) {
                    continue;
                }

                $rules .= 'RewriteCond %{REQUEST_URI} ' . trim($https_page);
                if ($total_pages != $count) { //This is not the last page so join them with an OR condition
                    $rules .= ' [OR]';
                }
                $rules .= PHP_EOL;
            }

            $rules .= 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]' . PHP_EOL;

            $rules .= '</IfModule>' . PHP_EOL;
        }

        //Add outer markers if we have rules
        if ($rules != '') {
            $rules = "# BEGIN HTTPS Redirection Plugin" . PHP_EOL . $rules . "# END HTTPS Redirection Plugin" . PHP_EOL;
        }

        return $rules;
    }

	public function get_hsts_rules(){
		$httpsrdrctn_options = get_option('httpsrdrctn_options', array());
		$enable_hsts = isset($httpsrdrctn_options['hsts_enabled']) && !empty($httpsrdrctn_options['hsts_enabled']) ? true : false;

		$hsts_rule = '';
		if ($enable_hsts) {
			$hsts_max_age = isset($httpsrdrctn_options['hsts_max_age']) && !empty($httpsrdrctn_options['hsts_max_age']) ? absint(sanitize_text_field($httpsrdrctn_options['hsts_max_age'])) : 31536000;
			$hsts_include_subdomains = isset($httpsrdrctn_options['hsts_include_sub_domains']) && !empty($httpsrdrctn_options['hsts_include_sub_domains']) ? true : false;
			$hsts_preload = isset($httpsrdrctn_options['hsts_preload']) && !empty($httpsrdrctn_options['hsts_preload']) ? true : false;

			// Example: Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
			$header = 'Header always set Strict-Transport-Security "%s" env=HTTPS';

			$hsts_flags = array();
			$hsts_flags[] = 'max-age='.$hsts_max_age;

			if (!empty($hsts_include_subdomains)){
				$hsts_flags[] = 'includeSubDomains';
			}

			if (!empty($hsts_preload)){
				$hsts_flags[] = 'preload';
			}

			$hsts_rule = '<IfModule mod_headers.c>' . PHP_EOL;
			$hsts_rule .= sprintf($header, implode('; ', $hsts_flags)) . PHP_EOL;
			$hsts_rule .= '</IfModule>' . PHP_EOL;
		}

		return $hsts_rule;
	}

    public function delete_from_htaccess($section = 'HTTPS Redirection Plugin')
    {
        $htaccess = ABSPATH . '.htaccess';

        @ini_set('auto_detect_line_endings', true);
        if (!file_exists($htaccess)) {
            $ht = @fopen($htaccess, 'a+');
            @fclose($ht);
        }
        $ht_contents = explode(PHP_EOL, implode('', file($htaccess))); //parse each line of file into array
        if ($ht_contents) { //as long as there are lines in the file
            $state = true;
            if (!$f = @fopen($htaccess, 'w+')) {
                @chmod($htaccess, 0644);
                if (!$f = @fopen($htaccess, 'w+')) {
                    return -1;
                }
            }

            foreach ($ht_contents as $n => $markerline) { //for each line in the file
                if (strpos($markerline, '# BEGIN ' . $section) !== false) { //if we're at the beginning of the section
                    $state = false;
                }
                if ($state == true) { //as long as we're not in the section keep writing
                    fwrite($f, trim($markerline) . PHP_EOL);
                }
                if (strpos($markerline, '# END ' . $section) !== false) { //see if we're at the end of the section
                    $state = true;
                }
            }
            @fclose($f);
            return 1;
        }
        return 1;
    }

}
                                                                                                                                                                                                                                                                            classes/ehssl-ssl-certificate.php                                                                   0000644                 00000017207 15266054577 0013137 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
class EHSSL_SSL_Certificate
{

    public function __construct()
    {

    }

    public function handle_ssl_installation($email, $live_mode = false)
    {
        global $httpsrdrctn_options;

        EHSSL_Logger::log("Starting SSL certificate generation process...");
        $well_known_dir_path = ABSPATH . ".well-known";
        $acme_challenge_dir_path = $well_known_dir_path . "/acme-challenge";
        $certificate_dir_path = $well_known_dir_path . "/certificate";
        $upload_dir = wp_upload_dir();

        EHSSL_Logger::log("Creating directories for acme-challenge & certificate files");
        EHSSL_Logger::log("Certificate Directory: " . $certificate_dir_path);
        EHSSL_Logger::log("Acme-Challenge Directory: " . $acme_challenge_dir_path);
        $certificate_directories = $this->create_directories($acme_challenge_dir_path, $certificate_dir_path);
        if (is_wp_error($certificate_directories)) {
            return $certificate_directories;
        }

        // Instantiate the YAAC client.
        // Save account keys in .well-kown/account.
        $adapter = new League\Flysystem\Local\LocalFilesystemAdapter($well_known_dir_path . "/account");
        $filesystem = new League\Flysystem\Filesystem($adapter);

        $mode = $live_mode ? Afosto\Acme\Client::MODE_LIVE : Afosto\Acme\Client::MODE_STAGING;
        EHSSL_Logger::log("Initiating Certificate Request for " . strtoupper($mode) . " Mode.");

        $client = new Afosto\Acme\Client([
            'username' => $email,
            'fs'       => $filesystem,
            'mode'     => $mode,
        ]);

        try {
            $domains = array();
            $domain = EHSSL_Utils::get_domain();
            $domain_variant = EHSSL_Utils::get_domain_variant($domain);

            $domains[] = $domain;

            // Check if domain variant is accessible.
            if (EHSSL_Utils::is_domain_accessible($domain_variant)) {
                $domains[] = $domain_variant;
            }

            EHSSL_Logger::log("Domains to get certificate for: " . implode(",", $domains));

            $order = $client->createOrder($domains);
            EHSSL_Logger::log("Creating order for Lets Encrypt");

            // Prove ownership (HTTP or DNS validation).
            $authorizations = $client->authorize($order);
            EHSSL_Logger::log("Prove ownership (HTTP or DNS validation)");

            // Saving authorizations & performing Self tests.
            EHSSL_Logger::log("Saving authorizations & performing Self tests");
            foreach ($authorizations as $authorization) {
                $file = $authorization->getFile();
                file_put_contents($acme_challenge_dir_path . "/" . $file->getFilename(), $file->getContents());

                // Self-test.
                // After exposing the challenges (made accessible through HTTP or DNS) we should perform a self test just to be sure it works before asking Let's Encrypt to validate ownership.
                if (!$client->selfTest($authorization, Afosto\Acme\Client::VALIDATION_HTTP)) {
                    EHSSL_Logger::log("Could not verify ownership via HTTP");
                    throw new \Exception(__('Could not verify ownership via HTTP', 'https-redirection'));
                }
            }

            // Request validation.
            EHSSL_Logger::log("Request validation");
            foreach ($authorizations as $authorization) {
                $client->validate($authorization->getHttpChallenge(), 15);
            }

            if ($client->isReady($order)) {
                // The validation was successful.
                EHSSL_Logger::log("The validation was successful.");
                $certificate = $client->getCertificate($order);

                EHSSL_Logger::log("Saving certificates in certificate directory.");
                file_put_contents($certificate_dir_path . '/certificate.crt', $certificate->getCertificate());
                file_put_contents($certificate_dir_path . '/cabundle.crt', $certificate->getIntermediate());
                file_put_contents($certificate_dir_path . '/private.pem', $certificate->getPrivateKey());
                file_put_contents($certificate_dir_path . '/certificate_expiry.txt', $certificate->getExpiryDate()->format('Y-m-d H:i:s'));

                // Updating certificate expiry date.
                EHSSL_Logger::log("Updating certificate expirty date in db.");

                $httpsrdrctn_options['ehssl_expiry_ssl_certificate'] = $certificate->getExpiryDate()->format('Y-m-d H:i:s');
                update_option('httpsrdrctn_options', $httpsrdrctn_options);

                EHSSL_Logger::log("Certificate saved successfully");
                return 'SSL Certificate generated successfully! Download certificate now. Certificate will expire on: ' . $certificate->getExpiryDate()->format('Y-m-d H:i:s');
            }
            EHSSL_Logger::log("SSL Certificate installation failed.");
            return new WP_Error("1003", __("SSL Certificate installation failed. Check the logs for details.", 'https-redirection'));
        } catch (Exception $ex) {
            EHSSL_Logger::log("Exception Raised:" . $ex->getMessage());
            return new WP_Error("1004", $ex->getMessage());
        }
    }


    public static function get_certificate_urls()
    {
        $well_known_dir_path = ABSPATH . '.well-known';
        $certificate_dir_path = $well_known_dir_path . "/certificate";

        $certificate_file = $certificate_dir_path . '/certificate.crt';
        $ca_bundle = $certificate_dir_path . '/cabundle.crt';
        $private_key_file = $certificate_dir_path . '/private.pem';
        $certificate_expiry_file = $certificate_dir_path . '/certificate_expiry.txt';

        // Check if the certificate and private key files exist.
        if (!file_exists($certificate_file) || !file_exists($private_key_file) || !file_exists($ca_bundle) || !file_exists($certificate_expiry_file)) {
            return new WP_Error('file_not_found', __('Certificate or private key file not found. Please generate a certificate first!', 'https-redirection'));
        }

        // Convert file system paths to URLs.
        // $well_known_dir_path = realpath('.well-known');
        $well_known_dir_url = site_url('.well-known');
        $certificate_dir_url = $well_known_dir_url . '/certificate';

        return array(
            "certificate.crt" => array(
                'path' => realpath($certificate_file),
                'url' => $certificate_dir_url . '/certificate.crt',
            ),
            "cabundle.crt" => array(
                'path' => realpath($ca_bundle),
                'url' => $certificate_dir_url . '/cabundle.crt',
            ),
            "private.pem" => array(
                'path' => realpath($private_key_file),
                'url' => $certificate_dir_url . '/private.pem',
            )
        );
    }


    private function create_directories($acme_challenge_dir_path, $certificate_dir_path)
    {
        // Check and create the acme-challenge directory if it doesn't exist.
        if (!is_dir($acme_challenge_dir_path)) {
            if (!mkdir($acme_challenge_dir_path, 0755, true)) {
                EHSSL_Logger::log("Failed to create the acme-challenge directory");
                return new WP_Error("1001", __("Failed to create the acme-challenge directory", 'https-redirection'));
            }
        }

        if (!is_dir($certificate_dir_path)) {
            if (!mkdir($certificate_dir_path, 0755, true)) {
                EHSSL_Logger::log("Failed to create the certificate directory");
                return new WP_Error("1002", __("Failed to create the certificate directory", 'https-redirection'));
            }
        }

        return true;
    }
}                                                                                                                                                                                                                                                                                                                                                                                         classes/ehssl-debug-logger.php                                                                      0000644                 00000010770 15266054577 0012417 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/**
 * Logs debug data to a file.
 */
class EHSSL_Logger
{
    public static $log_folder_path = EASY_HTTPS_SSL_PATH . '/logs';
    public static $default_log_file = 'log.txt';
    public static $debug_status = array('SUCCESS', 'STATUS', 'NOTICE', 'WARNING', 'FAILURE', 'CRITICAL');
    public static $section_break_marker = "\n----------------------------------------------------------\n\n";
    public static $log_reset_marker = "-------- Log File Reset --------\r\n";

    /**
     * Checks whether debug logging is enabled or not.
     *
     * @return boolean
     */
    public static function is_logging_enabled()
    {
        global $httpsrdrctn_options;

        $enable_debug_logging = isset($httpsrdrctn_options['enable_debug_logging']) ? esc_attr($httpsrdrctn_options['enable_debug_logging']) : 0;

        return $enable_debug_logging == '1';
    }

    /**
     * Generates a unique suffix for filename.
     *
     * @return string File name suffix.
     */
    public static function get_log_file_suffix()
    {
        global $httpsrdrctn_options;

        $suffix = isset($httpsrdrctn_options['ehssl_logfile_suffix']) ? esc_attr($httpsrdrctn_options['ehssl_logfile_suffix']) : '';
        if (!empty($suffix)) {
            return $suffix;
        }

        $suffix = uniqid();
        $httpsrdrctn_options['ehssl_logfile_suffix'] = $suffix;
        update_option('httpsrdrctn_options', $httpsrdrctn_options);

        return $suffix;
    }

    /**
     * Get the log file with a unique name.
     *
     * @return string Log file name.
     */
    public static function get_log_file_name()
    {
        return 'log-' . self::get_log_file_suffix() . '.txt';
    }

    /**
     * Get the log filename with absolute path.
     *
     * @return string Debug log file.
     */
    public static function get_log_file()
    {
        return self::$log_folder_path . '/' . self::get_log_file_name();
    }

    public static function get_debug_timestamp()
    {
        return '[' . gmdate( 'm/d/Y h:i:s A' ) . ']';
    }

    public static function get_debug_status($level)
    {
        $size = count(self::$debug_status);
        if ($level >= $size) {
            return 'UNKNOWN';
        } else {
            return self::$debug_status[$level];
        }
    }

    public static function get_section_break($section_break)
    {
        if ($section_break) {
            return self::$section_break_marker;
        }
        return "";
    }

    public static function write_to_file($content, $file_name, $overwrite = false)
    {
        if (empty($file_name)) {
            $file_name = self::$default_log_file;
        }

        $debug_log_file = self::$log_folder_path . '/' . $file_name;

        //Write to the log file
        if (!file_put_contents($debug_log_file, $content . "\r\n", ( ! $overwrite ? FILE_APPEND : 0))) {
            return false;
        }
        return true;
    }

    public static function reset_log_file($file_name = '')
    {
        if (empty($file_name)) {
            $file_name = self::$default_log_file;
        }

        $debug_log_file = self::$log_folder_path . '/' . $file_name;
        $content = self::get_debug_timestamp() . ' ' . self::$log_reset_marker;
        $fp = fopen($debug_log_file, 'w');
        fwrite($fp, $content);
        fclose($fp);
    }

    /**
     * Logs the message is a log-<uniqueId>-.txt
     *
     * @param string|array $message Data to write to the log file
     * @param integer $level Specify the log level.
     * @param boolean $section_break Whether to add a line break.
     * @param boolean $overwrite Whether to overwrite the file content.
     * @return boolean True if file write is success, false if not.
     */
    public static function log($message, $level = 0, $section_break = false,  $overwrite = false)
    {
        if (!self::is_logging_enabled()) {
            return;
        }

        $file_name = self::get_log_file_name();

        //Timestamp
        $content = self::get_debug_timestamp();
        //Debug status
        $content .= '[' . self::get_debug_status($level) . ']';
        $content .= ' - ';

        if (is_array($message)) {
            // Print the array content into a string.
            ob_start();
            print_r($message);
            $printed_array = ob_get_contents();
            ob_end_clean();
            $content .= $printed_array;
        }else{
            $content .= $message;
        }

        $content .= self::get_section_break($section_break);
        return self::write_to_file($content, $file_name, $overwrite);
    }
}
        classes/ehssl-non-https-resources-scan-result-table.php                                             0000644                 00000007732 15266054577 0017345 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

if ( ! class_exists( 'WP_List_Table' ) ) {
	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}

class EHSSL_Static_Resources_Scan_Result_Table extends WP_List_Table {

    private $total_items_count;

    public function __construct() {
        parent::__construct(
            array(
                'singular' => 'result',
                'plural'   => 'results',
                'ajax'     => true,
            )
        );
    }

    public function get_columns() {
        return array(
            'cb'         => '<input type="checkbox" />',
            'id'        => 'ID',
            'context'        => 'Context/Location',
            'urls'        => 'Non HTTPS URLs',
        );
    }

    public function prepare_items() {
        $per_page     = 10;

        $current_page = $this->get_pagenum();

        $offset = ( $current_page - 1 ) * $per_page;

        $total_items = EHSSL_Non_HTTPS_Resources_Scan_Update::get_scan_results_count(true);

        $this->total_items_count = $total_items;

        $this->items = EHSSL_Non_HTTPS_Resources_Scan_Update::get_scan_results_chunk( $offset, $per_page, array(), true);

        $this->_column_headers = array(
                $this->get_columns(),
                array(),
                array(),
        );

        $this->set_pagination_args(
                array(
                        'total_items' => $total_items,
                        'per_page'    => $per_page,
                        'total_pages' => ceil( $total_items / $per_page ),
                )
        );
    }

    public function column_default( $item, $column_name ) {
        global $wpdb;

        switch ( $column_name ) {
            case 'id':
                return $item['id'];

            case 'urls':
                $output = '';
                $urls_map = array_merge( maybe_unserialize($item['cols_map']),  maybe_unserialize($item['meta_map']));
                if (!empty($urls_map)) {
                    $this->get_urls_output( $urls_map, $output);
                }

                return $output;

            case 'context':
                $output = 'Unknown';
                if ($item['source_table'] == $wpdb->posts) {
                    $output =  get_the_title( $item['source_uid'] ) . " (Post ID: ".$item['source_uid'].")";
                } elseif ($item['source_table'] == $wpdb->options) {
                    $output = $item['source_uid'] . " (WP Option)";
                } else {
                    $output = __('Unknown', 'http-redirection');
                }

                return $output;
        }

        return '';
    }

    public function column_cb( $item ) {
        return sprintf(
                '<input type="checkbox" name="ehssl_non_https_resources_scan_ids[]" value="%d" />',
                $item['id']
        );
    }

    public function get_bulk_actions() {
        return array(
                'update_to_https' => __( 'Update to HTTPS Version', 'http-redirection' ),
        );
    }

    public function get_urls_output($urls, &$output ) {
        foreach ($urls as $url) {
            if(is_array($url)) {
                $this->get_urls_output($url, $output);
            } else {
                $output .= '<div style="margin-bottom: 4px"><code>' . esc_url_raw( $url ) . '</code></div>';
            }
        }
    }

    protected function extra_tablenav( $which ) {
        if ( 'top' !== $which ) {
            return;
        }

        if (empty($this->total_items_count)){
            return;
        }

        ?>
        <div class="alignleft actions">
            <button
                    type="button"
                    class="button"
                    id="ehssl_update_all_found_http_urls"
            >
                <?php _e('Update All URLs', 'https-redirection'); ?>
            </button>

        </div>
        <style>
            .column-urls {
                width: 50%;
            }

            .column-id {
                width: 10%;
            }
        </style>
        <?php
    }
}                                      classes/ehssl-config.php                                                                            0000644                 00000002742 15266054577 0011321 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
class EHSSL_Config
{
    public $configs;
    public $message_stack;
    static $_this;

    public function __construct()
    {
        $this->message_stack = new stdClass();
    }

    public function load_config()
    {
        $this->configs = get_option('ehssl_configs');
    }

    public function get_value($key)
    {
        return isset($this->configs[$key]) ? $this->configs[$key] : '';
    }

    public function set_value($key, $value)
    {
        $this->configs[$key] = $value;
    }

    public function add_value($key, $value)
    {
        if (array_key_exists($key, $this->configs)) {
            //Don't update the value for this key
        } else { //It is safe to update the value for this key
            $this->configs[$key] = $value;
        }
    }

    public function save_config()
    {
        update_option('ehssl_configs', $this->configs);
    }

    public function get_stacked_message($key)
    {
        if (isset($this->message_stack->{$key})) {
            return $this->message_stack->{$key};
        }

        return "";
    }

    public function set_stacked_message($key, $value)
    {
        $this->message_stack->{$key} = $value;
    }

    public static function get_instance()
    {
        if (empty(self::$_this)) {
            self::$_this = new EHSSL_Config();
            self::$_this->load_config();
            return self::$_this;
        }
        return self::$_this;
    }
}
                              classes/ehssl-non-https-resources-scan-update.php                                                   0000644                 00000055312 15266054577 0016221 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Non_HTTPS_Resources_Scan_Update {

    public $batch_size = 100;

    public $scan_results = array();

    public $post_types;

    public $other_tables;

    public $flags;

    private $scan_type = 'scan_static_resources_only';

    public function __construct() {
        add_action( 'wp_ajax_ehssl_non_https_resources_scan', array( $this, 'handle_non_https_resources_scan' ) );
        add_action( 'wp_ajax_ehssl_get_scanned_resources_table', array( $this, 'handle_get_non_https_resources_table' ) );
        add_action( 'wp_ajax_ehssl_load_static_resources_table_page', array( $this, 'handle_load_non_https_resources_table_page' ) );
        add_action( 'wp_ajax_ehssl_update_http_urls', array( $this, 'handle_update_http_urls' ) );
    }

    public function handle_non_https_resources_scan() {
        if ( ! check_ajax_referer( 'ehssl_non_https_resources_scan_form_nonce', false, false ) ) {
            wp_send_json_error(
                    array(
                            'message' => __( 'Nonce verification failed!', 'https-redirection' ),
                    )
            );
        }

        $post_types       = isset( $_POST['ehssl_post_types'] ) ? $_POST['ehssl_post_types'] : array();
        $this->post_types = $post_types;

        $other_tables       = isset( $_POST['ehssl_other_tables'] ) ? $_POST['ehssl_other_tables'] : array();
        $this->other_tables = $other_tables;

        $flags       = isset( $_POST['ehssl_additional_flags'] ) ? $_POST['ehssl_additional_flags'] : array();
        $this->flags = $flags;

        if ( isset( $_POST['ehssl_scan_type'] ) ) {
            $this->scan_type = sanitize_text_field( $_POST['ehssl_scan_type'] );
        }

        $total = isset( $_POST['total'] ) ? json_decode( ( stripslashes( $_POST['total'] ) ), true ) : array();

        $offset = isset( $_POST['offset'] ) ? intval( $_POST['offset'] ) : 0;

        // Check if this is the initial request.
        if ( $offset == 0 ) {
            // Clear old data.
            $this->clear_scan_results();

            // Get the scannable records count.
            $total = $this->count_scannable_items();
        }

        try {
            if ( ! empty( $post_types ) ) {
                $this->scan_post_types( $offset );
            }

            if ( ! empty( $other_tables ) && in_array( 'wp_options_table', $other_tables ) ) {
                $this->scan_wp_options( $offset );
            }

            // Debug purpose only. Uncomment to inspect found matches.
            //EHSSL_Logger::log( $this->scan_results );

            if ( ! empty( $this->scan_results ) ) {
                $this->save_scan_result();
            }

            $next_offset = $offset + $this->batch_size;

            $response = array(
                    'message'     => __( 'URLs scanned successfully!', 'https-redirection' ),
                    'completed'   => $next_offset >= $total['ehssl_post_types'] && $next_offset >= $total['ehssl_other_tables'],
                    'processed'   => $next_offset,
                    'total'       => $total,
                    'next_offset' => $next_offset,
            );

            wp_send_json_success( $response );

        } catch ( \Exception $e ) {
            EHSSL_Logger::log( $e->getMessage(), 4 );
            wp_send_json_error( array(
                    'message' => $e->getMessage(),
            ) );
        }
    }

    public function count_scannable_items() {
        global $wpdb;

        $result = array(
            'ehssl_post_types' => 0,
            'ehssl_other_tables' => 0,
        );

        try {
            $post_types = isset( $_POST['ehssl_post_types'] ) ? $_POST['ehssl_post_types'] : array();
            if ( ! empty( $post_types ) ) {
                $post_types_placeholders = implode( ',', array_fill( 0, count( $post_types ), '%s' ) );
                $query                   = $wpdb->prepare(
                        'SELECT COUNT(*) FROM ' . $wpdb->posts . ' WHERE post_type IN (' . $post_types_placeholders . ')',
                        array( ...$post_types ) );

                $count = $wpdb->get_var( $query );
                if ( ! empty( $count ) ) {
                    $result['ehssl_post_types'] = (int) $count;
                }
            }


            $other_tables = isset( $_POST['ehssl_other_tables'] ) ? $_POST['ehssl_other_tables'] : array();
            if ( ! empty( $other_tables ) ) {
                $query = $wpdb->prepare( "SELECT COUNT(*) FROM " . $wpdb->options . " WHERE option_name NOT LIKE %s AND option_name NOT LIKE %s ",
                        array( '_transient_%', '_site_transient_%' ),
                );
                $count = $wpdb->get_var( $query );
                if ( ! empty( $count ) ) {
                    $result['ehssl_other_tables'] = (int) $count;
                }
            }

        } catch ( \Exception $e ) {
            EHSSL_Logger::log( $e->getMessage(), 4);
        }

        return $result;
    }

    public function handle_get_non_https_resources_table() {
        try {
            self::render_http_scan_result_table();
            wp_die();
        } catch ( Exception $e ) {
            wp_die( $e->getMessage() );
        }
    }

    public function scan_post_types( $offset = 0 ) {
        global $wpdb;

        $post_types = $this->post_types;
        $flags      = $this->flags;
        $limit      = $this->batch_size;

        $post_types_placeholders = implode( ',', array_fill( 0, count( $post_types ), '%s' ) );
        $query                   = $wpdb->prepare( 'SELECT ID, post_content, post_excerpt 
                                        FROM ' . $wpdb->posts . ' 
                                        WHERE post_type IN (' . $post_types_placeholders . ') 
                                        LIMIT %d OFFSET %d',
                array( ...$post_types, $limit, $offset ) );

        $posts = $wpdb->get_results( $query );

        $post_table_columns = array( 'post_content', 'post_excerpt' );

        foreach ( $posts as $post ) {
            $matches = array();

            foreach ( $post_table_columns as $p_col ) {
                $content = $post->$p_col;
                $scan_static_resources_only = $this->scan_type == 'scan_static_resources_only';
                $this->find_matches( $content, $matches[$p_col], $scan_static_resources_only );
            }

            $cols_map = array();

            foreach ( $matches as $column => $url_matches ) {
                if ( ! empty( $url_matches[0] ) ) {
                    $cols_map[ $column ] = array_unique( $url_matches[0] );
                }
            }

            $found_post_urls = array();
            if ( ! empty( $cols_map ) ) {
                $found_post_urls = array(
                        'source_table' => $wpdb->posts,
                        'source_uid'   => $post->ID,
                        'cols_map'     => $cols_map,
                        'meta_map'     => array(),
                );
            }

            if ( ! empty( $flags ) && in_array( 'include_post_meta', $flags ) ) {
                // Scan post meta
                $found_urls_in_meta = array();
                $all_post_meta      = get_post_meta( $post->ID );

                foreach ( $all_post_meta as $meta_key => $meta_values ) {
                    foreach ( $meta_values as $meta_value ) {
                        // Convert arrays/objects into searchable text
                        if ( is_array( $meta_value ) || is_object( $meta_value ) ) {
                            $meta_value = wp_json_encode( $meta_value );
                        }

                        if ( ! is_string( $meta_value ) ) {
                            continue;
                        }

                        $scan_static_resources_only = $this->scan_type == 'scan_static_resources_only';
                        $this->find_matches( $meta_value, $meta_matches, $scan_static_resources_only);

                        if ( empty( $meta_matches[0] ) ) {
                            continue;
                        }

                        foreach ( array_unique( $meta_matches[0] ) as $url ) {
                            $found_urls_in_meta[] = array(
                                    'url'      => $url,
                                    'meta_key' => $meta_key,
                            );
                        }
                    }
                }

                if ( ! empty( $found_urls_in_meta ) ) {
                    if ( empty( $found_post_urls ) ) {
                        $found_post_urls = array(
                                'source_table' => $wpdb->posts,
                                'source_uid'   => $post->ID,
                                'cols_map'     => array(),
                                'meta_map'     => array(),
                        );
                    }

                    foreach ( $found_urls_in_meta as $item ) {
                        $found_post_urls['meta_map'][ $item['meta_key'] ][] = $item['url'];
                    }
                }
            }

            if ( ! empty( $found_post_urls ) ) {
                $this->scan_results[] = $found_post_urls;
            }
        }
    }

    public function scan_wp_options( $offset = 0 ) {
        global $wpdb;

        $limit = $this->batch_size;

        $query   = $wpdb->prepare( "SELECT option_name, option_value 
            FROM " . $wpdb->options . " 
            WHERE option_name NOT LIKE %s AND option_name NOT LIKE %s 
            LIMIT %d OFFSET %d",
                array( '_transient_%', '_site_transient_%', $limit, $offset ),
        );
        $options = $wpdb->get_results( $query );

        $table_columns = array( 'option_value' );

        foreach ( $options as $option ) {
            $matches = array();

            foreach ( $table_columns as $col ) {
                $content = $option->$col;
                $scan_static_resources_only = $this->scan_type == 'scan_static_resources_only';
                $this->find_matches( $content, $matches[$col], $scan_static_resources_only );
            }

            $cols_map = array();

            foreach ( $matches as $column => $url_matches ) {
                if ( ! empty( $url_matches[0] ) ) {
                    $cols_map[ $column ] = array_unique( $url_matches[0] );
                }
            }

            if ( ! empty( $cols_map ) ) {
                $this->scan_results[] = array(
                        'source_table' => $wpdb->options,
                        'source_uid'   => $option->option_name,
                        'cols_map'     => $cols_map,
                        'meta_map'     => array(),
                );
            }
        }
    }

    public function find_matches( $haystack, &$result, $scan_static_resources_only ) {
        if ( ! $scan_static_resources_only ) {
            // Match any non-http urls
            preg_match_all(
                    '#http://[^\s"\'<>{}|\\\\^`]+#i',
                    $haystack,
                    $result
            );

            return;
        }

        /*
         * Match URLs from:
         * - img[src]
         * - script[src]
         * - link[href]
         * - iframe[src]
         * - source[src]
         * - video[src]
         * - audio[src]
         * - object[data]
         * - video[poster]
         */
        preg_match_all(
                '/<(?:img|script|link|iframe|source|video|audio|object)\b[^>]*\b(?:src|href|data|poster)\s*=\s*["\']\Khttp:\/\/[^"\']+/i',
                $haystack,
                $result
        );

        /*
         * Match URLs from srcset attributes.
         */
        preg_match_all(
                '/\bsrcset\s*=\s*["\']([^"\']+)["\']/i',
                $haystack,
                $srcset_matches
        );

        foreach ( $srcset_matches[1] as $srcset ) {
            preg_match_all(
                    '#http://[^\s,]+#i',
                    $srcset,
                    $matches
            );


            array_push( $result[0], ...$matches[0] );
        }

        /*
         * Match URLs from CSS url(...)
         * Examples:
         * background-image:url(http://example.com/bg.jpg)
         * background:url('http://example.com/bg.jpg')
         */
        preg_match_all(
                '#url\s*\(\s*[\'"]?\Khttp://[^)"\'\s]+#i',
                $haystack,
                $css_urls
        );

        array_push( $result[0], ...$css_urls[0] );
    }

    public function save_scan_result() {
        $new_results = $this->scan_results;

        global $wpdb;

        $placeholders = array();
        $values       = array();

        foreach ( $new_results as $row ) {
            $placeholders[] = '(%s,%s,%s,%s)';
            array_push(
                    $values,
                    $row['source_table'],
                    $row['source_uid'],
                    isset( $row['cols_map'] ) ? serialize( $row['cols_map'] ) : array(),
                    isset( $row['meta_map'] ) ? serialize( $row['meta_map'] ) : array(),
            );
        }

        $query = "INSERT INTO {$wpdb->prefix}ehssl_resource_scan_tbl (source_table, source_uid, cols_map, meta_map) VALUES " . implode( ',', $placeholders );

        $query = $wpdb->prepare( $query, $values );

        return $wpdb->query( $query );
    }

    public static function get_scan_results_count( $skip_fixed = false ) {
        global $wpdb;
        $query =  "SELECT COUNT(*) FROM {$wpdb->prefix}ehssl_resource_scan_tbl";

        if ( $skip_fixed ) {
            $query .= " WHERE fixed != %d";
            $query = $wpdb->prepare( $query, 1 );
        }

        $count = $wpdb->get_var( $query );

        return (int) $count;
    }

    public static function get_scan_results_chunk( $offset = 0, $limit = 10, $where = array(), $skip_fixed = false ) {
        global $wpdb;

        $sql          = "SELECT * FROM {$wpdb->prefix}ehssl_resource_scan_tbl";
        $where_parts  = array();
        $prepare_args = array();

        if ($skip_fixed) {
            $where_parts[] = "fixed != 1";
        }

        foreach ( $where as $column => $ids ) {

            $column = sanitize_key( $column );

            if ( empty( $ids ) || ! is_array( $ids ) ) {
                continue;
            }

            $ids = array_map( 'absint', $ids );
            $ids = array_filter( $ids );

            if ( empty( $ids ) ) {
                continue;
            }

            $placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );

            $where_parts[] = "`{$column}` IN ({$placeholders})";

            $prepare_args = array_merge(
                    $prepare_args,
                    $ids
            );
        }

        if ( ! empty( $where_parts ) ) {
            $sql .= ' WHERE ' . implode( ' AND ', $where_parts );
        }

        $sql .= ' LIMIT %d OFFSET %d';

        $prepare_args[] = (int) $limit;
        $prepare_args[] = (int) $offset;

        $query = $wpdb->prepare( $sql, $prepare_args );

        return $wpdb->get_results( $query, ARRAY_A );
    }

    public function mark_items_fixed( &$batch ) {
        if (empty($batch) || !is_array($batch)) {
            return;
        }

        global $wpdb;

        $ids = array_column( $batch, 'id' );
        $ids = array_unique( $ids );

        if ( empty( $ids ) ) {
            return;
        }

        $placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );

        $sql = "UPDATE {$wpdb->prefix}ehssl_resource_scan_tbl SET `fixed` = 1 WHERE `id` IN ({$placeholders})";

        $query = $wpdb->prepare( $sql, $ids );

        $wpdb->query( $query );
    }

    public function clear_scan_results() {
        global $wpdb;
        $query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}ehssl_resource_scan_tbl;" );

        return $wpdb->query( $query );
    }

    public function handle_load_non_https_resources_table_page() {
        self::render_http_scan_result_table();

        wp_die();
    }

    public static function render_http_scan_result_table() {
        $table = new EHSSL_Static_Resources_Scan_Result_Table();
        $table->prepare_items();
        ?>
        <div class="wrap" id="nhs-table-container">
            <form method="post" id="ehssl_non_https_resources_table_form">
                <?php $table->display(); ?>
                <input type="hidden" name="ehssl_update_all_http_urls_nonce" value="<?php echo esc_attr( wp_create_nonce( 'ehssl_update_all_http_urls' ) ); ?>">
            </form>
        </div>
        <?php
    }

    public function handle_update_http_urls() {
        if ( ! check_ajax_referer( 'ehssl_update_all_http_urls', 'nonce', false ) ) {
            wp_send_json_error(
                    array(
                            'message' => __( 'Nonce verification failed!', 'https-redirection' ),
                    )
            );
        }

        $limit = $this->batch_size;
        $offset = isset( $_POST['offset'] ) ? absint( $_POST['offset'] ) : 0;
        $selected_ids = isset( $_POST['selected_ids'] ) ? json_decode(stripslashes($_POST['selected_ids'])) : null;

        $total = 0;

        if ( is_null( $selected_ids ) ) {
            // Need to update all items.
            $total = self::get_scan_results_count();
        } else {
            // Need to update selected items.
            $total = count( $selected_ids );
        }

        if ( empty( $total ) ) {
            wp_send_json_success(
                array(
                    'completed' => true,
                    'processed' => 0,
                )
            );
        }

        $batch = self::get_scan_results_chunk( $offset, $limit, array( 'id' => $selected_ids ) );

        if ( empty( $batch ) ) {
            wp_send_json_success(
                array(
                    'completed' => true,
                    'processed' => 0,
                )
            );
        }

        try {
            $this->update_urls( $batch );

            $this->mark_items_fixed($batch);

            $next_offset = $offset + count( $batch );

            $response = array(
                'message'     => __( 'URLs update to https successfully.', 'https-redirection' ),
                'completed'   => $next_offset >= $total,
                'processed'   => $next_offset,
                'total'       => $total,
                'next_offset' => $next_offset,
            );

            wp_send_json_success($response);

        } catch ( \Exception $e ) {
            EHSSL_Logger::log( $e->getMessage(), 4 );
            wp_send_json_error( array(
                    'message' => $e->getMessage(),
            ) );
        }
    }

    public function update_urls( &$batch ) {
        global $wpdb;
        foreach ( $batch as $item ) {
            switch ( $item['source_table'] ) {
                case $wpdb->posts:
                    $this->update_urls_in_post_type_item( $item );
                    break;
                case $wpdb->options:
                    $this->update_urls_in_option_table( $item );
                    break;
            }
        }
    }

    public function update_urls_in_post_type_item( &$item ) {
        $cols_map = isset( $item['cols_map'] ) ? maybe_unserialize( $item['cols_map'] ) : array();
        $meta_map = isset( $item['meta_map'] ) ? maybe_unserialize( $item['meta_map'] ) : array();

        $post_id = (int) $item['source_uid'];

        if (! empty( $cols_map ) ) {

            global $wpdb;
            $query = $wpdb->prepare( "SELECT ID, post_content, post_excerpt FROM {$wpdb->posts} WHERE ID = %d", $post_id );
            $post  = $wpdb->get_row( $query );
            if ( empty( $post ) ) {
                return;
            }

            $update_columns = array();

            foreach ( $cols_map as $column => $urls ) {
                if ( ! property_exists( $post, $column ) || empty( $urls )  ) {
                    continue;
                }

                $value = $post->$column;

                // Check if the column data is serialized or not.
                $was_serialized = is_serialized( $value );

                $value = $this->replace_urls_recursively( $value, $urls );

                if ( $was_serialized ) {
                    $value = maybe_serialize( $value );
                }

                $update_columns[ $column ] = $value;
            }

            if ( ! empty( $update_columns ) ) {
                $wpdb->update(
                        $wpdb->posts,
                        $update_columns,
                        array(
                            'ID' => $post_id
                        )
                );

                clean_post_cache( $post_id );
            }
        }

        if ( ! empty( $meta_map ) ) {
            $meta_keys_to_update = array_keys( $meta_map );
            $all_meta            = get_post_meta( $post_id );
            foreach ( $meta_keys_to_update as $meta_key ) {
                $value = isset($all_meta[$meta_key][0]) ? $all_meta[$meta_key][0] : '';

                $value = $this->replace_urls_recursively( $value, $meta_map[ $meta_key ] );

                update_post_meta( $post_id, $meta_key, $value );
            }
        }

    }

    public function update_urls_in_option_table( &$item ) {
        $cols_map = isset( $item['cols_map'] ) ? maybe_unserialize( $item['cols_map'] ) : '';

        $option_name = isset( $item['source_uid'] ) ? sanitize_key( $item['source_uid'] ) : '';

        if ( empty( $cols_map ) || empty( $option_name ) ) {
            return;
        }

        foreach ( $cols_map as $urls ) {
            if ( empty( $urls ) ) {
                continue;
            }

            $option_value = get_option( $option_name, '' );

            $option_value = $this->replace_urls_recursively( $option_value, $urls );

            update_option( $option_name, $option_value );
        }

    }

    public function replace_with_https( $http_url, $subject ) {
        $https_url = preg_replace( '#^http://#i', 'https://', $http_url );

        return str_replace( $http_url, $https_url, $subject );
    }

    /**
     * Makes sure it properly updates serialized data.
     */
    public function replace_urls_recursively( $value_to_update, $urls ) {
        $value_to_update = maybe_unserialize( $value_to_update );

        if ( is_array( $value_to_update ) ) {
            foreach ( $value_to_update as $key => $value ) {
                $value_to_update[ $key ] = $this->replace_urls_recursively( $value, $urls );
            }

            return $value_to_update;
        }

        if ( is_object( $value_to_update ) ) {
            foreach ( $value_to_update as $key => $value ) {
                $value_to_update->$key = $this->replace_urls_recursively( $value, $urls );
            }

            return $value_to_update;
        }

        if ( is_string( $value_to_update ) ) {
            foreach ( $urls as $url ) {
                $value_to_update = $this->replace_with_https( $url, $value_to_update );
            }
        }

        return $value_to_update;
    }

}

new EHSSL_Non_HTTPS_Resources_Scan_Update();                                                                                                                                                                                                                                                                                                                      classes/ehssl-email-handler.php                                                                     0000644                 00000012411 15266054577 0012550 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Email_handler {

	public static function send_expiry_notification_email( $cert_data ) {
		$settings = get_option( 'httpsrdrctn_options', array() );

		$content_type = isset( $settings['ehssl_expiry_notification_email_content_type'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_content_type'] ) : '';
		$from         = isset( $settings['ehssl_expiry_notification_email_from'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_from'] ) : '';
		$to           = isset( $settings['ehssl_expiry_notification_email_to'] ) ? sanitize_email( $settings['ehssl_expiry_notification_email_to'] ) : '';

		if ( empty( $to ) ) {
			EHSSL_Logger::log( 'Recipient email address could not be found to send expiry notification email.', 4 );

			return false;
		}

		$subj = isset( $settings['ehssl_expiry_notification_email_subject'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_subject'] ) : '';

		$body = isset( $settings['ehssl_expiry_notification_email_body'] ) ? sanitize_textarea_field( $settings['ehssl_expiry_notification_email_body'] ) : '';
		$body = self::apply_dynamic_tags( $body, $cert_data );

		$headers = array();
		if ( ! empty( $content_type ) && $content_type === 'html' ) {
			$headers[] = 'Content-Type: text/html; charset=UTF-8';
			$body      = nl2br( $body );
		}
		$headers[] = 'From: ' . $from;

		try {
			wp_mail( $to, $subj, $body, $headers );
			EHSSL_Logger::log( 'SSL certificate expiry notification email sent to : ' . $to . ', From email address used: ' . $from );

			return true;
		} catch ( \Exception $e ) {
			EHSSL_Logger::log( 'SSL certificate expiry notification email couldn\'t be sent to : ' . $to . ', From email address used: ' . $from, 4 );
		}

		return false;
	}

	public static function apply_dynamic_tags( $body, $data ) {
		$tags = array(
			'{label}',
			'{issuer}',
			'{issue_date}',
			'{issue_time}',
			'{issue_datetime}',
			'{expiry_date}',
			'{expiry_time}',
			'{expiry_datetime}',
			'{status}',
		);

		$values = array(
			$data['label'],
			$data['issuer'],
			EHSSL_Utils::parse_date( $data['issued_on'] ),
			EHSSL_Utils::parse_time( $data['issued_on'] ),
			EHSSL_Utils::parse_timestamp( $data['issued_on'] ),
			EHSSL_Utils::parse_date( $data['expires_on'] ),
			EHSSL_Utils::parse_time( $data['expires_on'] ),
			EHSSL_Utils::parse_timestamp( $data['expires_on'] ),
			ucfirst( EHSSL_SSL_Utils::get_certificate_status( $data['expires_on'] ) ),
		);

		return stripslashes( str_replace( $tags, $values, $body ) );
	}

	public static function get_merge_tags_hints() {
		ob_start()
		?>
        <div class="ehssl-settings-field-cat-3">
            <a href="#" class="ehssl-toggle toggled-off"> <?php _e( 'Click here to toggle email merge tag hints', 'https-redirection' ) ?></a>
            <div class="ehssl-tags-table-cont hidden">
                <table class="ehssl-tags-hint widefat striped">
                    <tbody>
                    <tr>
                        <td class="ehssl-tag-name"><b>{label}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The SSL certificate label', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{issuer}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The issuer of SSL certificate', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{issue_date}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The issuing date of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{issue_time}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The issuing time of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{issue_datetime}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The issuing datetime of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{expiry_date}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The expiry date of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{expiry_time}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The expiry time of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{expiry_datetime}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The expiry datetime of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    <tr>
                        <td class="ehssl-tag-name"><b>{status}</b></td>
                        <td class="ehssl-tag-descr"><?php _e('The current status of SSL certificate.', 'https-redirection') ?></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
		<?php
		return ob_get_clean();
	}
}                                                                                                                                                                                                                                                       classes/ehssl-custom-post-types.php                                                                 0000644                 00000001257 15266054577 0013513 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Custom_Post_Types {

	public static $instance;

	public static function get_instance() {
		if ( ! self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	private function __construct() {}

	public function register_custom_post_types() {
		$args = array(
			'supports'            => array( '' ),
			'hierarchical'        => false,
			'public'              => false,
			'show_ui'             => false,
			'can_export'          => false,
			'has_archive'         => false,
			'exclude_from_search' => true,
			'publicly_queryable'  => false,
			'capability_type'     => 'post',
		);
		register_post_type( 'ehssl_certs_info', $args );
	}
}                                                                                                                                                                                                                                                                                                                                                 classes/utilities/ehssl-ssl-utils.php                                                               0000644                 00000023025 15266054577 0014023 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_SSL_Utils {

	public static function get_current_domain() {
		return parse_url( home_url(), PHP_URL_HOST );
	}

	/**
	 * Retrieves the SSL info if have any
	 *
	 * @return array|bool The SSL information array.
	 */
	public static function get_ssl_info( $domain ) {
		$cert_info = [];

		$stream_context = stream_context_create( array(
			"ssl" => array(
				"capture_peer_cert" => true,
				// "verify_peer" => false,       // Disable verification for testing
				// "verify_peer_name" => false,  // Disable hostname verification
				// "allow_self_signed" => true,  // Allow self-signed certs
			)
		) );

		$err_str = '';
		$client = @stream_socket_client( "ssl://" . $domain . ":443", $errno, $err_str, 60, STREAM_CLIENT_CONNECT, $stream_context );

		if ( $client ) {
			$cert     = stream_context_get_params( $client );
			$cert_info = openssl_x509_parse( $cert['options']['ssl']['peer_certificate'] );
		}

		if (!empty($err_str)){
			EHSSL_Logger::log( $err_str, 4 );
		}

		return $cert_info;
	}

	public static function get_parsed_ssl_info($domain) {
		$cert_info = self::get_ssl_info( $domain );

		$parsed_cert_info = array();

		if ( !empty($cert_info) ) {
			$valid_from = $cert_info['validFrom_time_t'];
			$valid_to   = $cert_info['validTo_time_t'];

			// Get certificate issuer.
			$issuer_arr = array();
			$issuer_arr[] = isset($cert_info['issuer']['O'])  ? $cert_info['issuer']['O']  : '';
			$issuer_arr[] = isset($cert_info['issuer']['CN']) ? $cert_info['issuer']['CN'] : '';
			$issuer_arr[] = isset($cert_info['issuer']['C'])  ? $cert_info['issuer']['C']  : '';
			$issuer_arr = array_filter($issuer_arr);

			if (empty($issuer_arr)){
				$issuer = 'Unknown';
			} else {
				$issuer = implode(', ', $issuer_arr);
			}

			$subject    = isset($cert_info['subject']['CN']) ? $cert_info['subject']['CN'] : $domain;
			$cert_hash = md5( $issuer . $valid_from . $valid_to );
			$id = substr( $cert_hash, 0, 7 ); // Generate a short ID for Expiry Certificate list table.

			$parsed_cert_info = array(
				'id'         => $id,
				'label'      => $subject,
				'issuer'     => $issuer,
				'issued_on'  => $valid_from,
				'expires_on' => $valid_to,
				'cert_hash'  => $cert_hash,
			);
		}

		return $parsed_cert_info;
	}

	/**
	 * Get the parsed SSL info if any to display in the dashboard.
	 */
	public static function get_parsed_current_ssl_info_for_dashbaord() {
		$domain = self::get_current_domain();

		$info = self::get_ssl_info( $domain );

		if ( empty($info) ) {
			return false;
		}

		$certinfo = array(
			"Issued To"       => array(
				"Common Name (CN)"         => isset( $info['subject']['CN'] ) ? $info['subject']['CN'] : "N/A",
				"Organization (O)"         => isset( $info['subject']['O'] ) ? $info['subject']['O'] : "N/A",
				"Organizational Unit (OU)" => isset( $info['subject']['OU'] ) ? $info['subject']['OU'] : "N/A",
			),
			"Issued By"       => array(
				"Common Name (CN)"         => isset( $info['issuer']['CN'] ) ? $info['issuer']['CN'] : "N/A",
				"Organization (O)"         => isset( $info['issuer']['O'] ) ? $info['issuer']['O'] : "N/A",
				"Organizational Unit (OU)" => isset( $info['issuer']['OU'] ) ? $info['issuer']['OU'] : "N/A",
				"Country (C)" => isset( $info['issuer']['C'] ) ? $info['issuer']['C'] : "N/A",
			),
			"Validity Period" => array(
				"Issued On"  => isset( $info['validFrom_time_t'] ) ? EHSSL_Utils::parse_timestamp( $info['validFrom_time_t'] ) : "N/A",
				"Expires On" => isset( $info['validTo_time_t'] ) ? EHSSL_Utils::parse_timestamp( $info['validTo_time_t'] ) : "N/A",
			),
			// "SHA-256 Fingerprint" => array(
			//     "Certificate" => "",
			//     "Public Key" => "",
			// ),
		);

		return $certinfo;
	}

	public static function get_certificate_status( $expiry_timestamp ) {
		$expiry = (new DateTime())->setTimestamp(intval($expiry_timestamp));
		$now    = new DateTime();
		$diff   = $now->diff( $expiry );

		if ( $expiry < $now ) {
			return 'expired';
		} elseif ( $diff->days <= 7 ) {
			return 'critical';
		} elseif ( $diff->days <= 30 ) {
			return 'warning';
		} else {
			return 'active';
		}
	}

	public static function get_all_saved_certificates_info() {
		$certs_info = get_posts(array(
			'numberposts' => -1,
			'post_type' => 'ehssl_certs_info',
		));

		$data = [];
		foreach ( $certs_info as $cert_info ) {
			$data[] = array(
				'id' => get_post_meta($cert_info->ID, 'id', true ),
				'label' => get_post_meta($cert_info->ID, 'label', true ),
				'issuer' => get_post_meta($cert_info->ID, 'issuer', true ),
				'issued_on' => get_post_meta($cert_info->ID, 'issued_on', true ),
				'expires_on' => get_post_meta($cert_info->ID, 'expires_on', true ),
			);
		}

		return $data;
	}

	public static function check_and_save_current_cert_info() {
		$domain = self::get_current_domain();

		// Check if manual scan button was clicked. else the method ran using a cron event.
		if (isset($_POST['ehssl_scan_for_ssl_submit'])){
			EHSSL_Logger::log( 'Manually Scanning SSL certificate info for domain: ' . $domain);
		}

		$cert = self::get_parsed_ssl_info($domain);
		if (empty($cert)){
			// No ssl certificate found.
			EHSSL_Logger::log( "No SSL certificate info found for your current domain '".$domain."' !", 1 );
			return;
		}

		$cert_hash = isset($cert['cert_hash']) ? $cert['cert_hash'] : '';

		// Save SSL info as cpt if not saved already.
		$posts = get_posts( array(
			'post_type'      => 'ehssl_certs_info',
			'title'          => $cert_hash,
			'posts_per_page' => 1, // We only need one post
			'exact'          => true, // Ensure an exact title match
			'suppress_filters' => true, // Bypass filters for more predictable results
		) );

		if ( empty( $posts ) ) {
			EHSSL_Logger::log( 'Scanning for SSL certificate info...');

			$post_id = wp_insert_post( array(
				'post_title'    => $cert_hash,
				'post_content'  => '',
				'post_status'   => 'publish',
				'post_type'     => 'ehssl_certs_info',
			) );

			if ( is_wp_error( $post_id ) ) {
				EHSSL_Logger::log($post_id->get_error_message(), 4);
				return;
			}

			update_post_meta($post_id, 'id', $cert['id']);
			update_post_meta($post_id, 'label', $cert['label']);
			update_post_meta($post_id, 'issuer', $cert['issuer']);
			update_post_meta($post_id, 'issued_on', $cert['issued_on']);
			update_post_meta($post_id, 'expires_on', $cert['expires_on']);

			EHSSL_Logger::log( 'New certificate info captured. ID: ' . $cert['id']);
		} else {
			EHSSL_Logger::log( 'Current SSL info already saved. No new SSL certificate info found.');
		}
	}

	public static function check_and_send_notification_emails(){
		$settings = get_option( 'httpsrdrctn_options', array());

		$expiry_notification_enabled = isset( $settings['ehssl_enable_expiry_notification'] ) ? sanitize_text_field( $settings['ehssl_enable_expiry_notification'] ) : '';
		$expiry_notification_email_before_days = isset( $settings['ehssl_expiry_notification_email_before_days'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_before_days'] ) : '';

		if (empty($expiry_notification_enabled) || !is_numeric($expiry_notification_email_before_days)){
			return;
		}

		$domain = self::get_current_domain();

		$cert = self::get_parsed_ssl_info($domain);
		if (empty($cert)){
			// No SSL certificate found.
			return;
		}

		EHSSL_Logger::log( 'Checking if certificate expiry notification email need to be sent...');

		$expiry_timestamp = $cert['expires_on'];

		$expiry = (new DateTime())->setTimestamp( $expiry_timestamp );
		$now    = new DateTime();
		$diff   = $now->diff( $expiry );

		if ( $diff->days > intval($expiry_notification_email_before_days) ) {
			// Still many days left for expiry. Nothing to do.
			EHSSL_Logger::log( 'Certificate expiry date is more than ' . $expiry_notification_email_before_days . ' days away. No email will be sent.');
			return;
		}

		$cert_hash = $cert['cert_hash'];
		$posts = get_posts( array(
			'post_type'      => 'ehssl_certs_info',
			'title'          => $cert_hash,
			'posts_per_page' => 1, // We only need one post
			'exact'          => true, // Ensure an exact title match
			'suppress_filters' => true, // Bypass filters for more predictable results
		) );

		$post = !empty($posts) ? $posts[0] : null;

		// Check whether the notification email has already sent or not.
		if (empty($post) || empty(get_post_meta($post->ID, 'expiry_notification_email_sent', true)) ){
			// Notification email hasn't been sent yet. Send email now.
			$is_sent = EHSSL_Email_handler::send_expiry_notification_email($cert);

			update_post_meta($post->ID, 'expiry_notification_email_sent', $is_sent);
		}
	}

	/**
	 * Should be used for debug purpose only.
	 */
	public static function delete_all_certificate_info() {
		global $wpdb;

		$post_type = 'ehssl_certs_info';

		// Query to get all post IDs of the specified custom post type.
		$post_ids = $wpdb->get_col( $wpdb->prepare(
			"SELECT ID FROM {$wpdb->posts} WHERE post_type = %s",
			$post_type
		) );

		if ( $post_ids ) {
			foreach ( $post_ids as $post_id ) {
				/**
				 * wp_delete_post() permanently deletes a post.
				 * The second parameter, 'true', forces deletion bypassing the Trash.
				 */
				wp_delete_post( $post_id, true );
			}

			EHSSL_Logger::log('SSL certificate info was deleted successfully.');

			return true;
		}

		// No saved ssl certificates info found.
		EHSSL_Logger::log('No saved SSL certificate info was detected for deletion.');
		return false;
	}

	/**
	 * Check whether ssl certificate is installed and active.
	 *
	 * @return bool
	 */
	public static function is_ssl_installed() {
		if (is_ssl() && !empty(EHSSL_SSL_Utils::get_ssl_info(EHSSL_SSL_Utils::get_current_domain()))) {
			return true;
		}

		return false;
	}
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           classes/utilities/ehssl-utils.php                                                                   0000644                 00000011122 15266054577 0013217 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Utils
{
    public static function httpsrdrctn_force_https_embeds($content)
    {
        $files_to_check = array('jpg', 'jpeg', 'gif', 'png', 'js', 'css');

        if (strpos(home_url(), 'https') !== false) {
            $http_domain = str_replace('https', 'http', home_url());
        } else {
            $http_domain = home_url();
        }

        $matches = array();
        $pattern = '/' . str_replace('/', '\/', quotemeta($http_domain)) . '\/[^\"\']*\.[' . implode("|", $files_to_check) . ']+/';

        preg_match_all($pattern, $content, $matches);

        if (!empty($matches)) {
            foreach ($matches[0] as $match) {
                $match_https = str_replace('http', 'https', $match);
                $content = str_replace($match, $match_https, $content);
            }
        }

        return $content;
    }

    public static function redirect_to_url( $url, $delay = '0', $exit = '1' ) {
		$url = apply_filters( 'wpec_before_redirect_to_url', $url );
		if ( empty( $url ) ) {
			echo '<strong>';
			_e( 'Error! The URL value is empty. Please specify a correct URL value to redirect to!', 'wp-express-checkout' );
			echo '</strong>';
			exit;
		}
		if ( ! headers_sent() ) {
			header( 'Location: ' . $url );
		} else {
			echo '<meta http-equiv="refresh" content="' . $delay . ';url=' . $url . '" />';
		}

		if ( $exit == '1' ) {//exit
			exit;
		}
	}

    /*
     * Get the current domain name. Example: example.com
     */
    public static function get_domain(){
        // Get the home URL
        $home_url = get_home_url();        

        // Parse the URL to extract components
        $parsed_url = parse_url($home_url);

        // Get the host part of the URL
        $domain = isset($parsed_url['host']) ? $parsed_url['host'] : '';

        return $domain;
    }

    //returns www domain if passed domain is without www
    //other wise return without domain
    public static function get_domain_variant($domain)
    {   
        // Check if the domain starts with 'www.'
        if (substr($domain, 0, 4) === 'www.') {
            // Remove 'www.' from the domain
            return substr($domain, 4);
        } else {
            // Add 'www.' to the domain
            return 'www.' . $domain;
        }
    }


    public static function is_domain_accessible($url) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, true);    // we want headers
        curl_setopt($ch, CURLOPT_NOBODY, true);    // we don't need body
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_TIMEOUT,10);
        $output = curl_exec($ch);
        $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        return ($httpcode >= 200 && $httpcode < 400);
    }

	public static function parse_timestamp( $timestamp ) {
		$timestamp = intval($timestamp);

		$timezone_string = new DateTimeZone(wp_timezone_string());

		$dateTime = new DateTime();
		$dateTime->setTimestamp( $timestamp );
		$dateTime->setTimezone( $timezone_string );

		$formatted_date_time = $dateTime->format( get_option('date_format') . ' \a\t ' . get_option( 'time_format' ) );

		return $formatted_date_time;
	}

	public static function parse_date( $timestamp ) {
		$timestamp = intval($timestamp);

		$timezone_string = new DateTimeZone(wp_timezone_string());

		$dateTime = new DateTime();
		$dateTime->setTimestamp( $timestamp );
		$dateTime->setTimezone( $timezone_string );

		$formatted_date_time = $dateTime->format( get_option('date_format') );

		return $formatted_date_time;
	}

	public static function parse_time( $timestamp ) {
		$timestamp = intval($timestamp);

		$timezone_string = new DateTimeZone(wp_timezone_string());

		$dateTime = new DateTime();
		$dateTime->setTimestamp( $timestamp );
		$dateTime->setTimezone( $timezone_string );

		$formatted_date_time = $dateTime->format( get_option('time_format') );

		return $formatted_date_time;
	}

	public static function get_missing_extensions() {
		$required_extensions = array('curl', 'openssl');

		$missing_extensions = array();
		foreach ($required_extensions as $extension){
			if (! extension_loaded($extension)){
				$missing_extensions[] = $extension;
			}
		}

		return $missing_extensions;
	}
}

/***
 * Test Code
 */
/*
echo httpsrdrctn_force_https_embeds( '<img src="http://test.com/image.jpg" />
<a href="http://test.com/image.jpeg"></a>
"http://test.com/image.gif"
<img src="http://test.com/image.png" />
<link rel="javascript" type="text/javascript" href="http://test.com/somescript.js" />
<link rel="stylesheet" type="text/css" href="http://test.com/somestyles.css" />
http://test.com/somescript.bmp' );
*/                                                                                                                                                                                                                                                                                                                                                                                                                                              admin/ehssl-admin-init.php                                                                          0000644                 00000024402 15266054577 0011535 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/**
 * Inits the admin dashboard side of things.
 * Main admin file which loads all settings panels and sets up admin menus.
 */
class EHSSL_Admin_Init
{
    public $main_menu_page;
    public $dashboard_menu;
    public $settings_menu;

    public function __construct()
    {
        $this->admin_includes();
        add_action('admin_print_scripts', array($this, 'admin_menu_page_scripts'));
        add_action('admin_print_styles', array($this, 'admin_menu_page_styles'));
        add_action('admin_menu', array($this, 'create_admin_menus'));
        add_action('admin_init', array($this, 'plugin_admin_init'));
        add_action('admin_enqueue_scripts', array($this, 'plugin_admin_head'));

        //Handle any admin notices.
        add_action('admin_notices', array($this, 'easy_https_plugin_admin_notices'));
    }

    public function admin_includes()
    {
        include_once 'ehssl-admin-menu.php';
        include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-rules-helper.php';

	    // TODO: Need to work on this later.
        // require_once EASY_HTTPS_SSL_PATH."/vendor/autoload.php";
        // include_once EASY_HTTPS_SSL_PATH . '/classes/ehssl-ssl-certificate.php';
    }

    public function admin_menu_page_scripts()
    {
        // Make sure we are on the appropriate menu page.
        if (isset($_GET['page']) && strpos($_GET['page'], EHSSL_MENU_SLUG_PREFIX) !== false) {
            wp_enqueue_script('postbox');
            wp_enqueue_script('dashboard');
            wp_enqueue_script('thickbox');
            wp_enqueue_script('media-upload');
        }
    }

    public function admin_menu_page_styles()
    {
        // Make sure we are on the appropriate menu page.
        if (isset($_GET['page']) && strpos($_GET['page'], EHSSL_MENU_SLUG_PREFIX) !== false) {
            wp_enqueue_style('dashboard');
            wp_enqueue_style('thickbox');
            wp_enqueue_style('global');
            wp_enqueue_style('wp-admin');
            wp_enqueue_style('ehssl-admin-css', EASY_HTTPS_SSL_URL . '/css/ehssl-admin-styles.css');
        }
    }

    public function create_admin_menus() {
        //Going to use the lock dashicon for the menu icon for now.
        $menu_icon_url = 'dashicons-lock';
        //$menu_icon_url = EASY_HTTPS_SSL_URL . '/images/plugin-icon.png';

        $this->main_menu_page = add_menu_page(__('Easy HTTPS & SSL', 'https-redirection'), __('Easy HTTPS & SSL', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, EHSSL_MAIN_MENU_SLUG, array($this, 'handle_dashboard_menu_rendering'), $menu_icon_url);
        add_submenu_page(EHSSL_MAIN_MENU_SLUG, __('Dashboard', 'https-redirection'), __('Dashboard', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, EHSSL_MAIN_MENU_SLUG, array($this, 'handle_dashboard_menu_rendering'));
        add_submenu_page(EHSSL_MAIN_MENU_SLUG, __('Settings', 'https-redirection'), __('Settings', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, EHSSL_SETTINGS_MENU_SLUG, array($this, 'handle_settings_menu_rendering'));
        add_submenu_page(EHSSL_MAIN_MENU_SLUG, __('Certificate Expiry', 'https-redirection'), __('Certificate Expiry', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, EHSSL_CERTIFICATE_EXPIRY_MENU_SLUG, array($this, 'handle_certificate_expiry_menu_rendering'));

		// TODO: Need to work on this menu.
		// add_submenu_page(EHSSL_MAIN_MENU_SLUG, __('SSL Management', 'https-redirection'), __('SSL Management', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, EHSSL_SSL_MGMT_MENU_SLUG, array($this, 'handle_ssl_mgmt_menu_rendering'));
        
        //Keeping the old settings menu for now for backwards compatibility. There is a link to the new settings page in the old settings menu.
        add_submenu_page('options-general.php', __('HTTPS Redirection', 'https-redirection'), __('HTTPS Redirection', 'https-redirection'), EHSSL_MANAGEMENT_PERMISSION, 'https-redirection', array($this, 'handle_settings_menu_rendering_old'));

        //Trigger the action for the menu creation.
        do_action('ehssl_admin_menu_created');
    }

    public function handle_dashboard_menu_rendering()
    {
        include_once EASY_HTTPS_SSL_PATH . '/admin/ehssl-dashboard-menu.php';
        $this->dashboard_menu = new EHSSL_Dashboard_Menu();
    }

    public function handle_settings_menu_rendering()
    {
        include_once EASY_HTTPS_SSL_PATH . '/admin/ehssl-settings-menu.php';
        $this->settings_menu = new EHSSL_Settings_Menu();
    }

    public function handle_certificate_expiry_menu_rendering()
    {
        include_once EASY_HTTPS_SSL_PATH . '/admin/ehssl-certificate-expiry-menu.php';
        $this->settings_menu = new EHSSL_Certificate_Expiry_Menu();
    }

    public function handle_settings_menu_rendering_old()
    {
        include_once EASY_HTTPS_SSL_PATH . '/admin/ehssl-settings-menu-old.php';
        $this->settings_menu = new EHSSL_Settings_Menu_Old();
    }

    public function handle_ssl_mgmt_menu_rendering()
    {
        include_once EASY_HTTPS_SSL_PATH . '/admin/ehssl-ssl-management-menu.php';
        $this->settings_menu = new EHSSL_SSL_MGMT_Menu();
    }

    public function plugin_admin_init()
    {
        global $httpsrdrctn_plugin_info;

        $httpsrdrctn_plugin_info = get_plugin_data(__FILE__, false);

        /* Call register settings function */
        if (isset($_GET['page']) && "ehssl_settings" == $_GET['page']) {
            $this->register_httpsrdrctn_settings();
        }

        $this->handle_log_file_action();

        add_action( 'wp_ajax_ehssl_reset_log', array( $this, 'handle_reset_log' ) );
        add_action('wp_ajax_ehssl_save_dashboard_order', array($this, 'handle_save_dashboard_sorting_order'));
    }

    /**
     * Register settings function
     */
    public function register_httpsrdrctn_settings()
    {
        global $wpmu, $httpsrdrctn_options, $httpsrdrctn_plugin_info;

        $httpsrdrctn_option_defaults = array(
            'https' => 0,
            'https_domain' => 1,
            'https_pages_array' => array(),
            'force_resources' => 0,
            'plugin_option_version' => $httpsrdrctn_plugin_info["Version"],
        );

        // Install the option defaults.
        if (1 == $wpmu) {
            if (!get_site_option('httpsrdrctn_options')) {
                add_site_option('httpsrdrctn_options', $httpsrdrctn_option_defaults, '', 'yes');
            }

        } else {
            if (!get_option('httpsrdrctn_options')) {
                add_option('httpsrdrctn_options', $httpsrdrctn_option_defaults, '', 'yes');
            }
        }

        // Get options from the database.
        if (1 == $wpmu) {
            $httpsrdrctn_options = get_site_option('httpsrdrctn_options');
        } else {
            $httpsrdrctn_options = get_option('httpsrdrctn_options');
        }

        // Array merge incase this version has added new options.
        if (!isset($httpsrdrctn_options['plugin_option_version']) || $httpsrdrctn_options['plugin_option_version'] != $httpsrdrctn_plugin_info["Version"]) {
            $httpsrdrctn_options = array_merge($httpsrdrctn_option_defaults, $httpsrdrctn_options);
            $httpsrdrctn_options['plugin_option_version'] = $httpsrdrctn_plugin_info["Version"];
            update_option('httpsrdrctn_options', $httpsrdrctn_options);
        }
    }

    public function plugin_admin_head()
    {
         wp_enqueue_script('ehssl_script', EASY_HTTPS_SSL_URL . '/js/script.js', array('jquery'), EASY_HTTPS_SSL_VERSION);
    }

    public function handle_log_file_action()
    {
        if (isset($_GET['ehssl-debug-action']) && esc_attr($_GET['ehssl-debug-action']) === 'view_log') {
            if ( ! user_can( wp_get_current_user(), 'administrator' ) ) {
                // User is not an admin
                return;
            }
            $this->handle_view_log();
        }
    }

    public function handle_view_log()
    {
        if (!check_admin_referer('ehssl_view_log_nonce')) {
            //The nonce check failed
            echo 'Error! Nonce security check failed. Could not reset the log file.';
            wp_die(0);
        }

        $filename = EHSSL_Logger::get_log_file();
        if (file_exists($filename)) {
            $logfile = fopen(EHSSL_Logger::get_log_file(), 'rb');
            header('Content-Type: text/plain');
            fpassthru($logfile);
        }
        die;
    }

    public function handle_reset_log()
    {
        if (!current_user_can('manage_options')) {
            EHSSL_Logger::log("Error! No permission to reset log file.");
            //No permission for the current user to do this operation.
            wp_die(0);
        }

        if (!check_ajax_referer('ehssl_settings_ajax_nonce', 'nonce', false)) {
            //The nonce check failed
            echo 'Error! Nonce security check failed. Could not reset the log file.';
            wp_die(0);
        }

        $file_name = EHSSL_Logger::get_log_file_name();

        EHSSL_Logger::reset_log_file($file_name);

        echo '1';
		wp_die();
    }

    public function handle_save_dashboard_sorting_order(){
        global $httpsrdrctn_options;

        if (isset($_POST['ehssl_sort_order']) && ! empty($_POST['ehssl_sort_order'])) {
            $sorting_data = $_POST['ehssl_sort_order'];
            $httpsrdrctn_options['dashboard_widget_sort_order'] = json_encode($sorting_data);
            update_option('httpsrdrctn_options', $httpsrdrctn_options);
            wp_send_json_success( $httpsrdrctn_options['dashboard_widget_sort_order'] );
          } else {
            wp_send_json_error("Invalid request");
          }

          // Always exit to avoid further execution
          wp_die();
    }

    public function easy_https_plugin_admin_notices() {
        $missing_extensions = EHSSL_Utils::get_missing_extensions();
        if (!empty($missing_extensions)){
            $output = '<div class="notice notice-error">';
            $output .= '<p><b>'.__('NOTE:', 'https-redirection').'</b> ';
            $output .= __('The following php extensions are missing which is required by this plugin to work properly. Contact you hosting provider enable this.', 'https-redirection');
            $output .= '<ol>';
            foreach ($missing_extensions as $ext){
                $output .= '<li>'. $ext .'</li>';
            }
            $output .= '</ol>';
            $output .= '</p>';
            $output .= '</div>';

            echo $output;
        }
    }

} //End of class
                                                                                                                                                                                                                                                              admin/ehssl-settings-menu-old.php                                                                   0000644                 00000001600 15266054577 0013055 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Settings_Menu_Old extends EHSSL_Admin_Menu
{
    public $menu_page_slug = EHSSL_SETTINGS_MENU_SLUG;

    public function __construct()
    {
        $this->render_menu_page();
    }

    public function render_menu_page()
    {
        ?>
        <div class="wrap">
            <h2><?php _e("HTTPS Redirection Settings", 'https-redirection') ?></h2>
			<div class="notice notice-warning">
				<p>
				<?php _e('The HTTPS Redirection settings have been upgraded and relocated to a new menu page titled <strong>Easy HTTPS & SSL</strong>. We have also added new features to enhance the plugin. Click the link below to access the new settings page.','https-redirection');?>
				<br>
				<br>
				<a class="button-primary" href="admin.php?page=ehssl_settings"><?php _e('Go to the New Settings Page','https-redirection');?></a>
				</p>
			</div>
        </div>
        <?php
    }
}                                                                                                                                admin/ehssl-dashboard-menu.php                                                                      0000644                 00000013331 15266054577 0012374 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Dashboard_Menu extends EHSSL_Admin_Menu
{
    public $menu_page_slug = EHSSL_MAIN_MENU_SLUG;

    // Specify all the tabs of this menu in the following array
    public $dashboard_menu_tabs = array(
        'status' => 'Status',
        // 'tab2' => 'Tab Two'
    );

    public function get_current_tab()
    {
        $tab = isset($_GET['tab']) ? $_GET['tab'] : array_keys($this->dashboard_menu_tabs)[0];
        return $tab;
    }

    /**
     * Renders our tabs of this menu as nav items
     */
    public function render_page_tabs()
    {
        $current_tab = $this->get_current_tab();
        foreach ($this->dashboard_menu_tabs as $tab_key => $tab_caption) {
            $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
            echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
        }
    }

    /**
     * The menu rendering goes here
     */
    public function render_menu_page()
    {
        $tab = $this->get_current_tab();
        ?>
        <div class="wrap">
            <h2><?php _e("Dashboard", 'https-redirection') ?></h2>
            <h2 class="nav-tab-wrapper"><?php $this->render_page_tabs(); ?></h2>
            <div id="poststuff">
                <div id="post-body">
                    <?php
                    $tab_keys = array_keys($this->dashboard_menu_tabs);
                    switch ($tab) {
                        case 'status':
                        default:
                            $this->render_status_tab();
                            break;
                    }
                    ?>
                </div>
            </div>
        </div><!-- end or wrap -->
        <?php
    }

    public function render_status_tab()
    {
    ?>
        <div id="ehssl-dashboard-widgets-wrap">
            <div id="ehssl-dashboard-widgets" class="metabox-holder">
                <div class="ehssl-dashboard-widget-column postbox-container">
                    <?php $this->widget_ssl_status(); ?>
                </div>
                <div class="ehssl-dashboard-widget-column postbox-container">
                    <?php $this->widget_ssl_info(); ?>
                </div>
                <div class="ehssl-dashboard-widget-column postbox-container">
                    <!-- Widgets here -->
                </div>
            </div>
        </div>
        <style>
            #ehssl-dashboard-widgets{
                display: flex;
                justify-content: space-around;
            }
            .ehssl-dashboard-widget-column {
                flex: 1;
                background-color: transparent;
                min-width: 200px;
            }
            .ehssl-dashboard-widget-column .postbox {
                margin: 0px 8px 28px;
            }
        </style>
    <?php
    }

    public function widget_ssl_status()
    {
    ?>
        <div id="ehssl_dashboard_ssl_status" class="sortable-item postbox"  data-item-id="1">
            <div class="postbox-header handle">
                <h2><?php _e("SSL Status", 'https-redirection'); ?></h2>
            </div>

            <div class="inside">
                <div style="padding: 12px 0 6px; display: flex; align-items: center; flex-direction: column;">
                    <?php if ($this->is_ssl_installed) { ?>
                        <div style="color: green; height: 5rem">
                            <span class="dashicons dashicons-lock" style="transform: scale(4); transform-origin: top center;"></span>
                        </div>
                        <div>
                            <?php _e('Your site is protected!', 'https-redirection') ?>
                        </div>
                    <?php } else { ?>
                        <div style="color: #cc0000; height: 5rem">
                            <span class="dashicons dashicons-dismiss" style="transform: scale(4); transform-origin: top center;"></span>
                        </div>
                        <div>
                            <?php _e('No SSL found!', 'https-redirection') ?>
                        </div>
                    <?php } ?>
                </div>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
    <?php
    }

    public function widget_ssl_info() {
        if (empty($this->is_ssl_installed)) {
            return;
        }

        $ssl_info = EHSSL_SSL_Utils::get_parsed_current_ssl_info_for_dashbaord();
    ?>
        <div id="ehssl_dashboard_ssl_info" class="sortable-item postbox" data-item-id="2">
            <div class="postbox-header handle">
                <h2><?php _e("SSL Information", 'https-redirection'); ?></h2>
            </div>
            <div class="inside">
                <table>
                    <?php foreach ($ssl_info as $section => $fields) { ?>
                        <tr valign="top" style="margin: 24px 0;">
                            <td scope="row">
                                <b style="font-weight: bold;">
                                    <?php _e($section, 'https-redirection'); ?>
                                </b>
                            </td>
                            <th></th>
                            <th></th>
                        </tr>
                        <?php foreach ($fields as $field => $value) { ?>
                            <tr valign="top">
                                <td><?php _e($field, 'https-redirection'); ?></td>
                                <td> : </td>
                                <td><?php echo $value ?></td>
                            </tr>
                        <?php } ?>
                    <?php } ?>
                </table>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
    <?php
    }

} //end class                                                                                                                                                                                                                                                                                                       admin/index.php                                                                                     0000644                 00000000077 15266054577 0007501 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

/**
 * Do not modify the files in this folder.
 */
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 admin/ehssl-ssl-management-menu.php                                                                 0000644                 00000025530 15266054577 0013364 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_SSL_MGMT_Menu extends EHSSL_Admin_Menu
{
    public $menu_page_slug = EHSSL_SSL_MGMT_MENU_SLUG;

    // Specify all the tabs of this menu in the following array.
    public $dashboard_menu_tabs = array('get-ssl' => 'Get SSL', 'install-ssl' => 'Install SSL');

    public function __construct()
    {
        $this->render_menu_page();
    }

    public function get_current_tab()
    {
        $tab = isset($_GET['tab']) ? $_GET['tab'] : array_keys($this->dashboard_menu_tabs)[0];
        return $tab;
    }

    /**
     * Renders our tabs of this menu as nav items
     */
    public function render_page_tabs()
    {
        $current_tab = $this->get_current_tab();
        foreach ($this->dashboard_menu_tabs as $tab_key => $tab_caption) {
            $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
            echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
        }
    }

    /**
     * The menu rendering goes here
     */
    public function render_menu_page()
    {
        $tab = $this->get_current_tab();
        ?>
        <div class="wrap">
            <h2><?php _e("SSL Management", 'https-redirection') ?></h2>
            <h2 class="nav-tab-wrapper"><?php $this->render_page_tabs(); ?></h2>
            <div id="poststuff">
                <div id="post-body">
                    <?php
                    switch ($tab) {
                        case 'install-ssl':
                            //include_once('file-to-handle-this-tab-rendering.php');//If you want to include a file
                            $this->render_tab_2();
                            break;
                        case 'get-ssl':
                        default:
                            //include_once('file-to-handle-this-tab-rendering.php');//If you want to include a file
                            $this->render_tab_1();
                            break;
                    }
                    ?>
                </div>
            </div>
        </div><!-- end or wrap -->
        <?php
    }

    public function render_tab_1()
    {
        //Render tab 1
        if (EHSSL_Utils::get_domain() == "localhost" || filter_var(EHSSL_Utils::get_domain(), FILTER_VALIDATE_IP)) {
            _e("The SSL Certificates required for HTTPS cannot be issued for WordPress sites that are based on 'localhost' or use an IP address. To effectively utilize SSL certificates, and hence to make the most from our plugin, you should operate your WordPress site on a standard domain. This limitation is not specific from our plugin but is a general rule in the issuance of SSL certificates.", 'https-redirection');
            wp_die();
        }

        global $httpsrdrctn_options;

        // Save data for tab 1
        if (isset($_POST['ehssl_get_ssl_form_submit']) && check_admin_referer('ehssl_get_ssl_nonce')) {
            $httpsrdrctn_options['ehssl_email_for_ssl_certificate'] = isset($_POST['ehssl_email_for_ssl_certificate']) ? sanitize_email($_POST['ehssl_email_for_ssl_certificate']) : get_option('admin_email');
            $httpsrdrctn_options['ehssl_ssl_certificate_mode'] = isset($_POST['ehssl_ssl_certificate_mode']) ? sanitize_text_field($_POST['ehssl_ssl_certificate_mode']) : '';
            update_option('httpsrdrctn_options', $httpsrdrctn_options);

            $is_live_ssl_mode = $httpsrdrctn_options['ehssl_ssl_certificate_mode'] === 'live';

            //EHSSL_SSL_Certificate
            $ssl_certificate = new EHSSL_SSL_Certificate();
            $ssl_certificate_status = $ssl_certificate->handle_ssl_installation($httpsrdrctn_options['ehssl_email_for_ssl_certificate'], $is_live_ssl_mode);

            if (is_wp_error($ssl_certificate_status)) {
                $certificate_error = $ssl_certificate_status->get_error_message();
                if (stripos($certificate_error, '429 Too many Requests') !== false) {
                    $certificate_error = "Too many certificate requests, try again in few hours";
                }
        ?>
                <div class="notice notice-error">
                    <p><?php _e("Error getting SSL:", 'https-redirection'); ?> <?php echo $certificate_error; ?></p>
                </div>
            <?php
            } else { ?>
                <div class="notice notice-success">
                    <p><?php _e($ssl_certificate_status, 'https-redirection'); ?> </p>
                    <?php
                    $certificate_urls = EHSSL_SSL_Certificate::get_certificate_urls();

                    echo "<ul>";
                    foreach ($certificate_urls as $key => $url) {
                        echo "<li><a href='{$url}'>{$key}</a></li>";
                    }
                    echo "</ul>";
                    ?>
                </div>
            <?php
            }
            ?>
        <?php
        }

        $ehssl_ssl_certificate_generator_email = isset($httpsrdrctn_options['ehssl_email_for_ssl_certificate']) ? sanitize_email($httpsrdrctn_options['ehssl_email_for_ssl_certificate']) : '';
        $ehssl_ssl_certificate_mode = isset($httpsrdrctn_options['ehssl_ssl_certificate_mode']) ? sanitize_text_field($httpsrdrctn_options['ehssl_ssl_certificate_mode']) : 'staging';


        ?>
        <div class="postbox">
            <h3 class="hndle"><label for="title">Get SSL</label></h3>
            <div class="inside">
                <form method="post" action="">
                    <p>
                        SSL certificate will be generated for the domain:<br>
                        <b><?php echo EHSSL_Utils::get_domain(); ?></b>
                        <?php
                        $domain_variant = EHSSL_Utils::get_domain_variant(EHSSL_Utils::get_domain());
                        if (EHSSL_Utils::is_domain_accessible($domain_variant)) {
                            echo "<br><b>" . $domain_variant . "</b>";
                        }
                        ?>
                    </p>
                    
                    <table class="form-table">
                        <!-- Certificate mode field -->
                        <tr valign="top">
                            <th scope="row">
                               <span><?php _e('SSL certificate mode:', 'https-redirection'); ?></span>
                            </th>
                            <td>
                                <label><input type="radio" name="ehssl_ssl_certificate_mode" value="staging" style="margin-left: 12px;" <?php if ('staging' == $ehssl_ssl_certificate_mode) {echo "checked=\"checked\" ";}?>><?php _e('Staging', 'https-redirection') ?></label>
                                <label><input type="radio" name="ehssl_ssl_certificate_mode" value="live" style="margin-left: 12px;" <?php if ('live' == $ehssl_ssl_certificate_mode) {echo "checked=\"checked\" ";}?>><?php _e('Live', 'https-redirection') ?></label>
                            </td>
                        </tr>
                         <!-- Email address field -->
                        <tr valign="top">
                            <th scope="row">
                                <label for="ehssl_email_for_ssl_certificate"><?php _e('Email Address:', 'https-redirection'); ?></label>
                            </th>
                            <td>
                                <input type="email" id="ehssl_email_for_ssl_certificate" value="<?php echo esc_attr($ehssl_ssl_certificate_generator_email) ?>" name="ehssl_email_for_ssl_certificate" style="margin-left: 12px;" required>
                            </td>
                        </tr>
                    </table>

                    <!-- Submit button -->
                    <input type="submit" name="ehssl_get_ssl_form_submit" class="button-primary" value="<?php _e('Generate SSL Certificate', 'https-redirection') ?>" />
                    <?php wp_nonce_field('ehssl_get_ssl_nonce'); ?>
                                
                </form>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
    <?php
    }

    public function render_tab_2()
    {
        //Render tab 1
    ?>
        <div class="postbox">
            <h3 class="hndle"><label for="title">Install SSL</label></h3>
            <?php
            global $httpsrdrctn_options;
            $certificate_urls = EHSSL_SSL_Certificate::get_certificate_urls();
            ?>
            <div class="inside">
                <?php if (is_wp_error($certificate_urls)) { ?>
                    <div class="ehssl-yellow-box">
                            <?php echo $certificate_urls->get_error_message();?>
                    </div>
                <?php } else { ?>
                    <p>Please follow <a href="">this guide</a> to install SSL certificate</p>
                    <p>Certificate Expiry: <?php echo isset($httpsrdrctn_options['ehssl_expiry_ssl_certificate']) ? esc_attr($httpsrdrctn_options['ehssl_expiry_ssl_certificate']) : "" ?></p>
                    <ol>
                        <li>
                            <h4><?php _e('Get Certificate Files', 'https-redirection')?></h4>
                            <p><?php _e('Some documentation goes here...' , 'https-redirection') ?></p>
                            <table class="form-table">
                                <?php foreach ($certificate_urls as $key => $file) { ?>
                                    <tr>
                                        <th><?php esc_attr_e($key) ?></th>
                                        <td>
                                            <input type="text" style="width: 80%; margin-right: 4px" readonly value="<?php echo esc_url($file['path']); ?>" /><button class="button-primary"><?php _e('Copy File Path', 'https-redirection') ?></button>
                                        </td>
                                        <td>
                                            <a href='<?php echo esc_url($file['url'])?>' class="button-secondary"><?php _e('Download File', 'https-redirection') ?></a>
                                            <a href='#' class="button-secondary"><?php _e('Copy File Content', 'https-redirection') ?></a>
                                        </td>
                                    </tr>
                                <?php } ?>
                            </table>
                        </li>
                        <li>
                            <h4><?php _e('Add the certificate file paths', 'https-redirection')?></h4>
                            <p><?php _e('Some documentation goes here...' , 'https-redirection') ?></p>
                        </li>
                        <li>
                            <h4><?php _e('Restart the server', 'https-redirection')?></h4>
                            <p><?php _e('Some documentation goes here...' , 'https-redirection') ?></p>
                        </li>
                    </ol>
                    <?php } ?>

            </div><!-- end of inside -->
        </div><!-- end of postbox -->
<?php
    }
} // End class                                                                                                                                                                        admin/ehssl-certificate-expiry-menu.php                                                             0000644                 00000047666 15266054577 0014267 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Certificate_Expiry_Menu extends EHSSL_Admin_Menu {
	public $menu_page_slug = EHSSL_CERTIFICATE_EXPIRY_MENU_SLUG;

	// Specify all the tabs of this menu in the following array.
	public $dashboard_menu_tabs = array(
		'expiring-certificates' => 'Expiring Certificates',
		'expiry-notification'    => 'Expiry Notification',
	);

	public function __construct() {
		$this->render_menu_page();
	}

	public function get_current_tab() {
		$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : array_keys( $this->dashboard_menu_tabs )[0];

		return $tab;
	}

	/**
	 * Renders our tabs of this menu as nav items
	 */
	public function render_page_tabs() {
		$current_tab = $this->get_current_tab();
		foreach ( $this->dashboard_menu_tabs as $tab_key => $tab_caption ) {
			$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
			echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
		}
	}

	/**
	 * The menu rendering goes here
	 */
	public function render_menu_page() {
		$tab = $this->get_current_tab();

		?>
        <div class="wrap">
            <h2><?php _e( "Certificate Expiry", 'https-redirection' ) ?></h2>
            <h2 class="nav-tab-wrapper"><?php $this->render_page_tabs(); ?></h2>
            <div id="poststuff">
                <div id="post-body">
					<?php
					switch ( $tab ) {
						case 'expiring-certificates':
							$this->render_expiring_certificates_tab();
							break;
                        case 'expiry-notification':
						default:
							$this->render_email_notification_tab();
							break;
					}
					?>
                </div>
            </div>
			<?php $this->documentation_link_box(); ?>
        </div><!-- end or wrap -->
		<?php
	}

	public function render_expiring_certificates_tab() {
		if ( isset( $_POST['ehssl_scan_for_ssl_submit'] ) ){

			if (!check_admin_referer('ehssl_scan_for_ssl_nonce')){
				wp_die('Nonce verification failed!');
			}

			EHSSL_SSL_Utils::check_and_save_current_cert_info();

			echo '<div class="notice notice-success"><p>'. __('SSL certificate scan completed successfully.', 'https-redirection') .'</p></div>';
		}

		if ( isset( $_POST['ehssl_delete_all_cert_info_submit'] ) ){

			if (!check_admin_referer('ehssl_delete_all_cert_info_nonce')){
				wp_die('Nonce verification failed!');
			}

			$is_deleted = EHSSL_SSL_Utils::delete_all_certificate_info();

            if ($is_deleted){
			    echo '<div class="notice notice-success"><p>'. __('SSL certificate info was deleted successfully.', 'https-redirection') .'</p></div>';
            } else {
			    echo '<div class="notice notice-info"><p>'. __('No saved SSL certificate info was detected for deletion.', 'https-redirection') .'</p></div>';
            }
		}

        $certs_info = EHSSL_SSL_Utils::get_all_saved_certificates_info();
		?>
        <div class="postbox">
            <h3 class="hndle">
                <label for="title"><?php _e( "Certificates", 'https-redirection' ); ?></label>
            </h3>
            <div class="inside">
                <?php if (!empty($certs_info)) { ?>
                <table class="widefat striped">
                    <thead>
                    <tr>
                        <th><?php _e('ID', 'https-redirection') ?></th>
                        <th><?php _e('Label', 'https-redirection') ?></th>
                        <th><?php _e('Issuer', 'https-redirection') ?></th>
                        <th><?php _e('Issued on', 'https-redirection') ?></th>
                        <th><?php _e('Expires on', 'https-redirection') ?></th>
                        <th><?php _e('Status', 'https-redirection') ?></th>
                    </tr>
                    </thead>
                    <?php foreach ($certs_info as $cert){
                        $formatted_issued_on_date = EHSSL_Utils::parse_timestamp( $cert['issued_on'] );
                        $formatted_expires_on = EHSSL_Utils::parse_timestamp( $cert['expires_on'] );
	                    $formatted_ssl_status = ucfirst(EHSSL_SSL_Utils::get_certificate_status($cert['expires_on']));
                        ?>
                        <tr>
                            <td><?php esc_attr_e($cert['id']) ?></td>
                            <td><?php esc_attr_e($cert['label']) ?></td>
                            <td><?php esc_attr_e($cert['issuer']) ?></td>
                            <td><?php esc_attr_e($formatted_issued_on_date) ?></td>
                            <td><?php esc_attr_e($formatted_expires_on) ?></td>
                            <td><?php esc_attr_e($formatted_ssl_status) ?></td>
                        </tr>
                    <?php } ?>
                </table>
                <?php } else { ?>
                <p class="description">
                    <?php _e('No SSL certificate information found. Click the Scan button to search for installed certificates.', 'https-redirection') ?>
                </p>
                <?php } ?>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->

        <div class="postbox">
            <h3 class="hndle">
                <label for="title"><?php _e( "Certificate Actions", 'https-redirection' ); ?></label>
            </h3>
            <div class="inside">
                <div class="">
                    <form action="" method="post">
                        <div><?php _e('Click the Scan button to manually scan for available SSL certificates.', 'https-redirection') ?></div>
                        <br>
                        <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('ehssl_scan_for_ssl_nonce') ?>">
                        <input type="submit"
                               class="button-primary"
                               value="<?php _e('Scan Now', 'https-redirection') ?>"
                               name="ehssl_scan_for_ssl_submit"
                        >
                    </form>
                </div>

                <br>

                <div class="">
                    <form action="" method="post" onsubmit="return confirm('<?php _e('Do you really want to delete all saved SSL info?', 'https-redirection') ?>');">
                        <div><?php _e('Delete all SSL certificate records from the table.', 'https-redirection') ?></div>
                        <br>
                        <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('ehssl_delete_all_cert_info_nonce') ?>">
                        <input type="submit"
                               class="button-secondary"
                               style="border-color: #CC0000; color: #CC0000"
                               value="<?php _e('Delete All SSL Info', 'https-redirection') ?>"
                               name="ehssl_delete_all_cert_info_submit"
                        >
                    </form>
                </div>

            </div><!-- end of inside -->
        </div><!-- end of postbox -->
		<?php
	}

	public function render_email_notification_tab() {
        $settings = get_option('httpsrdrctn_options', array());

		if ( isset( $_POST['ehssl_expiry_notification_settings_form_submit'] ) && check_admin_referer( 'ehssl_expiry_notification_settings_nonce' ) ) {
			$settings['ehssl_enable_expiry_notification']             = isset( $_POST['ehssl_enable_expiry_notification'] ) ? esc_attr( $_POST['ehssl_enable_expiry_notification'] ) : '';
			$settings['ehssl_expiry_notification_email_content_type'] = isset( $_POST['ehssl_expiry_notification_email_content_type'] ) ? sanitize_text_field( $_POST['ehssl_expiry_notification_email_content_type'] ) : 'text';
			$settings['ehssl_expiry_notification_email_before_days']  = isset( $_POST['ehssl_expiry_notification_email_before_days'] ) ? intval( sanitize_text_field( $_POST['ehssl_expiry_notification_email_before_days'] ) ) : 'text';
			$settings['ehssl_expiry_notification_email_from']         = isset( $_POST['ehssl_expiry_notification_email_from'] ) ? $_POST['ehssl_expiry_notification_email_from'] : '';
			$settings['ehssl_expiry_notification_email_to']           = isset( $_POST['ehssl_expiry_notification_email_to'] ) ? sanitize_email( $_POST['ehssl_expiry_notification_email_to'] ) : '';
			$settings['ehssl_expiry_notification_email_subject']      = isset( $_POST['ehssl_expiry_notification_email_subject'] ) ? sanitize_text_field( $_POST['ehssl_expiry_notification_email_subject'] ) : '';
			$settings['ehssl_expiry_notification_email_body']         = isset( $_POST['ehssl_expiry_notification_email_body'] ) ? wp_kses_post( $_POST['ehssl_expiry_notification_email_body'] ) : '';

			update_option( 'httpsrdrctn_options', $settings )

			?>
            <div class="notice notice-success">
                <p><?php _e( "Settings Saved.", 'https-redirection' ); ?></p>
            </div>
			<?php
		}

		$expiry_notification_enabled = isset( $settings['ehssl_enable_expiry_notification'] ) ? sanitize_text_field( $settings['ehssl_enable_expiry_notification'] ) : 0;
		$expiry_notification_email_content_type = isset( $settings['ehssl_expiry_notification_email_content_type'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_content_type'] ) : '';

        $expiry_notification_email_before_days = isset( $settings['ehssl_expiry_notification_email_before_days'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_before_days'] ) : '';
		if (empty($expiry_notification_email_before_days)){
			$expiry_notification_email_before_days = 7;
		}

        $expiry_notification_email_from = isset( $settings['ehssl_expiry_notification_email_from'] ) ? $settings['ehssl_expiry_notification_email_from'] : '';
        if (empty($expiry_notification_email_from)){
            $default_domain_email_address = 'admin@' . EHSSL_Utils::get_domain();
	        $expiry_notification_email_from = get_bloginfo( 'name' ) . ' <'.$default_domain_email_address.'>';
        }

        $expiry_notification_email_to = isset( $settings['ehssl_expiry_notification_email_to'] ) ? sanitize_email( $settings['ehssl_expiry_notification_email_to'] ) : '';

		$expiry_notification_email_sub = isset( $settings['ehssl_expiry_notification_email_subject'] ) ? sanitize_text_field( $settings['ehssl_expiry_notification_email_subject'] ) : '';
		if (empty($expiry_notification_email_sub)){
			$expiry_notification_email_sub = 'SSL Certificate Expiry Notification';
		}

        $expiry_notification_email_body = isset( $settings['ehssl_expiry_notification_email_body'] ) ? wp_kses_post( $settings['ehssl_expiry_notification_email_body'] ) : '';
        if (empty($expiry_notification_email_body)){
            $expiry_notification_email_body = 'Dear Admin,' . "\r\n\r\n"
                                              . 'This is a reminder that your SSL certificate issued by {issuer} '
                                              . 'is set to expire on {expiry_datetime}.' . "\r\n\r\n"
                                              . 'Please take the necessary steps to renew the certificate to avoid any security or accessibility issues.' . "\r\n\r\n"
                                              . 'Thanks';
        }

		?>
        <div class="postbox">
            <h3 class="hndle">
                <label for="title"><?php _e( "Notification Email Settings", 'https-redirection' ); ?></label>
            </h3>
            <div class="inside">
                <form method="post" action="">
                    <table class="form-table">
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Enable Certificate Expiry Notification', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <input type="checkbox"
                                       name="ehssl_enable_expiry_notification"
                                       value="1"
                                    <?php echo !empty($expiry_notification_enabled) ? 'checked="checked"' : '' ?>
                                />
                                <br/>
                                <p class="description"><?php _e( "Enable this option to send SSL certificate expiry notifications.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Email Content Type', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <select name="ehssl_expiry_notification_email_content_type">
                                    <option value="text" <?php echo ($expiry_notification_email_content_type == 'text') ? 'selected' : '' ?>><?php _e('Plain Text', 'https-redirection') ?></option>
                                    <option value="html" <?php echo ($expiry_notification_email_content_type == 'html') ? 'selected' : '' ?>><?php _e('HTML', 'https-redirection') ?></option>
                                </select>
                                <br/>
                                <p class="description"><?php _e( "Choose whether the SSL expiry notification email should be sent in plain text or HTML format.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Notification Email Before Days', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <input type="number"
                                       name="ehssl_expiry_notification_email_before_days"
                                       class="ehssl-settings-field-cat-1"
                                       value="<?php esc_attr_e( $expiry_notification_email_before_days ) ?>"
                                       required
                                />
                                <br/>
                                <p class="description"><?php _e( "Set how many days in advance the expiry email should be sent. Default is 7 days.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Notification Email From', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <input type="text"
                                       name="ehssl_expiry_notification_email_from"
                                       class="ehssl-settings-field-cat-2"
                                       value="<?php esc_attr_e( $expiry_notification_email_from ) ?>"
                                />
                                <br/>
                                <p class="description"><?php _e( "The email address used as the 'From' address in the notification email.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Notification Email To', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <input type="email"
                                       name="ehssl_expiry_notification_email_to"
                                       class="ehssl-settings-field-cat-2"
                                       value="<?php esc_attr_e( $expiry_notification_email_to ) ?>"
                                       required
                                />
                                <br/>
                                <p class="description"><?php _e( "Email address where expiry notifications will be sent.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Notification Email Subject', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <input type="text"
                                       name="ehssl_expiry_notification_email_subject"
                                       class="ehssl-settings-field-cat-2"
                                       value="<?php esc_attr_e( $expiry_notification_email_sub ) ?>"
                                       required
                                />
                                <br/>
                                <p class="description"><?php _e( "Certificate expiry notification email subject.", 'https-redirection' ); ?></p>
                            </td>
                        </tr>
                        <tr valign="top">
                            <th scope="row">
                                <label>
									<?php _e( 'Notification Email Body', 'https-redirection' ); ?>
                                </label>
                            </th>
                            <td>
                                <?php if ($expiry_notification_email_content_type == 'html') {
	                                add_filter( 'wp_default_editor', array( $this, 'set_default_editor' ) );
                                    ?>
                                    <div class="ehssl-settings-field-cat-3">
                                        <?php
                                        wp_editor(
                                            html_entity_decode( $expiry_notification_email_body ),
                                            'ehssl_expiry_notification_email_body',
                                            array(
                                                'textarea_name' => 'ehssl_expiry_notification_email_body',
                                                'teeny'         => true,
                                                'media_buttons' => false,
                                                'textarea_rows' => 12,
                                            )
                                        );
                                        ?>
                                    </div>
                                    <?php
	                                remove_filter( 'wp_default_editor', array( $this, 'set_default_editor' ) );
                                } else { ?>
                                    <textarea
                                            name="ehssl_expiry_notification_email_body"
                                            class="ehssl-settings-field-cat-3"
                                            rows="10"
                                            required
                                    ><?php esc_attr_e( $expiry_notification_email_body ) ?></textarea>
                                    <br/>
                                <?php } ?>
                                <p class="description"><?php _e( "Certificate expiry notification email body.", 'https-redirection' ); ?></p>
                                <?php echo EHSSL_Email_handler::get_merge_tags_hints() ?>
                            </td>
                        </tr>
                    </table>

					<?php wp_nonce_field( 'ehssl_expiry_notification_settings_nonce' ); ?>
                    <p class="submit">
                        <input type="submit" name="ehssl_expiry_notification_settings_form_submit"
                               class="button-primary" value="<?php _e( 'Save Changes' ) ?>"/>
                    </p>
                </form>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
		<?php
	}

	public function set_default_editor( $r ) {
		$r = 'html';
		return $r;
	}


} // End class                                                                          admin/ehssl-admin-menu.php                                                                          0000644                 00000002153 15266054577 0011535 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

/* Parent class for all admin menu classes */
abstract class EHSSL_Admin_Menu
{
    protected $is_ssl_installed;

    public function __construct() {
        $this->is_ssl_installed = EHSSL_SSL_Utils::is_ssl_installed();

        $this->render_menu_page();
    }

    /**
     * Shows postbox for settings menu
     *
     * @param string $id css ID for postbox
     * @param string $title title of the postbox section
     * @param string $content the content of the postbox
     */
    public function postbox($id, $title, $content)
    {
        echo 'Do not use this old method. Use new HTML code instead.';
    }

    /**
     * Display documentations links.
     */
    public function documentation_link_box(){
        ?>
        <div class="ehssl-blue-box">
            You can view the <a href="https://www.tipsandtricks-hq.com/wordpress-easy-https-redirection-plugin" target="_blank">Easy HTTPS Redirection & SSL</a> plugin details on our site.
            Check out our other <a href="https://www.tipsandtricks-hq.com/development-center" target="_blank">WordPress plugins</a>.
        </div>
        <?php
    }
}                                                                                                                                                                                                                                                                                                                                                                                                                     admin/ehssl-settings-menu.php                                                                       0000644                 00000103105 15266054577 0012304 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

class EHSSL_Settings_Menu extends EHSSL_Admin_Menu
{
    public $menu_page_slug = EHSSL_SETTINGS_MENU_SLUG;

    // Specify all the tabs of this menu in the following array.
    public $dashboard_menu_tabs = array('general' => 'General', 'mixed-contents' => 'Mixed Contents');

    public function get_current_tab()
    {
        $tab = isset($_GET['tab']) ? $_GET['tab'] : array_keys($this->dashboard_menu_tabs)[0];
        return $tab;
    }

    /**
     * Renders our tabs of this menu as nav items
     */
    public function render_page_tabs()
    {
        $current_tab = $this->get_current_tab();
        foreach ($this->dashboard_menu_tabs as $tab_key => $tab_caption) {
            $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
            echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
        }
    }

    /**
     * The menu rendering goes here
     */
    public function render_menu_page()
    {
        $tab = $this->get_current_tab();

        ?>
        <div class="wrap">
            <h2><?php _e("Settings", 'https-redirection')?></h2>
            <h2 class="nav-tab-wrapper"><?php $this->render_page_tabs();?></h2>
            <div id="poststuff"><div id="post-body">
            <?php

        switch ($tab) {
	        case 'mixed-contents':
		        //include_once('file-to-handle-this-tab-rendering.php');//If you want to include a file
		        $this->render_mixed_content_tab();
		        break;
	        case 'general':
	        default:
                //include_once('file-to-handle-this-tab-rendering.php');//If you want to include a file
                $this->render_general_tab();
                break;
        }
        ?>
            </div>
        </div>
        <?php $this->documentation_link_box();?>
        </div><!-- end or wrap -->
        <?php
    }

    public function render_general_tab()
    {
	    $settings = get_option('httpsrdrctn_options', array());

	    // Save data for settings page.
	    if (isset($_REQUEST['httpsrdrctn_form_submit']) && check_admin_referer(plugin_basename(__FILE__), 'httpsrdrctn_nonce_name')) {
		    $settings['https'] = isset($_REQUEST['httpsrdrctn_https']) ? $_REQUEST['httpsrdrctn_https'] : 0;
		    $settings['https_domain'] = isset($_REQUEST['httpsrdrctn_https_domain']) ? $_REQUEST['httpsrdrctn_https_domain'] : 0;

		    $settings['hsts_enabled'] = isset($_REQUEST['hsts_enabled']) ? 1 : 0;
		    $settings['hsts_max_age'] = isset($_REQUEST['hsts_max_age']) && !empty($_REQUEST['hsts_max_age']) ? absint(sanitize_text_field($_REQUEST['hsts_max_age'])) : 31536000;
		    $settings['hsts_include_sub_domains'] = isset($_REQUEST['hsts_include_sub_domains']) ? 1 : 0;
		    $settings['hsts_preload'] = isset($_REQUEST['hsts_preload']) ? 1 : 0;

		    if (isset($_REQUEST['httpsrdrctn_https_pages_array'])) {
			    $settings['https_pages_array'] = array();
			    // var_dump($httpsrdrctn_options['https_pages_array']);
			    foreach ($_REQUEST['httpsrdrctn_https_pages_array'] as $httpsrdrctn_https_page) {
				    if (!empty($httpsrdrctn_https_page) && $httpsrdrctn_https_page != '') {
					    $httpsrdrctn_https_page = str_replace('https', 'http', $httpsrdrctn_https_page);
					    $settings['https_pages_array'][] = trim(str_replace(home_url(), '', $httpsrdrctn_https_page), '/');
				    }
			    }
		    }

            // Update options in the database.
            update_option('httpsrdrctn_options', $settings, '', 'yes');

            echo '<div class="notice notice-success"><p>'.__("Settings Saved.", 'https-redirection').'</p></div>';

            $httpsrdrctn_obj = new EHSSL_Htaccess();
            $httpsrdrctn_obj->write_to_htaccess();

            // clear caching plugins cache if needed
            // WP Fastest Cache
            if (isset($GLOBALS["wp_fastest_cache"])) {
                $wpfc = $GLOBALS["wp_fastest_cache"];
                if (method_exists($wpfc, 'deleteCache') && is_callable(array($wpfc, 'deleteCache'))) {
                    $wpfc->deleteCache(true);
                }
            }
            // httpsrdrctn_generate_htaccess();

	    }
	    $siteSSLurl = get_home_url(null, '', 'https');

        $hsta_enabled = isset($settings['hsts_enabled']) && !empty($settings['hsts_enabled']) ? 1 : 0;
        $hsta_max_age = isset($settings['hsts_max_age']) && !empty($settings['hsts_max_age']) ? absint(sanitize_text_field($settings['hsts_max_age'])) : 31536000;
        $hsta_include_sub_domains = isset($settings['hsts_include_sub_domains']) && !empty($settings['hsts_include_sub_domains']) ? 1 : 0;
        $hsta_preload = isset($settings['hsts_preload']) && !empty($settings['hsts_preload']) ? 1 : 0;

        // Save data for settings page.
        if (isset($_POST['ehssl_debug_log_form_submit']) && check_admin_referer('ehssl_debug_settings_nonce')) {
            $settings['enable_debug_logging'] = isset($_POST['enable_debug_logging']) ? esc_attr($_POST['enable_debug_logging']) : 0;

            update_option('httpsrdrctn_options', $settings)

            ?>
            <div class="notice notice-success">
                <p><?php _e("Settings Saved.", 'https-redirection');?></p>
            </div>
            <?php
        }

        $is_debug_logging_enabled = isset($settings['enable_debug_logging']) ? esc_attr($settings['enable_debug_logging']) : 0;

        if ( empty($this->is_ssl_installed) ) { ?>
        <div class="ehssl-yellow-box">
            <p>
			    <?php echo sprintf(__("When you enable the HTTPS redirection, the plugin will force redirect the URL to the HTTPS version of the URL. So before enabling this plugin's feature, visit your site's HTTPS URL %s to make sure the page loads correctly. Otherwise you may get locked out if your SSL certificate is not installed correctly on your site or the HTTPS URL is not working and this plugin is auto redirecting to the HTTPS URL.", 'https-redirection'), '<a href="' . $siteSSLurl . '" target="_blank">' . $siteSSLurl . '</a>'); ?>
            </p>
            <p>
                <span style="font-weight:bold; color:red;"><?php _e('Important!', 'https-redirection');?></span>
			    <?php _e("If you're using caching plugins similar to W3 Total Cache or WP Super Cache, you need to clear their cache after you enable or disable automatic redirection option. Failing to do so may result in mixed content warning from browser.", 'https-redirection');?>
            </p>
        </div>
        <?php } ?>

        <div class="postbox">
            <h3 class="hndle"><label for="title"><?php _e("HTTPS Redirection", 'https-redirection');?></label></h3>
            <div class="inside">
			    <?php
			    // Display form on the setting page.
			    if (get_option('permalink_structure')) {
				    // Pretty permalink is enabled. So allow HTTPS redirection feature.
				    ?>
                    <div id="httpsrdrctn_settings_notice" class="updated fade" style="display:none">
                        <p>
                            <strong><?php _e("Notice:", 'https-redirection');?></strong><?php _e("The plugin's settings have been changed. In order to save them please don't forget to click the 'Save Changes' button.", 'https-redirection');?>
                        </p>
                    </div>

                    <form id="httpsrdrctn_settings_form" method="post" action="">
                        <div style="position: relative">
                            <table class="form-table">
                                <tr valign="top">
                                    <th scope="row"><?php _e('Enable Automatic Redirection to HTTPS', 'https-redirection');?></th>
                                    <td>
                                        <label>
                                            <input type="checkbox" id="httpsrdrctn-checkbox" name="httpsrdrctn_https" value="1" <?php if ('1' == $settings['https']) {echo "checked=\"checked\" ";}?> />
                                        </label>
                                        <br />
                                        <p class="description"><?php _e("Use this option to make your webpage(s) load in HTTPS version only. If someone enters a non-https URL in the browser's address bar then the plugin will automatically redirect to the HTTPS version of that URL.", 'https-redirection');?></p>
                                    </td>
                                </tr>
                            </table>

                            <div class="ehssl-enable-automatic-redirection httpsrdrctn-overlay <?php echo ($this->is_ssl_installed ? 'hidden' : ''); ?>"></div>
                        </div>

                        <div style="position: relative">
                            <table class="form-table">
                                <tr>
                                    <th scope="row"><?php _e('Apply HTTPS Redirection To:', 'https-redirection');?></th>
                                    <td>
                                        <div style="margin-bottom: 6px">
                                            <label><input type="radio" name="httpsrdrctn_https_domain" value="1" <?php if ('1' == $settings['https_domain']) {echo "checked=\"checked\" ";}?> /> <?php _e('The whole domain', 'https-redirection');?></label>
                                        </div>
                                        <div style="margin-bottom: 6px">
                                            <label><input type="radio" name="httpsrdrctn_https_domain" value="0" <?php if ('0' == $settings['https_domain']) {echo "checked=\"checked\" ";}?> /> <?php _e('A few pages', 'https-redirection');?></label>
                                        </div>
									    <?php foreach ($settings['https_pages_array'] as $https_page) { ?>
                                            <div style="margin-bottom: 5px">
											    <?php echo str_replace("http://", "https://", home_url()); ?>/<input type="text" name="httpsrdrctn_https_pages_array[]" value="<?php echo $https_page; ?>" /> <span class="button-secondary rewrite_item_delete_btn"><i class="dashicons dashicons-trash"></i></span> <span class="rewrite_item_blank_error"><?php _e('Please enter a page slug value in the field before adding it.', 'https-redirection');?></span>
                                            </div>
									    <?php } ?>
                                        <div class="rewrite_new_item">
										    <?php echo str_replace("http://", "https://", home_url()); ?>/<input type="text" name="httpsrdrctn_https_pages_array[]" placeholder="<?php _e('Enter the page slug','https-redirection'); ?>" value="" /> <span class="button-secondary rewrite_item_add_btn"><i class="dashicons dashicons-plus-alt2"></i></span> <span class="rewrite_item_blank_error"><?php _e('Please enter a page slug value in the field before adding it.', 'https-redirection');?></span>
                                        </div>
                                    </td>
                                </tr>
                            </table>

                            <div class="ehssl-apply-redirection-on httpsrdrctn-overlay <?php echo ($settings['https'] == 1 ? 'hidden' : ''); ?>"></div>
                        </div>

                        <hr>

                        <h3 style="font-size: 16px"><?php _e('HTTP Strict Transport Security (HSTS) (Optional)', 'https-redirection'); ?></h3>
                        <p class="description"><?php _e("Only enable the HSTS option if your entire website is fully accessible over HTTPS.", 'https-redirection');?></p>
                        <div style="position: relative">
                            <table class="form-table">
                                <tr>
                                    <th scope="row"><?php _e('Enable HTTP Strict Transport Security (HSTS):', 'https-redirection');?></th>
                                    <td>                                        
                                        <input type="checkbox" id="https-hsts-checkbox" name="hsts_enabled" <?php echo $hsta_enabled ? "checked" : ''; ?> min="0" />
                                        <p class="description"><?php _e("Once a visitor accesses your site over HTTPS, their browser will automatically use HTTPS for future visits for the configured period.", 'https-redirection');?></p>

                                        <div class="description" style="position: relative;">
                                            <p class="description">
                                                <?php _e('Max age (in seconds):', 'https-redirection');?>
                                                <input type="number" id="ehssl-hsts-max-age" name="hsts_max_age" value="<?php echo esc_attr($hsta_max_age); ?>" style="width: 140px"/>
                                                <?php _e(' Specifies how long browsers should remember to use HTTPS only. The recommended value is 31536000 seconds (1 year).', 'https-redirection');?>
                                            </p>
                                            <p class="description">
                                                <input type="checkbox" id="ehssl-hsts-include-sub-domain" name="hsts_include_sub_domains" <?php echo $hsta_include_sub_domains ? "checked" : ''; ?> />
                                                <?php printf(__("Apply the HSTS policy to all subdomains of this site.", 'https-redirection'), $siteSSLurl);?>
                                            </p>
                                            <p class="description">
                                                <input type="checkbox" id="https-hsts-preload" name="hsts_preload" <?php echo $hsta_preload ? "checked" : ''; ?> />
                                                <?php
                                                printf(
                                                    __("Include the preload directive. This alone does not add your site to browser preload lists, you must also manually submit your domain using the %s.", 'https-redirection'),
                                                    '<a href="https://hstspreload.org/#submission-form" target="_blank">link here</a>'
                                                );
                                                ?>
                                            </p>

                                            <div class="ehssl-apply-hsts-directives httpsrdrctn-overlay <?php echo ($hsta_enabled ? 'hidden' : ''); ?>"></div>
                                        </div>
                                    </td>
                                </tr>
                            </table>

                            <div class="ehssl-apply-hsts httpsrdrctn-overlay <?php echo ($settings['https'] == 1 && $settings['https_domain'] == 1 ? 'hidden' : ''); ?>"></div>
                        </div>

                        <input type="hidden" name="httpsrdrctn_form_submit" value="submit" />

                        <p class="submit">
                            <input type="submit" class="button-primary" value="<?php _e('Save Changes')?>"  <?php echo !is_ssl() ? 'disabled' : '' ?>/>
                        </p>
					    <?php wp_nonce_field(plugin_basename(__FILE__), 'httpsrdrctn_nonce_name');?>
                    </form>
                    <script>
                        jQuery('input#httpsrdrctn-checkbox').change(function() {
                            if (jQuery(this).is(':checked')) {
                                jQuery('div.ehssl-apply-redirection-on.httpsrdrctn-overlay').fadeOut('fast');
                            } else {
                                jQuery('div.ehssl-apply-redirection-on.httpsrdrctn-overlay').fadeIn('fast');
                            }
                        });

                        jQuery('input#httpsrdrctn-checkbox').on('change', function() {
                            if (jQuery(this).is(':checked') && jQuery('input[name="httpsrdrctn_https_domain"]:checked').val() == 1) {
                                jQuery('div.ehssl-apply-hsts.httpsrdrctn-overlay').fadeOut('fast');
                            } else {
                                jQuery('div.ehssl-apply-hsts.httpsrdrctn-overlay').fadeIn('fast');
                            }
                        });

                        jQuery('input[name="httpsrdrctn_https_domain"]').on('change', function() {
                            if (jQuery(this).val() == 1 && jQuery('input#httpsrdrctn-checkbox').is(':checked')) {
                                jQuery('div.ehssl-apply-hsts.httpsrdrctn-overlay').fadeOut('fast');
                            } else {
                                jQuery('div.ehssl-apply-hsts.httpsrdrctn-overlay').fadeIn('fast');
                            }
                        });

                        jQuery('input#https-hsts-checkbox').change(function() {
                            if (jQuery(this).is(':checked')) {
                                jQuery('div.ehssl-apply-hsts-directives.httpsrdrctn-overlay').fadeOut('fast');
                            } else {
                                jQuery('div.ehssl-apply-hsts-directives.httpsrdrctn-overlay').fadeIn('fast');
                            }
                        });
                    </script>
                    <style>
                        .httpsrdrctn-overlay {
                            position: absolute;
                            top: 10px;
                            background-color: white;
                            width: 100%;
                            height: 100%;
                            opacity: 0.5;
                            text-align: center;
                        }
                    </style>

                    <div class="ehssl-red-box">
                        <p><strong><?php _e("Notice:", 'https-redirection');?></strong> <?php _e("It is very important to be extremely attentive when making changes to .htaccess file.", 'https-redirection');?></p>
                        <p><?php _e('If after making changes your site stops functioning, do the following:', 'https-redirection');?></p>
                        <p><?php _e('Step #1: Open .htaccess file in the root directory of the WordPress install and delete everything between the following two lines', 'https-redirection');?></p>
                        <p style="border: 1px solid #ccc; padding: 10px;">
                            # BEGIN HTTPS Redirection Plugin<br />
                            # END HTTPS Redirection Plugin
                        </p>
                        <p><?php _e('Step #2: Save the htaccess file (this will erase any change this plugin made to that file).', 'https-redirection');?></p>
                        <p><?php _e("Step #3: Deactivate the plugin or rename this plugin's folder (which will deactivate the plugin).", 'https-redirection');?></p>

                        <p><?php _e('The changes will be applied immediately after saving the changes, if you are not sure - do not click the "Save changes" button.', 'https-redirection');?></p>
                    </div>

			    <?php } else {?>
                    <!-- pretty permalink is NOT enabled. This plugin can't work. -->
                    <div class="error">
                        <p><?php _e('HTTPS redirection only works if you have pretty permalinks enabled.', 'https-redirection');?></p>
                        <p><?php _e('To enable pretty permalinks go to <em>Settings > Permalinks</em> and select any option other than "default".', 'https-redirection');?></p>
                        <p><a href="options-permalink.php"><?php _e('Enable Permalinks', 'https-redirection');?></a></p>
                    </div>
			    <?php }?>
            </div>
        </div>
        <div class="postbox">
            <h3 class="hndle"><label for="title"><?php _e("Debug Logging", 'https-redirection');?></label></h3>
            <div class="inside">
            <p>
                <?php _e('Debug logging can be useful to troubleshoot issues on your site. keep it disabled unless you are troubleshooting.', 'https-redirection');?>
            </p>
            <form id="ehssl_debug_settings_form" method="post" action="">
                <table class="form-table">
                    <tr valign="top">
                        <th scope="row">
                            <label for="ehssl-debug-enable-checkbox">
                                <?php _e('Enable Debug Logging', 'https-redirection');?>
                            </label>
                        </th>
                        <td>
                            <input type="checkbox" id="ehssl-debug-enable-checkbox" name="enable_debug_logging" value="1" <?php if ('1' == $is_debug_logging_enabled) {echo "checked=\"checked\" ";}?> />
                            <br />
                            <p class="description"><?php _e("Check this option to enable debug logging.", 'https-redirection');?></p>
                            <p class="description">
                                <a href="<?php echo wp_nonce_url(get_admin_url() . '?ehssl-debug-action=view_log', 'ehssl_view_log_nonce'); ?>" target="_blank">
                                    <?php _e('Click here', 'https-redirection')?>
                                </a>
                                <?php _e(' to view log file.', 'https-redirection');?>
                                <br>
                                <a id="ehssl-reset-log" href="#0" style="color: red">
                                    <?php _e('Click here', 'https-redirection');?>
                                </a>
                                <?php _e(' to reset log file.', 'https-redirection');?>
                            </p>
                        </td>
                    </tr>
                </table>

                <input type="submit" name="ehssl_debug_log_form_submit" class="button-primary" value="<?php _e('Save Changes')?>" />
                <?php wp_nonce_field('ehssl_debug_settings_nonce');?>
            </form>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
        <script>
            jQuery( document ).ready( function( $ ) {
                const ehssl_ajaxurl = "<?php echo get_admin_url() . 'admin-ajax.php' ?>";
				const ehssl_ajax_nonce = "<?php echo wp_create_nonce('ehssl_settings_ajax_nonce') ?>";
                $( '#ehssl-reset-log' ).on('click', function( e ) {
                    e.preventDefault();
                    $.post( ehssl_ajaxurl,
                            {
                                action: 'ehssl_reset_log',
                                nonce: ehssl_ajax_nonce
                            },
                            function( result ) {
                                if ( result === '1' ) {
                                    alert( '<?php _e('Log file has been reset.', 'https-redirection') ?>' );
                                } else {
                                    alert( '<?php _e('Error trying to reset log: ' , 'https-redirection') ?>' + result );
                                }
                            } );
                } );
            } );
        </script>
        <?php
    }

    public function render_mixed_content_tab()
    {
        global $httpsrdrctn_options;

        $is_https_redirection_enabled = isset($httpsrdrctn_options['https']) && esc_attr($httpsrdrctn_options['https']) == '1' ? true : false;

        if (isset($_POST['ehssl_mixed_content_form_submit']) && check_admin_referer('ehssl_mixed_content_settings_nonce')) {
            $httpsrdrctn_options['force_resources'] = isset($_POST['httpsrdrctn_force_resources']) ? esc_attr($_POST['httpsrdrctn_force_resources']) : 0;
            update_option('httpsrdrctn_options', $httpsrdrctn_options)

            ?>
            <div class="notice notice-success">
                <p><?php _e("Settings Saved.", 'https-redirection');?></p>
            </div>
            <?php
        }
        ?>
        <div class="postbox">
            <h3 class="hndle"><label for="title"><?php _e("Static Resources", 'https-redirection');?></label></h3>
            <div class="inside">
                <?php if(!$is_https_redirection_enabled){ ?>
                    <div class="ehssl-yellow-box">
                        <p>
                            <?php _e("HTTPS redirection is turned off. Turn it on first to change these settings below!", 'https-redirection');?>
                        </p>
                    </div>
                <?php } ?>
                <form action="" method="POST">
                    <table class="form-table">
                        <tr valign="top">
                            <th scope="row"><?php _e('Force Resources to Use HTTPS URL', 'https-redirection');?></th>
                            <td>
                                <label>
                                    <input type="checkbox" <?php echo !$is_https_redirection_enabled ? "disabled" : ''; ?> name="httpsrdrctn_force_resources" value="1" <?php echo (isset($httpsrdrctn_options['force_resources']) && $httpsrdrctn_options['force_resources'] == '1') ? 'checked="checked"' : ''; ?> />
                                </label>
                                <br />
                                <p class="description"><?php _e('When checked, the plugin will force load HTTPS URL for any static resources in your content. Example: if you have have an image embedded in a post with a NON-HTTPS URL, this option will change that to a HTTPS URL.', 'https-redirection');?></p>
                            </td>
                        </tr>
                    </table>
                    <input type="submit" name="ehssl_mixed_content_form_submit" class="button-primary" value="<?php _e('Save Changes')?>" <?php if (!$is_https_redirection_enabled) {echo "disabled";}?>/>
                    <?php wp_nonce_field('ehssl_mixed_content_settings_nonce');?>
                </form>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
        <?php
        $post_types = get_post_types(
                array(
                        'show_ui' => true,
                ),
                'objects'
        );

        $exclude = array(
                'attachment',
                'revision',
                'nav_menu_item',
                'custom_css',
                'customize_changeset',
                'oembed_cache',
                'user_request',
                'wp_block',
                'wp_template',
                'wp_template_part',
                'wp_navigation',
                'wp_font_family',
                'wp_font_face',
        );

        $scannable_post_types = array();
        foreach ( $post_types as $post_type ) {
            if ( in_array( $post_type->name, $exclude ) ) {
                continue;
            }
            $scannable_post_types[] = array(
                    'type' => 'post_type',
                    'name' => $post_type->name,
                    'label' => $post_type->label,
            );
        }

        $other_tables = array(
                array(
                        'name' => 'wp_options_table',
                        'label' => 'WP Options',
                ),
        );

        $flags = array(
                array(
                        'name' => 'include_post_meta',
                        'label' => 'Include Post Meta for Selected Post Types',
                ),
        );

        $has_previous_scan_data = EHSSL_Non_HTTPS_Resources_Scan_Update::get_scan_results_count(true) > 0;
        $rescan_btn_text = __('Re-scan', 'https-redirection');
        $scan_btn_text = $has_previous_scan_data ? $rescan_btn_text :__('Scan', 'https-redirection');
        ?>

        <div class="postbox">
            <h3 class="hndle"><label for="title"><?php _e("Scan and Update Non-HTTPS URLs", 'https-redirection');?></label></h3>
            <div class="inside">
                <p class="description"><?php _e('Use this tool to scan for non-https URLs and update them to HTTPS version. Please take a backup of your database before updating the URLs.', 'https-redirection');?></p>
                <br>
                <form action="" method="POST" id="ehssl_non_https_resources_scan_form">
                    <fieldset>
                        <legend><strong><?php _e('Post Types:', 'https-redirection')?></strong></legend>
                        <ul>
                            <?php foreach ($scannable_post_types as $index => $item) { ?>
                                <li>
                                    <input
                                            id="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"
                                            type="checkbox"
                                            name="ehssl_post_types[]"
                                            value="<?php echo esc_attr($item['name']); ?>"
                                    />
                                    <label for="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"><?php echo esc_attr($item['label']) . ' ('.esc_attr($item['name']).')' ?></label>
                                </li>
                            <?php } ?>
                        </ul>
                    </fieldset>

                    <fieldset>
                        <legend><strong><?php _e('Other Database Tables:', 'https-redirection')?></strong></legend>
                        <ul>
                            <?php foreach ($other_tables as $index => $item) { ?>
                                <li>
                                    <input
                                            id="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"
                                            type="checkbox"
                                            name="ehssl_other_tables[]"
                                            value="<?php echo esc_attr($item['name']); ?>"
                                    />
                                    <label for="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"><?php echo esc_attr($item['label']) ?></label>
                                </li>
                            <?php } ?>
                        </ul>
                    </fieldset>

                    <fieldset>
                        <legend><strong><?php _e('Additional Flags:', 'https-redirection')?></strong></legend>
                        <ul>
                            <?php foreach ($flags as $index => $item) { ?>
                                <li>
                                    <input
                                            id="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"
                                            type="checkbox"
                                            name="ehssl_additional_flags[]"
                                            value="<?php echo esc_attr($item['name']); ?>"
                                    />
                                    <label for="<?php echo esc_attr('ehssl-'.$item['name'].'-'.$index) ?>"><?php echo esc_attr($item['label']) ?></label>
                                </li>
                            <?php } ?>
                        </ul>
                    </fieldset>

                    <fieldset>
                        <legend><strong><?php _e('Scan Type:', 'https-redirection')?></strong></legend>
                        <ul>
                            <li>
                                <label>
                                    <input type="radio" name="ehssl_scan_type" value="scan_static_resources_only" checked>
                                    <?php _e('Scan Static Resources Only', 'https-redirection')?>
                                </label>
                            </li>
                            <li>
                                <label>
                                    <input type="radio" name="ehssl_scan_type" value="scan_all">
                                    <?php _e('Scan All', 'https-redirection')?>
                                </label>
                            </li>
                        </ul>

                    </fieldset>

                    <?php wp_nonce_field('ehssl_non_https_resources_scan_form_nonce');?>

                    <p class="description">
                        <button
                                type="submit"
                                id="ehssl_non_https_resources_scan_btn"
                                class="button-primary"
                        ><?php echo esc_attr($scan_btn_text) ?></button>
                    </p>

                </form>
                <div id="ehssl_scan_results" style="margin-top:20px;">
                    <!-- table renders here -->
                    <?php
                    if ($has_previous_scan_data){
                        EHSSL_Non_HTTPS_Resources_Scan_Update::render_http_scan_result_table();
                    }
                    ?>

                </div>
            </div><!-- end of inside -->
        </div><!-- end of postbox -->
        <?php
        wp_enqueue_script('ehssl_non_https_resources_scan_update', EASY_HTTPS_SSL_URL . '/js/ehssl-static-resources-scan-update.js', null, EASY_HTTPS_SSL_VERSION, array(
                'in_footer' => true,
                'strategy' => 'defer'
        ));

        wp_localize_script('ehssl_non_https_resources_scan_update', 'ehssl_non_https_resources_scan_update_js_data', array(
                'ajaxUrl' => admin_url( 'admin-ajax.php' ),
                'texts' => array(
                        'nothing_found' => __('Nothing Found!', 'https-redirection'),
                        'pls_select_an_item' => __('Please select an item to scan!', 'https-redirection'),
                        'confirm_update' => __('Are you sure? This will permanently update urls in databases.', 'https-redirection'),
                        'scan_btn_loading' => __('Scanning...', 'https-redirection'),
                        'rescan_btn' => $rescan_btn_text,
                        'update_btn_loading' => __('Updating...', 'https-redirection'),
                ),
        ));
    }
} // End class                                                                                                                                                                                                                                                                                                                                                                                                                                                           images/plugin-icon.png                                                                              0000644                 00000003250 15266054577 0010764 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       ‰PNG

   IHDR         óÿa   tEXtSoftware Adobe ImageReadyqÉe<   iTXtXML:com.adobe.xmp     <?xpacket begin="ï»¿" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-c060 61.134777, 2010/02/12-17:32:00        "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop CS5 Windows" xmpMM:InstanceID="xmp.iid:58AA0F3799AB11E2AFB3D6E207D5C2A8" xmpMM:DocumentID="xmp.did:58AA0F3899AB11E2AFB3D6E207D5C2A8"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:58AA0F3599AB11E2AFB3D6E207D5C2A8" stRef:documentID="xmp.did:58AA0F3699AB11E2AFB3D6E207D5C2A8"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>‘|  IDATxÚ|“{HSaÆŸs¶¹‹:ÍK–œ…�¦•IV†EPVD–DQ`�d],Š"öWAt£Û‚!3oY¹ÄË »8Í´æ¶VÓtsÛÙÎ9;çëX,Ã¾Þï}<ïÃ÷Qø¿Tyk6–fgef°¬Ÿúü¹ßÔÞZAˆè™ÞD™9)“Éçî;p¾Å<È†	–ãÈ°í1ÞyðN¯_´þ_ 5½¿ìÔÙ›ÕÅ;ŠÓÁ�óu¬NÞ“ã>Rc³‘$æòo_Xl6ãíËÇ\?û¦ tfÖŠ=…›wì+X·iyNv†Öl}�VÛ5øÂF�ö³ÎØÇ`U? ã±4f;Vé‹°jeÞÁ�ï{Œr	�X¸eg‰Áp"ß3É ®ç>x!ÓPR‘°hª¡�sY9\.:÷�¬É•üÿqMK‡
°å‘â±:¿àÕØCP
i7A�—Ô~0¬±l:ŽæÝ…à
—v§ZŸþ†>"94ø‚ýî/9V¢LÌÁ�Õ¼zôÛ	ªÀqžãDŸO M”`ýâ©…(Í½ÿ�ñ~”å_D¯¥&{¢”	pO°uX§ Sxìö‘Ñ	×$”aZÐ‚¯‹õKpT{N—¢ä·êÍE¨cÔÐÒz|¶{&ÝcŸBÜæ¾Þ›ÝšŠ@œ:öÊ+ö"B¥EfJ®=9	…šÇÐEä¢»»ã­47r€¯Cæg}}DÝüZ™‹û¼´†šCˆÒÄÂGÆ¡
*¡D"„t45¯	½�ß!rœ¿§­¥ö¹Å:‚ôù ãÃ¥<Âà‡f
¨ác¼Èˆß…—í�Ö/CïªÿL©ÓT®­­Þ�`4V&—€ñyA
2)X&àA¢jè|o�¹ µ;g xžíª®ºZ^W_%.I.Æýa"¼ŒÑ²X›z
7®œnp|6b6)UáE;wéo|ê$�Û?’ëµ•¤¦ÙL¶•š¤ëy³~¦iš›¨KÛ¿¶ h«.)m^KseÓûÞ—©>ö/à—  ëˆuh®W    IEND®B`‚                                                                                                                                                                                                                                                                                                                                                        images/px.png                                                                                       0000644                 00000005350 15266054600 0007155 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       ‰PNG

   IHDR         Ä‰   	pHYs     šœ  
OiCCPPhotoshop ICC profile  xÚ�SgTSé=÷ÞôBKˆ€”KoR RB‹€‘&*!	Jˆ!¡ÙQÁEEÈ ˆŽŽ€ŒQ,Š
Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×>ç¬ó�³ÏÀ–H3Q5€©BàƒÇÄÆáä.@�
$p ³d!sý# ø~<<+"À¾ xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€ @zŽB¦ @F€�˜&S   `Ëcbã P- `'æÓ €�ø™{ [”! ‘  eˆD h; ¬ÏVŠE X0 fKÄ9 Ø- 0IWfH °· ÀÎ²  0Qˆ…) { `È##x „™ FòW<ñ+®ç*  x™²<¹$9E�[-qWW.(ÎI+6aaš@.Ây™2�4àóÌ   ‘àƒóýxÎ®ÎÎ6Ž¶_-ê¿ÿ"bbãþåÏ«p@  át~Ñþ,/³€;€mþ¢%îh^ u÷‹f²@µ  éÚWópø~<<E¡�¹ÙÙåääØJÄB[aÊW}þgÂ_ÀWýlù~<ü÷õà¾â$�2]�GøàÂÌôL¥Ï’	„bÜæ�Gü·ÿüÓ"ÄIb¹X*ãQqŽDšŒó2¥"‰B’)Å%Òÿdâß,û>ß5 °j>{‘-¨]cöK'XtÀâ÷  ò»oÁÔ(€hƒáÏwÿï?ýG % €fI’q  ^D$.TÊ³?Ç  D �*°AôÁ,ÀÁÜÁü`6„B$ÄÂBB
d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼�	AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ÉˆQ"K‘5H1RŠT UHò=r9‡\Fº‘;È 2‚ü†¼G1”�²Q=ÔµC¹¨7„F¢Ðdt1š� ›Ðr´=Œ6¡çÐ«hÚ�>CÇ0Àè3Äl0.ÆÃB±8,	“cË±"¬«Æ°V¬»‰õcÏ±w�EÀ	6wB aAHXLXNØH¨ $4Ú	7	„QÂ'"“¨K´&ºùÄb21‡XH,#Ö�/{ˆCÄ7$‰C2'¹�I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ä�äÃä3ää!ò[
�b@q¤øSâ(RÊjJåå4åe˜2AU£šRÝ¨¡T5�ZB­¡¶R¯Q‡¨4uš9ÍƒIK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw†ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê
•J•&•*/T©ª¦ªÞªUóUËT�©^S}®FU3Sã©	Ô–«Uª�PëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k«†u�5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN	ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§�¦½E»Yû�AÇJ'\'Gg�Î�çSÙSÝ§
§M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õGX³$ÛÎ<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕF�FŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­�­%Ö»­»§§¹N“N«žÖgÃ°ñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ãî“½“}º}�ý=‡Ù«Z~s´r:V:ÞšÎœî?}Åô–é/gXÏÏØ3ã¶Ë)Äi�S›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝÈ½äJtõq]ázÒõ�›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ?Ÿ•0kß¬~OCO�gµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿÑ §€%g‰�A�[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA�‚­‚åÁ­!hÈì�­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~'…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕX�XIlK9.*®6nl¾ßüíó‡â�âã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž
yÂÂg"/Ñ6ÑˆØC\*NòH*Mz’ì‘¼5y$Å3¥,å¹„'©�¼LLÝ›:žšv m2=:½1ƒ’‘�qBª!M“¶gêgæfvË¬e…²þÅn‹·/•Ék³�¬Y-
¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+ÍíÌ³ÊÛ�7œïŸÿíÂá’¶¥†KW-Xæ½¬j9²<qyÛ
ã+†V¬<¸Š¶*mÕO«íW—®~½&zMk�^ÁÊ‚ÁµkëU
å…}ëÜ×í]OX/Yßµaú†�>‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—nÙÚ´ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒÝµa×ønÑî{¼ö4ìÕÛ[¼÷ý>É¾ÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TR�Ö+ëGÇ¾þ�ïw-6U�œÆâ#pDyäé÷	ß÷:ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ4<YyJóTÉiÚé‚Ó“gòÏŒ�•�}~.ùÜ`Û¢¶{çcÎßjoïºtáÒEÿ‹ç;¼;Î\ò¸tò²ÛåW¸Wš¯:_mêtê<þ“ÓOÇ»œ»š®¹\k¹îz½µ{f÷éž7ÎÝô½yñÿÖÕž9=Ý½ózo÷Å÷õßÝ~r'ýÎË»Ùw'î­¼O¼_ô@íAÙCÝ‡Õ?[þÜØïÜjÀw óÑÜG÷…ƒÏþ‘õ�C�™�Ë††ëž8>99â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×ÎÑ˜Ñ¡—ò—“¿m|¥ýêÀë¯ÛÆÂÆ¾Éx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSÐ§û“““ÿ˜óüc3-Û    cHRM  z%  €ƒ  ùÿ  €é  u0  ê`  :˜  o’_ÅF   IDATxÚbøÿÿ?   ÿÿ üþÓ¥ua    IEND®B`‚                                                                                                                                                                                                                                                                                        images/status-icons.png                                                                             0000644                 00000006243 15266054600 0011164 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       ‰PNG

   IHDR          @È   	pHYs     šœ  
OiCCPPhotoshop ICC profile  xÚ�SgTSé=÷ÞôBKˆ€”KoR RB‹€‘&*!	Jˆ!¡ÙQÁEEÈ ˆŽŽ€ŒQ,Š
Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×>ç¬ó�³ÏÀ–H3Q5€©BàƒÇÄÆáä.@�
$p ³d!sý# ø~<<+"À¾ xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€ @zŽB¦ @F€�˜&S   `Ëcbã P- `'æÓ €�ø™{ [”! ‘  eˆD h; ¬ÏVŠE X0 fKÄ9 Ø- 0IWfH °· ÀÎ²  0Qˆ…) { `È##x „™ FòW<ñ+®ç*  x™²<¹$9E�[-qWW.(ÎI+6aaš@.Ây™2�4àóÌ   ‘àƒóýxÎ®ÎÎ6Ž¶_-ê¿ÿ"bbãþåÏ«p@  át~Ñþ,/³€;€mþ¢%îh^ u÷‹f²@µ  éÚWópø~<<E¡�¹ÙÙåääØJÄB[aÊW}þgÂ_ÀWýlù~<ü÷õà¾â$�2]�GøàÂÌôL¥Ï’	„bÜæ�Gü·ÿüÓ"ÄIb¹X*ãQqŽDšŒó2¥"‰B’)Å%Òÿdâß,û>ß5 °j>{‘-¨]cöK'XtÀâ÷  ò»oÁÔ(€hƒáÏwÿï?ýG % €fI’q  ^D$.TÊ³?Ç  D �*°AôÁ,ÀÁÜÁü`6„B$ÄÂBB
d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼�	AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ÉˆQ"K‘5H1RŠT UHò=r9‡\Fº‘;È 2‚ü†¼G1”�²Q=ÔµC¹¨7„F¢Ðdt1š� ›Ðr´=Œ6¡çÐ«hÚ�>CÇ0Àè3Äl0.ÆÃB±8,	“cË±"¬«Æ°V¬»‰õcÏ±w�EÀ	6wB aAHXLXNØH¨ $4Ú	7	„QÂ'"“¨K´&ºùÄb21‡XH,#Ö�/{ˆCÄ7$‰C2'¹�I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ä�äÃä3ää!ò[
�b@q¤øSâ(RÊjJåå4åe˜2AU£šRÝ¨¡T5�ZB­¡¶R¯Q‡¨4uš9ÍƒIK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw†ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê
•J•&•*/T©ª¦ªÞªUóUËT�©^S}®FU3Sã©	Ô–«Uª�PëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k«†u�5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN	ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§�¦½E»Yû�AÇJ'\'Gg�Î�çSÙSÝ§
§M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õGX³$ÛÎ<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕF�FŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­�­%Ö»­»§§¹N“N«žÖgÃ°ñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ãî“½“}º}�ý=‡Ù«Z~s´r:V:ÞšÎœî?}Åô–é/gXÏÏØ3ã¶Ë)Äi�S›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝÈ½äJtõq]ázÒõ�›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ?Ÿ•0kß¬~OCO�gµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿÑ §€%g‰�A�[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA�‚­‚åÁ­!hÈì�­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~'…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕX�XIlK9.*®6nl¾ßüíó‡â�âã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž
yÂÂg"/Ñ6ÑˆØC\*NòH*Mz’ì‘¼5y$Å3¥,å¹„'©�¼LLÝ›:žšv m2=:½1ƒ’‘�qBª!M“¶gêgæfvË¬e…²þÅn‹·/•Ék³�¬Y-
¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+ÍíÌ³ÊÛ�7œïŸÿíÂá’¶¥†KW-Xæ½¬j9²<qyÛ
ã+†V¬<¸Š¶*mÕO«íW—®~½&zMk�^ÁÊ‚ÁµkëU
å…}ëÜ×í]OX/Yßµaú†�>‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—nÙÚ´ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒÝµa×ønÑî{¼ö4ìÕÛ[¼÷ý>É¾ÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TR�Ö+ëGÇ¾þ�ïw-6U�œÆâ#pDyäé÷	ß÷:ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ4<YyJóTÉiÚé‚Ó“gòÏŒ�•�}~.ùÜ`Û¢¶{çcÎßjoïºtáÒEÿ‹ç;¼;Î\ò¸tò²ÛåW¸Wš¯:_mêtê<þ“ÓOÇ»œ»š®¹\k¹îz½µ{f÷éž7ÎÝô½yñÿÖÕž9=Ý½ózo÷Å÷õßÝ~r'ýÎË»Ùw'î­¼O¼_ô@íAÙCÝ‡Õ?[þÜØïÜjÀw óÑÜG÷…ƒÏþ‘õ�C�™�Ë††ëž8>99â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×ÎÑ˜Ñ¡—ò—“¿m|¥ýêÀë¯ÛÆÂÆ¾Éx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSÐ§û“““ÿ˜óüc3-Û    cHRM  z%  €ƒ  ùÿ  €é  u0  ê`  :˜  o’_ÅF  ÎIDATxÚì–»JA†¿ÄEM¹ B"´ˆ]ÚÑGÐJðò¢(ÞJA¬ÔA�´vZ‰B
ƒDH¹"(A-œ“¸³»3/èËœ™Ì·ÿÉ™Ý™M	!hQ'°ÌÈþ°¼<ÏãödÜ˜?Àá³6�%¥¿t ËDËˆK‡ŒÍÊvL^êX”Œ88FC~;Ubx:¥Ré¬ÿ#4â€³ )§uÊ†iâ`RÉ*ó&[ú¦\è‰tÆWš8N‰9�ñ°&ŽSbîÇ•úÛŒï4qœs:ãM§Ä\`\“íDÄÜ‰–¹ípã]ÙË—=ì:VNÚä§Óº<Ö¦�^MæÀ>°ªŒÙr¤„°ÖòXÜ¸Â–u€Ãˆlu*J[Ö± ±4lbµH6›Åó<
…‚ñ]§Fz8Ÿïc¡˜ùß2?½N�òêÊ¨R©hË&µÜ;~¸q.—Ãqš?<]×Åu] êõz„q7™®´6ÿùUo\.—›Œóù<µZß÷Æ:©7Ít¥Y(f8¸|LVêjµjT^UG×O¡ÿTMèo?Õ)!Ä›-,÷êß÷ésoÉÞ·Ã¦�9yfšèArÖìû Õô”9°àõ    IEND®B`‚                                                                                                                                                                                                                                                                                                                                                             languages/https-redirection.pot                                                                     0000644                 00000034750 15266054601 0012723 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       "Project-Id-Version: Easy HTTPS (SSL) Redirection\n"
"POT-Creation-Date: 2025-04-20 17:40+0600\n"
"PO-Revision-Date: 2025-04-20 17:39+0600\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Poedit 3.4\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: easy-https-ssl.php\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
"X-Poedit-SearchPathExcluded-1: vendor\n"

#: admin/ehssl-admin-init.php:63
msgid "Easy HTTPS & SSL"
msgstr ""

#: admin/ehssl-admin-init.php:64 admin/ehssl-dashboard-menu.php:44
msgid "Dashboard"
msgstr ""

#: admin/ehssl-admin-init.php:65 admin/ehssl-settings-menu.php:42
#: easy-https-ssl.php:47 easy-https-ssl.php:61
msgid "Settings"
msgstr ""

#: admin/ehssl-admin-init.php:66 admin/ehssl-certificate-expiry-menu.php:41
msgid "Certificate Expiry"
msgstr ""

#: admin/ehssl-admin-init.php:72 admin/ehssl-settings-menu.php:133
msgid "HTTPS Redirection"
msgstr ""

#: admin/ehssl-admin-init.php:242
msgid "NOTE:"
msgstr ""

#: admin/ehssl-admin-init.php:243
msgid ""
"The following php extensions are missing which is required by this plugin to "
"work properly. Contact you hosting provider enable this."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:72
msgid "SSL certificate scan completed successfully."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:84
msgid "SSL certificate info was deleted successfully."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:86
msgid "No saved SSL certificate info was detected for deletion."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:94
msgid "Certificates"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:101
msgid "ID"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:102
msgid "Label"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:103
msgid "Issuer"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:104
msgid "Issued on"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:105
msgid "Expires on"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:106
msgid "Status"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:126
msgid ""
"No SSL certificate information found. Click the Scan button to search for "
"installed certificates."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:134
msgid "Certificate Actions"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:139
msgid "Click the Scan button to manually scan for available SSL certificates."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:144
msgid "Scan Now"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:153
msgid "Do you really want to delete all saved SSL info?"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:154
msgid "Delete all SSL certificate records from the table."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:160
msgid "Delete All SSL Info"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:187 admin/ehssl-settings-menu.php:89
#: admin/ehssl-settings-menu.php:115 admin/ehssl-settings-menu.php:316
msgid "Settings Saved."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:225
msgid "Notification Email Settings"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:233
msgid "Enable Certificate Expiry Notification"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:243
msgid "Enable this option to send SSL certificate expiry notifications."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:249
msgid "Email Content Type"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:254
msgid "Plain Text"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:255
msgid "HTML"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:258
msgid ""
"Choose whether the SSL expiry notification email should be sent in plain "
"text or HTML format."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:264
msgid "Notification Email Before Days"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:275
msgid ""
"Set how many days in advance the expiry email should be sent. Default is 7 "
"days."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:281
msgid "Notification Email From"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:291
msgid "The email address used as the 'From' address in the notification email."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:297
msgid "Notification Email To"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:308
msgid "Email address where expiry notifications will be sent."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:314
msgid "Notification Email Subject"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:325
msgid "Certificate expiry notification email subject."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:331
msgid "Notification Email Body"
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:363
msgid "Certificate expiry notification email body."
msgstr ""

#: admin/ehssl-certificate-expiry-menu.php:372
#: admin/ehssl-settings-menu.php:193 admin/ehssl-settings-menu.php:275
#: admin/ehssl-settings-menu.php:344
msgid "Save Changes"
msgstr ""

#: admin/ehssl-dashboard-menu.php:105
msgid "SSL Status"
msgstr ""

#: admin/ehssl-dashboard-menu.php:115
msgid "Your site is protected!"
msgstr ""

#: admin/ehssl-dashboard-menu.php:122
msgid "No SSL found!"
msgstr ""

#: admin/ehssl-dashboard-menu.php:137
msgid "SSL Information"
msgstr ""

#: admin/ehssl-settings-menu-old.php:16
msgid "HTTPS Redirection Settings"
msgstr ""

#: admin/ehssl-settings-menu-old.php:19
msgid ""
"The HTTPS Redirection settings have been upgraded and relocated to a new "
"menu page titled <strong>Easy HTTPS & SSL</strong>. We have also added new "
"features to enhance the plugin. Click the link below to access the new "
"settings page."
msgstr ""

#: admin/ehssl-settings-menu-old.php:22
msgid "Go to the New Settings Page"
msgstr ""

#: admin/ehssl-settings-menu.php:125
#, php-format
msgid ""
"When you enable the HTTPS redirection, the plugin will force redirect the "
"URL to the HTTPS version of the URL. So before enabling this plugin's "
"feature, visit your site's HTTPS URL %s to make sure the page loads "
"correctly. Otherwise you may get locked out if your SSL certificate is not "
"installed correctly on your site or the HTTPS URL is not working and this "
"plugin is auto redirecting to the HTTPS URL."
msgstr ""

#: admin/ehssl-settings-menu.php:128
msgid "Important!"
msgstr ""

#: admin/ehssl-settings-menu.php:129
msgid ""
"If you're using caching plugins similar to W3 Total Cache or WP Super Cache, "
"you need to clear their cache after you enable or disable automatic "
"redirection option. Failing to do so may result in mixed content warning "
"from browser."
msgstr ""

#: admin/ehssl-settings-menu.php:142 admin/ehssl-settings-menu.php:219
msgid "Notice:"
msgstr ""

#: admin/ehssl-settings-menu.php:142
msgid ""
"The plugin's settings have been changed. In order to save them please don't "
"forget to click the 'Save Changes' button."
msgstr ""

#: admin/ehssl-settings-menu.php:150
msgid "Enable Automatic Redirection to HTTPS"
msgstr ""

#: admin/ehssl-settings-menu.php:156
msgid ""
"Use this option to make your webpage(s) load in HTTPS version only. If "
"someone enters a non-https URL in the browser's address bar then the plugin "
"will automatically redirect to the HTTPS version of that URL."
msgstr ""

#: admin/ehssl-settings-menu.php:167
msgid "Apply HTTPS Redirection To:"
msgstr ""

#: admin/ehssl-settings-menu.php:170
msgid "The whole domain"
msgstr ""

#: admin/ehssl-settings-menu.php:173
msgid "A few pages"
msgstr ""

#: admin/ehssl-settings-menu.php:177 admin/ehssl-settings-menu.php:181
msgid "Please enter a page slug value in the field before adding it."
msgstr ""

#: admin/ehssl-settings-menu.php:181
msgid "Enter the page slug"
msgstr ""

#: admin/ehssl-settings-menu.php:219
msgid ""
"It is very important to be extremely attentive when making changes to ."
"htaccess file."
msgstr ""

#: admin/ehssl-settings-menu.php:220
msgid "If after making changes your site stops functioning, do the following:"
msgstr ""

#: admin/ehssl-settings-menu.php:221
msgid ""
"Step #1: Open .htaccess file in the root directory of the WordPress install "
"and delete everything between the following two lines"
msgstr ""

#: admin/ehssl-settings-menu.php:226
msgid ""
"Step #2: Save the htaccess file (this will erase any change this plugin made "
"to that file)."
msgstr ""

#: admin/ehssl-settings-menu.php:227
msgid ""
"Step #3: Deactivate the plugin or rename this plugin's folder (which will "
"deactivate the plugin)."
msgstr ""

#: admin/ehssl-settings-menu.php:229
msgid ""
"The changes will be applied immediately after saving the changes, if you are "
"not sure - do not click the \"Save changes\" button."
msgstr ""

#: admin/ehssl-settings-menu.php:235
msgid "HTTPS redirection only works if you have pretty permalinks enabled."
msgstr ""

#: admin/ehssl-settings-menu.php:236
msgid ""
"To enable pretty permalinks go to <em>Settings > Permalinks</em> and select "
"any option other than \"default\"."
msgstr ""

#: admin/ehssl-settings-menu.php:237
msgid "Enable Permalinks"
msgstr ""

#: admin/ehssl-settings-menu.php:243
msgid "Debug Logging"
msgstr ""

#: admin/ehssl-settings-menu.php:246
msgid ""
"Debug logging can be useful to troubleshoot issues on your site. keep it "
"disabled unless you are troubleshooting."
msgstr ""

#: admin/ehssl-settings-menu.php:253
msgid "Enable Debug Logging"
msgstr ""

#: admin/ehssl-settings-menu.php:259
msgid "Check this option to enable debug logging."
msgstr ""

#: admin/ehssl-settings-menu.php:262 admin/ehssl-settings-menu.php:267
msgid "Click here"
msgstr ""

#: admin/ehssl-settings-menu.php:264
msgid " to view log file."
msgstr ""

#: admin/ehssl-settings-menu.php:269
msgid " to reset log file."
msgstr ""

#: admin/ehssl-settings-menu.php:293
msgid "Log file has been reset."
msgstr ""

#: admin/ehssl-settings-menu.php:295
msgid "Error trying to reset log: "
msgstr ""

#: admin/ehssl-settings-menu.php:322
msgid "Static Resources"
msgstr ""

#: admin/ehssl-settings-menu.php:327
msgid ""
"HTTPS redirection is turned off. Turn it on first to change these settings "
"below!"
msgstr ""

#: admin/ehssl-settings-menu.php:334
msgid "Force Resources to Use HTTPS URL"
msgstr ""

#: admin/ehssl-settings-menu.php:340
msgid ""
"When checked, the plugin will force load HTTPS URL for any static resources "
"in your content. Example: if you have have an image embedded in a post with "
"a NON-HTTPS URL, this option will change that to a HTTPS URL."
msgstr ""

#: admin/ehssl-ssl-management-menu.php:41
msgid "SSL Management"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:68
msgid ""
"The SSL Certificates required for HTTPS cannot be issued for WordPress sites "
"that are based on 'localhost' or use an IP address. To effectively utilize "
"SSL certificates, and hence to make the most from our plugin, you should "
"operate your WordPress site on a standard domain. This limitation is not "
"specific from our plugin but is a general rule in the issuance of SSL "
"certificates."
msgstr ""

#: admin/ehssl-ssl-management-menu.php:93
msgid "Error getting SSL:"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:139
msgid "SSL certificate mode:"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:142
msgid "Staging"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:143
msgid "Live"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:149
msgid "Email Address:"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:158
msgid "Generate SSL Certificate"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:187
msgid "Get Certificate Files"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:188
#: admin/ehssl-ssl-management-menu.php:206
#: admin/ehssl-ssl-management-menu.php:210
msgid "Some documentation goes here..."
msgstr ""

#: admin/ehssl-ssl-management-menu.php:194
msgid "Copy File Path"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:197
msgid "Download File"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:198
msgid "Copy File Content"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:205
msgid "Add the certificate file paths"
msgstr ""

#: admin/ehssl-ssl-management-menu.php:209
msgid "Restart the server"
msgstr ""

#: classes/ehssl-email-handler.php:74
msgid "Click here to toggle email merge tag hints"
msgstr ""

#: classes/ehssl-email-handler.php:80
msgid "The SSL certificate label"
msgstr ""

#: classes/ehssl-email-handler.php:84
msgid "The issuer of SSL certificate"
msgstr ""

#: classes/ehssl-email-handler.php:88
msgid "The issuing date of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:92
msgid "The issuing time of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:96
msgid "The issuing datetime of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:100
msgid "The expiry date of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:104
msgid "The expiry time of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:108
msgid "The expiry datetime of SSL certificate."
msgstr ""

#: classes/ehssl-email-handler.php:112
msgid "The current status of SSL certificate."
msgstr ""

#: classes/ehssl-ssl-certificate.php:73
msgid "Could not verify ownership via HTTP"
msgstr ""

#: classes/ehssl-ssl-certificate.php:104
msgid "SSL Certificate installation failed. Check the logs for details."
msgstr ""

#: classes/ehssl-ssl-certificate.php:124
msgid ""
"Certificate or private key file not found. Please generate a certificate "
"first!"
msgstr ""

#: classes/ehssl-ssl-certificate.php:155
msgid "Failed to create the acme-challenge directory"
msgstr ""

#: classes/ehssl-ssl-certificate.php:162
msgid "Failed to create the certificate directory"
msgstr ""

#: classes/utilities/ehssl-utils.php:34
msgid ""
"Error! The URL value is empty. Please specify a correct URL value to "
"redirect to!"
msgstr ""

#. Plugin Name of the plugin/theme
msgid "Easy HTTPS (SSL) Redirection"
msgstr ""

#. Plugin URI of the plugin/theme
msgid ""
"https://www.tipsandtricks-hq.com/wordpress-easy-https-redirection-plugin"
msgstr ""

#. Description of the plugin/theme
msgid ""
"The plugin HTTPS Redirection allows an automatic redirection to the "
"\"HTTPS\" version/URL of the site."
msgstr ""

#. Author of the plugin/theme
msgid "Tips and Tricks HQ"
msgstr ""

#. Author URI of the plugin/theme
msgid "https://www.tipsandtricks-hq.com/"
msgstr ""
                        languages/index.php                                                                                 0000644                 00000000035 15266054601 0010335 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

// Silence is golden                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   js/script.js                                                                                        0000644                 00000002774 15266054601 0007041 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       (function ($) {
    $(document).ready(function () {
        /* add notice about changing in the settings page */
        $(document).on('click', '.rewrite_item_add_btn', function () {
            $(this).each(function () {
                if ($(this).prev().val() != '') {
                    $(this).next().hide();
                    $(this).parents('.rewrite_new_item').removeClass('rewrite_new_item').clone().addClass('rewrite_new_item').appendTo($(this).parents("td")).find('input').val('');
                    $(this).addClass('rewrite_item_delete_btn').removeClass('rewrite_item_add_btn');
                    $(this).children('.dashicons').addClass('dashicons-trash').removeClass('dashicons-plus-alt2');
                } else {
                    $(this).next().show();
                }
            });
        });

        $(document).on('click', '.rewrite_item_delete_btn', function () {
            $(this).each(function () {
                $(this).parent().remove();
            });
        });

        // Toggle merge tag hints
        $(document).on('click', 'a.ehssl-toggle', function (e) {
            e.preventDefault();
            var div = $(this).siblings('div');
            if (div.is(':visible')) {
                $(this).removeClass('toggled-on');
                $(this).addClass('toggled-off');
            } else {
                $(this).removeClass('toggled-off');
                $(this).addClass('toggled-on');
            }
            div.slideToggle('fast');
        });
    });
})(jQuery);    js/index.php                                                                                        0000644                 00000000035 15266054601 0007003 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

// Silence is golden                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   js/ehssl-static-resources-scan-update.js                                                            0000644                 00000020330 15266054601 0014336 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       /* global ehssl_non_https_resources_scan_update_js_data */

document.addEventListener('DOMContentLoaded', function () {
    const {ajaxUrl, texts} = ehssl_non_https_resources_scan_update_js_data;
    const scanForm = document.getElementById('ehssl_non_https_resources_scan_form');
    const scanBtn = document.getElementById('ehssl_non_https_resources_scan_btn');
    const resultsBox = document.getElementById('ehssl_scan_results');

    scanForm.addEventListener('submit', async function (e) {
        e.preventDefault();
        scanBtn.disabled = true;
        let scanBtnText = scanBtn.textContent;
        scanBtn.textContent = texts.scan_btn_loading;
        scanBtnText = texts.rescan_btn;

        const checked_post_types = scanForm.querySelectorAll('input[name="ehssl_post_types[]"]:checked');
        const checked_other_tables = scanForm.querySelectorAll('input[name="ehssl_other_tables[]"]:checked');

        if (!checked_post_types.length && !checked_other_tables.length) {
            alert(texts.pls_select_an_item);
            scanBtn.disabled = false;
            scanBtn.innerText = scanBtnText;
            return;
        }

        resultsBox.innerHTML = '';

        const formData = new FormData(e.target);
        formData.append('action', 'ehssl_non_https_resources_scan');
        formData.append('offset', 0);
        formData.append('total', JSON.stringify([]));

        const onComplete = async(resp) => {
            // console.log('processBatchScan onComplete:', resp); // Debug Purpose Only

            if (resp.success) {
                // Display the rendered table.
                await getScannedResourcesTable((tableHTML) => {
                    resultsBox.innerHTML = tableHTML;
                })
            }

            scanBtn.disabled = false;
            scanBtn.textContent = scanBtnText;
        }

        const onError = (response) => {
            // return response;
            let resp_msg;

            if ( response?.message !== undefined) {
                resp_msg = response.message;
            } else if ( response?.data?.message !== undefined) {
                resp_msg = response.data.message;
            } else {
                resp_msg = 'Something went wrong';
            }

            console.log(resp_msg, response);
            alert(resp_msg);
            scanBtn.disabled = false;
            scanBtn.innerText = scanBtnText;
        }

        await processBatchScan(formData, onComplete, onError);
    });

    async function processBatchScan(formData, onComplete, onError) {
        try {
            let response = await fetch(ajaxUrl, {
                method: 'POST',
                body: formData,
            })

            response = await response.json();

            const {success, data} = response;
            if (!success) {
                onError(response);
                return;
            }

            // console.log('processBatchScan response:', response); // Debug Purpose Only

            if (!data.completed) {
                formData.append('total', JSON.stringify(data.total));
                formData.append('offset', data.next_offset);

                await processBatchScan(formData, onComplete, onError);
            } else {
                onComplete(response);
            }

        } catch (error) {
            onError(error);
        }
    }

    async function getScannedResourcesTable(cb) {
        try {
            const currentParams = new URLSearchParams(window.location.search);
            const currentPage = currentParams.get('page');
            const currentTab = currentParams.get('tab');

            const url = new URL(ajaxUrl);
            url.searchParams.append('action', 'ehssl_get_scanned_resources_table');
            url.searchParams.append('page', currentPage);
            url.searchParams.append('tab', currentTab);

            let response = await fetch(url, {
                method: 'GET',
            })

            response = await response.text();

            cb(response);
        } catch (error) {
            alert(error.message);
        }
    }

    /**
     * AJAX pagination
     */
    document.addEventListener('click', function (e) {
        const navLink = e.target.closest('.tablenav-pages a');
        if (!navLink) {
            return;
        }
        e.preventDefault();

        const currentParams = new URLSearchParams(window.location.search);

        const url = new URL(ajaxUrl);
        url.searchParams.append('action', 'ehssl_load_static_resources_table_page');
        url.searchParams.append('page', currentParams.get('page'));
        url.searchParams.append('tab', currentParams.get('tab'));

        const navLinkUrl = new URL(navLink.href);
        const paged = navLinkUrl.searchParams.get('paged') || 1;
        url.searchParams.append('paged', paged);

        fetch(url, {
            method: 'GET',
        })
            .then(response => response.text())
            .then(html => {
                resultsBox.innerHTML = html;
            });
    });

    /**
     * Update URLs action.
     */
    document.addEventListener('click', function (e) {
        if (e.target.matches('#doaction, #doaction2')) {
            handle_update_urls(e);
        }

        else if (e.target.matches('#ehssl_update_all_found_http_urls')) {
            handle_update_urls(e, true);
        }
    });


    function handle_update_urls(e, update_all = false){
        e.preventDefault();

        const actionBtn = e.target;
        const actionBtnText = actionBtn.textContent;

        const nonce_input = document.querySelector('input[name="ehssl_update_all_http_urls_nonce"]');
        const nonce = nonce_input.value || '';

        const formData = new FormData();
        formData.append('action', 'ehssl_update_http_urls');
        formData.append('nonce', nonce);
        formData.append('offset', 0);

        const onComplete = (resp) => {
            getScannedResourcesTable((tableHTML) => {
                resultsBox.innerHTML = tableHTML;

                disableButtons(false);
            })
        }

        if (update_all) {
            actionBtn.textContent = texts.update_btn_loading;
        } else {
            const bulkSelect = actionBtn.id === 'doaction'
                ? document.getElementById('bulk-action-selector-top')
                : document.getElementById('bulk-action-selector-bottom');

            if (!bulkSelect || bulkSelect.value !== 'update_to_https') {
                alert('Please select an action!');
                return;
            }

            const selected_ids = [];

            const checkboxes = document.querySelectorAll('input[name="ehssl_non_https_resources_scan_ids[]"]:checked');
            checkboxes?.forEach(function (el) {
                selected_ids.push(el.value);
            });

            if (!selected_ids.length) {
                alert('Please select at least one item!');
                return;
            }

            formData.append('selected_ids', JSON.stringify(selected_ids));
        }

        if (!confirm(texts.confirm_update)) {
            disableButtons(false);
            actionBtn.textContent = actionBtnText;
            return;
        }

        disableButtons();

        processBatchUpdate(formData, onComplete);
    }

    function disableButtons(value = true){
        document.querySelectorAll('#ehssl_update_all_found_http_urls, #doaction, #doaction2').forEach((btn) => {
            btn.disabled = value;
        });
    }

    async function processBatchUpdate(formData, onComplete) {
        try {
            let response = await fetch(ajaxUrl, {
                method: 'POST',
                body: formData,
            })

            response = await response.json();

            const {success, data} = response;
            if (!success) {
                alert('Something went wrong');
                console.log('Something went wrong', response);
                return;
            }

            // console.log(`${data.processed}/${data.total}`); // Debug purpose only.

            if (!data.completed) {
                formData.append('offset', data.next_offset);
                await processBatchUpdate(formData, onComplete);
            } else {
                onComplete(response);
            }
        } catch (error) {
            alert(error.message);
        }
    }
});                                                                                                                                                                                                                                                                                                        license.txt                                                                                         0000644                 00000105726 15266054602 0006750 0                                                                                                    ustar 00                                                                                                                                                                                                                                                         GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright Â© 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright Â© <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright Â© <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.                                          readme.txt                                                                                          0000644                 00000024713 15266054602 0006557 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       ï»¿=== Easy HTTPS Redirection (SSL) ===
Contributors: Tips and Tricks HQ
Donate link: https://www.tipsandtricks-hq.com/development-center
Tags: ssl, https, force ssl, insecure content, redirection, automatic redirection, htaccess, https redirection, ssl certificate, secure page, secure, force https
Requires at least: 6.5
Tested up to: 7.0
Stable tag: 2.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

The plugin allows an automatic redirection to the "HTTPS" version/URL of the site. Make your site SSL compatible easily.

== Description ==

= Only use this plugin if you have installed SSL certificate on your site and HTTPS is working correctly =

Once you've installed an SSL certificate on your site, it's important to ensure that your webpages are accessed via their secure HTTPS URLs.

To improve SEO and user security, you want search engines and visitors to always use the HTTPS version of your pages. This plugin makes that easy by automatically redirecting users to the HTTPS version whenever they try to access the non-HTTPS (HTTP) version of a page.

=== Example ===

Let's say you want to ensure the following page is always accessed over HTTPS:

`https://www.example.com/checkout`

If a visitor tries to access:

`http://www.example.com/checkout`

The plugin will automatically redirect them to the secure version:

`https://www.example.com/checkout`

This ensures that visitors always access the HTTPS version of your pages or site.

You can choose to automatically redirect your entire domain to HTTPS, or selectively apply HTTPS redirection to specific pages.

=== Video Tutorials ===

https://www.youtube.com/watch?v=oyJgRFCM6u8

https://www.youtube.com/watch?v=LtyBraB64v8

=== Force Load Static Files Using HTTPS ===

If you started using SSL from day 1 of your site then all your static files are already embedded using HTTPS URL. You have no issue there.

However, if you have an existing website where you have a lot of static files that are embedded in your posts and pages using NON-HTTPS URL then you will need to change those. Otherwise, the browser will show an SSL warning to your visitors.

This plugin has an option that will allow you to force load those static files using HTTPS URL dynamically. 

This will help you make the webpage fully compatible with SSL.

=== Mixed Content Scanner & Database URL Fixer ===

After switching to HTTPS, your pages can still trigger browser "mixed content" warnings if old HTTP URLs remain saved in your database (in post content, custom post types, post meta, or WordPress options). This plugin includes a built-in scanner to find and update those insecure URLs to their HTTPS version - no manual database editing required.

Available from the **Mixed Contents** settings tab, the scanner lets you:

* **Scan selected post types** - Choose exactly which post types to scan and update, including posts, pages, and any custom post types registered by your other plugins (products, orders, downloads, subscriptions, and more).
* **Update other database tables** - Optionally include the WordPress options table in the scan.
* **Include post meta** - Extend the scan to post meta for the selected post types.
* **Choose your scan scope** - Run a quick "Scan Static Resources Only" pass, or a thorough "Scan All" to catch every non-HTTPS reference.

This makes cleaning up legacy HTTP links straightforward, helping you achieve a fully secure padlock with no mixed content errors.

=== SSL Certificate Expiry Notification ===

This plugin includes a feature that allows you to receive email notifications when your SSL certificate is about to expire. It helps ensure your website remains secure and accessible over HTTPS.

You can configure the recipient email address and specify how many days in advance the notification should be sent. By default, the notification is sent 7 days before expiry, but you can adjust this to suit your preference.

This feature is especially useful for site owners who may not frequently check their SSL status, or for those managing multiple websites. By receiving timely alerts, you can renew your SSL certificate in advance and prevent potential downtime or security warnings.

=== HTTP Strict Transport Security (HSTS) Support ===

Easy HTTPS Redirection includes built-in support for sending the HTTP Strict Transport Security (HSTS) response header.

HSTS instructs compatible web browsers to automatically access your website over HTTPS after a visitor has successfully visited your secure site. This helps strengthen your site's HTTPS enforcement and reduces the risk of users accidentally accessing the HTTP version of your website.

The plugin allows you to:

* Enable or disable the HSTS response header with a simple checkbox.
* Configure the HSTS max-age value.
* Apply the HSTS policy to all subdomains using the `includeSubDomains` directive.
* Include the `preload` directive for sites that intend to submit their domain to the browser HSTS preload list.

=== Features ===
* Automatically redirect all HTTP traffic to HTTPS
* Option to force HTTPS on the entire site
* Option to selectively apply HTTPS redirection to specific pages
* Helps search engines index the secure versions of your pages
* Improves site security and user trust
* Force load static files (images, js, css etc) using a HTTPS URL
* Built-in mixed content scanner to find and update non-HTTPS URLs across post content, post meta, custom post types, and WordPress options
* SSL certificate expiry notification - Option to send SSL expiry notifications to a specific email address
* Easily see which SSL certificates on your site are approaching their expiry date.
* HTTP Strict Transport Security (HSTS) support with configurable max-age, includeSubDomains, and preload options.

View more details on the [HTTPS Redirection plugin](https://www.tipsandtricks-hq.com/wordpress-easy-https-redirection-plugin) page.

== Installation ==

1. Upload `https-redirection` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. The plugin settings can be found in the left-hand menu of the Admin Dashboard under 'Easy HTTPS & SSL'.

== Frequently Asked Questions ==

= How will the plugin work with the existing .htaccess file?=

If the file exists, the plugin will update existing .htaccess file.

= What should I do if the .htaccess file does not exist? =

The plugin will store the settings in the database and add all the necessary conditions to the settings of WordPress automatically.

= What should I do if after making changes in the .htaccess file with the help of the plugin my site stops working? =

The.htaccess is located in the site root. With your FTP program or via cPanel go to the site root, open the .htaccess file and delete the necessary strings manually.
Please make use of the following information: https://codex.wordpress.org/FTP_Clients

= How to use the other language files with the HTTPS Redirection? = 

Here is an example for German language files.

1. In order to use another language for WordPress it is necessary to set the WP version to the required language and in configuration wp file - `wp-config.php` in the line `define('WPLANG', '');` write `define('WPLANG', 'de_DE');`. If everything is done properly the admin panel will be in German.

2. Make sure that there are files `de_DE.po` and `de_DE.mo` in the plugin (the folder languages in the root of the plugin).

3. If there are no such files it will be necessary to copy other files from this folder (for example, for Russian or Italian language) and rename them (you should write `de_DE` instead of `ru_RU` in the both files).

4. The files are edited with the help of the program Poedit - https://poedit.net/download - please load this program, install it, open the file with the help of this program (the required language file) and for each line in English you should write translation in German.

5. If everything has been done properly all the lines will be in German in the admin panel and on frontend.

== Screenshots ==

1. Plugin settings page.

== Changelog ==

= v2.0.1 =
- New feature: Mixed content scanner tool to find and update non-HTTPS URLs.
- Added support for sending the HTTP Strict Transport Security (HSTS) response header via the plugin settings.
- WordPress 7 related UI fix.
- Fixed a small PHP deprecation warning.

= v2.0.0 =
- The plugin has gone through significant updates and improvements in this version.
- If you have any issues after you upgrade to this version, please roll back to the previous version and contact us for support.
- Here is the download link for the previous version: https://downloads.wordpress.org/plugin/https-redirection.1.9.2.zip
- The plugin now has it's own admin menu labeled "Easy HTTPS & SSL".
- Added a new option to send SSL expiry notifications to a specific email address.
- Added a new option to specify how many days in advance the notification should be sent.
- Added debug logging feature.
- Updated the translation POT file.

= v1.9.2 =
- Added rule to handle sites that are sitting behind a reverse-proxy. Thanks to @canadiannaginata for pointing it out.

= v1.9.1 =
- WP 5.3 warning fix for the add_submenu_page() function call. Thanks to @vfontj for pointing this out.

= v1.9 =
- WP Fastest Cache cache is automatically cleared when plugin settings are changed. This is to prevent "mixed content" warning from browsers.
- Fixed rare conflict with WP Fastest Cache (thanks to emrevona).

= v1.8 =
- Apply HTTPS redirection on the whole domain will be the default selected option after plugin install. You an change this option when you actually go to enable the feature.

= v1.7 =
- Additional options are only accessible when "Enable automatic redirection to the "HTTPS" is enabled.
- https://www.yoursite.com/some-page is replaced with site's actual https address in Settings information box.
- Added reminder for user to clear cache of optimization plugins similar to W3 Total Cache or WP Super Cache.

= v1.6 =
- Improved the "Force Load Static Files Using HTTPS" feature.
- The htaccess redirection is now detected based on SERVER_PORT (this is should work better on most servers).

= v1.5 =
- WordPress 4.6 compatibility.

= v1.4 =
- Improved the settings area to only show the options if pretty permalink feature is enabled.

= v1.3 =
- Updated the htaccess rules for HTTPS redirection to be more robust to prevent errors on some servers.

= v1.2 =
- Added a new option to automatically force load static files using HTTPS URL.

= v1.1 =
- Fixed a bug with the settings page.

= v1.0 =
* First commit to WordPress repository

== Upgrade Notice ==

None                                                     logs/index.php                                                                                      0000644                 00000000035 15266054602 0007334 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php

// Silence is golden                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   css/ehssl-common-style.css                                                                          0000644                 00000000000 15266054602 0011604 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       css/ehssl-admin-styles.css                                                                          0000644                 00000007403 15266054602 0011605 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       /* General CSS */
.ehssl-margin-10{
    margin: 10px;
}
.ehssl-margin-top-10{
    margin-top: 10px;
}
.ehssl-margin-bottom-10{
    margin-bottom: 10px;
}
.ehssl-hidden{
    display: none;
}
.ehssl-green-success-text{
    font-weight: bold;
    color: green;    
}
.ehssl-red-error-text{
    font-weight: bold;
    color: red;
}
.ehssl-box-shadow {
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-yellow-box{
    margin: 10px 0px;
    padding: 10px;
    background-color: #FFFFE0;
    border-color: #E6DB55;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-red-box {
    margin: 10px 0px;
    padding: 10px;
    background-color: #FFEBE8;
    border-color: #CC0000;
    color: #333333;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-orange-box{
    margin: 10px 0px;
    padding: 15px 10px;
    color: #3F2502;
    background-color: #FFF6D5;
    border-color: #D1B655;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-white-box{
    margin: 10px 0px;
    padding: 15px 10px;
    color: #3c434a;
    background-color: #fff;
    border-color: #c3c4c7;
    border-width: 1px;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-grey-box{
    margin: 10px 0px;
    padding: 15px 10px;
    background-color: #DDDDDD;
    border-color: #CCCCCC;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-green-box {
    margin: 10px 0px;
    padding: 15px 10px;
    background-color: #CCF4D6;
    border-color: #059B53;
    color: #043B14;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/* Wrap directly with this class (not to be used with a paragraph tag) */
.ehssl-blue-box {
    margin: 10px 0px;
    padding: 15px 10px;
    background-color: #E7F4FE;
    border-color: #AACEE6;
    color: #1D263B;
    border-radius: 3px 3px 3px 3px;
    border-style: solid;
    border-width: 1px;
}

/*
* styles for settings page
*/
.rewrite_info {
    color: rgb(136, 136, 136); 
    font-size: 10px;
    clear: both;
}

.rewrite_item_delete_btn, .rewrite_item_add_btn {
    padding-left: 6px !important;
    padding-right: 6px !important;
	cursor: pointer;
}
.rewrite_select_item .rewrite_delete_select_item{
	padding: 0 6px 0 6px;
}

.rewrite_item_blank_error{
	color: red;
	display: none;
}

/*----- Email tags hint ----- */

.ehssl-tags-table-cont {
    margin-top: 10px;
}

a.ehssl-toggle {
    text-decoration: none;
    border-bottom: 1px dashed;
}

a.ehssl-toggle.toggled-on::after {
    content: " â†‘";
}

a.ehssl-toggle.toggled-off::after {
    content: " â†“";
}

table.ehssl-tags-hint td, table.ehssl-tags-hint th {
    padding: 5px 10px;
}

table.ehssl-tags-hint {
    background: #fff;
    width: 100%;
}

table.ehssl-tags-hint td.ehssl-tag-name {
    width: 150px;
    border-bottom: 1px solid #ededed;
}

table.ehssl-tags-hint td.ehssl-tag-descr {
    width: 70%;
    border-bottom: 1px solid #ededed;
}

/*----- END Email tags hint ----- */

.ehssl-settings-field-cat-1{
    width: 70px;
}

.ehssl-settings-field-cat-2{
    width: 400px;
}

.ehssl-settings-field-cat-3{
    width: 650px;
}

@media only screen and (max-width: 782px){
    .ehssl-settings-field-cat-1,
    .ehssl-settings-field-cat-2,
    .ehssl-settings-field-cat-3{
        width: 100%;
    }
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             