­

ID,'map_width',true);$map_height=get_post_meta($mapid,'map_height',true);$centter_lat=get_post_meta($mapid,'initial_map_latitude',true);$center_long=get_post_meta($mapid,'initial_map_longtitude',true);$kmlfileID=get_post_meta($mapid,'KML File',true);$kmlfile=wp_get_attachment_url($kmlfileID); // prints the widget//extract($args, EXTR_SKIP);$width = empty($map_width) ? '100%' : apply_filters('widget_width', $map_width);$heigh = empty($map_height) ? '425' : $map_height;$zoom=get_post_meta($mapid,'intitial_zoom_level',true);$zoom=$zoom?$zoom:10;?>

'; $plink =get_permalink($postID); $cats=get_the_terms( $postID,'place_category'); if(!empty($cats)){ foreach($cats as $term){ if($cat_options[$term->term_id]){ $image = $cat_options[$term->term_id]; break; } } } if (!$image) { $image = PLUGIN_URL . '/javascript/icons/pin.png'; } $retstr = ''; if ($user_meta_data && in_array($postID, $user_meta_data)) { $retstr .= '
' . REMOVE_FAVOURITE_TEXT . ''; } else { $retstr .= '
' . ADD_FAVOURITE_TEXT . ''; } if ($lat && $lon && trim($row->post_title)) { $marker = array( 'favorites' => $retstr, 'name' => $row->post_title, 'lat' => $lat, 'lon' => $lon, 'contact' => $contact, 'address' => $address, 'pimage' => $pimg, 'plink' => $plink, 'icons' => $image, 'ID' => $postID); $array_places_values[]=$marker; } } } } $array_events_values=array(); if($event=='yes'){ global $ai1ec_registry; if(is_object($ai1ec_registry)){ $instance_id = false; $drag_drop_events=array(); $events=count($_SESSION['FavID']['event'])?array_unique($_SESSION['FavID']['event']):array(); $favlisting=array(); if($_SESSION['FavID']['event']) $favlisting = array_unique($_SESSION['FavID']['event']); $markers = array(); $fav_lists=''; $arr_list_events=array(); $arr_list_dates=array(); $content_events_data=array(); foreach($favlisting as $vid){ $event_item=array(); $check_event_exist= get_post($vid); if(!$check_event_exist) continue; $event=$ai1ec_registry->get( 'model.event', $vid, $instance_id); $row= $event->get('post'); $address=$event->get( 'address' ); $phone=$event->get( 'contact_phone' ); $website=$event->get( 'contact_url' ); $longitude = floatval( $event->get( 'longitude' ) ); $latitude = floatval( $event->get( 'latitude' ) ); $start=$event->get('start'); $date=''; if($start){ $date=date('Y-m-d',strtotime($start)); } if(!$longitude && !$latitude ){ $prepAddr = str_replace(' ','+',$address); $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false'); $output= json_decode($geocode); $latitude = $output->results[0]->geometry->location->lat; $longitude = $output->results[0]->geometry->location->lng; } $start=$event->get('start'); $extra_info=(trim($address)?$address.'
':'').(trim($phone)?$phone.'
':'').(trim($website)?'Event Website'.'
':''); $extra_info=esc_attr($extra_info); $image=PLUGIN_URL.'/images/markers/timely2.png'; $favorites=''; $favorites .= "$title"; $favorites .= "
$address"; $favorites .= "
$phone"; $type='event'; if(!empty($_SESSION['FavID'][$type]) && in_array($row->ID,$_SESSION['FavID'][$type])){ $showfav= 'Remove from Favoritesr'; }else{ $showfav=' Add to Favorites'; } //$favorites .="
".$showfav; $event_item=array( 'name'=>$row->post_title, 'start'=>date('m/d/Y',strtotime($date)), 'lat'=>$latitude, 'lon'=>$longitude, 'link'=>get_permalink($row->ID), 'address'=>$address, 'contact'=>$phone, 'icons'=>$image, 'favorites'=>$favorites ); $array_events_values[] = $event_item; } $chk_timely_venues= get_option('chk_timely_venues',array()); // print_R($chk_timely_venues); if(count($chk_timely_venues[$postMap->ID])){ foreach($chk_timely_venues[$postMap->ID] as $vid){ $term=get_term($vid,AI1ECV_TAXONOMY_NAME); $taxonomy = $ai1ec_registry->get( 'model.venue', $term ); $venue = $taxonomy->to_array(); $address=$venue['address']; $phone=$venue['phone']; $website=$venue['url']; $longitude = $venue['longitude']; $latitude = $venue['latitude']; $date=''; $settings = $ai1ec_registry->get( 'model.settings' ); $calendar_page_id = $settings->get( 'calendar_page_id' ); //$plink=get_permalink($calendar_page_id); //$plink=$plink.'tag_ids~'.$term->term_id.'/'; $plink=get_term_link($term->term_id,AI1ECV_TAXONOMY_NAME); $extra_info=(trim($address)?$address.'
':'').(trim($phone)?$phone.'
':'').(trim($website)?'Event Website'.'
':''); $extra_info=esc_attr($extra_info); $image=PLUGIN_URL.'/images/markers/timely3.png'; $favorites=''; $favorites .= "$title"; $favorites .= "
$address"; $favorites .= "
$phone"; $type='event'; if(!empty($_SESSION['FavID'][$type]) && in_array($row->ID,$_SESSION['FavID'][$type])){ $showfav= 'Remove from Trip Builder'; }else{ $showfav=' Add to Trip Builder'; } $event_item=array( 'name'=>$term->name, 'start'=>'no', 'lat'=>$latitude, 'lon'=>$longitude, 'plink'=>$plink, 'address'=>$address, 'contact'=>$phone, 'icons'=>$image, 'favorites'=>'' ); $array_events_values[] = $event_item; } } } } $config['admin_url']=admin_url('admin-ajax.php'); $config['postID']=$mapid; $config['center_lat']=$centter_lat; $config['center_lon']=$center_long; $cat_content_info= "'default':[".implode(',',$content_data)."]"; wp_localize_script( 'shortcode-map-planer', 'map_config', $config ); wp_localize_script( 'shortcode-map-planer', 'fav_events_marker', json_encode($array_events_values) ); wp_localize_script( 'shortcode-map-planer', 'fav_places_marker', json_encode($array_places_values) ); wp_enqueue_script( 'shortcode-map-planer' );?>