| @@ -77,10 +77,13 @@ | ||
| 77 | 77 | add_filter( 'wp_get_attachment_url', array( $this, 'fix_url_scheme' ), 10, 1 ); |
| 78 | 78 | add_filter( 'the_content', array( $this, 'fix_content_urls' ), 999 ); |
| 79 | 79 | add_filter( 'widget_text', array( $this, 'fix_content_urls' ), 999 ); |
| 80 | 80 | |
| 81 | - // The rewriters above only cover same-domain URLs; external | |
| 82 | - // http:// references need the browser-side CSP directive. | |
| 81 | + } | |
| 82 | + | |
| 83 | + // Its own setting since 2.9.8: the rewriters above are same-domain and | |
| 84 | + // harmless, this one governs everybody else's resources too. | |
| 85 | + if ( ! empty( $this->options['upgrade_insecure_requests'] ) ) { | |
| 83 | 86 | add_action( 'send_headers', array( $this, 'emit_upgrade_insecure_requests' ) ); |
| 84 | 87 | } |
| 85 | 88 | } |
| 86 | 89 | |
| @@ -306,31 +309,8 @@ | ||
| 306 | 309 | return $content; |
| 307 | 310 | } |
| 308 | 311 | |
| 309 | 312 | return $this->replace_http_with_https( $content ); |
| 310 | - } | |
| 311 | - | |
| 312 | - /** | |
| 313 | - * Update WordPress site URLs to HTTPS | |
| 314 | - * | |
| 315 | - * @return bool | |
| 316 | - */ | |
| 317 | - public function update_site_urls() { | |
| 318 | - $siteurl = get_option( 'siteurl' ); | |
| 319 | - $home = get_option( 'home' ); | |
| 320 | - $updated = false; | |
| 321 | - | |
| 322 | - if ( strpos( $siteurl, 'http://' ) === 0 ) { | |
| 323 | - update_option( 'siteurl', str_replace( 'http://', 'https://', $siteurl ) ); | |
| 324 | - $updated = true; | |
| 325 | - } | |
| 326 | - | |
| 327 | - if ( strpos( $home, 'http://' ) === 0 ) { | |
| 328 | - update_option( 'home', str_replace( 'http://', 'https://', $home ) ); | |
| 329 | - $updated = true; | |
| 330 | - } | |
| 331 | - | |
| 332 | - return $updated; | |
| 333 | 313 | } |
| 334 | 314 | |
| 335 | 315 | /** |
| 336 | 316 | * Check if site is properly configured for HTTPS |