WordPress.org

Plugin Directory

Changeset 569749


Ignore:
Timestamp:
07/10/12 02:39:23 (22 months ago)
Author:
jbrinley
Message:

merged updates from github

Location:
wp-router/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-router/trunk/WP_Router_Page.class.php

    r567871 r569749  
    55 * Time: 2:31 PM 
    66 */ 
    7   
     7 
    88class WP_Router_Page extends WP_Router_Utility { 
    99    const POST_TYPE = 'wp_router_page'; 
    10      
     10 
    1111    protected static $rewrite_slug = 'WP_Router'; 
    1212    protected static $post_id = 0; // The ID of the post this plugin uses 
     
    1515    protected $title = ''; 
    1616    protected $template = ''; 
    17      
     17 
    1818    public static function init() { 
    1919        self::register_post_type(); 
     
    9999        add_filter('the_title', array($this, 'get_title'), 10, 2); 
    100100        add_filter('single_post_title', array($this, 'get_single_post_title'), 10, 2); 
     101        add_filter('redirect_canonical', array($this, 'override_redirect'), 10, 2); 
    101102        if ( $this->template ) { 
    102103            add_filter('template_include', array($this, 'override_template'), 10, 1); 
     
    126127    /** 
    127128     * Override the global $pages array to yield our content 
    128      *  
     129     * 
    129130     * @param object $post 
    130131     * @return void 
     
    179180 
    180181    /** 
    181      * If %category% is in the permastruct, WordPress will try to redirect 
    182      * all router pages to the URL for the dummy page. This should 
    183      * stop that from happening 
    184      * 
    185      * @see redirect_canonical() 
     182     * If asking for a paged router page, or if %category% is in 
     183     * the permastruct, WordPress will try to redirect to the URL 
     184     * for the dummy page. This should stop that from happening. 
     185     * 
     186     * @wordpress-filter redirect_canonical 
    186187     * @param string $redirect_url 
    187188     * @param string $requested_url 
     
    189190     */ 
    190191    public function override_redirect( $redirect_url, $requested_url ) { 
    191         if ( get_query_var('WP_Route') ) { 
     192        if ( $redirect_url && get_query_var('WP_Route') ) { 
    192193            return FALSE; 
    193194        } 
     195        if ( $redirect_url && get_permalink(self::get_post_id()) == $redirect_url ) { 
     196            return FALSE; 
     197        } 
    194198        return $redirect_url; 
    195199    } 
  • wp-router/trunk/readme.txt

    r567872 r569749  
    172172* Redirect placeholder page to the blog front page 
    173173* Fix usage of translation functions 
     174 
     175= 0.4 = 
     176 
     177* Prevent redirect from route pages with the "page" or "paged" query arg 
  • wp-router/trunk/wp-router.php

    r567871 r569749  
    22/* 
    33Plugin Name: WP Router 
    4 Plugin URI: http://www.adeliedesign.com/ 
     4Plugin URI: https://github.com/jbrinley/WP-Router 
    55Description: Provides a simple API for mapping requests to callback functions. 
    6 Author: Adelie Design 
    7 Author URI: http://www.adeliedesign.com/ 
    8 Version: 0.3.3 
     6Author: Flightless 
     7Author URI: http://flightless.us/ 
     8Version: 0.4 
    99*/ 
    1010/* 
    11 Copyright (c) 2011 Adelie Design, Inc. http://www.AdelieDesign.com/ 
     11Copyright (c) 2012 Flightless, Inc. http://flightless.us/ 
    1212 
    1313Permission is hereby granted, free of charge, to any person obtaining 
Note: See TracChangeset for help on using the changeset viewer.