Advertisement
doingweb

Wordpress HTTPS 1.9.3-dev Patch for Non-Standard Ports

Aug 29th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.56 KB | None | 0 0
  1. --- wordpress-https-1.9.3-dev.php   2011-08-29 19:57:06.000000000 -0700
  2. +++ wordpress-https.php 2011-08-29 22:04:10.000000000 -0700
  3. @@ -331,7 +331,10 @@
  4.                     for ($i = 0; $i<=sizeof($matches[0]); $i++) {
  5.                         $html = $matches[0][$i];
  6.                         $url = $matches[1][$i];
  7. -                       $buffer = str_replace($html, str_replace($url, $this->replace_https($url), $html), $buffer);
  8. +
  9. +                       if (strpos($html, $url) != strpos($html, $this->https_url)) { // Ensure Shared SSL Host URL isn't already there
  10. +                           $buffer = str_replace($html, str_replace($url, $this->https_url, $html), $buffer);
  11. +                       }
  12.                     }
  13.                 }
  14.  
  15. @@ -635,7 +638,8 @@
  16.          * @return string $string
  17.          */
  18.         function replace_http_url($string) {
  19. -           preg_match_all('/(http|https):\/\/[\/-\w\.,#?=\+&%;:\d]+/im', $string, $url);
  20. +           preg_match_all('/((http|https):\/\/[^\/\s]+)[\/-\w\.,#?=\+&%;:\d]*/im', $string, $url);
  21. +           $base_url = $url[1][0];
  22.             $url = $url[0][0];
  23.  
  24.             // If URL matches home_url, but lacks www, add www
  25. @@ -648,8 +652,7 @@
  26.             }
  27.  
  28.             // Replace the HTTPS version of the domain with $this->https_url for Shared SSL
  29. -           $string = str_replace($this->replace_http($this->http_url), $this->https_url, $string);
  30. -           $string = str_replace($this->http_url, $this->https_url, $string);
  31. +           $string = str_replace($base_url, $this->https_url, $string);
  32.             return $string;
  33.         }
  34.  
  35. @@ -882,4 +885,4 @@
  36.  if ( class_exists('WordPressHTTPS') ) {
  37.     $wordpress_https = new WordPressHTTPS();
  38.     register_activation_hook( __FILE__, array(&$wordpress_https, 'install'));
  39. -}
  40. \ No newline at end of file
  41. +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement