Changeset 10117 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-query-plugins.php
- Timestamp:
- 08/05/2020 01:49:48 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-query-plugins.php
r10115 r10117 66 66 } 67 67 68 // Temporary hacky block search69 $block_search = trim( strtolower( $request->get_param( 'block' ) ));68 // Block Directory searches 69 $block_search = $request->get_param( 'block' ); 70 70 if ( $block_search ) { 71 $meta_query = array( 72 'relation' => 'AND', 73 array( 74 'key' => 'block_files', 75 'compare' => 'EXISTS', 76 ), 77 array( 78 'relation' => 'OR', 79 array( 80 'key' => 'block_name', 81 'value' => '^' . preg_quote( $block_search ), 82 'compare' => 'RLIKE', 83 ), 84 array( 85 'key' => 'block_name', 86 'value' => '/' . $block_search, // search following the slash 87 'compare' => 'LIKE', 88 ), 89 array( 90 'key' => 'block_title', 91 'value' => $block_search, // search in title 92 'compare' => 'LIKE', 93 ), 94 array( 95 'key' => 'header_name', 96 'value' => $block_search, // search in plugin title 97 'compare' => 'LIKE', 98 ), 99 ) 100 ); 101 102 // Limit the search to the Block section 103 $query[ 'meta_query' ] = $meta_query; 104 $query[ 'tax_query' ] = array( 105 array( 106 'taxonomy' => 'plugin_section', 107 'field' => 'slug', 108 'terms' => 'block', 109 ) 110 ); 71 $query['s'] = $block_search; 72 $query['block_search'] = true; 111 73 } 112 74
Note: See TracChangeset
for help on using the changeset viewer.