Plugin Directory

Changeset 187907


Ignore:
Timestamp:
12/29/2009 08:34:45 PM (16 years ago)
Author:
akrabat
Message:

support permalinks that start with /%category%/

Location:
shorter-links/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shorter-links/trunk/readme.txt

    r111336 r187907  
    44Tags: revcanonical links url shorter shorturl
    55Requires at least: 2.5
    6 Tested up to: 2.7.9
    7 Stable tag: 1.4
     6Tested up to: 2.9
     7Stable tag: 1.5
    88
    99This plugin creates rel="shorturl" link with a shorter URL in it, along with
     
    7171== History ==
    7272
     73**1.5 - 29 December 2009**
     74Support permalinks that start with /%category%/
     75
    7376**1.4 - 14 April 2009**
    7477Support rel="shorturl" as per [Robert Spychala's Short URL Auto-Discovery proposal](http://sites.google.com/a/snaplog.com/wiki/short_url).
  • shorter-links/trunk/shorter_links.php

    r111327 r187907  
    5959function akrabat_sl_redirect($query_vars)
    6060{
    61     // check if pagename matches a short url
    62     if(!array_key_exists('pagename', $query_vars)) {
     61    // check if pagename or category_name matches a short url
     62    $shortUrl = '';
     63    if(array_key_exists('pagename', $query_vars)) {
     64        $shortUrl = $query_vars['pagename'];
     65    }
     66    if(array_key_exists('category_name', $query_vars)) {
     67        $shortUrl = $query_vars['category_name'];
     68    }
     69    if(!$shortUrl) {
    6370        return $query_vars;
    6471    }
    6572
    66     $shortUrl = $query_vars['pagename'];
    6773    if((int)$shortUrl > 0) {
    6874        wp_redirect(get_permalink($shortUrl));
Note: See TracChangeset for help on using the changeset viewer.