Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged ssl_port field into ssl_host.

  • Loading branch information...
commit ce98cde62e79e67ad348ed9d920302ba9a37bfdd 1 parent 98363e8
@mvied authored
View
4 admin/css/settings.css
@@ -94,10 +94,6 @@
float: left;
margin-right: 10px;
}
-#wphttps-main #ssl_port_label {
- display: inline-block;
- padding-top: 10px;
-}
#wphttps-main #ssl_host {
width: 70%;
}
View
5 admin/templates/metabox/settings.php
@@ -4,7 +4,7 @@
$count = 1; // Used to restrict str_replace count
$ssl_host = clone $this->getPlugin()->getHttpsUrl();
-$ssl_host = $ssl_host->setPort('')->setScheme('')->toString();
+$ssl_host = $ssl_host->setScheme('')->toString();
if ( $this->getPlugin()->getHttpUrl()->getPath() != '/' ) {
$ssl_host = str_replace($this->getPlugin()->getHttpUrl()->getPath(), '', $ssl_host, $count);
}
@@ -22,9 +22,6 @@
<label for="ssl_host" id="ssl_host_label">
<input name="ssl_host" type="text" id="ssl_host" class="regular-text code" value="<?php echo $ssl_host; ?>" />
</label>
- <label for="ssl_port" id="ssl_port_label"><?php _e('Port','wordpress-https'); ?>
- <input name="ssl_port" type="text" id="ssl_port" class="small-text" value="<?php echo $this->getPlugin()->getSetting('ssl_port'); ?>" />
- </label>
</fieldset>
</td>
</tr>
View
19 lib/WordPressHTTPS.php
@@ -32,7 +32,6 @@ class WordPressHTTPS extends Mvied_Plugin {
*/
protected $_settings = array(
'ssl_host' => '', // Hostname for SSL Host
- 'ssl_port' => '', // Port number for SSL Host
'secure_external_urls' => array(), // Secure external URL's
'unsecure_external_urls' => array(), // Unsecure external URL's
'ssl_host_diff' => 0, // Is SSL Host different than WordPress host
@@ -135,13 +134,6 @@ public function getHttpsUrl() {
if ( strpos($this->_https_url->getPath(), $this->getHttpUrl()->getPath()) === false ) {
$this->_https_url->setPath( $this->_https_url->getPath() . $this->getHttpUrl()->getPath() );
}
-
- // Add SSL Port to HTTPS URL
- if ( (int)$this->getSetting('ssl_port') > 0 && $this->getSetting('ssl_port') != 443 ) {
- $this->_https_url->setPort($this->getSetting('ssl_port'));
- } else {
- $this->_https_url->setPort(null);
- }
}
return $this->_https_url;
@@ -230,11 +222,20 @@ public function install() {
// Fix a bug that saved the ssl_host as an object
if ( ! is_string($this->getSetting('ssl_host', $blog_id)) ) {
$this->setSetting('ssl_host', $this->_settings['ssl_host'], $blog_id);
- $this->setSetting('ssl_port', $this->_settings['ssl_port'], $blog_id);
$this->setSetting('ssl_host_diff', $this->_settings['ssl_host_diff'], $blog_id);
$this->setSetting('ssl_host_subdomain', $this->_settings['ssl_host_subdomain'], $blog_id);
}
+ // Remove old ssl_port setting and append to HTTPS URL
+ if ( (int)$this->getSetting('ssl_port', $blog_id) > 0 ) {
+ if ( $this->getSetting('ssl_port', $blog_id) != 443 ) {
+ $ssl_host = WordPressHTTPS_Url::fromString( $this->getSetting('ssl_host', $blog_id) );
+ $ssl_host->setPort($this->getSetting('ssl_port', $blog_id));
+ $this->setSetting('ssl_host', $ssl_host->toString(), $blog_id);
+ }
+ $this->setSetting('ssl_port', null, $blog_id);
+ }
+
// If secure front page option exists, create front page filter
if ( $this->getSetting('frontpage', $blog_id) ) {
$this->setSetting('secure_filter', array_merge($this->getSetting('secure_filter'), array(rtrim(str_replace('http://', '', $this->getHttpUrl()->toString()), '/') . '/$')));
View
6 lib/WordPressHTTPS/Module/Settings.php
@@ -238,10 +238,6 @@ public function save() {
$ssl_host = WordPressHTTPS_Url::fromString($_POST[$key]);
- // Add Port
- $_POST['ssl_port'] = $port = ((isset($_POST['ssl_port']) && is_int($_POST['ssl_port'])) ? $_POST['ssl_port'] : $ssl_host->getPort());
- $ssl_host->setPort($port);
-
// Add Path
if ( strpos($ssl_host->getPath(), $this->getPlugin()->getHttpUrl()->getPath()) !== true ) {
$path = '/'. ltrim(str_replace(rtrim($this->getPlugin()->getHttpUrl()->getPath(), '/'), '', $ssl_host->getPath()), '/');
@@ -256,7 +252,7 @@ public function save() {
if ( $this->getPlugin()->isSsl() ) {
$logout = true;
}
- $_POST[$key] = $ssl_host->setPort('')->toString();
+ $_POST[$key] = $ssl_host->toString();
/*} else {
$errors[] = '<strong>SSL Host</strong> - Invalid WordPress installation at ' . $ssl_host;
$_POST[$key] = get_option($key);
Please sign in to comment.
Something went wrong with that request. Please try again.