From f59a7f76a19c6321450c3bb3689a76d972f0aab7 Mon Sep 17 00:00:00 2001 From: atif11 Date: Tue, 12 Sep 2023 21:25:52 +0100 Subject: [PATCH] cloud api token check --- php/cloud/class-cloud-api.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/php/cloud/class-cloud-api.php b/php/cloud/class-cloud-api.php index 8d9bf1e6..f2e9c979 100644 --- a/php/cloud/class-cloud-api.php +++ b/php/cloud/class-cloud-api.php @@ -66,7 +66,7 @@ public function get_local_to_cloud_map() { // Fetch data from the stored transient, if available. $stored_data = get_transient( self::CLOUD_MAP_TRANSIENT_KEY ); - if ( $stored_data && is_array( $stored_data ) ) { + if ( $stored_data ) { $this->local_to_cloud_map = $stored_data; return $stored_data; } @@ -81,6 +81,12 @@ public function get_local_to_cloud_map() { continue; } + // If the snippet is a token snippet skip it. + $has_valid_cloud_id = boolval( strpos( $local_snippet->cloud_id, '_' ) ); + if ( ! $has_valid_cloud_id ) { + continue; + } + $link = new Cloud_Link(); $cloud_id = explode( '_', $local_snippet->cloud_id ); $cloud_id_int = (int) $cloud_id[0] ?? '';