WordPress.org

Make WordPress Core

Ticket #20352: 20352.diff

File 20352.diff, 1.7 KB (added by scribu, 2 years ago)
  • wp-includes/compat.php

    diff --git wp-includes/compat.php wp-includes/compat.php
    index cb2a559..9d01933 100644
    if ( !function_exists('json_decode') ) { 
    9494                return is_array($data) ? array_map(__FUNCTION__, $data) : $data; 
    9595        } 
    9696} 
     97 
     98if ( !function_exists( 'str_getcsv' ) ) { 
     99        function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) { 
     100                $fp = fopen( 'php://temp/', 'r+' ); 
     101                fputs( $fp, $input ); 
     102                rewind( $fp ); 
     103                $data = fgetcsv( $fp, strlen( $input ), $delimiter, $enclosure ); 
     104                fclose( $fp ); 
     105                return $data; 
     106        } 
     107} 
     108 
  • wp-includes/functions.php

    diff --git wp-includes/functions.php wp-includes/functions.php
    index 726eebb..dbc0d1f 100644
    function get_file_data( $file, $default_headers, $context = '' ) { 
    33993399} 
    34003400 
    34013401/** 
    3402  * Used internally to tidy up the search terms. 
    3403  * 
    3404  * @access private 
    3405  * @since 2.9.0 
    3406  * 
    3407  * @param string $t 
    3408  * @return string 
    3409  */ 
    3410 function _search_terms_tidy($t) { 
    3411         return trim($t, "\"'\n\r "); 
    3412 } 
    3413  
    3414 /** 
    34153402 * Returns true. 
    34163403 * 
    34173404 * Useful for returning true to filters easily. 
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index 303a395..78ba230 100644
    class WP_Query { 
    21802180                        if ( !empty($q['sentence']) ) { 
    21812181                                $q['search_terms'] = array($q['s']); 
    21822182                        } else { 
    2183                                 preg_match_all('/".*?("|$)|((?<=[\r\n\t ",+])|^)[^\r\n\t ",+]+/', $q['s'], $matches); 
    2184                                 $q['search_terms'] = array_map('_search_terms_tidy', $matches[0]); 
     2183                                $q['search_terms'] = array_filter( str_getcsv( $q['s'], ' ' ) ); 
    21852184                        } 
    21862185                        $n = !empty($q['exact']) ? '' : '%'; 
    21872186                        $searchand = '';