WordPress.org

Make WordPress Core

Changeset 12052


Ignore:
Timestamp:
10/18/2009 11:50:59 AM (9 years ago)
Author:
westi
Message:

Remove duplicated create_function calls an use a private _search_terms_tidy function instead for tidying up the post/page searching when looking to attach orphans to a parent post or page.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r12036 r12052  
    11981198    $s = stripslashes($_POST['ps']);
    11991199    preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
    1200     $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
     1200    $search_terms = array_map('_search_terms_tidy', $matches[0]);
    12011201
    12021202    $searchand = $search = '';
  • trunk/wp-includes/functions.php

    r12044 r12052  
    34803480    return $file_data;
    34813481}
     3482/*
     3483 * Used internally to tidy up the search terms
     3484 *
     3485 * @private
     3486 * @since 2.9.0
     3487 */
     3488function _search_terms_tidy($t) {
     3489    return trim($t, "\"\'\n\r ");
     3490}
    34823491?>
  • trunk/wp-includes/query.php

    r11998 r12052  
    17481748            } else {
    17491749                preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches);
    1750                 $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
     1750                $q['search_terms'] = array_map('_search_terms_tidy', $matches[0]);
    17511751            }
    17521752            $n = !empty($q['exact']) ? '' : '%';
Note: See TracChangeset for help on using the changeset viewer.