wp-force-ssl
Last commit date
index.php
11 years ago
php-backwards-compatibility.php
7 years ago
plugin.php
7 years ago
readme.txt
6 years ago
wp-force-ssl.php
7 years ago
wp-force-ssl.php
109 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: WP Force SSL |
| 4 | Plugin URI: https://www.kosvrouvas.com |
| 5 | Description: Redirect all traffic from HTTP to HTTPS to all pages of your WordPress website. |
| 6 | Stable Tag: 1.4 |
| 7 | Author: Kostas Vrouvas |
| 8 | Version: 1.4 |
| 9 | */ |
| 10 | |
| 11 | // |
| 12 | register_activation_hook( __FILE__, 'wpfssl_welcome_screen_activate' ); |
| 13 | function wpfssl_welcome_screen_activate() { |
| 14 | set_transient( '_welcome_screen_activation_redirect', true, 30 ); |
| 15 | } |
| 16 | |
| 17 | add_action( 'admin_init', 'wpfssl_welcome_screen_do_activation_redirect' ); |
| 18 | function wpfssl_welcome_screen_do_activation_redirect() { |
| 19 | // Bail if no activation redirect |
| 20 | if ( ! get_transient( '_welcome_screen_activation_redirect' ) ) { |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | // Delete the redirect transient |
| 25 | delete_transient( '_welcome_screen_activation_redirect' ); |
| 26 | |
| 27 | // Bail if activating from network, or bulk |
| 28 | if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | // Redirect to bbPress about page |
| 33 | wp_safe_redirect( add_query_arg( array( 'page' => 'wpfssl-welcome-screen' ), admin_url( 'index.php' ) ) ); |
| 34 | } |
| 35 | |
| 36 | add_action('admin_menu', 'wpfssl_welcome_screen_pages'); |
| 37 | function wpfssl_welcome_screen_pages() { |
| 38 | add_dashboard_page( |
| 39 | 'Welcome to WP Force SSL', |
| 40 | 'Welcome to WP Force SSL', |
| 41 | 'read', |
| 42 | 'wpfssl-welcome-screen', |
| 43 | 'wpfssl_welcome_screen_content' |
| 44 | ); |
| 45 | } |
| 46 | function wpfssl_welcome_screen_content() { |
| 47 | ?> |
| 48 | <div id="wpbody"> |
| 49 | <div id="wpbody-content"> |
| 50 | <div class="wrap about-wrap"> |
| 51 | <h1>Thank you for installing WP Force SSL!</h1> |
| 52 | <div class="about-text"> |
| 53 | This plugin helps you redirect HTTP traffic to HTTPS without the need of touching any code.</div> |
| 54 | <h3>Some things are required for this to happen:</h3> |
| 55 | <ul class="ul-disc"> |
| 56 | <li>You need an SSL Certificate in order for this plugin to work.</li> |
| 57 | <li>You need to add https to the WordPress Address (URL) and Site Address (URL) parameters under General > Settings. (Required by WordPress itself)</li> |
| 58 | </ul> |
| 59 | <br> |
| 60 | <br> |
| 61 | <hr> |
| 62 | <h1>Changelog:</h1> |
| 63 | <br> |
| 64 | <h4>1.4</h4> |
| 65 | <p><small>Release date: December 9th, 2018</small></p> |
| 66 | <ul class="ul-disc"> |
| 67 | <li>Changed function naming to avoid conflicts reported by users.</li> |
| 68 | </ul> |
| 69 | <h4>1.3</h4> |
| 70 | <p><small>Release date: February 11th, 2016</small></p> |
| 71 | <ul class="ul-disc"> |
| 72 | <li>Dropping support for PHP 5.3: Only 15.9% of the people that use WordPress use PHP 5.3, it reached end of life and you should ask your host to upgrade.</li> |
| 73 | </ul> |
| 74 | <h4>1.2.1</h4> |
| 75 | <p><small>Release date: April 22th, 2015</small></p> |
| 76 | <ul class="ul-disc"> |
| 77 | <li>Fixed an issue where some users were getting a error message for no valid header when activating the plugin.</li> |
| 78 | </ul> |
| 79 | <h4>1.2</h4> |
| 80 | <ul class="ul-disc"> |
| 81 | <li>Dropping support for PHP 5.2: Only 5.7% of the people that use WordPress use PHP 5.2, it's old, buggy, and insecure.</li> |
| 82 | </ul> |
| 83 | </div> |
| 84 | </div> |
| 85 | </div><!-- wpbody-content --> |
| 86 | |
| 87 | <?php |
| 88 | } |
| 89 | |
| 90 | add_action( 'admin_head', 'wpfssl_welcome_screen_remove_menus' ); |
| 91 | function wpfssl_welcome_screen_remove_menus() { |
| 92 | remove_submenu_page( 'index.php', 'wpfssl-welcome-screen' ); |
| 93 | } |
| 94 | |
| 95 | |
| 96 | // Prevent direct access to this file. |
| 97 | if( !defined( 'ABSPATH' ) ) { |
| 98 | exit( 'You are not allowed to access this file directly.' ); |
| 99 | } |
| 100 | |
| 101 | // Check if PHP is at the minimum required version |
| 102 | if( version_compare( PHP_VERSION, '5.4', '>=' ) ) { |
| 103 | define( 'WP_FORCE_SSL_FILE', __FILE__ ); |
| 104 | require_once dirname( __FILE__ ) . '/plugin.php'; |
| 105 | } else { |
| 106 | require_once dirname( __FILE__ ) . '/php-backwards-compatibility.php'; |
| 107 | } |
| 108 | |
| 109 | ?> |