HTTP / HTTPS Remover: SSL Mixed Content Fix - Version 1.2

Version Description

(12/11/16) = * Added support for Google (Fonts, Ajax, Maps etc.) * Compatibility for Wordpress 4.7

Download this release

Release Info

Developer condacore
Plugin Icon 128x128 HTTP / HTTPS Remover: SSL Mixed Content Fix
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2

Files changed (2) hide show
  1. http-https-remover.php +78 -70
  2. readme.txt +7 -3
http-https-remover.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: HTTP / HTTPS Remover
4
  * Plugin URI: https://de.wordpress.org/plugins/http-https-remover/
5
  * Description: This Plugin removes HTTP and HTTPS protocols from all links.
6
- * Version: 1.1.1
7
  * Author: Marius Bolik (CONDACORE)
8
  * Author URI: https://condacore.com/
9
  * License: GPLv3
@@ -19,76 +19,84 @@
19
  #
20
 
21
 
22
- if ( ! defined( 'ABSPATH' ) ) exit;
 
23
 
24
- class HTTP_HTTPS_REMOVER {
25
-
26
- ############################################
27
- ###### Apply Plugin on the whole Site ######
28
- ############################################
29
 
30
- public function __construct() {
31
- add_action('wp_loaded', array( $this, 'letsGo' ), 99, 1);
32
- }
33
-
34
- ##########################
35
- ###### More Code... ######
36
- ##########################
37
-
38
-
39
- public function letsGo() {
40
- global $pagenow;
41
- ob_start( array( $this, 'mainPath' ) );
42
- }
43
 
44
- public function mainPath( $buffer ) {
45
- $content_type = NULL;
46
- foreach ( headers_list() as $header ) {
47
- if (strpos( strtolower( $header ), 'content-type:' ) === 0 ) {
48
- $pieces = explode( ':', strtolower( $header ) );
49
- $content_type = trim( $pieces[1] );
50
- break;
51
- }
52
- }
53
- if ( is_null( $content_type ) || substr( $content_type, 0, 9 ) === 'text/html' ) {
54
-
55
- ################################
56
- ###### The important Path ######
57
- ################################
58
-
59
- #href
60
- $buffer = str_replace( 'href=\'https://'.$_SERVER['HTTP_HOST'], 'href=\'//'.$_SERVER['HTTP_HOST'], $buffer );
61
- $buffer = str_replace( 'href="https://'.$_SERVER['HTTP_HOST'], 'href="//'.$_SERVER['HTTP_HOST'], $buffer );
62
- $buffer = str_replace( 'href=\'http://'.$_SERVER['HTTP_HOST'], 'href=\'//'.$_SERVER['HTTP_HOST'], $buffer );
63
- $buffer = str_replace( 'href="http://'.$_SERVER['HTTP_HOST'], 'href="//'.$_SERVER['HTTP_HOST'], $buffer );
64
-
65
- #src
66
- $buffer = str_replace( 'src=\'https://'.$_SERVER['HTTP_HOST'], 'src=\'//'.$_SERVER['HTTP_HOST'], $buffer );
67
- $buffer = str_replace( 'src="https://'.$_SERVER['HTTP_HOST'], 'src="//'.$_SERVER['HTTP_HOST'], $buffer );
68
- $buffer = str_replace( 'src=\'http://'.$_SERVER['HTTP_HOST'], 'src=\'//'.$_SERVER['HTTP_HOST'], $buffer );
69
- $buffer = str_replace( 'src="http://'.$_SERVER['HTTP_HOST'], 'src="//'.$_SERVER['HTTP_HOST'], $buffer );
70
-
71
- #content
72
- $buffer = str_replace( 'content=\'https://'.$_SERVER['HTTP_HOST'], 'content=\'//'.$_SERVER['HTTP_HOST'], $buffer );
73
- $buffer = str_replace( 'content="https://'.$_SERVER['HTTP_HOST'], 'content="//'.$_SERVER['HTTP_HOST'], $buffer );
74
- $buffer = str_replace( 'content=\'http://'.$_SERVER['HTTP_HOST'], 'content=\'//'.$_SERVER['HTTP_HOST'], $buffer );
75
- $buffer = str_replace( 'content="http://'.$_SERVER['HTTP_HOST'], 'content="//'.$_SERVER['HTTP_HOST'], $buffer );
76
-
77
- #url
78
- $buffer = str_replace( 'url(\'https://'.$_SERVER['HTTP_HOST'], 'url(\'//'.$_SERVER['HTTP_HOST'], $buffer );
79
- $buffer = str_replace( 'url("https://'.$_SERVER['HTTP_HOST'], 'url("//'.$_SERVER['HTTP_HOST'], $buffer );
80
- $buffer = str_replace( 'url(\'http://'.$_SERVER['HTTP_HOST'], 'url(\'//'.$_SERVER['HTTP_HOST'], $buffer );
81
- $buffer = str_replace( 'url("http://'.$_SERVER['HTTP_HOST'], 'url("//'.$_SERVER['HTTP_HOST'], $buffer );
82
-
83
- #loaderUrl
84
- $buffer = str_replace( 'https:\/\/'.$_SERVER['HTTP_HOST'], '\/\/'.$_SERVER['HTTP_HOST'], $buffer );
85
- $buffer = str_replace( 'http:\/\/'.$_SERVER['HTTP_HOST'], '\/\/'.$_SERVER['HTTP_HOST'], $buffer );
86
-
87
- # Fix for visible links
88
- $buffer = str_replace( '>http://'.$_SERVER['HTTP_HOST'], '>https://'.$_SERVER['HTTP_HOST'], $buffer );
89
-
90
- }
91
- return $buffer;
92
- }
 
 
 
 
 
 
 
 
 
 
93
  }
94
- new HTTP_HTTPS_REMOVER();
3
  * Plugin Name: HTTP / HTTPS Remover
4
  * Plugin URI: https://de.wordpress.org/plugins/http-https-remover/
5
  * Description: This Plugin removes HTTP and HTTPS protocols from all links.
6
+ * Version: 1.2
7
  * Author: Marius Bolik (CONDACORE)
8
  * Author URI: https://condacore.com/
9
  * License: GPLv3
19
  #
20
 
21
 
22
+ if (!defined('ABSPATH')) exit;
23
+ class HTTP_HTTPS_REMOVER
24
 
25
+ {
26
+ // ###########################################
27
+ // ##### Apply Plugin on the whole Site ######
28
+ // ###########################################
29
+ public function __construct()
30
 
31
+ {
32
+ add_action('wp_loaded', array(
33
+ $this,
34
+ 'letsGo'
35
+ ) , 99, 1);
36
+ }
37
+ // #########################
38
+ // ##### More Code... ######
39
+ // #########################
40
+ public function letsGo()
 
 
 
41
 
42
+ {
43
+ global $pagenow;
44
+ ob_start(array(
45
+ $this,
46
+ 'mainPath'
47
+ ));
48
+ }
49
+ public function mainPath($buffer)
50
+
51
+ {
52
+ $content_type = NULL;
53
+ foreach(headers_list() as $header) {
54
+ if (strpos(strtolower($header) , 'content-type:') === 0) {
55
+ $pieces = explode(':', strtolower($header));
56
+ $content_type = trim($pieces[1]);
57
+ break;
58
+ }
59
+ }
60
+ if (is_null($content_type) || substr($content_type, 0, 9) === 'text/html') {
61
+ // ###############################
62
+ // ##### The important Path ######
63
+ // ###############################
64
+ // href
65
+ $buffer = str_replace('href=\'https://' . $_SERVER['HTTP_HOST'], 'href=\'//' . $_SERVER['HTTP_HOST'], $buffer);
66
+ $buffer = str_replace('href="https://' . $_SERVER['HTTP_HOST'], 'href="//' . $_SERVER['HTTP_HOST'], $buffer);
67
+ $buffer = str_replace('href=\'http://' . $_SERVER['HTTP_HOST'], 'href=\'//' . $_SERVER['HTTP_HOST'], $buffer);
68
+ $buffer = str_replace('href="http://' . $_SERVER['HTTP_HOST'], 'href="//' . $_SERVER['HTTP_HOST'], $buffer);
69
+ // src
70
+ $buffer = str_replace('src=\'https://' . $_SERVER['HTTP_HOST'], 'src=\'//' . $_SERVER['HTTP_HOST'], $buffer);
71
+ $buffer = str_replace('src="https://' . $_SERVER['HTTP_HOST'], 'src="//' . $_SERVER['HTTP_HOST'], $buffer);
72
+ $buffer = str_replace('src=\'http://' . $_SERVER['HTTP_HOST'], 'src=\'//' . $_SERVER['HTTP_HOST'], $buffer);
73
+ $buffer = str_replace('src="http://' . $_SERVER['HTTP_HOST'], 'src="//' . $_SERVER['HTTP_HOST'], $buffer);
74
+ // content
75
+ $buffer = str_replace('content=\'https://' . $_SERVER['HTTP_HOST'], 'content=\'//' . $_SERVER['HTTP_HOST'], $buffer);
76
+ $buffer = str_replace('content="https://' . $_SERVER['HTTP_HOST'], 'content="//' . $_SERVER['HTTP_HOST'], $buffer);
77
+ $buffer = str_replace('content=\'http://' . $_SERVER['HTTP_HOST'], 'content=\'//' . $_SERVER['HTTP_HOST'], $buffer);
78
+ $buffer = str_replace('content="http://' . $_SERVER['HTTP_HOST'], 'content="//' . $_SERVER['HTTP_HOST'], $buffer);
79
+ // url
80
+ $buffer = str_replace('url(\'https://' . $_SERVER['HTTP_HOST'], 'url(\'//' . $_SERVER['HTTP_HOST'], $buffer);
81
+ $buffer = str_replace('url("https://' . $_SERVER['HTTP_HOST'], 'url("//' . $_SERVER['HTTP_HOST'], $buffer);
82
+ $buffer = str_replace('url(\'http://' . $_SERVER['HTTP_HOST'], 'url(\'//' . $_SERVER['HTTP_HOST'], $buffer);
83
+ $buffer = str_replace('url("http://' . $_SERVER['HTTP_HOST'], 'url("//' . $_SERVER['HTTP_HOST'], $buffer);
84
+ // loaderUrl
85
+ $buffer = str_replace('https:\/\/' . $_SERVER['HTTP_HOST'], '\/\/' . $_SERVER['HTTP_HOST'], $buffer);
86
+ $buffer = str_replace('http:\/\/' . $_SERVER['HTTP_HOST'], '\/\/' . $_SERVER['HTTP_HOST'], $buffer);
87
+ // Google URLs
88
+ $buffer = str_replace('https://fonts.googleapis.com', '//fonts.googleapis.com', $buffer);
89
+ $buffer = str_replace('http://fonts.googleapis.com', '//fonts.googleapis.com', $buffer);
90
+ $buffer = str_replace('https://maps.googleapis.com', '//maps.googleapis.com', $buffer);
91
+ $buffer = str_replace('http://maps.googleapis.com', '//maps.googleapis.com', $buffer);
92
+ $buffer = str_replace('https://ajax.googleapis.com', '//ajax.googleapis.com', $buffer);
93
+ $buffer = str_replace('http://ajax.googleapis.com', '//ajax.googleapis.com', $buffer);
94
+ $buffer = str_replace('https://storage.googleapis.com', '//storage.googleapis.com', $buffer);
95
+ $buffer = str_replace('http://storage.googleapis.com', '//storage.googleapis.com', $buffer);
96
+ // Fix for visible links
97
+ $buffer = str_replace('>http://' . $_SERVER['HTTP_HOST'], '>https://' . $_SERVER['HTTP_HOST'], $buffer);
98
+ }
99
+ return $buffer;
100
+ }
101
  }
102
+ new HTTP_HTTPS_REMOVER();
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === HTTP / HTTPS Remover ===
2
  Contributors: condacore
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=marius%2ebolik%40me%2ecom&lc=DE&item_name=HTTP%20%2f%20HTTPS%20Remover&no_note=0&cn=Message%3a&no_shipping=1&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: http, https, mixed content
5
  Requires at least: 1.2.0
6
- Tested up to: 4.6.1
7
- Stable tag: 1.1.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -17,6 +17,7 @@ A fix for mixed content! This Plugin removes HTTP and HTTPS protocols from all l
17
  - Makes every Plugin compatible with https<br>
18
  - No Setup needed<br>
19
  - Compatible with Visual Composer
 
20
 
21
 
22
  **Mixed content** occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection. This is called mixed content because both HTTP and HTTPS content are being loaded to display the same page, and the initial request was secure over HTTPS. Modern browsers display warnings about this type of content to indicate to the user that this page contains insecure resources.
@@ -65,6 +66,9 @@ Please purge/clear cache for the changes to take effect!
65
  1. The Sourcecode of the Website will look like this!
66
 
67
  == Changelog ==
 
 
 
68
  = 1.1.1 (10/18/16) =
69
  * Added support for "content" tag
70
  * Added support for "loaderUrl" tag
1
  === HTTP / HTTPS Remover ===
2
  Contributors: condacore
3
+ Donate link: https://www.paypal.me/MariusBolik
4
  Tags: http, https, mixed content
5
  Requires at least: 1.2.0
6
+ Tested up to: 4.7
7
+ Stable tag: 1.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
17
  - Makes every Plugin compatible with https<br>
18
  - No Setup needed<br>
19
  - Compatible with Visual Composer
20
+ - Fixes Google Fonts issues
21
 
22
 
23
  **Mixed content** occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection. This is called mixed content because both HTTP and HTTPS content are being loaded to display the same page, and the initial request was secure over HTTPS. Modern browsers display warnings about this type of content to indicate to the user that this page contains insecure resources.
66
  1. The Sourcecode of the Website will look like this!
67
 
68
  == Changelog ==
69
+ = 1.2 (12/11/16) =
70
+ * Added support for Google (Fonts, Ajax, Maps etc.)
71
+ * Compatibility for Wordpress 4.7
72
  = 1.1.1 (10/18/16) =
73
  * Added support for "content" tag
74
  * Added support for "loaderUrl" tag