WP Force SSL - Version 1.4

Version Description

  • Changed function naming to avoid conflicts reported by users.
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP Force SSL
Version 1.4
Comparing to
See all releases

Version 1.4

Files changed (5) hide show
  1. index.php +2 -0
  2. php-backwards-compatibility.php +39 -0
  3. plugin.php +21 -0
  4. readme.txt +43 -0
  5. wp-force-ssl.php +109 -0
index.php ADDED
@@ -0,0 +1,2 @@
1
+ <?php
2
+ //Silence is golden.
php-backwards-compatibility.php ADDED
@@ -0,0 +1,39 @@
1
+ <?php
2
+ // Prevent direct file access
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ header( 'Status: 403 Forbidden' );
5
+ header( 'HTTP/1.1 403 Forbidden' );
6
+ exit;
7
+ }
8
+ /**
9
+ * Deactivates the plugin
10
+ *
11
+ * @return bool
12
+ */
13
+ function wpfssl_deactivate_self() {
14
+ if( ! current_user_can( 'activate_plugins' ) ) {
15
+ return false;
16
+ }
17
+ // deactivate self
18
+ deactivate_plugins( 'wp-force-ssl/wp-force-ssl.php' );
19
+ // get rid of "Plugin activated" notice
20
+ if( isset( $_GET['activate'] ) ) {
21
+ unset( $_GET['activate'] );
22
+ }
23
+ // show notice to user
24
+ add_action( 'admin_notices', 'wpfssl_requirement_notice' );
25
+ return true;
26
+ }
27
+ /**
28
+ * Outputs a notice telling the user that the plugin deactivated itself
29
+ */
30
+ function wpfssl_requirement_notice() {
31
+ ?>
32
+ <div class="updated">
33
+ <p><?php _e( 'WP Force SSL did not activate because it requires your server to run PHP 5.4 or higher. <a href="http://www.wpupdatephp.com/update/" target="_blank">Learn More</a>', 'wp-force-ssl' ); ?></p>
34
+ </div>
35
+ <?php
36
+ }
37
+ // Hook into `admin_init`
38
+ add_action( 'admin_init', 'wpfssl_deactivate_self' );
39
+ ?>
plugin.php ADDED
@@ -0,0 +1,21 @@
1
+ <?php
2
+ // Prevent direct access to this file.
3
+ if( !defined( 'ABSPATH' ) ) {
4
+ exit( 'You are not allowed to access this file directly.' );
5
+ }
6
+
7
+ // "The Core"
8
+ define('FORCE_SSL' , true);
9
+
10
+ if (defined('FORCE_SSL'))
11
+ add_action('template_redirect', 'wpfssl_core');
12
+
13
+ function wpfssl_core(){
14
+
15
+ if ( FORCE_SSL && !is_ssl () )
16
+ {
17
+ wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
18
+ exit();
19
+ }
20
+ }
21
+ ?>
readme.txt ADDED
@@ -0,0 +1,43 @@
1
+ === Plugin Name ===
2
+ Contributors: kosvrouvas, webfactory
3
+ Tags: ssl, force, https, security, ssl certificate, certificate, redirect
4
+ Requires at least: 3.9
5
+ Tested up to: 5.2.2
6
+ Stable Tag: 1.4
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ == Description ==
11
+ This plugin helps you redirect HTTP traffic to HTTPS without the need of touching any code.
12
+
13
+ Want to contribute? Visit the <a href="https://bit.ly/2KIS3wC" target="_blank">Github repo</a>.
14
+
15
+ = Notes: =
16
+ - You need an SSL Certificate in order for this plugin to work.
17
+ - You need to <strong>add https to the WordPress Address (URL) and Site Address (URL) parameters under General > Settings</strong>. (Required by WordPress itself)
18
+
19
+ == Installation ==
20
+ You need to <strong>add https to the WordPress Address (URL) and Site Address (URL) parameters under General > Settings</strong>. (Required by WordPress itself)
21
+
22
+ 1. Add https to the WordPress Address (URL) and Site Address (URL) parameters under General > Settings. (Required by WordPress itself)
23
+ 2. Install as a regular WordPress plugin.
24
+ 3. Activate the plugin.
25
+ 4. Done.
26
+
27
+ == Changelog ==
28
+ = 1.4 =
29
+ - Changed function naming to avoid conflicts reported by users.
30
+
31
+ = 1.3 =
32
+ - 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.
33
+
34
+ = 1.2.1 =
35
+ - Fixed an issue where some users were getting a error message for no valid header when activating the plugin.
36
+
37
+ = 1.2 =
38
+ - 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.
39
+
40
+ == Upgrade Notice ==
41
+
42
+ = 1.3 =
43
+ In this version, we are dropping support for PHP 5.3. Do not upgrade if your website is running on it just yet, and ask you host to upgrade.
wp-force-ssl.php ADDED
@@ -0,0 +1,109 @@
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
+ ?>