Ticket #16459: 16459.no-translating-slugs.2.diff
File 16459.no-translating-slugs.2.diff, 2.2 KB (added by , 14 years ago) |
---|
-
wp-includes/post.php
5066 5066 } 5067 5067 5068 5068 /** 5069 * Retrieves an array of (translated and sanitized)post format slugs.5069 * Retrieves an array of post format slugs. 5070 5070 * 5071 5071 * @since 3.1.0 5072 5072 * 5073 * @uses sanitize_title_with_dashes() 5074 * @return array The array of (translated and sanitized) post format slugs. 5073 * @return array The array of post format slugs. 5075 5074 */ 5076 5075 function get_post_format_slugs() { 5077 $slugs = array( 5078 'standard' => _x( 'standard', 'Post format slug' ), 5079 'aside' => _x( 'aside', 'Post format slug' ), 5080 'chat' => _x( 'chat', 'Post format slug' ), 5081 'gallery' => _x( 'gallery', 'Post format slug' ), 5082 'link' => _x( 'link', 'Post format slug' ), 5083 'image' => _x( 'image', 'Post format slug' ), 5084 'quote' => _x( 'quote', 'Post format slug' ), 5085 'status' => _x( 'status', 'Post format slug' ), 5086 'video' => _x( 'video', 'Post format slug' ), 5087 'audio' => _x( 'audio', 'Post format slug' ), 5088 ); 5089 $slugs = array_map( 'sanitize_title_with_dashes', $slugs ); 5090 return $slugs; 5076 $slugs = array_keys( get_post_format_strings() ); 5077 return array_combine( $slugs, $slugs ); 5091 5078 } 5092 5079 5093 5080 /** … … 5152 5139 function _post_format_request( $qvs ) { 5153 5140 if ( ! isset( $qvs['post_format'] ) ) 5154 5141 return $qvs; 5155 $slugs = array_flip( get_post_format_slugs());5142 $slugs = get_post_format_slugs(); 5156 5143 if ( isset( $slugs[ $qvs['post_format'] ] ) ) 5157 5144 $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; 5158 5145 $tax = get_taxonomy( 'post_format' ); … … 5171 5158 global $wp_rewrite; 5172 5159 if ( 'post_format' != $taxonomy ) 5173 5160 return $link; 5174 $slugs = get_post_format_slugs();5175 5161 if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { 5176 return str_replace( "/{$term->slug}", '/' . $slugs[ str_replace( 'post-format-', '', $term->slug ) ], $link );5162 return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); 5177 5163 } else { 5178 5164 $link = remove_query_arg( 'post_format', $link ); 5179 5165 return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link );