Skip to content

Commit

Permalink
Merge pull request #127 from xylusthemes/aioec_ical_support
Browse files Browse the repository at this point in the history
added AIOEC iCal separate support
  • Loading branch information
Rajat1192 authored Aug 28, 2023
2 parents 96cc65f + c17042d commit ff93255
Show file tree
Hide file tree
Showing 5 changed files with 699 additions and 8 deletions.
2 changes: 2 additions & 0 deletions import-facebook-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static function instance() {
self::$instance->admin = new Import_Facebook_Events_Admin();

self::$instance->ical_parser = new Import_Facebook_Events_Ical_Parser();
self::$instance->ical_parser_aioec = new Import_Facebook_Events_Ical_Parser_AIOEC();
self::$instance->ical = new Import_Facebook_Events_Ical();
if ( ife_is_pro() ) {
self::$instance->manage_import = new Import_Facebook_Events_Pro_Manage_Import();
Expand Down Expand Up @@ -182,6 +183,7 @@ private function includes() {
require_once IFE_PLUGIN_DIR . 'includes/lib/icalcreator/autoload.php';
}
require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser.php';
require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser_aioec.php';
require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical.php';
require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-cpt.php';
require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-facebook.php';
Expand Down
16 changes: 16 additions & 0 deletions includes/class-import-facebook-events-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,22 @@ function ife_is_pro() {
return false;
}

/**
* Check is pro active or not.
*
* @since 1.5.0
* @return boolean
*/
function ife_aioec_active() {
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if ( is_plugin_active( 'all-in-one-event-calendar/all-in-one-event-calendar.php' ) ) {
return true;
}
return false;
}


/**
* Template Functions
Expand Down
10 changes: 8 additions & 2 deletions includes/class-import-facebook-events-ical.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ public function import_events_from_ics_content( $event_data = array(), $ics_cont
return array();
}

$imported_events = $ife_events->ical_parser->parse_import_events( $event_data, $ics_content );
return $imported_events;
if( ife_aioec_active() && post_type_exists( 'ai1ec_event' ) ){
$imported_events = $ife_events->ical_parser_aioec->parse_import_events( $event_data, $ics_content );
return $imported_events;
}else{
$imported_events = $ife_events->ical_parser->parse_import_events( $event_data, $ics_content );
return $imported_events;
}

}

/**
Expand Down
Loading

0 comments on commit ff93255

Please sign in to comment.