'ENGLISH', "ar" => 'ARABIC', "eu" => 'BASQUE', "bg" => 'BULGARIAN', "bn" => 'BENGALI', "ca" => 'CATALAN', "cs" => 'CZECH', "da" => 'DANISH', "de" => 'GERMAN', "el" => 'GREEK', "en-AU" => 'ENGLISH (AUSTRALIAN)', "en-GB" => 'ENGLISH (GREAT BRITAIN)', "es" => 'FARSI', "fi" => 'FINNISH', "fil" => 'FILIPINO', "fr" => 'FRENCH', "gl" => 'GALICIAN', "gu" => 'GUJARATI', "hi" => 'HINDI', "hu" => 'HUNGARIAN', "id" => 'INDONESIAN', "it" => 'ITALIAN', "iw" => 'HEBREW', "ja" => 'JAPANESE', "kn" => 'KANNADA', "ko" => 'KOREAN', "lt" => 'LITHUANIAN', "lv" => 'LATVIAN', "ml" => 'MALAYALAM', "mr" => 'MARATHI', "nl" => 'DUTCH', "no" => 'NORWEGIAN', "pl" => 'POLISH', "pt" => 'PORTUGUESE', "pt-BR" => 'PORTUGUESE (BRAZIL)', "pt-PT" => 'PORTUGUESE (PORTUGAL)', "ro" => 'ROMANIAN', "ru" => 'RUSSIAN', "sk" => 'SLOVAK', "sl" => 'SLOVENIAN', "sr" => 'SERBIAN', "sv" => 'SWEDISH', "tl" => 'TAGALOG', "ta" => 'TAMIL', "te" => 'TELUGU', "th" => 'THAI', "tr" => 'TURKISH', "uk" => 'UKRAINIAN', "vi" => 'VIETNAMESE', "zh-CN" => 'CHINESE (SIMPLIFIED)', "zh-TW" => 'CHINESE (TRADITIONAL)', ); } /* Location marker animation array */ public static function get_location_marker_animation() { return array( "BOUNCE" => 'Bounce', "DROP" => 'Drop', ); } /* Map Style Themes array */ public static function get_map_style_theme() { return array( "silver" => 'Silver', "retro" => 'Retro', "dark" => 'Dark', "night" => 'Night', "aubergine" => 'Aubergine', "standard" => 'Standard', ); } /* Stroke Opacity array */ public static function get_stroke_opacity() { return array( '1', '0.9', '0.8', '0.7', '0.6', '0.5', '0.4', '0.3', '0.2', '0.1' ); } /* Unit system array */ public static function get_unit_system() { return array( "METRIC", 'IMPERIAL' ); } /* Map Type array */ public static function get_map_type() { return array( "roadmap" => 'ROADMAP', "satellite" => 'SATELLITE', "hybrid" => 'HYBRID', "terrain" => 'TERRAIN', ); } /* Interactive Map's Continents */ public static function get_continents() { return array( "002" => 'Africa', "019" => 'Americas', "142" => 'Asia', "150" => 'Europe', "009" => 'Oceania', ); } /* Interactive Map's Resolutions */ public static function get_region_resolution() { return array( "countries", "provinces", "metros" ); } /* Interactive Map's Display Modes */ public static function get_map_display_mode() { return array( "regions", "markers", "text" ); } /* Get Last Updated Day and Time */ public static function get_last_updated_time( $post_type ) { $latest = new WP_Query( array( 'post_type' => $post_type, 'post_status' => 'publish', 'posts_per_page' => 1, 'orderby' => 'modified', 'order' => 'DESC' ) ); if ( $latest->have_posts() ) { $modified_date = $latest->posts[0]->post_modified; $timestamp = strtotime( $modified_date ); return $new_date_format = date( 'd M Y, H:i A', $timestamp ); } } /* Location Cpt Metabox Select Field Helper */ public static function location_cpt_select_options( $post_id ) { query_posts( 'p=' . $post_id . '&post_type=wl_agm_locations' ); ?> #redirect_input_div { display: none; } '; } if ( empty ( $location_redirect ) ) { echo ""; } ?> results[0]->geometry->location->lat; } elseif ( $value == 'long' ) { return $longitude = $output->results[0]->geometry->location->lng; } } /* Get Interactive Map's elements */ public static function get_map_elements_data( $post_id ) { $regions_arr = array(); $args = array( 'post_type' => 'wl_agm_inter_maps', 'post__in' => array( $post_id ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $saved_data_arr = get_post_meta( get_the_ID(), 'saved_data_arr', true ); $arr = json_decode( $saved_data_arr ); if ( ! empty ( $arr ) ) { $size_data = sizeof( $arr ); for ( $i = 0; $i < $size_data; $i ++ ) { $single_arr = [ $arr[ $i ]->region, $arr[ $i ]->tooltip_value, $arr[ $i ]->click_value, $arr[ $i ]->color ]; array_push( $regions_arr, $single_arr ); } } endwhile; } wp_reset_postdata(); return $regions_arr; } /* Get Selected Locations for Map */ public static function get_multiple_location_for_map( $post_id ) { query_posts( 'p=' . $post_id . '&post_type=wl_agm_maps' ); while ( have_posts() ): the_post(); $selected_locations = get_post_meta( get_the_ID(), 'selected_locations', true ); $way_locations_str = str_replace( [ '[', ']', '"' ], ' ', $selected_locations ); $way_locations_arr = ( explode( ",", $way_locations_str ) ); endwhile; wp_reset_query(); $locations = array(); $args = array( 'post_type' => 'wl_agm_locations', 'post__in' => $way_locations_arr ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $location_address = get_post_meta( get_the_ID(), 'location_address', true ); $location_lat = get_post_meta( get_the_ID(), 'location_lat', true ); $location_long = get_post_meta( get_the_ID(), 'location_long', true ); $location_marker_img = get_post_meta( get_the_ID(), 'location_marker_img', true ); $location_info_win = get_post_meta( get_the_ID(), 'location_info_win', true ); $location_image = get_post_meta( get_the_ID(), 'location_image', true ); $single_arr = [ get_the_title(), $location_lat, $location_long, $location_marker_img, $location_address, $location_image, $location_info_win ]; array_push( $locations, $single_arr ); endwhile; } wp_reset_postdata(); return $locations; } /* Interactive Map's Cpt Metabox Select Field Helper */ public static function interactive_cpt_select_options( $post_id ) { query_posts( 'p=' . $post_id . '&post_type=wl_agm_inter_maps' ); ?> 'wl_agm_locations', 'post__in' => array( $post_id ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $location_map_height = get_post_meta( get_the_ID(), 'location_map_height', true ); if ( empty ( $location_map_height ) ) { $location_map_height = '600px'; } $location_map_width = get_post_meta( get_the_ID(), 'location_map_width ', true ); if ( empty ( $location_map_width ) ) { $location_map_width = '100%'; } $location_address = get_post_meta( get_the_ID(), 'location_address', true ); $location_lat = get_post_meta( $post_id, 'location_lat', true ); $location_long = get_post_meta( $post_id, 'location_long', true ); $location_onclick = get_post_meta( get_the_ID(), 'location_onclick', true ); $location_info_win = get_post_meta( get_the_ID(), 'location_info_win', true ); $location_image = get_post_meta( get_the_ID(), 'location_image', true ); $location_disable_info = get_post_meta( get_the_ID(), 'location_disable_info', true ); $location_marker_ani = get_post_meta( get_the_ID(), 'location_marker_ani', true ); $location_style_theme = get_post_meta( get_the_ID(), 'location_style_theme', true ); $location_marker_img = get_post_meta( get_the_ID(), 'location_marker_img', true ); $location_redirect = get_post_meta( get_the_ID(), 'location_redirect', true ); $map_zoom_level = get_post_meta( get_the_ID(), 'map_zoom_level', true ); $loc_map_type = get_post_meta( get_the_ID(), 'loc_map_type', true ); $location_id = get_the_ID(); $title = get_the_title(); endwhile; } wp_reset_query(); // Register the script wp_register_script( 'wl_agm_lite_loc_frot', WL_AGM_LITE_PLUGIN_URL. 'public/js/location_frontend.js' ); // Localize the script with new data $shortcode_data = array( 'address' => $location_address, 'lat' => $location_lat, 'long' => $location_long, 'onclick' => $location_onclick, 'info_win' => $location_info_win, 'image' => $location_image, 'disable_info' => $location_disable_info, 'marker_ani' => $location_marker_ani, 'theme' => $location_style_theme, 'mrker_img' => $location_marker_img, 'redirect' => $location_redirect, 'location_id' => $location_id, 'wl_title' => $title, 'wl_zoom' => $map_zoom_level, 'wl_map_type' => $loc_map_type ); wp_localize_script( 'wl_agm_lite_loc_frot', 'wl_agm_lite_loc', $shortcode_data ); // Enqueued script with localized data. wp_enqueue_script( 'wl_agm_lite_loc_frot' ); self::google_script_location(); ?> 'wl_agm_maps', 'post__in' => array( $post_id ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $map_height = get_post_meta( get_the_ID(), 'map_height', true ); $map_height = ( isset( $map_height ) && ! empty( $map_height ) ) ? $map_height : '500px'; $map_width = get_post_meta( get_the_ID(), 'map_width', true ); $map_width = ( isset( $map_width ) && ! empty( $map_width ) ) ? $map_width : '100%'; $map_type = get_post_meta( get_the_ID(), 'map_type', true ); $map_theme = get_post_meta( get_the_ID(), 'map_theme', true ); $map_lat = get_post_meta( get_the_ID(), 'center_lat', true ); $map_long = get_post_meta( get_the_ID(), 'center_long', true ); $map_scroll = get_post_meta( get_the_ID(), 'map_scroll_wheel', true ); $map_draggable = get_post_meta( get_the_ID(), 'map_m_draggable', true ); $map_imagery = get_post_meta( get_the_ID(), 'map_imagery', true ); $map_zoom = get_post_meta( get_the_ID(), 'map_zoom_level', true ); $back_color = get_post_meta( get_the_ID(), 'custom_back_color', true ); $border_radius = get_post_meta( get_the_ID(), 'custom_border_radius', true ); $border_color = get_post_meta( get_the_ID(), 'custom_bg_color', true ); $custom_width = get_post_meta( get_the_ID(), 'custom_width_info', true ); $text_color = get_post_meta( get_the_ID(), 'custom_text_color', true ); $location_image = get_post_meta( get_the_ID(), 'location_image', true ); $locations = self::get_multiple_location_for_map( $post_id ); $size = sizeof( $locations ); $map_id = get_the_ID(); if ( empty ( $back_color ) ) { $back_color = '#fff'; } if ( empty ( $border_radius ) ) { $border_radius = '4px'; } if ( empty ( $border_color ) ) { $border_color = '#fff'; } if ( empty ( $custom_width ) ) { $custom_width = '350px'; } if ( empty ( $text_color ) ) { $text_color = '#000'; } endwhile; } wp_reset_query(); // Register the script wp_register_script( 'wl_agm_lite_multi_frot', WL_AGM_LITE_PLUGIN_URL. 'public/js/multi_frontend.js' ); // Localize the script with new data $shortcode_data = array( 'map_type' => $map_type, 'lat' => $map_lat, 'long' => $map_long, 'theme' => $map_theme, 'scroll' => $map_scroll, 'draggable' => $map_draggable, 'imagnary' => $map_imagery, 'zoom' => $map_zoom, 'wl_size' => $size, 'locations' => $locations, 'map_id' => $map_id, 'location_image' => $location_image, ); wp_localize_script( 'wl_agm_lite_multi_frot', 'wl_agm_lite_multi', $shortcode_data ); // Enqueued script with localized data. wp_enqueue_script( 'wl_agm_lite_multi_frot' ); self::google_script_location(); ?> 'wl_agm_routes', 'post__in' => array( $post_id ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $r_stroke_typ = get_post_meta( get_the_ID(), 'r_stroke_typ', true ); $r_storke_weight = get_post_meta( get_the_ID(), 'r_storke_weight', true ); $r_unit_system = get_post_meta( get_the_ID(), 'r_unit_system', true ); $r_draggable = get_post_meta( get_the_ID(), 'r_draggable', true ); $r_start_location = get_post_meta( get_the_ID(), 'r_start_location', true ); $r_end_location = get_post_meta( get_the_ID(), 'r_end_location', true ); $r_map_height = get_post_meta( get_the_ID(), 'r_map_height', true ); $r_map_width = get_post_meta( get_the_ID(), 'r_map_width', true ); $r_style_theme = get_post_meta( get_the_ID(), 'r_style_theme', true ); $r_stroke_color = get_post_meta( get_the_ID(), 'r_stroke_color', true ); $r_center = get_post_meta( get_the_ID(), 'r_center', true ); $r_center_lat = self::get_lat_long_by_address( 'lat', $r_center ); $r_center_long = self::get_lat_long_by_address( 'long', $r_center ); $route_type = get_post_meta( get_the_ID(), 'route_type', true ); $r_waypoints_ed = get_post_meta( get_the_ID(), 'r_waypoints_ed', true ); $map_id = get_the_ID(); endwhile; } wp_reset_query(); // Register the script wp_register_script( 'wl_agm_lite_route_frot', WL_AGM_LITE_PLUGIN_URL. 'public/js/route_frontend.js' ); // Localize the script with new data $shortcode_data = array( 'stroke_typ' => $r_stroke_typ, 'stroke_weight' => $r_storke_weight, 'unit_system' => $r_unit_system, 'draggable' => $r_draggable, 'start_loc' => $r_start_location, 'end_loc' => $r_end_location, 'theme' => $r_style_theme, 'stroke_color' => $r_stroke_color, 'wl_lat' => $r_center_lat, 'wl_long' => $r_center_long, 'route_type' => $route_type, 'r_waypoints_ed' => $r_waypoints_ed, 'map_id' => $map_id, ); wp_localize_script( 'wl_agm_lite_route_frot', 'wl_agm_lite_route', $shortcode_data ); // Enqueued script with localized data. wp_enqueue_script( 'wl_agm_lite_route_frot' ); self::google_script_location(); ?> 'wl_agm_inter_maps', 'post__in' => array( $post_id ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); $map_width = get_post_meta( get_the_ID(), 'map_width', true ); $map_height = get_post_meta( get_the_ID(), 'map_height', true ); $map_desc = get_post_meta( get_the_ID(), 'map_desc', true ); $map_continents = get_post_meta( get_the_ID(), 'map_continents', true ); $map_subcontinents = get_post_meta( get_the_ID(), 'map_subcontinents', true ); $map_country = get_post_meta( get_the_ID(), 'map_country', true ); $map_resolution = get_post_meta( get_the_ID(), 'map_resolution', true ); $bg_color = get_post_meta( get_the_ID(), 'bg_color', true ); $dataless_color = get_post_meta( get_the_ID(), 'dataless_color', true ); $map_interactivity = get_post_meta( get_the_ID(), 'map_interactivity', true ); $map_display_mode = get_post_meta( get_the_ID(), 'map_display_mode', true ); $save_settings = get_option( 'wl_agm_settings_data' ); $regions_arr = self::get_map_elements_data( get_the_ID() ); $size = sizeof( $regions_arr ); $map_id = $post_id; $save_settings = get_option( 'wl_agm_settings_data' ); $map_api_key = $save_settings['wl_agm_gmap_api']; $map_con_id = $post_id; endwhile; } wp_reset_query(); if ( empty ( $map_height ) ) { $map_height = '500px'; } if ( empty ( $map_width ) ) { $map_width = '100%'; } if ( empty ( $bg_color ) ) { $bg_color = '#ffffff'; } if ( empty ( $dataless_color ) ) { $dataless_color = '#f8bbd0'; } if ( ! empty ( $map_continents ) && ! empty ( $map_subcontinents ) && ! empty ( $map_country ) ) { $region = $map_country; } elseif ( ! empty ( $map_continents ) && ! empty ( $map_subcontinents ) && empty ( $map_country ) ) { $region = $map_subcontinents; } elseif ( ! empty ( $map_continents ) && empty ( $map_subcontinents ) && empty ( $map_country ) ) { $region = $map_continents; } elseif ( empty ( $map_continents ) && empty ( $map_subcontinents ) && empty ( $map_country ) ) { $region = 'world'; } if ( ! empty ( $map_interactivity ) ) { $interactivity = 'true'; } else { $interactivity = 'false'; } $map_id = 'map-'.$map_id; $regions_data = array(); $single_arr = [ 'Country', 'Value', 'Tooltip' ]; array_push( $regions_data, $single_arr ); for ( $i = 0; $i < $size; $i ++ ) { $single_arr = [ $regions_arr[ $i ][0], $i + 1, $regions_arr[ $i ][1] ]; array_push( $regions_data, $single_arr ); } $color_data = array(); for ( $i = 0; $i < $size; $i ++ ) { $color_arr = $regions_arr[ $i ][3]; array_push( $color_data, $color_arr ); } // Register the script wp_register_script( 'wl_agm_lite_inter_frot', WL_AGM_LITE_PLUGIN_URL. 'public/js/inter_frontend.js' ); // Localize the script with new data $shortcode_data = array( 'region' => $region, 'interactivity' => $interactivity, 'dataless_color' => $dataless_color, 'bg_color' => $bg_color, 'resolution' => $map_resolution, 'regions_arr' => $regions_arr, 'wl_size' => $size, 'map_id' => $map_id, 'api_key' => $map_api_key, 'display_mode' => $map_display_mode, 'container_id' => $map_con_id, 'regions_data' => $regions_data, 'color_data' => $color_data, ); wp_localize_script( 'wl_agm_lite_inter_frot', 'wl_agm_lite_inter', $shortcode_data ); // Enqueued script with localized data. wp_enqueue_script( 'wl_agm_lite_inter_frot' ); ?>