1
0
Fork 0
forked from lino/radar-wp

WIP suggested fields, additional theming, cron, shortcodes.

This commit is contained in:
ekes 2019-04-29 20:07:19 +02:00
parent 98872a46bc
commit a6f657092d
5 changed files with 284 additions and 115 deletions

View file

@ -45,7 +45,8 @@ class Squat_Radar_Connector {
$query[] = ['facets[' . urlencode($key) . '][]' => urlencode($value)];
}
if ( ! empty($fields) ) {
$query['fields'] = urlencode(implode(',', $fields));
// {raw}urlencode is encoding : and , both of which are valid pchar.
$query['fields'] = preg_replace('/[^a-z_:,]/', '', implode(',', $fields));
}
if ( ! empty($language) ) {
$query['language'] = urlencode($language);
@ -57,7 +58,7 @@ class Squat_Radar_Connector {
}
function events( $facets, $fields = [], $language = NULL, $limit = 10, $expiration = 10800, $reset = FALSE ) {
$fields = array_merge($fields, ['uuid', 'url']);
$fields = array_merge($fields, ['uuid', 'title', 'url', 'event_status']);
$transient_key = 'squat_radar_events_' . sha1(implode($facets) . implode($fields) . $language . $limit);
if (! $reset && $data = get_transient( $transient_key )) {
return $data;