Changeset 1062917
- Timestamp:
- 01/08/2015 09:36:24 AM (11 years ago)
- Location:
- custom-permalinks/trunk
- Files:
-
- 2 edited
-
custom-permalinks.php (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-permalinks/trunk/custom-permalinks.php
r1062911 r1062917 243 243 244 244 // Re-run the filter, now with original environment in place 245 remove_filter( 'request', 'custom_permalinks_request', 10, 1 );245 remove_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 ); 246 246 global $wp; 247 247 $wp->parse_request(); 248 248 $query = $wp->query_vars; 249 add_filter( 'request', 'custom_permalinks_request', 10, 1 );250 249 add_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 ); 250 251 251 // Restore values 252 252 $_SERVER['REQUEST_URI'] = $oldRequestUri; $_SERVER['QUERY_STRING'] = $oldQueryString; … … 313 313 } 314 314 } 315 316 return '<strong>' . __('Permalink:') . "</strong>\n" . $content . 317 ( isset($view_post) ? "<span id='view-post-btn'><a href='$permalink' class='button ' target='_blank'>$view_post</a></span>\n" : "" );315 316 return '<strong>' . __('Permalink:') . "</strong>\n" . $content . 317 ( isset($view_post) ? "<span id='view-post-btn'><a href='$permalink' class='button button-small' target='_blank'>$view_post</a></span>\n" : "" ); 318 318 } 319 319 … … 418 418 <?php endif; ?> 419 419 <?php echo home_url() ?>/ 420 <input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>" 421 style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>" 422 onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }" 423 onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' || this.value == '<?php echo htmlspecialchars(urldecode($original)) ?>' ) { this.value = '<?php echo htmlspecialchars(urldecode($original)) ?>'; this.style.color = '#ddd'; }"/> 424 <?php if ( $renderContainers ) : ?> 420 <span id="editable-post-name" title="Click to edit this part of the permalink"> 421 <input type="text" id="new-post-slug" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>" 422 style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>" 423 onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }" 424 onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' || this.value == '<?php echo htmlspecialchars(urldecode($original)) ?>' ) { this.value = '<?php echo htmlspecialchars(urldecode($original)) ?>'; this.style.color = '#ddd'; }"/> 425 </span> 426 <?php if ( $renderContainers ) : ?> 425 427 <br /> 426 428 <small><?php _e('Leave blank to disable', 'custom-permalink') ?></small> … … 671 673 */ 672 674 function custom_permalinks_original_post_link($post_id) { 673 remove_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook674 remove_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );675 remove_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 ); // original hook 676 remove_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 ); 675 677 $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/'); 676 add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook677 add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );678 add_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 ); // original hook 679 add_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 ); 678 680 return $originalPermalink; 679 681 } … … 686 688 */ 687 689 function custom_permalinks_original_page_link($post_id) { 688 remove_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );689 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );690 remove_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 ); 691 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 690 692 $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/'); 691 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );692 add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );693 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 694 add_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 ); 693 695 return $originalPermalink; 694 696 } … … 702 704 */ 703 705 function custom_permalinks_original_tag_link($tag_id) { 704 remove_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );705 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );706 remove_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 707 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 706 708 $originalPermalink = ltrim(str_replace(home_url(), '', get_tag_link($tag_id)), '/'); 707 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );708 add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );709 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 710 add_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 709 711 return $originalPermalink; 710 712 } … … 717 719 */ 718 720 function custom_permalinks_original_category_link($category_id) { 719 remove_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );720 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );721 remove_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 722 remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 721 723 $originalPermalink = ltrim(str_replace(home_url(), '', get_category_link($category_id)), '/'); 722 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );723 add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );724 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 725 add_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 724 726 return $originalPermalink; 725 727 } … … 768 770 if (function_exists("add_action") && function_exists("add_filter")) { 769 771 add_action( 'template_redirect', 'custom_permalinks_redirect', 5 ); 770 add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 );771 add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );772 add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );773 add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );774 add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );775 add_filter( 'request', 'custom_permalinks_request', 10, 1 );776 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );772 add_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 ); 773 add_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 ); 774 add_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 ); 775 add_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 776 add_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 ); 777 add_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 ); 778 add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 ); 777 779 778 780 if (function_exists("get_bloginfo")) { … … 781 783 782 784 if ( $v[0] >= 2 ) { 783 add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html', 10, 4 );785 add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html', 'edit_files', 4 ); 784 786 } else { 785 787 add_action( 'edit_form_advanced', 'custom_permalinks_post_options' ); … … 796 798 add_action( 'create_post_tag', 'custom_permalinks_save_tag' ); 797 799 add_action( 'create_category', 'custom_permalinks_save_category' ); 798 add_action( 'delete_post', 'custom_permalinks_delete_permalink', 10);800 add_action( 'delete_post', 'custom_permalinks_delete_permalink', 'edit_files'); 799 801 add_action( 'delete_post_tag', 'custom_permalinks_delete_term' ); 800 802 add_action( 'delete_post_category', 'custom_permalinks_delete_term' ); -
custom-permalinks/trunk/readme.txt
r1062908 r1062917 4 4 Tags: permalink, url, link, address, custom, redirect 5 5 Requires at least: 2.6 6 Tested up to: 3.96 Tested up to: 4.1 7 7 Stable tag: 0.7.20 8 8 … … 34 34 * Addressed a noisy warning 35 35 * Revised addition of admin forms js (don't use is_admin()) 36 * Updated Roles and Capabilities from depreciated numerical to label capabilities (by OF-6) 37 * Added css/html to match WP 3.5+ layout (by OF-6) 36 38 37 39 = 0.7.19 =
Note: See TracChangeset
for help on using the changeset viewer.