WordPress.org

Plugin Directory

Changeset 393086


Ignore:
Timestamp:
06/04/11 15:53:16 (3 years ago)
Author:
jbrinley
Message:

Merge branch 'master' into svn

Location:
wp-router/trunk
Files:
4 edited

Legend:

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

    r391925 r393086  
    121121 
    122122    /** 
     123     * Return the URL for this route, with the given arguments 
     124     * 
     125     * @todo This currently only returns the non-pretty URL. If 
     126     *       using permalinks, it should be a pretty URL based on 
     127     *       $this->path 
     128     * @param array $args 
     129     * @return string 
     130     */ 
     131    public function url( $args = array() ) { 
     132        $args[self::QUERY_VAR] = $this->id; 
     133        return add_query_arg($args, trailingslashit(home_url())); 
     134    } 
     135 
     136    /** 
    123137     * @return array WordPress rewrite rules that should point to this instance's callback 
    124138     */ 
  • wp-router/trunk/WP_Router.class.php

    r388695 r393086  
    9191    } 
    9292 
     93    public function get_url( $route_id, $arguments ) { 
     94        $route = $this->get_route($route_id); 
     95        if ( !$route ) { 
     96            return home_url(); 
     97        } else { 
     98            return $route->url($arguments); 
     99        } 
     100    } 
     101 
    93102    /**************************************************** 
    94103     * PLUMBING 
  • wp-router/trunk/readme.txt

    r391925 r393086  
    137137* `WP_Router::remove_route( string $id )` - delete the route with the given ID 
    138138* `WP_Router::get_route( string $id )` - get the `WP_Route` object for the given ID 
     139* `WP_Router::get_url( string $id, array $arguments )` - get the URL to reach the route with the given ID, with the given query variables and their values 
    139140* `WP_Route::get( string $property )` - get the value of the specified property for 
    140141    the `WP_Route` instance 
     
    155156* Added option to specify different callback functions depending on the HTTP request method 
    156157* Verified compatibility with WordPress 3.0 
     158* Added WP_Router::get_url() function 
  • wp-router/trunk/wp-router.php

    r391925 r393086  
    66Author: Adelie Design 
    77Author URI: http://www.adeliedesign.com/ 
    8 Version: 0.3 
     8Version: 0.3.1 
    99*/ 
    1010/* 
Note: See TracChangeset for help on using the changeset viewer.