* Plugin Name: GLM Members Database Events
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.6.11
+ * Version: 1.6.12
* Author: Chuck Scott
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseEventsAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.6.11
+ * @version 1.6.12
*/
/*
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.11');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.12');
define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.1');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
$feed_id
)
);
+ if ( $debug ) {
+ $out .= '<pre>$feed_url: ' . print_r( $feed_url, true ) . '</pre>';
+ }
// Set new updated date for feed
$this->wpdb->update(
GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'feed_import',
}
if ( $events ) {
foreach ( $events as $event ) {
+ if ( $debug ) {
+ $out .= '<pre>$event: ' . print_r( $event, true ) . '</pre>';
+ }
$contact = array();
$image = '';
$event['DESCRIPTION']
= str_replace( '\n', "<br>", $event['DESCRIPTION'] );
$intro = substr( strip_tags( $event['DESCRIPTION'] ), 0 ,150);
if ( isset( $event['CONTACT'] ) ) {
- $contact_data = explode( ',', str_replace( '\\', '', $event['CONTACT'] ) );
+ // Remove the backslashes
+ $eventContact = str_replace( '\\', '', $event['CONTACT'] );
if ( $debug ) {
- //$out .= '<pre>$contact_data: ' . print_r( $contact_data, true ) . '</pre>';
+ $out .= '<pre>$eventContact: ' . print_r( $eventContact, true ) . '</pre>';
+ }
+
+ // Check if the event CONTACT has semi colons in it.
+ // If it does then the CONTACT string hold the contact email phone and name.
+ if ( strpos( $eventContact, ';' ) !== false ) {
+ $contact_data = explode( ';', $eventContact );
+ if ( $debug ) {
+ $out .= '<pre>' . __LINE__ . '$contact_data: ' . print_r( $contact_data, true ) . '</pre>';
+ }
+ $contact = array(
+ 'email' => $contact_data[0],
+ 'phone' => $contact_data[2],
+ 'name' => $contact_data[3],
+ );
+ } else {
+ $contact_data = explode( ',', $eventContact );
+ if ( $debug ) {
+ $out .= '<pre>$contact_data: ' . print_r( $contact_data, true ) . '</pre>';
+ }
+ $contact = array(
+ 'name' => $contact_data[0],
+ 'email' => $contact_data[1],
+ 'phone' => $contact_data[2],
+ );
}
- $contact = array(
- 'name' => $contact_data[0],
- 'email' => $contact_data[1],
- 'phone' => $contact_data[2],
- );
} else {
$contact = array(
'name' => '',
'contact_phone' => $contact['phone'],
);
if ( $debug ) {
- //$out .= '<pre>$event_data: ' . print_r( $event_data, true ) . '</pre>';
+ $out .= '<pre>$event_data: ' . print_r( $event_data, true ) . '</pre>';
}
$event_data_format = array(
'%d',
'%s',
'%s',
);
- if ( $event_id ) {
- $this->wpdb->update(
- GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
- $event_data,
- array( 'id' => $event_id ),
- $event_data_format,
- '%d'
- );
+ if ( !$debug ) {
+ if ( $event_id ) {
+ $this->wpdb->update(
+ GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
+ $event_data,
+ array( 'id' => $event_id ),
+ $event_data_format,
+ '%d'
+ );
+ } else {
+ $this->wpdb->insert(
+ GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
+ $event_data,
+ $event_data_format
+ );
+ $event_id = $this->wpdb->insert_id;
+ }
} else {
- $this->wpdb->insert(
- GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
- $event_data,
- $event_data_format
- );
- $event_id = $this->wpdb->insert_id;
+ continue;
}
if ( !$event_id ) {
continue;
}
}
}
+ if ( isset( $event['RDATE'] ) && preg_match( '%VALUE=DATE:(.*)%', $event['RDATE'], $matches ) ) {
+ $rDates = explode( ',', $matches[1] );
+ foreach ( $rDates as $key => &$rDate ) {
+ if ( preg_match( '%([0-9]{4})([0-9]{2})([0-9]{2})%', $rDate, $rDateMatches ) ) {
+ $rDate = $rDateMatches[1].'-'.$rDateMatches[2].'-'.$rDateMatches[3];
+ }
+ }
+ $serialized_times = serialize($rDates);
+ $recurring_event = 1;
+ $month_of_year = 0;
+ $week_of_month = 0;
+ }
if ( $btime === $etime ) {
if ( $btime === '00:00' ) {
$all_day = true;