mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
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.
git-svn-id: http://svn.automattic.com/wordpress/trunk@12052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9783a2415a
commit
04638ecd6f
@ -1197,7 +1197,7 @@ case 'find_posts':
|
||||
$what = isset($_POST['pages']) ? 'page' : 'post';
|
||||
$s = stripslashes($_POST['ps']);
|
||||
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
|
||||
$search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
|
||||
$search_terms = array_map('_search_terms_tidy', $matches[0]);
|
||||
|
||||
$searchand = $search = '';
|
||||
foreach( (array) $search_terms as $term) {
|
||||
|
@ -3479,4 +3479,13 @@ function get_file_data( $file, $default_headers, $context = '' ) {
|
||||
|
||||
return $file_data;
|
||||
}
|
||||
/*
|
||||
* Used internally to tidy up the search terms
|
||||
*
|
||||
* @private
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function _search_terms_tidy($t) {
|
||||
return trim($t, "\"\'\n\r ");
|
||||
}
|
||||
?>
|
@ -1747,7 +1747,7 @@ class WP_Query {
|
||||
$q['search_terms'] = array($q['s']);
|
||||
} else {
|
||||
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches);
|
||||
$q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
|
||||
$q['search_terms'] = array_map('_search_terms_tidy', $matches[0]);
|
||||
}
|
||||
$n = !empty($q['exact']) ? '' : '%';
|
||||
$searchand = '';
|
||||
|
Loading…
Reference in New Issue
Block a user