Plugin Directory

Changeset 965010 for https-redirection


Ignore:
Timestamp:
08/13/2014 09:16:12 AM (12 years ago)
Author:
mra13
Message:

committing v1.2

Location:
https-redirection/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • https-redirection/trunk/https-redirection.php

    r957989 r965010  
    55Description: The plugin HTTPS Redirection allows an automatic redirection to the "HTTPS" version/URL of the site.
    66Author: Tips and Tricks HQ
    7 Version: 1.1
     7Version: 1.2
    88Author URI: http://www.tipsandtricks-hq.com/
    99License: GPLv2 or later
     
    3535if ( ! function_exists ( 'httpsrdrctn_plugin_init' ) ) {
    3636    function httpsrdrctn_plugin_init() {
     37        global $httpsrdrctn_options;
    3738        /* Internationalization, first(!) */
    3839        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        }
    3950    }
    4051}
     
    7990            'https_domain'  => 0,
    8091            'https_pages_array' => array(),
     92            'force_resources' => 0,
    8193            'plugin_option_version' => $httpsrdrctn_plugin_info["Version"]
    8294        );
     
    142154            $httpsrdrctn_options['https'] = isset( $_REQUEST['httpsrdrctn_https'] ) ? $_REQUEST['httpsrdrctn_https'] : 0 ;
    143155            $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 ;
    144157           
    145158            if( isset( $_REQUEST['httpsrdrctn_https_pages_array'] ) ){
     
    187200                        <td>
    188201                            <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>
    189206                            <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 />
    190207                            <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 />
     
    196213                            <span class="rewrite_new_item <?php if( '1' == $httpsrdrctn_options['https_domain'] || '0' == $httpsrdrctn_options['https'] ) echo 'hidden'; ?>" >
    197214                                <?php echo str_replace( "http://", "https://", home_url() ); ?>/<input type="text" name="httpsrdrctn_https_pages_array[]" value="" /> <span class="rewrite_add_item">&nbsp;</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>
    199223                        </td>
    200224                    </tr>
     
    352376}
    353377
     378if ( ! 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
    354414if ( ! function_exists ( 'httpsrdrctn_admin_head' ) ) {
    355415    function httpsrdrctn_admin_head() {
  • https-redirection/trunk/readme.txt

    r958000 r965010  
    22Contributors: Tips and Tricks HQ
    33Donate link: http://www.tipsandtricks-hq.com/development-center
    4 Tags: redirection, https, automatic redirection, htaccess, ssl, https redirection, ssl certificate, secure page, secure
     4Tags: redirection, https, automatic redirection, htaccess, ssl, https redirection, ssl certificate, secure page, secure, force ssl, force https
    55Requires at least: 3.5
    6 Tested up to: 3.9.1
    7 Stable tag: 1.1
     6Tested up to: 3.9.2
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 The plugin HTTPS Redirection allows an automatic redirection to the "HTTPS" version/URL of the site.
     11The plugin allows an automatic redirection to the "HTTPS" version/URL of the site. Make your site SSL compatible.
    1212
    1313== Description ==
    1414
    1515After you install SSL certificate on your site you want to use the "HTTPS" URL of your webpages.
     16
     17You want to force search engines to index your HTTPS version of the webpage(s).
    1618
    1719This plugin will help you automatically setup a redirection to the https version of an URL when anyone tries to access the non-https version.
     
    2931So you are always forcing the visitor to view the HTTPS version of the page or site in question.
    3032
     33= Force Load Static Files Using HTTPS =
     34
     35If 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
     37However, 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
     39This plugin has an option that will allow you to force load those static files using HTTPS URL dynamically.
     40
     41This will help you make the webpage fully compatible with SSL.
     42
    3143= Features =
    3244
    3345* Actions: Do an auto redirect for the whole domain. So every URL will be redirected to the HTTPS version automatically.
    3446* 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.
    3548
    3649== Installation ==
     
    7588== Changelog ==
    7689
     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
    7796= v1.0 =
    7897* First commit to WordPress repository
Note: See TracChangeset for help on using the changeset viewer.