From 5d73f09fbf6c98030ee99f86dc11d33519a4dafc Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 25 Apr 2017 14:36:45 -0400 Subject: [PATCH] Working on the ical feed import Working on getting the address fixed. Working on the categories. --- models/admin/management/events.php | 5 +++++ models/front/events/icalFeedImport.php | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/models/admin/management/events.php b/models/admin/management/events.php index b9231d6..f069f3f 100644 --- a/models/admin/management/events.php +++ b/models/admin/management/events.php @@ -210,6 +210,8 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement break; case 'icalfeed': + //echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; + //exit; if ( isset( $_REQUEST['option2'] ) ) { $option2 = filter_var( $_REQUEST['option2'], FILTER_SANITIZE_STRING ); } @@ -248,8 +250,11 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement if ( !wp_next_scheduled( GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT, $feed_id ) ) { wp_schedule_event( time(), GLM_MEMBERS_EVENTS_PLUGIN_CRON_RECURRANCE, GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT, array( $feed_id ) ); } + } else { + $icalFeedResult = 'Not a valid url'; } + $event_settings = $this->editEntry(1); break; case 'eventImagesImport': diff --git a/models/front/events/icalFeedImport.php b/models/front/events/icalFeedImport.php index 70e064d..45b2554 100644 --- a/models/front/events/icalFeedImport.php +++ b/models/front/events/icalFeedImport.php @@ -287,11 +287,13 @@ class GlmMembersFront_events_icalFeedImport // Location Data if ( isset( $event['LOCATION'] ) ) { $location_data = explode( ',', str_replace( '\\', '', $event['LOCATION'] ) ); - $place = ( isset( $location_data[0] ) ? $location_data[0]: ''); - $address = ( isset( $location_data[1] ) ? $location_data[1]: ''); - $city = ( isset( $location_data[2] ) ? $location_data[2]: ''); - $state = ( isset( $location_data[3] ) ? $location_data[3]: ''); - $zip = ( isset( $location_data[4] ) ? $location_data[4]: ''); + // Place will be before the first dash + $placeParts = explode( ' - ', $location_data[0] ); + $place = ( isset( $placeParts[0] ) ? $placeParts[0]: ''); + $address = ( isset( $placeParts[1] ) ? $placeParts[1]: ''); + $city = ( isset( $location_data[1] ) ? $location_data[1]: ''); + $state = ( isset( $location_data[2] ) ? $location_data[2]: ''); + $zip = ( isset( $location_data[3] ) ? $location_data[3]: ''); $location = array( 'event' => $event_id, 'name' => $place, -- 2.17.1