Skip to content

Commit

Permalink
Remove separated host parts for simplicity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Ems committed Mar 31, 2013
1 parent 417f13a commit 4af828f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/WordPressHTTPS/Module/UrlMapping.php
Expand Up @@ -46,8 +46,8 @@ public function map_http_url( $url ) {
if ( !is_array($mapping) || @$mapping[0]['scheme'] != 'https' ) { if ( !is_array($mapping) || @$mapping[0]['scheme'] != 'https' ) {
continue; continue;
} }
$http_url = 'http://' . @$mapping[1]['host'] . ( isset($mapping[1]['port']) ? ':' . $mapping[1]['port'] : '' ) . @$mapping[1]['path']; $http_url = 'http://' . @$mapping[1]['host'];
$https_url = 'https://' . @$mapping[0]['host'] . ( isset($mapping[0]['port']) ? ':' . $mapping[0]['port'] : '' ) . @$mapping[0]['path']; $https_url = 'https://' . @$mapping[0]['host'];
preg_match('|' . $https_url . '|', $url, $matches); preg_match('|' . $https_url . '|', $url, $matches);
if ( sizeof($matches) > 0 ) { if ( sizeof($matches) > 0 ) {
$url = preg_replace('|' . $https_url . '|', $http_url, $url); $url = preg_replace('|' . $https_url . '|', $http_url, $url);
Expand All @@ -69,8 +69,8 @@ public function map_https_url( $url ) {
if ( !is_array($mapping) || @$mapping[0]['scheme'] != 'http' ) { if ( !is_array($mapping) || @$mapping[0]['scheme'] != 'http' ) {
continue; continue;
} }
$http_url = 'http://' . @$mapping[0]['host'] . ( isset($mapping[0]['port']) ? ':' . $mapping[0]['port'] : '' ) . @$mapping[0]['path']; $http_url = 'http://' . @$mapping[0]['host'];
$https_url = 'https://' . @$mapping[1]['host'] . ( isset($mapping[1]['port']) ? ':' . $mapping[1]['port'] : '' ) . @$mapping[1]['path']; $https_url = 'https://' . @$mapping[1]['host'];
preg_match('|' . $http_url . '|', $url, $matches); preg_match('|' . $http_url . '|', $url, $matches);
if ( sizeof($matches) > 0 ) { if ( sizeof($matches) > 0 ) {
$url = preg_replace('|' . $http_url . '|', $https_url, $url); $url = preg_replace('|' . $http_url . '|', $https_url, $url);
Expand Down
4 changes: 2 additions & 2 deletions view/metabox/url_mapping.php
Expand Up @@ -63,7 +63,7 @@
<span class="label">://</span> <span class="label">://</span>
</td> </td>
<td class="host"> <td class="host">
<input type="text" name="url_mapping[host][]" value="<?php echo @$mapping[0]['host'] . ( isset($mapping[0]['port']) ? ':' . $mapping[0]['port'] : '' ) . @$mapping[0]['path']; ?>" /> <input type="text" name="url_mapping[host][]" value="<?php echo @$mapping[0]['host']; ?>" />
</td> </td>
<td class="sep url-sep"> <td class="sep url-sep">
<span class="label">&gt;</span> <span class="label">&gt;</span>
Expand All @@ -78,7 +78,7 @@
<span class="label">://</span> <span class="label">://</span>
</td> </td>
<td class="host"> <td class="host">
<input type="text" name="url_mapping[host][]" value="<?php echo @$mapping[1]['host'] . ( isset($mapping[1]['port']) ? ':' . $mapping[1]['port'] : '' ) . @$mapping[1]['path']; ?>" /> <input type="text" name="url_mapping[host][]" value="<?php echo @$mapping[1]['host']; ?>" />
</td> </td>
<td class="controls"> <td class="controls">
<a class="remove" href="#" title="<?php _e('Remove URL Mapping','wordpress-https'); ?>"><?php _e('Remove','wordpress-https'); ?></a> <a class="remove" href="#" title="<?php _e('Remove URL Mapping','wordpress-https'); ?>"><?php _e('Remove','wordpress-https'); ?></a>
Expand Down

0 comments on commit 4af828f

Please sign in to comment.