Changeset 965010 for https-redirection
- Timestamp:
- 08/13/2014 09:16:12 AM (12 years ago)
- Location:
- https-redirection/trunk
- Files:
-
- 2 edited
-
https-redirection.php (modified) (7 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
https-redirection/trunk/https-redirection.php
r957989 r965010 5 5 Description: The plugin HTTPS Redirection allows an automatic redirection to the "HTTPS" version/URL of the site. 6 6 Author: Tips and Tricks HQ 7 Version: 1. 17 Version: 1.2 8 8 Author URI: http://www.tipsandtricks-hq.com/ 9 9 License: GPLv2 or later … … 35 35 if ( ! function_exists ( 'httpsrdrctn_plugin_init' ) ) { 36 36 function httpsrdrctn_plugin_init() { 37 global $httpsrdrctn_options; 37 38 /* Internationalization, first(!) */ 38 39 load_plugin_textdomain( 'https_redirection', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 40 if( empty( $httpsrdrctn_options ) ){ 41 $httpsrdrctn_options = get_option( 'httpsrdrctn_options' ); 42 } 43 if( isset($httpsrdrctn_options['force_resources']) && $httpsrdrctn_options['force_resources'] == '1' ){ 44 //Handle the appropriate content filters to force the static resources to use HTTPS URL 45 add_filter( 'the_content', 'httpsrdrctn_the_content' ); 46 add_filter( 'get_the_content', 'httpsrdrctn_the_content' ); 47 add_filter( 'the_excerpt', 'httpsrdrctn_the_content' ); 48 add_filter( 'get_the_excerpt', 'httpsrdrctn_the_content' ); 49 } 39 50 } 40 51 } … … 79 90 'https_domain' => 0, 80 91 'https_pages_array' => array(), 92 'force_resources' => 0, 81 93 'plugin_option_version' => $httpsrdrctn_plugin_info["Version"] 82 94 ); … … 142 154 $httpsrdrctn_options['https'] = isset( $_REQUEST['httpsrdrctn_https'] ) ? $_REQUEST['httpsrdrctn_https'] : 0 ; 143 155 $httpsrdrctn_options['https_domain'] = isset( $_REQUEST['httpsrdrctn_https_domain'] ) ? $_REQUEST['httpsrdrctn_https_domain'] : 0 ; 156 $httpsrdrctn_options['force_resources'] = isset( $_REQUEST['httpsrdrctn_force_resources'] ) ? $_REQUEST['httpsrdrctn_force_resources'] : 0 ; 144 157 145 158 if( isset( $_REQUEST['httpsrdrctn_https_pages_array'] ) ){ … … 187 200 <td> 188 201 <label><input type="checkbox" name="httpsrdrctn_https" value="1" <?php if ( '1' == $httpsrdrctn_options['https'] ) echo "checked=\"checked\" "; ?>/></label><br /> 202 <p class="description">Use this option to make your webpage(s) load in HTTPS version only. If someone enters a non-https URL in the browser's address bar then the plugin will automatically redirect to the HTTPS version of that URL.</p> 203 204 <br /> 205 <p>You can apply a force HTTPS redirection on your entire domain or just a few pages.</p> 189 206 <label <?php if( '0' == $httpsrdrctn_options['https'] ) echo 'class="hidden"'; ?>><input type="radio" name="httpsrdrctn_https_domain" value="1" <?php if ( '1' == $httpsrdrctn_options['https_domain'] ) echo "checked=\"checked\" "; ?>/> The whole domain</label><br /> 190 207 <label <?php if( '0' == $httpsrdrctn_options['https'] ) echo 'class="hidden"'; ?>><input type="radio" name="httpsrdrctn_https_domain" value="0" <?php if ( '0' == $httpsrdrctn_options['https_domain'] ) echo "checked=\"checked\" "; ?>/> A few pages</label><br /> … … 196 213 <span class="rewrite_new_item <?php if( '1' == $httpsrdrctn_options['https_domain'] || '0' == $httpsrdrctn_options['https'] ) echo 'hidden'; ?>" > 197 214 <?php echo str_replace( "http://", "https://", home_url() ); ?>/<input type="text" name="httpsrdrctn_https_pages_array[]" value="" /> <span class="rewrite_add_item"> </span> <span class="rewrite_item_blank_error"><?php _e( 'Please, fill field', 'list' ); ?></span><br /> 198 </span> 215 </span> 216 </td> 217 </tr> 218 <tr valign="top"> 219 <th scope="row"><?php _e( 'Force resources to use HTTPS URL', 'https_redirection' ); ?></th> 220 <td> 221 <label><input type="checkbox" name="httpsrdrctn_force_resources" value="1" <?php if ( isset($httpsrdrctn_options['force_resources']) && $httpsrdrctn_options['force_resources'] == '1' ) echo "checked=\"checked\" "; ?>/></label><br /> 222 <p class="description">When checked, the plugin will force load HTTPS URL for any static resources in your content. Example: if you have have an image embedded in a post with a NON-HTTPS URL, this option will change that to a HTTPS URL.</p> 199 223 </td> 200 224 </tr> … … 352 376 } 353 377 378 if ( ! function_exists ( 'httpsrdrctn_the_content' ) ) { 379 function httpsrdrctn_the_content( $content ) { 380 global $httpsrdrctn_options; 381 if( empty( $httpsrdrctn_options ) ){ 382 $httpsrdrctn_options = get_option( 'httpsrdrctn_options' ); 383 } 384 if( $httpsrdrctn_options['force_resources'] == '1' && $httpsrdrctn_options['https'] == 1 ){ 385 if( $httpsrdrctn_options['https_domain'] == 1 ){ 386 if( strpos( home_url(), 'https' ) !== false ){ 387 $http_domain = str_replace( 'https', 'http', home_url() ); 388 $https_domain = home_url(); 389 } 390 else{ 391 $http_domain = home_url(); 392 $https_domain = str_replace( 'http', 'https', home_url() ); 393 } 394 $content = str_replace( $http_domain, $https_domain, $content ); 395 } 396 else if( ! empty( $httpsrdrctn_options['https_pages_array'] ) ) { 397 foreach( $httpsrdrctn_options['https_pages_array'] as $https_page ) { 398 if( strpos( home_url(), 'https' ) !== false ){ 399 $http_domain = str_replace( 'https', 'http', home_url() ); 400 $https_domain = home_url(); 401 } 402 else{ 403 $http_domain = home_url(); 404 $https_domain = str_replace( 'http', 'https', home_url() ); 405 } 406 $content = str_replace( $http_domain . '/' . $https_page, $https_domain . '/' . $https_page, $content ); 407 } 408 } 409 } 410 return $content; 411 } 412 } 413 354 414 if ( ! function_exists ( 'httpsrdrctn_admin_head' ) ) { 355 415 function httpsrdrctn_admin_head() { -
https-redirection/trunk/readme.txt
r958000 r965010 2 2 Contributors: Tips and Tricks HQ 3 3 Donate link: http://www.tipsandtricks-hq.com/development-center 4 Tags: redirection, https, automatic redirection, htaccess, ssl, https redirection, ssl certificate, secure page, secure 4 Tags: redirection, https, automatic redirection, htaccess, ssl, https redirection, ssl certificate, secure page, secure, force ssl, force https 5 5 Requires at least: 3.5 6 Tested up to: 3.9. 17 Stable tag: 1. 16 Tested up to: 3.9.2 7 Stable tag: 1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 The plugin HTTPS Redirection allows an automatic redirection to the "HTTPS" version/URL of the site.11 The plugin allows an automatic redirection to the "HTTPS" version/URL of the site. Make your site SSL compatible. 12 12 13 13 == Description == 14 14 15 15 After you install SSL certificate on your site you want to use the "HTTPS" URL of your webpages. 16 17 You want to force search engines to index your HTTPS version of the webpage(s). 16 18 17 19 This plugin will help you automatically setup a redirection to the https version of an URL when anyone tries to access the non-https version. … … 29 31 So you are always forcing the visitor to view the HTTPS version of the page or site in question. 30 32 33 = Force Load Static Files Using HTTPS = 34 35 If you started using SSL from day 1 of your site then all your static files are already embedded using HTTPS URL. You have no issue there. 36 37 However, if you have an existing website where you have a lot of static files that are embedded in your posts and pages using NON-HTTPS URL then you will need to change those. Otherwise, the browser will show an warning. 38 39 This plugin has an option that will allow you to force load those static files using HTTPS URL dynamically. 40 41 This will help you make the webpage fully compatible with SSL. 42 31 43 = Features = 32 44 33 45 * Actions: Do an auto redirect for the whole domain. So every URL will be redirected to the HTTPS version automatically. 34 46 * Actions: Do an auto redirect for a few pages. The user can enter the URLs that will be auto redirected to the HTTPS version. 47 * Force load static files (images, js, css etc) using a HTTPS URL. 35 48 36 49 == Installation == … … 75 88 == Changelog == 76 89 90 = v1.2 = 91 - Added a new option to automatically force load static files using HTTPS URL. 92 93 = v1.1 = 94 - Fixed a bug with the settings page. 95 77 96 = v1.0 = 78 97 * First commit to WordPress repository
Note: See TracChangeset
for help on using the changeset viewer.