From 88f586ff11c8cd278583d9396fbbb431ccdcb31a Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 21 Oct 2019 15:43:30 +0300 Subject: [PATCH] - fixed members search engine; - fixed get_template function for specific settings at Windows servers; --- includes/class-functions.php | 7 ++----- includes/core/class-member-directory.php | 14 +++----------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/includes/class-functions.php b/includes/class-functions.php index 1b3d4b5c..441c2ff2 100644 --- a/includes/class-functions.php +++ b/includes/class-functions.php @@ -178,11 +178,8 @@ if ( ! class_exists( 'UM_Functions' ) ) { $path = ''; if ( $basename ) { - $array = explode( DIRECTORY_SEPARATOR, trim( $basename, DIRECTORY_SEPARATOR ) ); - $path = $array[0]; - } - if ( substr_count( $path, '/' ) ) { - $array = explode( '/', trim( $basename, '/' ) ); + // use '/' instead of "DIRECTORY_SEPARATOR", because wp_normalize_path makes the correct replace + $array = explode( '/', wp_normalize_path( trim( $basename ) ) ); $path = $array[0]; } diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index bdd92c54..0b9e4d44 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -1182,19 +1182,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $search = trim( $_POST['search'] ); if ( ! empty( $search ) ) { - $identity = '%'; - preg_match( - '/LIKE \'(\{(.*)\})' . esc_attr( $search ) . '(\{(.*)\})\'/im', - $sql['where'], - $matches - ); - - if ( ! empty( $matches[1] ) ) { - $identity = $matches[1]; - } + $meta_value = '%' . $wpdb->esc_like( $search ) . '%'; + $search_meta = $wpdb->prepare( '%s', $meta_value ); preg_match( - '/^(.*).meta_value LIKE \'' . $identity . esc_attr( $search ) . $identity . '\' [^\)]/im', + '/^(.*).meta_value LIKE ' . addslashes( $search_meta ) . '[^\)]/im', $sql['where'], $join_matches );