From 902b860fd42685c10a7923415023dca1a586a393 Mon Sep 17 00:00:00 2001 From: Leo Germani Date: Tue, 28 May 2019 11:45:08 -0300 Subject: [PATCH] Fix exposers to new API response --- src/exposers/class-tainacan-csv.php | 1 + src/exposers/class-tainacan-html.php | 1 + src/oaipmh-expose/class-tainacan-oaipmh-list-records.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/exposers/class-tainacan-csv.php b/src/exposers/class-tainacan-csv.php index ae78d82e9..0bcafbc70 100644 --- a/src/exposers/class-tainacan-csv.php +++ b/src/exposers/class-tainacan-csv.php @@ -27,6 +27,7 @@ class Csv extends Exposer { ); $items = $response->get_data(); + $items = is_array($items) && isset($items['items']) ? $items['items'] : []; if (sizeof($items) > 0) { diff --git a/src/exposers/class-tainacan-html.php b/src/exposers/class-tainacan-html.php index cbbc7d452..cc6762478 100644 --- a/src/exposers/class-tainacan-html.php +++ b/src/exposers/class-tainacan-html.php @@ -27,6 +27,7 @@ class Html extends Exposer { $response->set_headers( ['Content-Type: text/html; charset=' . get_option( 'blog_charset' )] ); $items = $response->get_data(); + $items = is_array($items) && isset($items['items']) ? $items['items'] : []; $html = ' diff --git a/src/oaipmh-expose/class-tainacan-oaipmh-list-records.php b/src/oaipmh-expose/class-tainacan-oaipmh-list-records.php index ac021e86f..e3b62a03e 100644 --- a/src/oaipmh-expose/class-tainacan-oaipmh-list-records.php +++ b/src/oaipmh-expose/class-tainacan-oaipmh-list-records.php @@ -181,7 +181,7 @@ class OAIPMH_List_Records extends OAIPMH_Expose { foreach ($maps as $key => $val) { if( $val && is_object($val) ) - $this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value())); + $this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value_as_string())); else $this->xml_creater->addChild($this->working_node, $key, ''); }