Changeset 16705
- Timestamp:
- 12/03/2010 10:13:17 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/themes.php
r16553 r16705 13 13 $wp_list_table->check_permissions(); 14 14 15 if ( current_user_can( 'switch_themes') && isset($_GET['action']) ) {15 if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { 16 16 if ( 'activate' == $_GET['action'] ) { 17 17 check_admin_referer('switch-theme_' . $_GET['template']); … … 19 19 wp_redirect( admin_url('themes.php?activated=true') ); 20 20 exit; 21 } else 21 } elseif ( 'delete' == $_GET['action'] ) { 22 22 check_admin_referer('delete-theme_' . $_GET['template']); 23 23 if ( !current_user_can('delete_themes') ) … … 35 35 36 36 if ( current_user_can( 'switch_themes' ) ) : 37 38 // Flush rewrite rules on activation once new theme is in place. 39 if ( isset( $_GET['activated'] ) && $_GET['activated'] == 'true' ) 40 flush_rewrite_rules(); 37 41 38 42 $help = '<p>' . __('Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties.') . '</p>'; -
trunk/wp-includes/post.php
r16698 r16705 5068 5068 } 5069 5069 5070 function get_post_format_slugs() { 5071 $slugs = array( 5072 'default' => _x( 'default', 'Post format slug' ), 5073 'aside' => _x( 'aside', 'Post format slug' ), 5074 'chat' => _x( 'chat', 'Post format slug' ), 5075 'gallery' => _x( 'gallery', 'Post format slug' ), 5076 'link' => _x( 'link', 'Post format slug' ), 5077 'image' => _x( 'image', 'Post format slug' ), 5078 'quote' => _x( 'quote', 'Post format slug' ), 5079 'status' => _x( 'status', 'Post format slug' ), 5080 'video' => _x( 'video', 'Post format slug' ), 5081 'audio' => _x( 'audio', 'Post format slug' ), 5082 ); 5083 $slugs = array_map( 'sanitize_title_with_dashes', $slugs ); 5084 return $slugs; 5085 } 5086 5070 5087 /** 5071 5088 * Returns a pretty, translated version of a post format slug … … 5106 5123 } 5107 5124 5125 /** 5126 * Returns a link to a post format index. 5127 * 5128 * @since 3.1.0 5129 * 5130 * @param $format string Post format 5131 * @return string Link 5132 */ 5133 function get_post_format_link( $format ) { 5134 $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); 5135 if ( ! $term || is_wp_error( $term ) ) 5136 return false; 5137 return get_term_link( $term ); 5138 } 5139 5140 /** 5141 * Filters the request to allow for the format prefix. 5142 * 5143 * @access private 5144 * @since 3.1.0 5145 */ 5146 function _post_format_request( $qvs ) { 5147 if ( ! isset( $qvs['post_format'] ) ) 5148 return $qvs; 5149 $slugs = array_flip( get_post_format_slugs() ); 5150 if ( isset( $slugs[ $qvs['post_format'] ] ) ) 5151 $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; 5152 return $qvs; 5153 } 5154 add_filter( 'request', '_post_format_request' ); 5155 5156 /** 5157 * Filters the post format term link to remove the format prefix. 5158 * 5159 * @access private 5160 * @since 3.1.0 5161 */ 5162 function _post_format_link( $link, $term, $taxonomy ) { 5163 global $wp_rewrite; 5164 if ( 'post_format' != $taxonomy ) 5165 return $link; 5166 $slugs = get_post_format_slugs(); 5167 if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { 5168 return str_replace( "/{$term->slug}", '/' . $slugs[ str_replace( 'post-format-', '', $term->slug ) ], $link ); 5169 } else { 5170 $link = remove_query_arg( 'format', $link ); 5171 return add_query_arg( 'format', str_replace( 'post-format-', $term->slug ), $link ); 5172 } 5173 } 5174 add_filter( 'term_link', '_post_format_link', 10, 3 ); 5175 5108 5176 ?> -
trunk/wp-includes/taxonomy.php
r16691 r16705 20 20 'update_count_callback' => '_update_post_term_count', 21 21 'query_var' => 'category_name', 22 'rewrite' => array(22 'rewrite' => did_action( 'init' ) ? array( 23 23 'hierarchical' => true, 24 24 'slug' => get_option('category_base') ? get_option('category_base') : 'category', 25 'with_front' => false) ,25 'with_front' => false) : false, 26 26 'public' => true, 27 27 'show_ui' => true, … … 33 33 'update_count_callback' => '_update_post_term_count', 34 34 'query_var' => 'tag', 35 'rewrite' => array(36 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag' 37 'with_front' => false) ,35 'rewrite' => did_action( 'init' ) ? array( 36 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', 37 'with_front' => false) : false, 38 38 'public' => true, 39 39 'show_ui' => true, … … 53 53 '_builtin' => true, 54 54 'show_in_nav_menus' => false, 55 ) ) 55 ) ); 56 56 57 57 register_taxonomy( 'link_category', 'link', array( … … 76 76 'show_ui' => false, 77 77 '_builtin' => true, 78 ) ) ; 78 ) ); 79 80 $rewrite = false; 81 if ( did_action( 'init' ) && current_theme_supports( 'post-formats' ) ) { 82 $rewrite = apply_filters( 'post_format_rewrite_base', 'type' ); 83 $rewrite = $rewrite ? array( 'slug' => $rewrite ) : false; 84 } 79 85 80 86 register_taxonomy( 'post_format', 'post', array( 81 'public' => false,87 'public' => true, 82 88 'hierarchical' => false, 83 89 'labels' => array( … … 85 91 'singular_name' => '', 86 92 ), 87 'query_var' => false,88 'rewrite' => false,93 'query_var' => 'post_format', 94 'rewrite' => $rewrite, 89 95 'show_ui' => false, 90 96 '_builtin' => true, 91 97 'show_in_nav_menus' => false, 92 ) ) 98 ) ); 93 99 } 94 100 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority … … 311 317 } 312 318 313 if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') && !empty($wp_rewrite)) {319 if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) { 314 320 $args['rewrite'] = wp_parse_args($args['rewrite'], array( 315 321 'slug' => sanitize_title_with_dashes($taxonomy),
Note: See TracChangeset
for help on using the changeset viewer.