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

Version Description

(03/02/17) = * Finally fixed srcset Problems * Changed the working method of the Plugin * Some other bugfixes

Download this release

Release Info

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

Code changes from version 1.3.1 to 1.4

Files changed (2) hide show
  1. http-https-remover.php +76 -42
  2. readme.txt +16 -5
http-https-remover.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
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.3.1
7
- * Author: Marius Bolik (CONDACORE)
8
  * Author URI: https://condacore.com/
9
  * License: GPLv3
10
  */
@@ -23,12 +23,17 @@ 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'
@@ -61,47 +66,76 @@ class HTTP_HTTPS_REMOVER
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
- // srcset
75
- $buffer = str_replace('srcset=\'https://' . $_SERVER['HTTP_HOST'], 'srcset=\'//' . $_SERVER['HTTP_HOST'], $buffer);
76
- $buffer = str_replace('srcset="https://' . $_SERVER['HTTP_HOST'], 'srcset="//' . $_SERVER['HTTP_HOST'], $buffer);
77
- $buffer = str_replace('srcset=\'http://' . $_SERVER['HTTP_HOST'], 'srcset=\'//' . $_SERVER['HTTP_HOST'], $buffer);
78
- $buffer = str_replace('srcset="http://' . $_SERVER['HTTP_HOST'], 'srcset="//' . $_SERVER['HTTP_HOST'], $buffer);
79
- // content
80
- $buffer = str_replace('content=\'//' . $_SERVER['HTTP_HOST'], 'content=\'https://' . $_SERVER['HTTP_HOST'], $buffer);
81
- $buffer = str_replace('content="//' . $_SERVER['HTTP_HOST'], 'content="https://' . $_SERVER['HTTP_HOST'], $buffer);
82
- $buffer = str_replace('content=\'http://' . $_SERVER['HTTP_HOST'], 'content=\'https://' . $_SERVER['HTTP_HOST'], $buffer);
83
- $buffer = str_replace('content="http://' . $_SERVER['HTTP_HOST'], 'content="https://' . $_SERVER['HTTP_HOST'], $buffer);
84
- // url
85
- $buffer = str_replace('url(\'https://' . $_SERVER['HTTP_HOST'], 'url(\'//' . $_SERVER['HTTP_HOST'], $buffer);
86
- $buffer = str_replace('url("https://' . $_SERVER['HTTP_HOST'], 'url("//' . $_SERVER['HTTP_HOST'], $buffer);
87
- $buffer = str_replace('url(\'http://' . $_SERVER['HTTP_HOST'], 'url(\'//' . $_SERVER['HTTP_HOST'], $buffer);
88
- $buffer = str_replace('url("http://' . $_SERVER['HTTP_HOST'], 'url("//' . $_SERVER['HTTP_HOST'], $buffer);
89
- // loaderUrl
90
- $buffer = str_replace('https:\/\/' . $_SERVER['HTTP_HOST'], '\/\/' . $_SERVER['HTTP_HOST'], $buffer);
91
- $buffer = str_replace('http:\/\/' . $_SERVER['HTTP_HOST'], '\/\/' . $_SERVER['HTTP_HOST'], $buffer);
92
- // Google URLs
93
- $buffer = str_replace('https://fonts.googleapis.com', '//fonts.googleapis.com', $buffer);
94
- $buffer = str_replace('http://fonts.googleapis.com', '//fonts.googleapis.com', $buffer);
95
- $buffer = str_replace('https://maps.googleapis.com', '//maps.googleapis.com', $buffer);
96
- $buffer = str_replace('http://maps.googleapis.com', '//maps.googleapis.com', $buffer);
97
- $buffer = str_replace('https://ajax.googleapis.com', '//ajax.googleapis.com', $buffer);
98
- $buffer = str_replace('http://ajax.googleapis.com', '//ajax.googleapis.com', $buffer);
99
- $buffer = str_replace('https://storage.googleapis.com', '//storage.googleapis.com', $buffer);
100
- $buffer = str_replace('http://storage.googleapis.com', '//storage.googleapis.com', $buffer);
101
- // Fix for visible links
102
- $buffer = str_replace('>http://' . $_SERVER['HTTP_HOST'], '>https://' . $_SERVER['HTTP_HOST'], $buffer);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
  return $buffer;
105
  }
106
  }
107
  new HTTP_HTTPS_REMOVER();
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Plugin Name: HTTP / HTTPS Remover
4
  * Plugin URI: https://de.wordpress.org/plugins/http-https-remover/
5
+ * Description: I changed the way how „HTTP / HTTPS Remover“ is working. It doesn’t remove http and https from links in source code anymore. Now it converts all links to https!
6
+ * Version: 1.4
7
+ * Author: CONDACORE
8
  * Author URI: https://condacore.com/
9
  * License: GPLv3
10
  */
23
  class HTTP_HTTPS_REMOVER
24
 
25
  {
26
+
27
+
28
+ //Add some links on the plugin page
29
+
30
  // ###########################################
31
  // ##### Apply Plugin on the whole Site ######
32
  // ###########################################
33
  public function __construct()
34
 
35
  {
36
+
37
  add_action('wp_loaded', array(
38
  $this,
39
  'letsGo'
66
  // ###############################
67
  // ##### The important Path ######
68
  // ###############################
69
+
70
+
71
+
72
+ // All Intern Links
73
+ $buffer = str_replace('http://' . $_SERVER['HTTP_HOST'], 'https://' . $_SERVER['HTTP_HOST'], $buffer);
74
+ $buffer = str_replace('"//' . $_SERVER['HTTP_HOST'], '"https://' . $_SERVER['HTTP_HOST'], $buffer);
75
+ $buffer = str_replace('\'//' . $_SERVER['HTTP_HOST'], '\'https://' . $_SERVER['HTTP_HOST'], $buffer);
76
+
77
+ // Google APIs
78
+ $buffer = preg_replace('|http://(.*?).googleapis.com|', 'https://$1.googleapis.com', $buffer);
79
+ $buffer = preg_replace('|"//(.*?).googleapis.com|', '"https://$1.googleapis.com', $buffer);
80
+ $buffer = preg_replace("|'//(.*?).googleapis.com|", "'https://$1.googleapis.com", $buffer);
81
+
82
+ $buffer = preg_replace('|http://(.*?).google.com|', 'https://$1.google.com', $buffer);
83
+ $buffer = preg_replace('|"//(.*?).google.com|', '"https://$1.google.com', $buffer);
84
+ $buffer = preg_replace("|'//(.*?).google.com|", "'https://$1.google.com", $buffer);
85
+
86
+ // Facebook URLs
87
+ $buffer = preg_replace('|http://(.*?).fbcdn.net|', 'https://$1.fbcdn.net', $buffer);
88
+ $buffer = preg_replace('|"//(.*?).facebook.net|', '"https://$1.facebook.net', $buffer);
89
+ $buffer = preg_replace("|'//(.*?).facebook.com|", "'https://$1.facebook.com", $buffer);
90
+
91
+ // Instagram URLs
92
+ $buffer = preg_replace('|http://(.*?).instagram.com|', 'https://$1.instagram.com', $buffer);
93
+ $buffer = preg_replace('|http://(.*?).cdninstagram.com|', 'https://$1.cdninstagram.com', $buffer);
94
+
95
+
96
+ // Some CDNs
97
+ $buffer = str_replace('http://amazonaws.com', 'https://amazonaws.com', $buffer);
98
+ $buffer = preg_replace('|http://(.*?).amazonaws.com|', 'https://$1.amazonaws.com', $buffer);
99
+ $buffer = preg_replace('|http://(.*?).cloudfront.net|', 'https://$1.cloudfront.net', $buffer);
100
+ $buffer = preg_replace('|http://(.*?).cloudfront.com|', 'https://$1.cloudfront.com', $buffer);
101
+ $buffer = preg_replace('|http://(.*?).cloudflare.com|', 'https://$1.cloudflare.com', $buffer);
102
+ $buffer = preg_replace('|http://(.*?).jsdelivr.net|', 'https://$1.jsdelivr.net', $buffer);
103
+ $buffer = preg_replace('|http://(.*?).bootstrapcdn.com|', 'https://$1.bootstrapcdn.com', $buffer);
104
+ $buffer = preg_replace('|http://(.*?).rawgit.com|', 'https://$1.rawgit.com', $buffer);
105
+ $buffer = preg_replace('|http://(.*?).maxcdn.com|', 'https://$1.maxcdn.com', $buffer);
106
+
107
+
108
+ // Disqus URLs
109
+ $buffer = preg_replace('|http://(.*?).disquscdn.com|', 'https://$1.disquscdn.com', $buffer);
110
+ $buffer = preg_replace('|http://(.*?).disqus.com|', 'https://$1.disqus.com', $buffer);
111
+
112
+ // Twitter
113
+ $buffer = preg_replace('|http://(.*?).twitter.com|', 'https://$1.twitter.com', $buffer);
114
+
115
+ // Akamai
116
+ $buffer = preg_replace('|http://(.*?).akamaihd.net|', 'https://$1.akamaihd.net', $buffer);
117
+
118
+ // Gravatar
119
+ $buffer = preg_replace("|http://(.+).gravatar.com|", "'https://$1.gravatar.com", $buffer);
120
+
121
+ // WordPress
122
+ $buffer = preg_replace("|'//(.*?).w.org|", "'https://$1.w.org", $buffer);
123
+
124
+
125
  }
126
  return $buffer;
127
  }
128
  }
129
  new HTTP_HTTPS_REMOVER();
130
+
131
+ //Add some links on the plugin page
132
+ add_filter('plugin_row_meta', 'http_https_remover_extra_links', 10, 2);
133
+
134
+ function http_https_remover_extra_links($links, $file) {
135
+ if ( $file == plugin_basename(dirname(__FILE__).'/http-https-remover.php') ) {
136
+ $links[] = '<a href="https://condacore.com/portfolio/http-https-remover/#beta" target="_blank">' . esc_html__('Become a Beta Tester', 'http-https-remover') . '</a>';
137
+ $links[] = '<a href="https://twitter.com/condacore" target="_blank">' . esc_html__('Twitter', 'http-https-remover') . '</a>';
138
+ $links[] = '<a href="https://paypal.me/MariusBolik" target="_blank">' . esc_html__('Donate', 'http-https-remover') . '</a>';
139
+ }
140
+ return $links;
141
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.3.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -18,7 +18,11 @@ A fix for mixed content! This Plugin removes HTTP and HTTPS protocols from all l
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.
24
 
@@ -28,11 +32,14 @@ Your users are counting on you to protect them when they visit your website. It
28
  = Example =
29
 
30
  Without Plugin:
31
- `"http://domain.com/script.js"`
32
- `"https://domain.com/script.js"`
 
33
 
34
  With Plugin:
35
- `"//domain.com/script.js"`
 
 
36
 
37
  For more infos take a look at the screenshot.
38
 
@@ -66,6 +73,10 @@ Please purge/clear cache for the changes to take effect!
66
  1. The Sourcecode of the Website will look like this!
67
 
68
  == Changelog ==
 
 
 
 
69
  = 1.3.1 (01/13/17) =
70
  * Added support for srcset tag
71
  = 1.3 (01/07/17) =
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.2
7
+ Stable tag: 1.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
18
  - No Setup needed<br>
19
  - Compatible with Visual Composer
20
  - Fixes Google Fonts issues
21
+ - Speeds up your website
22
 
23
+ = Only install this Plugin if your web server supports https =
24
+
25
+ **Note: I changed the way how „HTTP / HTTPS Remover“ is working. It doesn’t remove http and https from links in source code anymore. Now it converts all links to https!**
26
 
27
  **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.
28
 
32
  = Example =
33
 
34
  Without Plugin:
35
+ `src="http://domain.com/script01.js"
36
+ src="https://domain.com/script02.js"
37
+ src="//domain.com/script03.js"`
38
 
39
  With Plugin:
40
+ `src="https://domain.com/script01.js"
41
+ src="https://domain.com/script02.js"
42
+ src="https://domain.com/script03.js"`
43
 
44
  For more infos take a look at the screenshot.
45
 
73
  1. The Sourcecode of the Website will look like this!
74
 
75
  == Changelog ==
76
+ = 1.4 (03/02/17) =
77
+ * Finally fixed srcset Problems
78
+ * Changed the working method of the Plugin
79
+ * Some other bugfixes
80
  = 1.3.1 (01/13/17) =
81
  * Added support for srcset tag
82
  = 1.3 (01/07/17) =