Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- wordpress-https.php 2011-08-09 11:37:45.000000000 -0700
- +++ wordpress-https-patched.php 2011-08-21 17:40:02.851635730 -0700
- @@ -348,9 +348,10 @@
- if ( $this->is_ssl() ) {
- // Fix the regular stuff
- if ( is_admin() ) {
- - preg_match_all('/\<(script|link|img)[^>]+((http|https):\/\/[\/-\w\.#?=\+&;]+)[^>]+>/im', $buffer, $matches);
- + // RegEx's altered to include port
- + preg_match_all('/\<(script|link|img)[^>]+((http|https):\/\/[-\w\.\d]+(:\d+)?)[^>]+>/im', $buffer, $matches);
- } else {
- - preg_match_all('/\<(script|link|img|input|form|embed|param)[^>]+((http|https):\/\/[\/-\w\.#?=\+&;]+)[^>]+>/im', $buffer, $matches);
- + preg_match_all('/\<(script|link|img|input|form|embed|param)[^>]+((http|https):\/\/[-\w\.\d]+(:\d+)?)[^>]+>/im', $buffer, $matches);
- }
- $external_urls = get_option('wordpress-https_external_urls');
- @@ -395,7 +396,7 @@
- }
- // Fix any CSS background images
- - preg_match_all('/background: url\([\'"]?(http:\/\/[\/-\w\.#?=\+&;]+)[\'"]?\)/im', $buffer, $matches);
- + preg_match_all('/background: url\([\'"]?(http:\/\/[-\w\.\d]+(:\d+)?)[\'"]?\)/im', $buffer, $matches);
- for ($i = 0; $i<=sizeof($matches[0]); $i++) {
- $css = $matches[0][$i];
- $url = $matches[1][$i];
- @@ -419,7 +420,7 @@
- }
- // Update anchor and form tags to appropriate URL's
- - preg_match_all('/\<(a|form)[^>]+[\'"]((http|https):\/\/[\/-\w\.#?=\+&;]+)[^>]+>/im', $buffer, $matches);
- + preg_match_all('/\<(a|form)[^>]+[\'"]((http|https):\/\/[-\w\.\d]+(:\d+)?)[^>]+>/im', $buffer, $matches);
- for ($i = 0; $i<=sizeof($matches[0]); $i++) {
- $html = $matches[0][$i];
- @@ -470,7 +471,9 @@
- $type = $matches[1][$i];
- $url = $matches[2][$i];
- - $buffer = str_replace($html, str_replace($url, $this->https_url, $html), $buffer);
- + if (strpos($html, $url) != strpos($html, $this->https_url)) { // https url isn't already there
- + $buffer = str_replace($html, str_replace($url, $this->https_url, $html), $buffer);
- + }
- }
- }
- @@ -675,7 +678,8 @@
- * @return string $string
- */
- function replace_http_url($string) {
- - preg_match_all('/(http|https):\/\/[\/-\w\.#?=\+&;]+/im', $string, $url);
- + preg_match_all('/((http|https):\/\/[-\w\.\d]+(:\d+)?)[\/-\w\.#?=\+&;]*/im', $string, $url);
- + $base_url = $url[1][0];
- $url = $url[0][0];
- // If URL matches home_url, but lacks www, add www
- @@ -688,7 +692,7 @@
- }
- // Replace the HTTPS version of the domain with $this->https_url for Shared SSL
- - $string = str_replace($this->replace_http($this->http_url), $this->https_url, $string);
- + $string = str_replace($base_url, $this->https_url, $string);
- $string = str_replace($this->http_url, $this->https_url, $string);
- return $string;
- }
- @@ -737,7 +741,7 @@
- $url = parse_url($_POST[$key]);
- }
- if ( sizeof($url) > 1 ) {
- - $_POST[$key] = 'https://' . $url['host'] . @$url['path'];
- + $_POST[$key] = 'https://' . $url['host'] . (isset($url['port']) ? ':' . $url['port'] : '') . @$url['path'];
- if ( substr($_POST[$key], -1, 1) == '/' ) {
- $_POST[$key] = substr($_POST[$key], 0, strlen($_POST[$key])-1);
- }
- @@ -919,4 +923,4 @@
- global $wordpress_https;
- return $wordpress_https->auth_redirect();
- }
- -}
- \ No newline at end of file
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement