Ticket #21296: 21296.patch
File 21296.patch, 2.3 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
function wp_ajax_find_posts() { 1440 1440 wp_die(); 1441 1441 1442 1442 if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) 1443 $what = $_POST['post_type']; 1443 $what = sprintf("post_type = '%s'", $_POST['post_type']); 1444 elseif ($_POST['post_type'] == 'any') 1445 $what = '1=1'; 1444 1446 else 1445 $what = 'post';1447 $what = "post_type = 'post'"; 1446 1448 1447 1449 $s = stripslashes($_POST['ps']); 1448 1450 preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); … … function wp_ajax_find_posts() { 1458 1460 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1459 1461 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1460 1462 1461 $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what'AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" );1463 $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE $what AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" ); 1462 1464 1463 1465 if ( ! $posts ) { 1464 1466 $posttype = get_post_type_object($what); … … function wp_ajax_find_posts() { 1498 1500 1499 1501 $x = new WP_Ajax_Response(); 1500 1502 $x->add( array( 1501 'what' => $ what,1503 'what' => $_POST['post_type'], 1502 1504 'data' => $html 1503 1505 )); 1504 1506 $x->send(); -
wp-admin/includes/template.php
function find_posts_div($found_action = 1313 1313 <input type="text" id="find-posts-input" name="ps" value="" /> 1314 1314 <input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> 1315 1315 1316 <input type="radio" name="find-posts-what" id="find-posts-any" value="any" /> 1317 <label for="find-posts-any"><?php _e( 'Any' ); ?></label> 1316 1318 <?php 1317 1319 $post_types = get_post_types( array('public' => true), 'objects' ); 1318 1320 foreach ( $post_types as $post ) {