Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #46 from pantheon-systems/release-0.2.9
Browse files Browse the repository at this point in the history
Release 0.2.9
  • Loading branch information
John Spellman committed Mar 2, 2022
2 parents 6d7db85 + 579f5a5 commit 5431e9c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pantheon WordPress Edge Integrations

[![Unsupported](https://img.shields.io/badge/pantheon-unsupported-yellow?logo=pantheon&color=FFDC28&style=for-the-badge)](https://github.com/topics/unsupported?q=org%3Apantheon-systems "Unsupported, e.g. a tool we are actively using internally and are making available, but do not promise to support") ![Pantheon WordPress Edge Integrations](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/actions/workflows/test.yml/badge.svg)
[![Unsupported](https://img.shields.io/badge/pantheon-unsupported-yellow?logo=pantheon&color=FFDC28)](https://github.com/topics/unsupported?q=org%3Apantheon-systems "Unsupported, e.g. a tool we are actively using internally and are making available, but do not promise to support") ![Pantheon WordPress Edge Integrations](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/actions/workflows/test.yml/badge.svg) [![GitHub release](https://img.shields.io/github/release/pantheon-systems/pantheon-wordpress-edge-integrations.svg)](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/releases/)

WordPress plugin to support Pantheon Edge Integrations and personalization features

Expand Down
6 changes: 5 additions & 1 deletion inc/geo.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ function get_geo( string $data_type = '', $data = null, string $header = 'Audien
* @param array The full, parsed Audience geo data as an array.
*/
$parsed_geo = apply_filters( 'pantheon.ei.parsed_geo_data', EI\HeaderData::parse( $header, $data ) );

// If no geo data type was passed, return all Audience data.
if ( empty( $data_type ) ) {
return json_encode( $parsed_geo );
}

// If no data exists for the data type, return an empty string.
if ( ! isset( $parsed_geo[ $data_type ] ) ) {
return '';
}

// If 'latlon' was requested, return the latitude and longitude.
if ( $data_type === 'latlon' ) {
$parsed_geo['latlon'] = $parsed_geo['lat'] . ',' . $parsed_geo['lon'];
Expand Down
2 changes: 0 additions & 2 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ function bootstrap() {

// Load the Interest namespace.
Interest\bootstrap();

add_action( 'init', __NAMESPACE__ . '\\set_interest_header' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pantheon-wordpress-edge-integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: WordPress plugin to support Pantheon Edge Integrations and personalization features.
* Author: Pantheon
* Author URI: https://pantheon.io
* Version: 0.2.8
* Version: 0.2.9
*
* @package Pantheon/EdgeIntegrations
*/
Expand Down
17 changes: 17 additions & 0 deletions tests/geoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,21 @@ public function testGetGeoFilter() {
'Filtered geo data does not match'
);
}

/**
* Test that we dn't get an undefined array key error when calling a geo value that doesn't exist.
*/
public function testUndefinedArrayKey() {
// Reset the geo data to nothing.
add_filter( 'pantheon.ei.parsed_geo_data', function() {
return [];
}, 10 );

$this->assertEmpty( Geo\get_geo( 'country' ) );

// Reset the geo back to something resembling real data.
add_filter( 'pantheon.ei.parsed_geo_data', function() {
return EI\HeaderData::parse( 'Audience-Set', $this->mockAudienceData()[0]['US'] );
}, 10 );
}
}
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '920c315778adb1298d1b9476acf78164e5f2b18d',
'reference' => 'c03d3b5b486e9597b5aa767b524ddf8cc5b0bb5e',
'name' => 'pantheon-systems/pantheon-wordpress-edge-integrations',
'dev' => false,
),
Expand All @@ -25,7 +25,7 @@
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '920c315778adb1298d1b9476acf78164e5f2b18d',
'reference' => 'c03d3b5b486e9597b5aa767b524ddf8cc5b0bb5e',
'dev_requirement' => false,
),
),
Expand Down

0 comments on commit 5431e9c

Please sign in to comment.