Permalink
Browse files

Fixed multsite Dashboard links.

  • Loading branch information...
1 parent 9657b2c commit 9cbfa1ce941b7c45237aa606b62da17f2f70c599 @mvied committed Mar 13, 2013
Showing with 14 additions and 9 deletions.
  1. +14 −9 lib/WordPressHTTPS/Module/Parser.php
View
23 lib/WordPressHTTPS/Module/Parser.php
@@ -352,8 +352,10 @@ public function fixLinksAndForms() {
foreach( $url_path_segments as $url_path_segment ) {
if ( is_null($blog_id) && $url_path_segment != '' ) {
$url_path .= $url_path_segment . '/';
- if ( $blog_id = get_blog_id_from_url( $url_parts['host'], $url_path) ) {
+ if ( ($blog_id = get_blog_id_from_url( $url_parts['host'], $url_path)) > 0 ) {
break;
+ } else {
+ $blog_id = null;
}
}
}
@@ -389,14 +391,17 @@ public function fixLinksAndForms() {
if ( is_null($blog_id) ) {
$updated = $this->getPlugin()->makeUrlHttps($url);
} else {
- if ( $ssl_host = $this->getPlugin()->getSetting('ssl_host', $blog_id) ) {
- if ( is_subdomain_install() ) {
- $host = $url_parts['host'] . '/';
- } else {
- $host = $url_parts['host'] . $url_path;
- }
- $updated = str_replace($url_parts['scheme'] . '://' . $host, $ssl_host, $url);
+ if ( $this->getPlugin()->getSetting('ssl_host', $blog_id) ) {
+ $ssl_host = $this->getPlugin()->getSetting('ssl_host', $blog_id);
+ } else {
+ $ssl_host = parse_url(get_home_url($blog_id, '/'), PHP_URL_HOST);
+ }
+ if ( is_subdomain_install() ) {
+ $host = $url_parts['host'] . '/';
+ } else {
+ $host = $url_parts['host'] . '/' . $url_path;
}
+ $updated = str_replace($url_parts['scheme'] . '://' . $host, $ssl_host, $url);
}
$this->_html = str_replace($html, str_replace($url, $updated, $html), $this->_html);
} else if ( !is_null($force_ssl) && !$force_ssl ) {
@@ -406,7 +411,7 @@ public function fixLinksAndForms() {
if ( is_subdomain_install() ) {
$host = $url_parts['host'] . '/';
} else {
- $host = $url_parts['host'] . $url_path;
+ $host = $url_parts['host'] . '/' . $url_path;
}
$updated = str_replace($url_parts['scheme'] . '://' . $host, get_home_url($blog_id, '/'), $url);
}

0 comments on commit 9cbfa1c

Please sign in to comment.