| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - <?php | ||
| 1 | + <?php | ||
| 2 | 2 | /** | |
| 3 | 3 | * WordPress HTTPS | |
| 4 | 4 | * | |
@@ -32,7 +32,7 @@ class WordPressHTTPS extends Mvied_Plugin_Modular { | |||
| 32 | 32 | ||
| 33 | 33 | /** | |
| 34 | 34 | * Plugin Settings | |
| 35 | - * | ||
| 35 | + * | ||
| 36 | 36 | * setting_name => default_value | |
| 37 | 37 | * | |
| 38 | 38 | * @var multitype:multitype | |
@@ -56,12 +56,13 @@ class WordPressHTTPS extends Mvied_Plugin_Modular { | |||
| 56 | 56 | 'path_cache' => array(), // Cache of URL paths to Post IDs | |
| 57 | 57 | 'blog_cache' => array(), // Cache of URL paths to Blog IDs | |
| 58 | 58 | 'version' => '', // Version of the plugin this blog has installed | |
| 59 | + 'hosts' => array(), | ||
| 59 | 60 | ); | |
| 60 | 61 | ||
| 61 | 62 | /** | |
| 62 | 63 | * File extensions to be loaded securely. | |
| 63 | 64 | * File type => Array of extensions | |
| 64 | - * | ||
| 65 | + * | ||
| 65 | 66 | * @var multitype:multitype | |
| 66 | 67 | */ | |
| 67 | 68 | protected $_file_extensions = array( | |
@@ -126,7 +127,7 @@ class WordPressHTTPS extends Mvied_Plugin_Modular { | |||
| 126 | 127 | ||
| 127 | 128 | /** | |
| 128 | 129 | * Get File Extensions to Secure | |
| 129 | - * | ||
| 130 | + * | ||
| 130 | 131 | * @param none | |
| 131 | 132 | * @return array | |
| 132 | 133 | */ | |
@@ -136,7 +137,7 @@ public function getFileExtensions() { | |||
| 136 | 137 | ||
| 137 | 138 | /** | |
| 138 | 139 | * Get HTTP Url | |
| 139 | - * | ||
| 140 | + * | ||
| 140 | 141 | * @param none | |
| 141 | 142 | * @return Mvied_Url | |
| 142 | 143 | */ | |
@@ -149,7 +150,7 @@ public function getHttpUrl() { | |||
| 149 | 150 | ||
| 150 | 151 | /** | |
| 151 | 152 | * Get HTTPS Url | |
| 152 | - * | ||
| 153 | + * | ||
| 153 | 154 | * @param none | |
| 154 | 155 | * @return Mvied_Url | |
| 155 | 156 | */ | |
@@ -184,28 +185,34 @@ public function getHttpsUrl() { | |||
| 184 | 185 | ||
| 185 | 186 | /** | |
| 186 | 187 | * Get domains local to the WordPress installation. | |
| 187 | - * | ||
| 188 | + * | ||
| 188 | 189 | * @param none | |
| 189 | 190 | * @return array $hosts Array of domains local to the WordPress installation. | |
| 190 | 191 | */ | |
| 191 | 192 | public function getLocalDomains() { | |
| 193 | + $hosts = $this->getSetting( 'hosts' ); | ||
| 194 | + | ||
| 195 | + if ( ! empty( $hosts ) ) | ||
| 196 | + return $hosts; | ||
| 197 | + | ||
| 192 | 198 | global $wpdb; | |
| 193 | 199 | $hosts = array( | |
| 194 | 200 | $this->getHttpUrl()->getHost(), | |
| 195 | - $this->getHttpsUrl()->getHost() | ||
| 201 | + $this->getHttpsUrl()->getHost(), | ||
| 196 | 202 | ); | |
| 197 | 203 | ||
| 198 | 204 | 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 ); | ||
| 201 | 207 | } | |
| 202 | 208 | ||
| 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 ) ) | ||
| 205 | 211 | $hosts[] = $mapped_host; | |
| 206 | - } | ||
| 207 | 212 | } | |
| 208 | 213 | ||
| 214 | + $this->setSetting( 'hosts', $hosts ); | ||
| 215 | + | ||
| 209 | 216 | return $hosts; | |
| 210 | 217 | } | |
| 211 | 218 | ||
@@ -231,7 +238,7 @@ public function init() { | |||
| 231 | 238 | ||
| 232 | 239 | /** | |
| 233 | 240 | * Install | |
| 234 | - * | ||
| 241 | + * | ||
| 235 | 242 | * @param none | |
| 236 | 243 | * @return void | |
| 237 | 244 | */ | |
@@ -312,7 +319,7 @@ public function install() { | |||
| 312 | 319 | $this->setSetting('unsecure_external_urls', $this->_settings['unsecure_external_urls'], $blog_id); | |
| 313 | 320 | $this->setSetting('path_cache', $this->_settings['path_cache'], $blog_id); | |
| 314 | 321 | $this->setSetting('blog_cache', $this->_settings['blog_cache'], $blog_id); | |
| 315 | - | ||
| 322 | + | ||
| 316 | 323 | // Set default URL Mapping | |
| 317 | 324 | if ( $this->getSetting('ssl_host_mapping', $blog_id) == array() ) { | |
| 318 | 325 | $this->setSetting('ssl_host_mapping', WordPressHTTPS::$ssl_host_mapping, $blog_id); | |
@@ -335,7 +342,7 @@ public function install() { | |||
| 335 | 342 | ||
| 336 | 343 | /** | |
| 337 | 344 | * Is Local URL | |
| 338 | - * | ||
| 345 | + * | ||
| 339 | 346 | * Determines if URL is local or external | |
| 340 | 347 | * | |
| 341 | 348 | * @param string $url | |
@@ -537,7 +544,7 @@ public function isSsl() { | |||
| 537 | 544 | } | |
| 538 | 545 | return apply_filters('is_ssl', $is_ssl); | |
| 539 | 546 | } | |
| 540 | - | ||
| 547 | + | ||
| 541 | 548 | /** | |
| 542 | 549 | * Maintained for backwards compatibility. | |
| 543 | 550 | * | |
@@ -609,7 +616,7 @@ public function getDirectories() { | |||
| 609 | 616 | $scannedDirectories[$directory]['name'] = $directory; | |
| 610 | 617 | if ( is_readable($directory) && ($files = scandir($directory)) ) { | |
| 611 | 618 | $scannedDirectories[$directory]['files'] = $files; | |
| 612 | - unset($files); | ||
| 619 | + unset($files); | ||
| 613 | 620 | } else { | |
| 614 | 621 | $scannedDirectories[$directory]['error'] = "Unable to read directory."; | |
| 615 | 622 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments