'slug' => true,
);
$query_args =
array_intersect_key( $request->
get_params(),
$valid_query_args );
$query_args['locale'
] =
get_user_locale();
$query_args['wp-version'
] =
$wp_version; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- it's defined in `version.php` above.
$query_args['pattern-categories'
] =
isset( $request['category'
] ) ?
$request['category'
] : false;
$query_args['pattern-keywords'
] =
isset( $request['keyword'
] ) ?
$request['keyword'
] : false;
$query_args =
array_filter( $query_args );
$transient_key =
$this->
get_transient_key( $query_args );
/*
* Use network-wide transient to improve performance. The locale is the only site
* configuration that affects the response, and it's included in the transient key.
*/
$raw_patterns =
get_site_transient( $transient_key );
if ( !
$raw_patterns ) { $api_url = 'http://api.wordpress.org/patterns/1.0/?' .
build_query( $query_args );
if ( wp_http_supports( array
( 'ssl'
) ) ) { $api_url =
set_url_scheme( $api_url, 'https'
);
}