Changeset 588769
- Timestamp:
- 08/22/2012 10:17:30 AM (14 years ago)
- Location:
- custom-permalinks
- Files:
-
- 3 added
- 2 edited
-
tags/0.7.15 (added)
-
tags/0.7.15/custom-permalinks.php (added)
-
tags/0.7.15/readme.txt (added)
-
trunk/custom-permalinks.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-permalinks/trunk/custom-permalinks.php
r550239 r588769 5 5 Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/ 6 6 Description: Set custom permalinks on a per-post basis 7 Version: 0.7.1 47 Version: 0.7.15 8 8 Author: Michael Tyson 9 9 Author URI: http://atastypixel.com/blog … … 94 94 95 95 // Get request URI, strip parameters 96 $url = parse_url(get_bloginfo('url')); $url = $url['path']; 96 $url = parse_url(get_bloginfo('url')); 97 $url = isset($url['path']) ? $url['path'] : ''; 97 98 $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/'); 98 99 if ( ($pos=strpos($request, "?")) ) $request = substr($request, 0, $pos); … … 114 115 custom_permalinks_original_category_link($theTerm->term_id)); 115 116 } 116 117 117 118 if ( $custom_permalink && 118 119 (substr($request, 0, strlen($custom_permalink)) != $custom_permalink || … … 152 153 153 154 // Get request URI, strip parameters and /'s 154 $url = parse_url(get_bloginfo('url')); $url = $url['path']; 155 $url = parse_url(get_bloginfo('url')); 156 $url = isset($url['path']) ? $url['path'] : ''; 155 157 $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/'); 156 158 $request = (($pos=strpos($request, '?')) ? substr($request, 0, $pos) : $request); 157 159 $request_noslash = preg_replace('@/+@','/', trim($request, '/')); 158 160 159 161 if ( !$request ) return $query; 160 162 … … 163 165 " meta_key = 'custom_permalink' AND ". 164 166 " meta_value != '' AND ". 165 " ( meta_value = LEFT('".mysql_escape_string($request_noslash)."', LENGTH(meta_value)) OR ".166 " meta_value = LEFT('".mysql_escape_string($request_noslash."/")."', LENGTH(meta_value)) ) ".167 " ( LOWER(meta_value) = LEFT(LOWER('".mysql_escape_string($request_noslash)."'), LENGTH(meta_value)) OR ". 168 " LOWER(meta_value) = LEFT(LOWER('".mysql_escape_string($request_noslash."/")."'), LENGTH(meta_value)) ) ". 167 169 "ORDER BY LENGTH(meta_value) DESC LIMIT 1"; 168 170 169 171 $posts = $wpdb->get_results($sql); 170 172 171 173 if ( $posts ) { 172 174 // A post matches our request … … 176 178 $_CPRegisteredURL = $request; 177 179 178 $originalUrl = preg_replace( '@/+@', '/', str_replace( trim( $posts[0]->meta_value,'/' ),180 $originalUrl = preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ), 179 181 ( $posts[0]->post_type == 'page' ? 180 182 custom_permalinks_original_page_link($posts[0]->ID) 181 183 : custom_permalinks_original_post_link($posts[0]->ID) ), 182 $request_noslash) );183 } 184 184 strtolower($request_noslash) ) ); 185 } 186 185 187 if ( $originalUrl === NULL ) { 186 188 // See if any terms have a matching permalink … … 231 233 $_REQUEST[$key] = $_GET[$key] = $value; 232 234 } 233 235 234 236 // Re-run the filter, now with original environment in place 235 237 remove_filter( 'request', 'custom_permalinks_request', 10, 1 ); -
custom-permalinks/trunk/readme.txt
r550239 r588769 5 5 Requires at least: 2.6 6 6 Tested up to: 3.3.1 7 Stable tag: 0.7.1 47 Stable tag: 0.7.15 8 8 9 9 Set custom permalinks on a per-post, per-tag or per-category basis. … … 29 29 30 30 == Changelog == 31 32 = 0.7.15 = 33 34 * Permalinks are now case-insensitive (thanks to @ericmann) 31 35 32 36 = 0.7.14 =
Note: See TracChangeset
for help on using the changeset viewer.