WordPress.org

Plugin Directory

Changeset 611229


Ignore:
Timestamp:
10/12/12 02:44:27 (19 months ago)
Author:
tlovett1
Message:

Version 1.4.1 - contains 3 important bug fixes which are documented in the readme

Location:
safe-redirect-manager/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • safe-redirect-manager/trunk/readme.txt

    r610199 r611229  
    44Requires at least: 3.1 
    55Tested up to: 3.4.2 
    6 Stable tag: 1.4 
     6Stable tag: 1.4.1 
    77 
    88Safely and easily manage your website's HTTP redirects. 
     
    2525== Changelog == 
    2626 
     27= 1.4.1 (Oct. 11, 2012) = 
     28* Refresh cache after create_redirect call - bug fix 
     29* Refresh cache after save_post is called - bug fix 
     30* Chop off "pre-WP" path from requested path. This allows the plugin to work on WP installations in sub-directories - bug fix 
     31 
    2732= 1.4 (Oct. 9, 2012) = 
    2833* Use the '*' wildcard at the end of your match value to configure a wildcard redirect. Use the same symbol at the end of your redirect to value in order to have the matched value be appended to the end of the redirect. Thanks [prettyboymp](https://github.com/prettyboymp) for the pull request 
  • safe-redirect-manager/trunk/safe-redirect-manager.php

    r610199 r611229  
    55Description: Easily and safely manage HTTP redirects. 
    66Author: Taylor Lovett (10up LLC), VentureBeat 
    7 Version: 1.4 
     7Version: 1.4.1 
    88Author URI: http://www.10up.com 
    99 
     
    229229        update_post_meta( $post_id, $this->meta_key_redirect_to, $sanitized_redirect_to ); 
    230230        update_post_meta( $post_id, $this->meta_key_redirect_status_code, $sanitized_status_code ); 
     231         
     232        // We need to update the cache after creating this redirect 
     233        $this->update_redirect_cache(); 
    231234         
    232235        return $post_id; 
     
    477480                delete_post_meta( $post_id, $this->meta_key_redirect_status_code ); 
    478481            } 
     482             
     483            /** 
     484             * This fixes an important bug where the redirect cache was not up-to-date. Previously the cache was only being 
     485             * updated on transition_post_status which gets called BEFORE save post. But since save_post is where all the important 
     486             * redirect info is saved, updating the cache before it is not sufficient. 
     487             */ 
     488            $this->update_redirect_cache(); 
    479489        } 
    480490    } 
     
    669679    public function action_parse_request() { 
    670680         
    671         // get requested path and add a / before it 
    672         $requested_path = sanitize_text_field( $_SERVER['REQUEST_URI'] ); 
    673          
    674681        // get redirects from cache or recreate it 
    675682        if ( false === ( $redirects = get_transient( $this->cache_key_redirects ) ) ) { 
    676683            $redirects = $this->update_redirect_cache(); 
     684        } 
     685         
     686        // If we have no redirects, there is no need to continue 
     687        if ( empty( $redirects ) ) 
     688            return; 
     689         
     690        // get requested path and add a / before it 
     691        $requested_path = sanitize_text_field( $_SERVER['REQUEST_URI'] ); 
     692         
     693        /** 
     694         * If WordPress resides in a directory that is not the public root, we have to chop 
     695         * the pre-WP path off the requested path. 
     696         */ 
     697        $parsed_site_url = parse_url( site_url() ); 
     698        if ( '/' != $parsed_site_url['path'] ) { 
     699            $requested_path = preg_replace( '@' . $parsed_site_url['path'] . '@i', '', $requested_path, 1 ); 
    677700        } 
    678701         
Note: See TracChangeset for help on using the changeset viewer.