Custom Permalinks - Version 0.5

Version Description

Download this release

Release Info

Developer michaeltyson
Plugin Icon Custom Permalinks
Version 0.5
Comparing to
See all releases

Code changes from version 0.4.1 to 0.5

Files changed (2) hide show
  1. custom-permalinks.php +6 -3
  2. readme.txt +3 -1
custom-permalinks.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Permalinks
4
  Plugin URI: http://michael.tyson.id.au/wordpress/plugins/custom-permalinks
5
  Donate link: http://michael.tyson.id.au/wordpress/plugins/custom-permalinks
6
  Description: Set custom permalinks on a per-post basis
7
- Version: 0.4.1
8
  Author: Michael Tyson
9
  Author URI: http://michael.tyson.id.au
10
  */
@@ -93,7 +93,8 @@ function custom_permalinks_term_link($permalink, $term) {
93
  function custom_permalinks_redirect() {
94
 
95
  // Get request URI, strip parameters
96
- $request = ltrim($_SERVER['REQUEST_URI'],'/');
 
97
  if ( ($pos=strpos($request, "?")) ) $request = substr($request, 0, $pos);
98
 
99
  global $wp_query;
@@ -145,7 +146,9 @@ function custom_permalinks_request($query) {
145
  $originalUrl = '';
146
 
147
  // Get request URI, strip parameters and /'s
148
- $request = (($pos=strpos($_SERVER['REQUEST_URI'], '?')) ? substr($_SERVER['REQUEST_URI'], 0, $pos) : $_SERVER['REQUEST_URI']);
 
 
149
  $request = preg_replace('@/+@','/', trim($request, '/'));
150
 
151
  if ( !$request ) return $query;
4
  Plugin URI: http://michael.tyson.id.au/wordpress/plugins/custom-permalinks
5
  Donate link: http://michael.tyson.id.au/wordpress/plugins/custom-permalinks
6
  Description: Set custom permalinks on a per-post basis
7
+ Version: 0.5
8
  Author: Michael Tyson
9
  Author URI: http://michael.tyson.id.au
10
  */
93
  function custom_permalinks_redirect() {
94
 
95
  // Get request URI, strip parameters
96
+ $url = parse_url(get_bloginfo('url')); $url = $url['path'];
97
+ $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');
98
  if ( ($pos=strpos($request, "?")) ) $request = substr($request, 0, $pos);
99
 
100
  global $wp_query;
146
  $originalUrl = '';
147
 
148
  // Get request URI, strip parameters and /'s
149
+ $url = parse_url(get_bloginfo('url')); $url = $url['path'];
150
+ $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');
151
+ $request = (($pos=strpos($request, '?')) ? substr($request, 0, $pos) : $request);
152
  $request = preg_replace('@/+@','/', trim($request, '/'));
153
 
154
  if ( !$request ) return $query;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://michael.tyson.id.au/wordpress/plugins/custom-permalinks
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 2.6.2
7
- Stable tag: 0.4.1
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
@@ -23,6 +23,8 @@ over your site structure.
23
 
24
  == Changelog ==
25
 
 
 
26
  0.4.1: WP 2.7 compatability fixes; fix for bug encountered when publishing a draft, or reverting to draft status, and fix for placeholder permalink value for pages
27
 
28
  0.4: Support for pages, and a fix for draft posts/pages
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 2.6.2
7
+ Stable tag: 0.5
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
23
 
24
  == Changelog ==
25
 
26
+ 0.5: Support for Wordpress sites in subdirectories (i.e., not located at the webroot)
27
+
28
  0.4.1: WP 2.7 compatability fixes; fix for bug encountered when publishing a draft, or reverting to draft status, and fix for placeholder permalink value for pages
29
 
30
  0.4: Support for pages, and a fix for draft posts/pages