diff --git a/includes/squat-radar-connector.php b/includes/squat-radar-connector.php index 8268f35..50479d6 100644 --- a/includes/squat-radar-connector.php +++ b/includes/squat-radar-connector.php @@ -59,7 +59,7 @@ class Squat_Radar_Connector { $result = []; // Urldecode not required here because of the regex match. // Radar paramaters here are transcoded so will match. - if (preg_match('|//radar.squat.net/([a-z]{2})/events/([a-zA-Z0-9/]*)|', $url, $matches)) { + if (preg_match('|//radar.squat.net/([a-z]{2})/events/([a-zA-Z0-9\-/]*)|', $url, $matches)) { $result['language'] = $matches[1]; foreach (array_chunk(explode('/', $matches[2]), 2) as $key_value_pair) { $result['facets'][$key_value_pair[0]] = $key_value_pair[1]; @@ -90,7 +90,7 @@ class Squat_Radar_Connector { // Urlencode should do nothing here @see comment in decode_search_url. // If someone has snuck something in it will however help. foreach ( $facets as $key => $value ) { - $query[] = ['facets[' . urlencode($key) . '][]' => urlencode($value)]; + $query['facets[' . urlencode($key) . ']'][] = urlencode($value); } if ( ! empty($fields) ) { // {raw}urlencode is encoding : and , both of which are valid pchar. diff --git a/includes/squat-radar-formatter.php b/includes/squat-radar-formatter.php index 717d849..8481f49 100644 --- a/includes/squat-radar-formatter.php +++ b/includes/squat-radar-formatter.php @@ -339,12 +339,12 @@ class Squat_Radar_Formatter { static public function field_summary_html($value, $original, $field, $context) { if ( $field[0] == 'summary' ) { // Summary is only populated if there is an explict summary. - if ( empty( trim($value) ) ) { + $value = trim($value); + if ( empty( $value ) ) { array_shift($field); if (is_array($field)) { $field_tree = array_reverse($field); $sibling_fields = self::getValue($context['event'], $field_tree); - $value = print_r($context['event'], true); if (! empty( $sibling_fields['value'] ) ) { $value = wp_trim_words( $sibling_fields['value'], 30 ); } @@ -366,7 +366,10 @@ class Squat_Radar_Formatter { * image:file:url */ static public function field_image_html($value, $original, $field, $context) { - if ($field[0] == 'url' && $field[1] == 'file' && $field[2] == 'image') { + if ( isset($field[0]) && $field[0] == 'url' && + isset($field[1]) && $field[1] == 'file' && + isset($field[2]) && $field[2] == 'image' + ) { return ''; } diff --git a/includes/squat-radar-widget.php b/includes/squat-radar-widget.php index 2aacb5a..c058824 100644 --- a/includes/squat-radar-widget.php +++ b/includes/squat-radar-widget.php @@ -40,7 +40,7 @@ class Squat_Radar_Widget extends WP_Widget { * Enqueue scripts callback, add CSS. */ static public function widget_style() { - wp_register_style( 'squat-radar-widget', SQUAT_RADAR_URL . '/assets/squat-radar.css' ); + wp_register_style( 'squat-radar-widget', SQUAT_RADAR_URL . 'assets/squat-radar.css' ); wp_enqueue_style( 'squat-radar-widget' ); } @@ -48,7 +48,7 @@ class Squat_Radar_Widget extends WP_Widget { * Enqueue scripts callback, add JS. */ static public function widget_script() { - wp_register_script( 'squat-radar-widget', SQUAT_RADAR_URL . '/assets/squat-radar.js', ['jquery'] ); + wp_register_script( 'squat-radar-widget', SQUAT_RADAR_URL . 'assets/squat-radar.js', ['jquery'] ); } /** @@ -121,7 +121,7 @@ class Squat_Radar_Widget extends WP_Widget { else { wp_enqueue_script( 'squat-radar-widget'); wp_localize_script( 'squat-radar-widget', 'squat_radar_widget', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] ); - wp_localize_script( 'squat-radar-widget', $widget_id, $instance ); + wp_localize_script( 'squat-radar-widget', $widget_id, ['number' => $this->number] ); echo '