Ticket #12750: 12750.2.diff
| File 12750.2.diff, 2.4 KB (added by , 16 years ago) |
|---|
-
wp-includes/post.php
1559 1559 * @since 2.5.0 1560 1560 * 1561 1561 * @param string|array $mime_types List of mime types or comma separated string of mime types. 1562 * @param string $table_alias Optional. Specify a table alias, if needed. 1562 1563 * @return string The SQL AND clause for mime searching. 1563 1564 */ 1564 function wp_post_mime_type_where($post_mime_types ) {1565 function wp_post_mime_type_where($post_mime_types, $table_alias = '') { 1565 1566 $where = ''; 1566 1567 $wildcards = array('', '%', '%/%'); 1567 1568 if ( is_string($post_mime_types) ) … … 1589 1590 return ''; 1590 1591 1591 1592 if ( false !== strpos($mime_pattern, '%') ) 1592 $wheres[] = "post_mime_type LIKE '$mime_pattern'";1593 $wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; 1593 1594 else 1594 $wheres[] = "post_mime_type = '$mime_pattern'";1595 $wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; 1595 1596 } 1596 1597 if ( !empty($wheres) ) 1597 1598 $where = ' AND (' . join(' OR ', $wheres) . ') '; -
wp-includes/query.php
2027 2027 $post_ids = get_objects_in_term($term_ids, $taxonomy); 2028 2028 if ( !is_wp_error($post_ids) && !empty($post_ids) ) { 2029 2029 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 2030 if ( '' === $post_type) {2030 if ( empty($post_type) ) { 2031 2031 $post_type = 'any'; 2032 2032 $post_status_join = true; 2033 2033 } elseif ( in_array('attachment', (array)$post_type) ) { 2034 2034 $post_status_join = true; 2035 2035 } 2036 $q['post_status'] = 'publish'; 2036 if ( empty($q['post_status']) ) 2037 $q['post_status'] = 'publish'; 2037 2038 } else { 2038 2039 $whichcat = " AND 0 "; 2039 2040 } … … 2084 2085 2085 2086 // MIME-Type stuff for attachment browsing 2086 2087 2087 if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) 2088 $whichmimetype = wp_post_mime_type_where($q['post_mime_type']); 2088 if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) { 2089 $table_alias = $post_status_join ? $wpdb->posts : ''; 2090 $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias); 2091 } 2089 2092 2090 2093 $where .= $search . $whichcat . $whichauthor . $whichmimetype; 2091 2094
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)