芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/public_html/wp-content/plugins/envato-elements/inc/api/class-photos-search.php
get_params(); // Elements API maxes out around page 50, so lets not even attempt to query pages beyond that number: $max_pages = 49; $api_parameters = [ 'type' => 'photos', 'page' => empty( $search['page'] ) || (int) $search['page'] < 1 || (int) $search['page'] > $max_pages ? 1 : (int) $search['page'], ]; // 'our_query' => 'elements_query' $parameter_mapping = [ 'text' => 'search_terms', 'orientation' => 'orientation', 'background' => 'background', 'colors' => 'colors', 'tag' => 'tags', ]; foreach ( $parameter_mapping as $our_query_key => $elements_query_key ){ if ( ! empty( $search[ $our_query_key ] ) && strlen( trim( $search[ $our_query_key ] ) ) > 0 ) { $api_parameters[ $elements_query_key ] = sanitize_text_field( trim( $search[ $our_query_key ] ) ); } } $data = Extensions_API::get_instance()->api_call( '/extensions/search?' . http_build_query( $api_parameters ) ); if ( is_wp_error( $data ) ) { return $this->format_error( 'fetchPhotosSearchResults', 'generic_api_error', 'Failed to fetch photo search results: ' . $data->get_error_message() ); } return new \WP_REST_Response( $data, 200 ); } public function register_api_endpoints() { $this->register_endpoint( 'fetchPhotosSearchResults', [ $this, 'fetch_photos_search_results' ] ); } }