FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #33 from desrosj/master · ashucg/wordpress-https@99729cd · GitHub

Commit 99729cd

Browse files
committed
Merge pull request mvied#33 from desrosj/master
Fixing PHP notice caused by WordPress 3.9 update / Multisite performance updates
2 parents 4c937c3 + 949d40b commit 99729cd

1 file changed

Lines changed: 25 additions & 18 deletions

File tree

‎lib/WordPressHTTPS.php‎

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php
22
/**
33
* WordPress HTTPS
44
*
@@ -32,7 +32,7 @@ class WordPressHTTPS extends Mvied_Plugin_Modular {
3232

3333
/**
3434
* Plugin Settings
35-
*
35+
*
3636
* setting_name => default_value
3737
*
3838
* @var multitype:multitype
@@ -56,12 +56,13 @@ class WordPressHTTPS extends Mvied_Plugin_Modular {
5656
'path_cache' => array(), // Cache of URL paths to Post IDs
5757
'blog_cache' => array(), // Cache of URL paths to Blog IDs
5858
'version' => '', // Version of the plugin this blog has installed
59+
'hosts' => array(),
5960
);
6061

6162
/**
6263
* File extensions to be loaded securely.
6364
* File type => Array of extensions
64-
*
65+
*
6566
* @var multitype:multitype
6667
*/
6768
protected $_file_extensions = array(
@@ -126,7 +127,7 @@ class WordPressHTTPS extends Mvied_Plugin_Modular {
126127

127128
/**
128129
* Get File Extensions to Secure
129-
*
130+
*
130131
* @param none
131132
* @return array
132133
*/
@@ -136,7 +137,7 @@ public function getFileExtensions() {
136137

137138
/**
138139
* Get HTTP Url
139-
*
140+
*
140141
* @param none
141142
* @return Mvied_Url
142143
*/
@@ -149,7 +150,7 @@ public function getHttpUrl() {
149150

150151
/**
151152
* Get HTTPS Url
152-
*
153+
*
153154
* @param none
154155
* @return Mvied_Url
155156
*/
@@ -184,28 +185,34 @@ public function getHttpsUrl() {
184185

185186
/**
186187
* Get domains local to the WordPress installation.
187-
*
188+
*
188189
* @param none
189190
* @return array $hosts Array of domains local to the WordPress installation.
190191
*/
191192
public function getLocalDomains() {
193+
$hosts = $this->getSetting( 'hosts' );
194+
195+
if ( ! empty( $hosts ) )
196+
return $hosts;
197+
192198
global $wpdb;
193199
$hosts = array(
194200
$this->getHttpUrl()->getHost(),
195-
$this->getHttpsUrl()->getHost()
201+
$this->getHttpsUrl()->getHost(),
196202
);
197203

198204
if ( is_multisite() && is_subdomain_install() ) {
199-
$multisite_hosts = $wpdb->get_col($wpdb->prepare("SELECT domain FROM %d", $wpdb->blogs));
200-
$hosts = array_merge($hosts, $multisite_hosts);
205+
$multisite_hosts = $wpdb->get_col($wpdb->prepare( "SELECT domain FROM %d", $wpdb->blogs ) );
206+
$hosts = array_merge( $hosts, $multisite_hosts );
201207
}
202208

203-
if ( function_exists('domain_mapping_siteurl') ) {
204-
if ( $mapped_host = parse_url(domain_mapping_siteurl(false), PHP_URL_HOST) ) {
209+
if ( function_exists( 'domain_mapping_siteurl' ) ) {
210+
if ( $mapped_host = parse_url( domain_mapping_siteurl( false ), PHP_URL_HOST ) )
205211
$hosts[] = $mapped_host;
206-
}
207212
}
208213

214+
$this->setSetting( 'hosts', $hosts );
215+
209216
return $hosts;
210217
}
211218

@@ -231,7 +238,7 @@ public function init() {
231238

232239
/**
233240
* Install
234-
*
241+
*
235242
* @param none
236243
* @return void
237244
*/
@@ -312,7 +319,7 @@ public function install() {
312319
$this->setSetting('unsecure_external_urls', $this->_settings['unsecure_external_urls'], $blog_id);
313320
$this->setSetting('path_cache', $this->_settings['path_cache'], $blog_id);
314321
$this->setSetting('blog_cache', $this->_settings['blog_cache'], $blog_id);
315-
322+
316323
// Set default URL Mapping
317324
if ( $this->getSetting('ssl_host_mapping', $blog_id) == array() ) {
318325
$this->setSetting('ssl_host_mapping', WordPressHTTPS::$ssl_host_mapping, $blog_id);
@@ -335,7 +342,7 @@ public function install() {
335342

336343
/**
337344
* Is Local URL
338-
*
345+
*
339346
* Determines if URL is local or external
340347
*
341348
* @param string $url
@@ -537,7 +544,7 @@ public function isSsl() {
537544
}
538545
return apply_filters('is_ssl', $is_ssl);
539546
}
540-
547+
541548
/**
542549
* Maintained for backwards compatibility.
543550
*
@@ -609,7 +616,7 @@ public function getDirectories() {
609616
$scannedDirectories[$directory]['name'] = $directory;
610617
if ( is_readable($directory) && ($files = scandir($directory)) ) {
611618
$scannedDirectories[$directory]['files'] = $files;
612-
unset($files);
619+
unset($files);
613620
} else {
614621
$scannedDirectories[$directory]['error'] = "Unable to read directory.";
615622
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL