prefix . "wpgmza"; $wpgmza_tblname_maps = $wpdb->prefix . "wpgmza_maps"; $wpgmza_tblname_poly = $wpdb->prefix . "wpgmza_polygon"; $wpgmza_tblname_polylines = $wpdb->prefix . "wpgmza_polylines"; $wpgmza_tblname_categories = $wpdb->prefix. "wpgmza_categories"; $wpgmza_tblname_category_maps = $wpdb->prefix. "wpgmza_category_maps"; $wpgmza_version = "6.1.7"; $wpgmza_p_version = "6.1.7"; $wpgmza_t = "basic"; define("WPGMAPS", $wpgmza_version); define("WPGMAPS_DIR",plugin_dir_url(__FILE__)); include ("base/includes/wp-google-maps-polygons.php"); include ("base/includes/wp-google-maps-polylines.php"); include ("base/includes/deprecated.php"); if (function_exists('wpgmaps_head_pro')) { add_action('admin_head', 'wpgmaps_head_pro'); } else { if (function_exists('wpgmaps_pro_activate') && floatval($wpgmza_version) < 5.24) { add_action('admin_head', 'wpgmaps_head_old'); } else { add_action('admin_head', 'wpgmaps_head'); } } add_action('admin_head','wpgmaps_feedback_head'); add_action('admin_footer', 'wpgmaps_reload_map_on_post'); register_activation_hook( __FILE__, 'wpgmaps_activate' ); register_deactivation_hook( __FILE__, 'wpgmaps_deactivate' ); add_action('init', 'wpgmaps_init'); add_action('admin_menu', 'wpgmaps_admin_menu'); add_filter('widget_text', 'do_shortcode'); $debug_start = (float) array_sum(explode(' ',microtime())); function wpgmaps_activate() { global $wpdb; global $wpgmza_version; $table_name = $wpdb->prefix . "wpgmza"; $table_name_maps = $wpdb->prefix . "wpgmza_maps"; delete_option("WPGMZA"); /* set defaults for the Marker XML Dir and Marker XML URL */ if (get_option("wpgmza_xml_location") == "") { $upload_dir = wp_upload_dir(); add_option("wpgmza_xml_location",'{uploads_dir}/wp-google-maps/'); } if (get_option("wpgmza_xml_url") == "") { $upload_dir = wp_upload_dir(); add_option("wpgmza_xml_url",'{uploads_url}/wp-google-maps/'); } wpgmaps_handle_db(); wpgmaps_handle_directory(); $wpgmza_data = get_option("WPGMZA"); if (!$wpgmza_data) { /* load first map as an example map (i.e. if the user has not installed this plugin before, this must run */ $res_maps = $wpdb->get_results("SELECT * FROM $table_name_maps"); if (!$res_maps) { $rows_affected = $wpdb->insert( $table_name_maps, array( "map_title" => __("My first map","wp-google-maps"), "map_start_lat" => "45.950464398418106", "map_start_lng" => "-109.81550500000003", "map_width" => "100", "map_height" => "400", "map_width_type" => "%", "map_height_type" => "px", "map_start_location" => "45.950464398418106,-109.81550500000003", "map_start_zoom" => "2", "directions_enabled" => '1', "default_marker" => "0", "alignment" => "0", "styling_enabled" => "0", "styling_json" => "", "active" => "0", "type" => "1", "kml" => "", "fusion" => "", "bicycle" => "2", "traffic" => "2", "dbox" => "1", "dbox_width" => "250", "default_to" => "", "listmarkers" => "0", "listmarkers_advanced" => "0", "filterbycat" => "0", "order_markers_by" => "1", "order_markers_choice" => "2", "show_user_location" => "0", "ugm_enabled" => "0", "ugm_category_enabled" => "0", "ugm_access" => "0", "mass_marker_support" => "1", "other_settings" => "" ) ); } } else { $rows_affected = $wpdb->insert( $table_name_maps, array( "map_start_lat" => "".$wpgmza_data['map_start_lat']."", "map_start_lng" => "".$wpgmza_data['map_start_lng']."", "map_title" => "My Map", "map_width" => "".$wpgmza_data['map_width']."", "map_height" => "".$wpgmza_data['map_height']."", "map_width_type" => "".$wpgmza_data['map_width_type']."", "map_height_type" => "".$wpgmza_data['map_height_type']."", "map_start_location" => "".$wpgmza_data['map_start_lat'].",".$wpgmza_data['map_start_lng']."", "map_start_zoom" => "".$wpgmza_data['map_start_zoom']."", "default_marker" => "".$wpgmza_data['map_default_marker']."", "type" => "".$wpgmza_data['map_type']."", "alignment" => "".$wpgmza_data['map_align']."", "styling_enabled" => "0", "styling_json" => "", "active" => "0", "kml" => "", "fusion" => "", "directions_enabled" => "".$wpgmza_data['directions_enabled']."", "bicycle" => "".$wpgmza_data['bicycle']."", "traffic" => "".$wpgmza_data['traffic']."", "dbox" => "".$wpgmza_data['dbox']."", "dbox_width" => "".$wpgmza_data['dbox_width']."", "default_to" => "".$wpgmza_data['default_to']."", "listmarkers" => "".$wpgmza_data['listmarkers']."", "listmarkers_advanced" => "".$wpgmza_data['listmarkers_advanced']."", "filterbycat" => "".$wpgmza_data['filterbycat']."", "order_markers_by" => "".$wpgmza_data['order_markers_by']."", "order_markers_choice" => "".$wpgmza_data['order_markers_choice']."", "show_user_location" => "".$wpgmza_data['show_user_location']."", "ugm_enabled" => "".$wpgmza_data['ugm_enabled']."", "ugm_category_enabled" => "".$wpgmza_data['ugm_category_enabled']."", "ugm_access" => "".$wpgmza_data['ugm_access']."", "mass_marker_support" => "1", "other_settings" => "" ) ); delete_option("WPGMZA"); } /* load first marker as an example marker */ $results = $wpdb->get_results("SELECT * FROM $table_name WHERE `map_id` = '1'"); if (!$results) { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => '1', 'address' => 'California', 'lat' => '36.778261', 'lng' => '-119.4179323999', 'pic' => '', 'link' => '', 'icon' => '', 'anim' => '', 'title' => '', 'infoopen' => '', 'description' => '', 'category' => 0, 'retina' => 0) ); } add_option("wpgmaps_current_version",$wpgmza_version); } function wpgmaps_deactivate() { /* wpgmza_cURL_response("deactivate"); */ } function wpgmaps_init() { global $wpgmza_pro_version; global $wpgmza_version; wp_enqueue_script("jquery"); $plugin_dir = basename(dirname(__FILE__))."/languages/"; load_plugin_textdomain( 'wp-google-maps', false, $plugin_dir ); if (get_option("wpgmza_xml_location") == "") { $upload_dir = wp_upload_dir(); add_option("wpgmza_xml_location",'{uploads_dir}/wp-google-maps/'); } if (get_option("wpgmza_xml_url") == "") { $upload_dir = wp_upload_dir(); add_option("wpgmza_xml_url",'{uploads_url}/wp-google-maps/'); } $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "") { $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME"); if (!$wpgmza_first_time) { /* first time, set marker pull to DB */ $wpgmza_settings['wpgmza_settings_marker_pull'] = "0"; update_option("WPGMZA_OTHER_SETTINGS",$wpgmza_settings); } else { /* previous users - set it to XML (what they were using originally) */ $wpgmza_settings['wpgmza_settings_marker_pull'] = "1"; update_option("WPGMZA_OTHER_SETTINGS",$wpgmza_settings); } } if (function_exists("wpgmza_register_pro_version")) { global $wpgmza_pro_version; if (floatval($wpgmza_pro_version) < 5.41) { /* user has pro and is prior to version 5.41 so therefore do not save the shortcode in the URL, rather process it and then save it */ update_option("wpgmza_xml_url",wpgmza_return_marker_url()); update_option("wpgmza_xml_location",wpgmza_return_marker_path()); } else { } } wpgmaps_handle_directory(); /* handle first time users and updates */ if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') { /* check if their using APC object cache, if yes, do nothing with the welcome page as it causes issues when caching the DB options */ if (class_exists("APC_Object_Cache")) { /* do nothing here as this caches the "first time" option and the welcome page just loads over and over again. quite annoying really... */ } else { if (isset($_GET['override']) && $_GET['override'] == "1") { $wpgmza_first_time = $wpgmza_version; update_option("WPGMZA_FIRST_TIME",$wpgmza_first_time); } else { $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME"); if (!$wpgmza_first_time) { /* show welcome screen */ $wpgmza_first_time = $wpgmza_version; update_option("WPGMZA_FIRST_TIME",$wpgmza_first_time); wp_redirect(get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page"); exit(); } if ($wpgmza_first_time != $wpgmza_version) { update_option("WPGMZA_FIRST_TIME",$wpgmza_version); } } } } /* check if version is outdated or plugin is being automatically updated */ $current_version = get_option("wpgmaps_current_version"); if (!isset($current_version) || $current_version != $wpgmza_version) { wpgmaps_handle_db(); wpgmaps_handle_directory(); wpgmaps_update_all_xml_file(); update_option("wpgmaps_current_version",$wpgmza_version); } /* if (floatval($wpgmza_pro_version) < 5.52) { if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') { echo "

WP Google Maps Notice

We have stopped using Timthumb to generate thumbnails for your markers due to security concerns.

Please update your pro version of WP Google Maps to at least 5.52 in order for your marker images to function correctly.

"; } }*/ } function wpgmaps_handle_directory() { $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') { /* using db method, do nothing */ return; } if (get_option("wpgmza_xml_location") == "") { $upload_dir = wp_upload_dir(); add_option("wpgmza_xml_location",'{uploads_dir}/wp-google-maps/'); } $xml_marker_location = get_option("wpgmza_xml_location"); if (!file_exists($xml_marker_location)) { if (@mkdir($xml_marker_location)) { return true; } else { return false; } } } function wpgmaps_folder_check() { $xml_marker_location = wpgmza_return_marker_path(); if (!file_exists($xml_marker_location) && (isset($_GET['activate']) && $_GET['activate'] == 'true')) { add_action('admin_notices', 'wpgmaps_folder_warning'); } } function wpgmaps_folder_warning() { $file = get_option("wpgmza_xml_location"); echo '

'.__('WP Google Maps cannot find the directory it uses to save marker data to. Please confirm that ', 'wp-google-maps').' '.$file.' '.__('exists. Please also ensure that you assign file permissions of 755 (or 777) to this directory.','wp-google-maps').'

'; } function wpgmaps_cache_permission_warning() { echo "
"; _e("Timthumb does not have 'write' permission for the cache directory. Please enable 'write' permissions (755 or 777) for "); echo "\"".dirname(__FILE__).DS."cache "; _e("in order for images to show up while using Timthumb. Please see "); echo ""; _e("this page"); echo " "; _e("for help on how to do it. Alternatively, you can disable the use of Timthumb in Maps->Settings"); echo "
"; } function wpgmaps_check_permissions_cache() { $filename = dirname( __FILE__ ).DS.'cache'.DS.'wpgmaps.tmp'; $testcontent = "Permission Check\n"; $handle = @fopen($filename, 'w'); if (@fwrite($handle, $testcontent) === FALSE) { @fclose($handle); add_option("wpgmza_permission","n"); return false; } else { @fclose($handle); add_option("wpgmza_permission","y"); return true; } } function wpgmaps_reload_map_on_post() { if (isset($_POST['wpgmza_savemap'])){ $res = wpgmza_get_map_data($_GET['map_id']); $wpgmza_lat = $res->map_start_lat; $wpgmza_lng = $res->map_start_lng; $wpgmza_width = $res->map_width; $wpgmza_height = $res->map_height; $wpgmza_width_type = $res->map_width_type; $wpgmza_height_type = $res->map_height_type; $wpgmza_map_type = $res->type; if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; } else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; } else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; } else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; } else { $wpgmza_map_type = "ROADMAP"; } $start_zoom = $res->map_start_zoom; if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; } if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; } ?> lat; $wpgmza_lng = $res->lng; $wpgmza_map_type = "ROADMAP"; $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); $api_version = $wpgmza_settings['wpgmza_api_version']; if (isset($api_version) && $api_version != "") { $api_version_string = "v=$api_version&"; } else { $api_version_string = "v=3.14&"; } ?> other_settings); if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = 0; } if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = 0; } if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = 0; } if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = 0; } if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; } $wpgmza_lat = $res->map_start_lat; $wpgmza_lng = $res->map_start_lng; $wpgmza_width = $res->map_width; $wpgmza_height = $res->map_height; $wpgmza_width_type = $res->map_width_type; $wpgmza_height_type = $res->map_height_type; $wpgmza_map_type = $res->type; $wpgmza_traffic = $res->traffic; $wpgmza_bicycle = $res->bicycle; if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = null; } if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; } if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; } else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; } else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; } else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; } else { $wpgmza_map_type = "ROADMAP"; } $start_zoom = $res->map_start_zoom; if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; } if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; } if (isset($wpgmza_settings['wpgmza_api_version'])) { $api_version = $wpgmza_settings['wpgmza_api_version']; } else { $api_version = ""; } if (isset($api_version) && $api_version != "") { $api_version_string = "v=$api_version&"; } else { $api_version_string = "v=3.exp&"; } if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; } if (isset($marker_pull) && $marker_pull == "0") { if (!defined('PHP_VERSION_ID')) { $phpversion = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($phpversion[0] * 10000 + $phpversion[1] * 100 + $phpversion[2])); } if (PHP_VERSION_ID < 50300) { $markers = json_encode(wpgmaps_return_markers($_GET['map_id'])); } else { $markers = json_encode(wpgmaps_return_markers($_GET['map_id']),JSON_HEX_APOS); } } ?> other_settings); if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = false; } if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = false; } if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = false; } if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = false; } if (isset($map_other_settings['store_locator_bounce'])) { $store_locator_bounce = $map_other_settings['store_locator_bounce']; } else { $store_locator_bounce = 1; } $wpgmza_lat = $res->map_start_lat; $wpgmza_lng = $res->map_start_lng; $wpgmza_width = $res->map_width; $wpgmza_height = $res->map_height; $wpgmza_width_type = $res->map_width_type; $wpgmza_height_type = $res->map_height_type; $wpgmza_map_type = $res->type; $wpgmza_traffic = $res->traffic; $wpgmza_bicycle = $res->bicycle; if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; } if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = '1'; } if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; } if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; } else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; } else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; } else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; } else { $wpgmza_map_type = "ROADMAP"; } $start_zoom = $res->map_start_zoom; if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; } if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; } if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; } $restrict_search = false; if (isset($map_other_settings['wpgmza_store_locator_restrict'])) { $restrict_search = $map_other_settings['wpgmza_store_locator_restrict']; } else { $restrict_search = false; } if (isset($marker_pull) && $marker_pull == "0") { $markers = json_encode(wpgmaps_return_markers($wpgmza_current_map_id)); } ?> formatOutput = true; $channel_main = $dom->createElement('markers'); $channel = $dom->appendChild($channel_main); $table_name = $wpdb->prefix . "wpgmza"; /* PREVIOUS VERSION HANDLING */ if (function_exists('wpgmza_register_pro_version')) { $prov = get_option("WPGMZA_PRO"); $wpgmza_pro_version = $prov['version']; $sql = "SELECT * FROM $table_name WHERE `map_id` = '$mapid' AND `approved` = 1"; $results = $wpdb->get_results($sql); } else { $results = $wpdb->get_results( " SELECT * FROM $table_name WHERE `map_id` = '$mapid' AND `approved` = 1 " ); } foreach ( $results as $result ) { $id = $result->id; $address = stripslashes($result->address); $description = stripslashes($result->description); $pic = $result->pic; if (!$pic) { $pic = ""; } $icon = $result->icon; if (!$icon) { $icon = ""; } $link_url = $result->link; if ($link_url) { } else { $link_url = ""; } $lat = $result->lat; $lng = $result->lng; $anim = $result->anim; $retina = $result->retina; $category = $result->category; if ($icon == "") { if (function_exists('wpgmza_get_category_data')) { $category_data = wpgmza_get_category_data($category); if (isset($category_data->category_icon) && isset($category_data->category_icon) != "") { $icon = $category_data->category_icon; } else { $icon = ""; } if (isset($category_data->retina)) { $retina = $category_data->retina; } } } $infoopen = $result->infoopen; $mtitle = stripslashes($result->title); $map_id = $result->map_id; $channel = $channel_main->appendChild($dom->createElement('marker')); $title = $channel->appendChild($dom->createElement('marker_id')); $title->appendChild($dom->CreateTextNode($id)); $title = $channel->appendChild($dom->createElement('map_id')); $title->appendChild($dom->CreateTextNode($map_id)); $title = $channel->appendChild($dom->createElement('title')); $title->appendChild($dom->CreateTextNode($mtitle)); $title = $channel->appendChild($dom->createElement('address')); $title->appendChild($dom->CreateTextNode($address)); $desc = $channel->appendChild($dom->createElement('desc')); $desc->appendChild($dom->CreateTextNode($description)); $desc = $channel->appendChild($dom->createElement('pic')); $desc->appendChild($dom->CreateTextNode($pic)); $desc = $channel->appendChild($dom->createElement('icon')); $desc->appendChild($dom->CreateTextNode($icon)); $desc = $channel->appendChild($dom->createElement('linkd')); $desc->appendChild($dom->CreateTextNode($link_url)); $bd = $channel->appendChild($dom->createElement('lat')); $bd->appendChild($dom->CreateTextNode($lat)); $bd = $channel->appendChild($dom->createElement('lng')); $bd->appendChild($dom->CreateTextNode($lng)); $bd = $channel->appendChild($dom->createElement('anim')); $bd->appendChild($dom->CreateTextNode($anim)); $bd = $channel->appendChild($dom->createElement('retina')); $bd->appendChild($dom->CreateTextNode($retina)); $bd = $channel->appendChild($dom->createElement('category')); $bd->appendChild($dom->CreateTextNode($category)); $bd = $channel->appendChild($dom->createElement('infoopen')); $bd->appendChild($dom->CreateTextNode($infoopen)); } $upload_dir = wp_upload_dir(); wpgmaps_handle_directory(); $xml_marker_location = wpgmza_return_marker_path(); if (is_multisite()) { global $blog_id; if ($dom->save($xml_marker_location.$blog_id.'-'.$mapid.'markers.xml') == FALSE) { return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$blog_id."-".$mapid."markers.xml) for Map ID $mapid" ); } } else { /* PREVIOUS VERSION HANDLING */ if (function_exists('wpgmza_register_pro_version')) { $prov = get_option("WPGMZA_PRO"); $wpgmza_pro_version = $prov['version']; if ($dom->save($xml_marker_location.$mapid.'markers.xml') == FALSE) { return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$mapid."markers.xml) for Map ID $mapid" ); } } else { if ($dom->save($xml_marker_location.$mapid.'markers.xml') == FALSE) { return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$mapid."markers.xml) for Map ID $mapid" ); } } } return true; } function wpgmaps_return_markers($mapid = false) { if (!$mapid) { return; } global $wpdb; $table_name = $wpdb->prefix . "wpgmza"; $sql = "SELECT * FROM $table_name WHERE `map_id` = '$mapid' AND `approved` = 1"; $results = $wpdb->get_results($sql); $m_array = array(); $cnt = 0; foreach ( $results as $result ) { $id = $result->id; $address = stripslashes($result->address); $description = stripslashes($result->description); $pic = $result->pic; if (!$pic) { $pic = ""; } $icon = $result->icon; if (!$icon) { $icon = ""; } $link_url = $result->link; if ($link_url) { } else { $link_url = ""; } $lat = $result->lat; $lng = $result->lng; $anim = $result->anim; $retina = $result->retina; $category = $result->category; if ($icon == "") { if (function_exists('wpgmza_get_category_data')) { $category_data = wpgmza_get_category_data($category); if (isset($category_data->category_icon) && isset($category_data->category_icon) != "") { $icon = $category_data->category_icon; } else { $icon = ""; } if (isset($category_data->retina)) { $retina = $category_data->retina; } } } $infoopen = $result->infoopen; $mtitle = stripslashes($result->title); $map_id = $result->map_id; $m_array[$cnt] = array( 'map_id' => $map_id, 'marker_id' => $id, 'title' => $mtitle, 'address' => $address, 'desc' => $description, 'pic' => $pic, 'icon' => $icon, 'linkd' => $link_url, 'lat' => $lat, 'lng' => $lng, 'anim' => $anim, 'retina' => $retina, 'category' => $category, 'infoopen' => $infoopen ); $cnt++; } return $m_array; } function wpgmza_return_marker_url() { $url = get_option("wpgmza_xml_url"); $content_url = content_url(); $content_url = trim($content_url, '/'); $plugins_url = plugins_url(); $plugins_url = trim($plugins_url, '/'); $upload_url = wp_upload_dir(); $upload_url = $upload_url['baseurl']; $upload_url = trim($upload_url, '/'); $url = str_replace('{wp_content_url}', $content_url, $url); $url = str_replace('{plugins_url}', $plugins_url, $url); $url = str_replace('{uploads_url}', $upload_url, $url); /* just incase people use the "dir" instead of "url" */ $url = str_replace('{wp_content_dir}', $content_url, $url); $url = str_replace('{plugins_dir}', $plugins_url, $url); $url = str_replace('{uploads_dir}', $upload_url, $url); if (empty($url)) { $url = $upload_url."/wp-google-maps/"; } if (substr($url, -1) != "/") { $url = $url."/"; } return $url; } function wpgmza_return_marker_path() { $file = get_option("wpgmza_xml_location"); $content_dir = WP_CONTENT_DIR; $content_dir = trim($content_dir, '/'); if (defined('WP_PLUGIN_DIR')) { $plugin_dir = str_replace(wpgmza_get_document_root(), '', WP_PLUGIN_DIR); $plugin_dir = trim($plugin_dir, '/'); } else { $plugin_dir = str_replace(wpgmza_get_document_root(), '', WP_CONTENT_DIR . '/plugins'); $plugin_dir = trim($plugin_dir, '/'); } $upload_dir = wp_upload_dir(); $upload_dir = $upload_dir['basedir']; $upload_dir = rtrim($upload_dir, '/'); $file = str_replace('{wp_content_dir}', $content_dir, $file); $file = str_replace('{plugins_dir}', $plugin_dir, $file); $file = str_replace('{uploads_dir}', $upload_dir, $file); $file = trim($file); if (empty($file)) { $file = $upload_dir."/wp-google-maps/"; } /* 6.0.32 - checked for beginning slash, but not on local host */ if ( (isset($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] == "127.0.0.1") || (isset($_SERVER['LOCAL_ADDR']) && $_SERVER['LOCAL_ADDR'] == "127.0.0.1") || substr($file, 0, 2) == "C:" || substr($file, 0, 2) == "D:" || substr($file, 0, 2) == "E:" || substr($file, 0, 2) == "F:" || substr($file, 0, 2) == "G:" ) { } else { if (substr($file, 0, 1) != "/") { $file = "/".$file; } } /* 6.0.32 - check if its just returning 'wp-content/...' */ if (substr($file, 0, 10) == "wp-content") { $file = wpgmza_get_site_root()."/".$file; } if (substr($file, -1) != "/") { $file = $file."/"; } return $file; } function wpgmza_get_document_root() { $document_root = null; if ($document_root === null) { if (!empty($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == $_SERVER['PHP_SELF']) { $document_root = wpgmza_get_site_root(); } elseif (!empty($_SERVER['SCRIPT_FILENAME'])) { $document_root = substr(wpgmza_path($_SERVER['SCRIPT_FILENAME']), 0, -strlen(wpgmza_path($_SERVER['PHP_SELF']))); } elseif (!empty($_SERVER['PATH_TRANSLATED'])) { $document_root = substr(wpgmza_path($_SERVER['PATH_TRANSLATED']), 0, -strlen(wpgmza_path($_SERVER['PHP_SELF']))); } elseif (!empty($_SERVER['DOCUMENT_ROOT'])) { $document_root = wpgmza_path($_SERVER['DOCUMENT_ROOT']); } else { $document_root = wpgmza_get_site_root(); } $document_root = realpath($document_root); $document_root = wpgmza_path($document_root); } return $document_root; } function wpgmza_get_site_root() { $site_root = ABSPATH; $site_root = realpath($site_root); $site_root = wpgmza_path($site_root); return $site_root; } function wpgmza_path($path) { $path = preg_replace('~[/\\\]+~', '/', $path); $path = rtrim($path, '/'); return $path; } function wpgmza_get_site_path() { $site_url = wpgmza_get_site_url(); $parse_url = @parse_url($site_url); if ($parse_url && isset($parse_url['path'])) { $site_path = '/' . ltrim($parse_url['path'], '/'); } else { $site_path = '/'; } if (substr($site_path, -1) != '/') { $site_path .= '/'; } return $site_path; } function wpgmza_get_site_url() { static $site_url = null; if ($site_url === null) { $site_url = get_option('siteurl'); $site_url = rtrim($site_url, '/'); } return $site_url; } function wpgmaps_update_all_xml_file() { global $wpdb; $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') { /* using db method, do nothing */ return; } $table_name = $wpdb->prefix . "wpgmza_maps"; $results = $wpdb->get_results("SELECT `id` FROM $table_name WHERE `active` = 0"); foreach ( $results as $result ) { $map_id = $result->id; $wpgmza_check = wpgmaps_update_xml_file($map_id); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); } } function wpgmaps_action_callback_basic() { global $wpdb; global $wpgmza_tblname; global $wpgmza_p; global $wpgmza_tblname_poly; global $wpgmza_tblname_polylines; $check = check_ajax_referer( 'wpgmza', 'security' ); $table_name = $wpdb->prefix . "wpgmza"; if ($check == 1) { if ($_POST['action'] == "add_marker") { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => $_POST['map_id'], 'address' => $_POST['address'], 'lat' => $_POST['lat'], 'lng' => $_POST['lng'], 'infoopen' => $_POST['infoopen'], 'description' => '', 'title' => '', 'anim' => $_POST['anim'], 'link' => '', 'icon' => '', 'pic' => '', 'infoopen' => $_POST['infoopen'], 'retina' => '0' ) ); $wpgmza_check = wpgmaps_update_xml_file($_POST['map_id']); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); $return_a = array( "marker_id" => $wpdb->insert_id, "marker_data" => wpgmaps_return_markers($_POST['map_id']), "table_html" => wpgmza_return_marker_list($_POST['map_id']) ); echo json_encode($return_a); } if ($_POST['action'] == "edit_marker") { $cur_id = $_POST['edit_id']; $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET address = %s, lat = %f, lng = %f, anim = %d, infoopen = %d WHERE id = %d", $_POST['address'], $_POST['lat'], $_POST['lng'], $_POST['anim'], $_POST['infoopen'], $cur_id) ); $wpgmza_check = wpgmaps_update_xml_file($_POST['map_id']); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); $return_a = array( "marker_id" => $cur_id, "marker_data" => wpgmaps_return_markers($_POST['map_id']), "table_html" => wpgmza_return_marker_list($_POST['map_id']) ); echo json_encode($return_a); } if ($_POST['action'] == "delete_marker") { $marker_id = $_POST['marker_id']; $wpdb->query( " DELETE FROM $wpgmza_tblname WHERE `id` = '$marker_id' LIMIT 1 " ); $wpgmza_check = wpgmaps_update_xml_file($_POST['map_id']); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); $return_a = array( "marker_id" => $marker_id, "marker_data" => wpgmaps_return_markers($_POST['map_id']), "table_html" => wpgmza_return_marker_list($_POST['map_id']) ); echo json_encode($return_a); } if ($_POST['action'] == "delete_poly") { $poly_id = $_POST['poly_id']; $wpdb->query( " DELETE FROM $wpgmza_tblname_poly WHERE `id` = '$poly_id' LIMIT 1 " ); echo wpgmza_b_return_polygon_list($_POST['map_id']); } if ($_POST['action'] == "delete_polyline") { $poly_id = $_POST['poly_id']; $wpdb->query( " DELETE FROM $wpgmza_tblname_polylines WHERE `id` = '$poly_id' LIMIT 1 " ); echo wpgmza_b_return_polyline_list($_POST['map_id']); } } die(); } function wpgmaps_load_maps_api() { wp_enqueue_script('google-maps' , 'http://maps.google.com/maps/api/js?sensor=true' , false , '3'); } function wpgmaps_tag_basic( $atts ) { global $wpgmza_current_map_id; extract( shortcode_atts( array( 'id' => '1' ), $atts ) ); $ret_msg = ""; global $short_code_active; $wpgmza_current_map_id = $atts['id']; $res = wpgmza_get_map_data($atts['id']); if (!isset($res)) { echo __("Error: The map ID","wp-google-maps")." (".$wpgmza_current_map_id.") ".__("does not exist","wp-google-maps"); return; } $short_code_active = true; $map_align = $res->alignment; $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') { } else { /* only check if marker file exists if they are using the XML method */ wpgmza_check_if_marker_file_exists($wpgmza_current_map_id); } $map_width_type = stripslashes($res->map_width_type); $map_height_type = stripslashes($res->map_height_type); if (!isset($map_width_type)) { $map_width_type == "px"; } if (!isset($map_height_type)) { $map_height_type == "px"; } if ($map_width_type == "%" && intval($res->map_width) > 100) { $res->map_width = 100; } if ($map_height_type == "%" && intval($res->map_height) > 100) { $res->map_height = 100; } if (!$map_align || $map_align == "" || $map_align == "1") { $map_align = "float:left;"; } else if ($map_align == "2") { $map_align = "margin-left:auto !important; margin-right:auto; !important; align:center;"; } else if ($map_align == "3") { $map_align = "float:right;"; } else if ($map_align == "4") { $map_align = ""; } $map_style = "style=\"display:block; overflow:auto; width:".$res->map_width."".$map_width_type."; height:".$res->map_height."".$map_height_type."; $map_align\""; $map_other_settings = maybe_unserialize($res->other_settings); $sl_data = ""; if (isset($map_other_settings['store_locator_enabled']) && $map_other_settings['store_locator_enabled'] == 1) { $sl_data = wpgmaps_sl_user_output_basic($wpgmza_current_map_id); } else { $sl_data = ""; } $ret_msg .= " $sl_data
"; if (isset($wpgmza_main_settings['wpgmza_custom_css']) && $wpgmza_main_settings['wpgmza_custom_css'] != "") { $ret_msg = " ".$ret_msg; } return $ret_msg; } function wpgmza_check_if_marker_file_exists($mapid) { wpgmaps_handle_directory(); $upload_dir = wp_upload_dir(); $xml_marker_location = get_option("wpgmza_xml_location"); if (is_multisite()) { global $blog_id; if (file_exists($xml_marker_location.$blog_id.'-'.$mapid.'markers.xml')) { /* all OK */ } else { $wpgmza_check = wpgmaps_update_xml_file($mapid); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); } } else { if (file_exists($xml_marker_location.$mapid.'markers.xml')) { } else { $wpgmza_check = wpgmaps_update_xml_file($mapid); if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check); } } } function wpgmaps_sl_user_output_basic($map_id) { $map_settings = wpgmza_get_map_data($map_id); $map_width = $map_settings->map_width; $map_width_type = stripslashes($map_settings->map_width_type); $map_other_settings = maybe_unserialize($map_settings->other_settings); if (isset($map_other_settings['store_locator_query_string'])) { $sl_query_string = stripslashes($map_other_settings['store_locator_query_string']); } else { $sl_query_string = __("ZIP / Address:","wp-google-maps"); } if ($map_width_type == "px" && $map_width < 300) { $map_width = "300"; } $ret_msg = ""; $ret_msg .= "
"; $ret_msg .= "
"; $ret_msg .= "
".$sl_query_string."
"; $ret_msg .= "
"; $ret_msg .= "
"; $ret_msg .= "
"; $ret_msg .= "
".__("Radius","wp-google-maps").":
"; $ret_msg .= "
"; $ret_msg .= " "; $ret_msg .= "
"; $ret_msg .= "
"; if (function_exists("wpgmza_register_pro_version") && isset($map_other_settings['store_locator_category']) && $map_other_settings['store_locator_category'] == "1") { $ret_msg .= "
"; $ret_msg .= "
".__("Category","wp-google-maps").":
"; $ret_msg .= "
"; $ret_msg .= " ".wpgmza_pro_return_category_checkbox_list($map_id).""; $ret_msg .= "
"; $ret_msg .= "
"; } $ret_msg .= " "; $ret_msg .= "
"; $ret_msg .= "
"; return $ret_msg; } function wpgmaps_get_plugin_url() { if ( !function_exists('plugins_url') ) return get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__)); return plugins_url(plugin_basename(dirname(__FILE__))); } function wpgmaps_head() { global $wpgmza_tblname_maps; global $wpgmza_version; /* deprecated in version 6.0.30 as GoDaddy have added a "flush cache" feature */ /* $checker = get_dropins(); if (isset($checker['object-cache.php'])) { echo "

".__("Please note: WP Google Maps will not function correctly while using APC Object Cache. We have found that GoDaddy hosting packages automatically include this with their WordPress hosting packages. Please email GoDaddy and ask them to remove the object-cache.php from your wp-content/ directory.","wp-google-maps")."

"; } * */ if ((isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu") || (isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu-settings")) { wpgmaps_folder_check(); } if (isset($_POST['wpgmza_savemap'])){ global $wpdb; $map_id = esc_attr($_POST['wpgmza_id']); $map_title = esc_attr($_POST['wpgmza_title']); $map_height = esc_attr($_POST['wpgmza_height']); $map_width = esc_attr($_POST['wpgmza_width']); $map_width_type = esc_attr($_POST['wpgmza_map_width_type']); if ($map_width_type == "%") { $map_width_type = "\%"; } $map_height_type = esc_attr($_POST['wpgmza_map_height_type']); if ($map_height_type == "%") { $map_height_type = "\%"; } $map_start_location = esc_attr($_POST['wpgmza_start_location']); $map_start_zoom = intval($_POST['wpgmza_start_zoom']); $type = intval($_POST['wpgmza_map_type']); $alignment = intval($_POST['wpgmza_map_align']); $bicycle_enabled = intval($_POST['wpgmza_bicycle']); $traffic_enabled = intval($_POST['wpgmza_traffic']); $map_max_zoom = intval($_POST['wpgmza_max_zoom']); $gps = explode(",",$map_start_location); $map_start_lat = $gps[0]; $map_start_lng = $gps[1]; $other_settings = array(); $other_settings['store_locator_enabled'] = intval($_POST['wpgmza_store_locator']); $other_settings['store_locator_distance'] = intval($_POST['wpgmza_store_locator_distance']); $other_settings['store_locator_bounce'] = intval($_POST['wpgmza_store_locator_bounce']); $other_settings['store_locator_query_string'] = sanitize_text_field($_POST['wpgmza_store_locator_query_string']); if (isset($_POST['wpgmza_store_locator_restrict'])) { $other_settings['wpgmza_store_locator_restrict'] = esc_attr($_POST['wpgmza_store_locator_restrict']); } $other_settings['map_max_zoom'] = sanitize_text_field($map_max_zoom); $other_settings['weather_layer'] = intval($_POST['wpgmza_weather']); $other_settings['weather_layer_temp_type'] = intval($_POST['wpgmza_weather_temp_type']); $other_settings['cloud_layer'] = intval($_POST['wpgmza_cloud']); $other_settings['transport_layer'] = intval($_POST['wpgmza_transport']); $other_settings_data = maybe_serialize($other_settings); $data['map_default_starting_lat'] = $map_start_lat; $data['map_default_starting_lng'] = $map_start_lng; $data['map_default_height'] = $map_height; $data['map_default_width'] = $map_width; $data['map_default_zoom'] = $map_start_zoom; $data['map_default_max_zoom'] = $map_max_zoom; $data['map_default_type'] = $type; $data['map_default_alignment'] = $alignment; $data['map_default_width_type'] = $map_width_type; $data['map_default_height_type'] = $map_height_type; $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET map_title = %s, map_width = %s, map_height = %s, map_start_lat = %f, map_start_lng = %f, map_start_location = %s, map_start_zoom = %d, type = %d, bicycle = %d, traffic = %d, alignment = %d, map_width_type = %s, map_height_type = %s, other_settings = %s WHERE id = %d", $map_title, $map_width, $map_height, $map_start_lat, $map_start_lng, $map_start_location, $map_start_zoom, $type, $bicycle_enabled, $traffic_enabled, $alignment, $map_width_type, $map_height_type, $other_settings_data, $map_id) ); update_option('WPGMZA_SETTINGS', $data); echo "
"; _e("Your settings have been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_maker_location'])){ global $wpdb; global $wpgmza_tblname; $mid = esc_attr($_POST['wpgmaps_marker_id']); $wpgmaps_marker_lat = esc_attr($_POST['wpgmaps_marker_lat']); $wpgmaps_marker_lng = esc_attr($_POST['wpgmaps_marker_lng']); $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname SET lat = %s, lng = %s WHERE id = %d", $wpgmaps_marker_lat, $wpgmaps_marker_lng, $mid) ); echo "
"; _e("Your marker location has been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_poly'])){ global $wpdb; global $wpgmza_tblname_poly; $mid = esc_attr($_POST['wpgmaps_map_id']); if (!isset($_POST['wpgmza_polygon']) || $_POST['wpgmza_polygon'] == "") { echo "
"; _e("You cannot save a blank polygon","wp-google-maps"); echo "
"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polygon']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = "Polyline"; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_fill'])) { $fillcolor = esc_attr($_POST['poly_fill']); } else { $fillcolor = "66FF00"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "0.5"; } if (isset($_POST['poly_line_opacity'])) { $line_opacity = esc_attr($_POST['poly_line_opacity']); } else { $line_opacity = "0.5"; } if (isset($_POST['poly_line_hover_line_color'])) { $ohlinecolor = esc_attr($_POST['poly_line_hover_line_color']); } else { $ohlinecolor = ""; } if (isset($_POST['poly_hover_fill_color'])) { $ohfillcolor = esc_attr($_POST['poly_hover_fill_color']); } else { $ohfillcolor = ""; } if (isset($_POST['poly_hover_opacity'])) { $ohopacity = esc_attr($_POST['poly_hover_opacity']); } else { $ohopacity = ""; } $rows_affected = $wpdb->query( $wpdb->prepare( "INSERT INTO $wpgmza_tblname_poly SET map_id = %d, polydata = %s, polyname = %s, linecolor = %s, lineopacity = %s, fillcolor = %s, opacity = %s, ohlinecolor = %s, ohfillcolor = %s, ohopacity = %s ", $mid, $wpgmaps_polydata, $polyname, $linecolor, $line_opacity, $fillcolor, $opacity, $ohlinecolor, $ohfillcolor, $ohopacity ) ); echo "
"; _e("Your polygon has been created.","wp-google-maps"); echo "
"; } } else if (isset($_POST['wpgmza_edit_poly'])){ global $wpdb; global $wpgmza_tblname_poly; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_id']); if (!isset($_POST['wpgmza_polygon']) || $_POST['wpgmza_polygon'] == "") { echo "
"; _e("You cannot save a blank polygon","wp-google-maps"); echo "
"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polygon']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = "Polyline"; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_fill'])) { $fillcolor = esc_attr($_POST['poly_fill']); } else { $fillcolor = "66FF00"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "0.5"; } if (isset($_POST['poly_line_opacity'])) { $line_opacity = esc_attr($_POST['poly_line_opacity']); } else { $line_opacity = "0.5"; } if (isset($_POST['poly_line_hover_line_color'])) { $ohlinecolor = esc_attr($_POST['poly_line_hover_line_color']); } else { $ohlinecolor = ""; } if (isset($_POST['poly_hover_fill_color'])) { $ohfillcolor = esc_attr($_POST['poly_hover_fill_color']); } else { $ohfillcolor = ""; } if (isset($_POST['poly_hover_opacity'])) { $ohopacity = esc_attr($_POST['poly_hover_opacity']); } else { $ohopacity = ""; } $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_poly SET polydata = %s, polyname = %s, linecolor = %s, lineopacity = %s, fillcolor = %s, opacity = %s, ohlinecolor = %s, ohfillcolor = %s, ohopacity = %s WHERE `id` = %d" , $wpgmaps_polydata, $polyname, $linecolor, $line_opacity, $fillcolor, $opacity, $ohlinecolor, $ohfillcolor, $ohopacity, $pid ) ); echo "
"; _e("Your polygon has been saved.","wp-google-maps"); echo "
"; } } else if (isset($_POST['wpgmza_save_polyline'])){ global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") { echo "
"; _e("You cannot save a blank polyline","wp-google-maps"); echo "
"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = ""; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_thickness'])) { $linethickness = esc_attr($_POST['poly_thickness']); } else { $linethickness = "0"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "1"; } $rows_affected = $wpdb->query( $wpdb->prepare( "INSERT INTO $wpgmza_tblname_polylines SET map_id = %d, polydata = %s, polyname = %s, linecolor = %s, linethickness = %s, opacity = %s ", $mid, $wpgmaps_polydata, $polyname, $linecolor, $linethickness, $opacity ) ); echo "
"; _e("Your polyline has been created.","wp-google-maps"); echo "
"; } } else if (isset($_POST['wpgmza_edit_polyline'])){ global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_id']); if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") { echo "
"; _e("You cannot save a blank polyline","wp-google-maps"); echo "
"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = ""; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_thickness'])) { $linethickness = esc_attr($_POST['poly_thickness']); } else { $linethickness = "0"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "1"; } $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_polylines SET polydata = %s, polyname = %s, linecolor = %s, linethickness = %s, opacity = %s WHERE `id` = %d" , $wpgmaps_polydata, $polyname, $linecolor, $linethickness, $opacity, $pid ) ); echo "
"; _e("Your polyline has been saved.","wp-google-maps"); echo "
"; } } else if (isset($_POST['wpgmza_save_settings'])){ global $wpdb; $wpgmza_data = array(); if (isset($_POST['wpgmza_settings_map_streetview'])) { $wpgmza_data['wpgmza_settings_map_streetview'] = esc_attr($_POST['wpgmza_settings_map_streetview']); } if (isset($_POST['wpgmza_settings_map_zoom'])) { $wpgmza_data['wpgmza_settings_map_zoom'] = esc_attr($_POST['wpgmza_settings_map_zoom']); } if (isset($_POST['wpgmza_settings_map_pan'])) { $wpgmza_data['wpgmza_settings_map_pan'] = esc_attr($_POST['wpgmza_settings_map_pan']); } if (isset($_POST['wpgmza_settings_map_type'])) { $wpgmza_data['wpgmza_settings_map_type'] = esc_attr($_POST['wpgmza_settings_map_type']); } if (isset($_POST['wpgmza_settings_force_jquery'])) { $wpgmza_data['wpgmza_settings_force_jquery'] = esc_attr($_POST['wpgmza_settings_force_jquery']); } if (isset($_POST['wpgmza_settings_map_scroll'])) { $wpgmza_data['wpgmza_settings_map_scroll'] = esc_attr($_POST['wpgmza_settings_map_scroll']); } if (isset($_POST['wpgmza_settings_map_draggable'])) { $wpgmza_data['wpgmza_settings_map_draggable'] = esc_attr($_POST['wpgmza_settings_map_draggable']); } if (isset($_POST['wpgmza_settings_map_clickzoom'])) { $wpgmza_data['wpgmza_settings_map_clickzoom'] = esc_attr($_POST['wpgmza_settings_map_clickzoom']); } if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza_data['wpgmza_settings_map_open_marker_by'] = esc_attr($_POST['wpgmza_settings_map_open_marker_by']); } if (isset($_POST['wpgmza_api_version'])) { $wpgmza_data['wpgmza_api_version'] = esc_attr($_POST['wpgmza_api_version']); } if (isset($_POST['wpgmza_custom_css'])) { $wpgmza_data['wpgmza_custom_css'] = esc_attr($_POST['wpgmza_custom_css']); } if (isset($_POST['wpgmza_marker_xml_location'])) { update_option("wpgmza_xml_location",$_POST['wpgmza_marker_xml_location']); } if (isset($_POST['wpgmza_marker_xml_url'])) { update_option("wpgmza_xml_url",$_POST['wpgmza_marker_xml_url']); } if (isset($_POST['wpgmza_access_level'])) { $wpgmza_data['wpgmza_settings_access_level'] = esc_attr($_POST['wpgmza_access_level']); } if (isset($_POST['wpgmza_settings_marker_pull'])) { $wpgmza_data['wpgmza_settings_marker_pull'] = esc_attr($_POST['wpgmza_settings_marker_pull']); } update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data); echo "
"; _e("Your settings have been saved.","wp-google-maps"); echo "
"; } } function wpgmaps_feedback_head() { if (isset($_POST['wpgmza_save_feedback'])) { global $wpgmza_pro_version; global $wpgmza_global_array; if (function_exists('curl_version')) { $request_url = "http://www.wpgmaps.com/apif/rec.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $wpgmza_global_array['message'] = __('Thank you for your feedback!','wp-google-maps'); $wpgmza_global_array['code'] = '100'; } else { $wpgmza_global_array['message'] = __('Thank you for your feedback!','wp-google-maps'); $wpgmza_global_array['code'] = '100'; } } } function wpgmaps_head_old() { global $wpgmza_tblname_maps; if (isset($_POST['wpgmza_savemap'])){ global $wpdb; $map_id = esc_attr($_POST['wpgmza_id']); $map_title = esc_attr($_POST['wpgmza_title']); $map_height = esc_attr($_POST['wpgmza_height']); $map_width = esc_attr($_POST['wpgmza_width']); $map_width_type = esc_attr($_POST['wpgmza_map_width_type']); if ($map_width_type == "%") { $map_width_type = "\%"; } $map_height_type = esc_attr($_POST['wpgmza_map_height_type']); if ($map_height_type == "%") { $map_height_type = "\%"; } $map_start_location = esc_attr($_POST['wpgmza_start_location']); $map_start_zoom = intval($_POST['wpgmza_start_zoom']); $type = intval($_POST['wpgmza_map_type']); $alignment = intval($_POST['wpgmza_map_align']); $order_markers_by = intval($_POST['wpgmza_order_markers_by']); $order_markers_choice = intval($_POST['wpgmza_order_markers_choice']); $show_user_location = intval($_POST['wpgmza_show_user_location']); $directions_enabled = intval($_POST['wpgmza_directions']); $bicycle_enabled = intval($_POST['wpgmza_bicycle']); $traffic_enabled = intval($_POST['wpgmza_traffic']); $dbox = intval($_POST['wpgmza_dbox']); $dbox_width = esc_attr($_POST['wpgmza_dbox_width']); $default_to = esc_attr($_POST['wpgmza_default_to']); $listmarkers = intval($_POST['wpgmza_listmarkers']); $listmarkers_advanced = intval($_POST['wpgmza_listmarkers_advanced']); $filterbycat = intval($_POST['wpgmza_filterbycat']); $gps = explode(",",$map_start_location); $map_start_lat = $gps[0]; $map_start_lng = $gps[1]; $map_default_marker = $_POST['upload_default_marker']; $kml = esc_attr($_POST['wpgmza_kml']); $fusion = esc_attr($_POST['wpgmza_fusion']); $data['map_default_starting_lat'] = $map_start_lat; $data['map_default_starting_lng'] = $map_start_lng; $data['map_default_height'] = $map_height; $data['map_default_width'] = $map_width; $data['map_default_zoom'] = $map_start_zoom; $data['map_default_type'] = $type; $data['map_default_alignment'] = $alignment; $data['map_default_order_markers_by'] = $order_markers_by; $data['map_default_order_markers_choice'] = $order_markers_choice; $data['map_default_show_user_location'] = $show_user_location; $data['map_default_directions'] = $directions_enabled; $data['map_default_bicycle'] = $bicycle_enabled; $data['map_default_traffic'] = $traffic_enabled; $data['map_default_dbox'] = $dbox; $data['map_default_dbox_width'] = $dbox_width; $data['map_default_default_to'] = $default_to; $data['map_default_listmarkers'] = $listmarkers; $data['map_default_listmarkers_advanced'] = $listmarkers_advanced; $data['map_default_filterbycat'] = $filterbycat; $data['map_default_marker'] = $map_default_marker; $data['map_default_width_type'] = $map_width_type; $data['map_default_height_type'] = $map_height_type; $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET map_title = %s, map_width = %s, map_height = %s, map_start_lat = %f, map_start_lng = %f, map_start_location = %s, map_start_zoom = %d, default_marker = %s, type = %d, alignment = %d, order_markers_by = %d, order_markers_choice = %d, show_user_location = %d, directions_enabled = %d, kml = %s, bicycle = %d, traffic = %d, dbox = %d, dbox_width = %s, default_to = %s, listmarkers = %d, listmarkers_advanced = %d, filterbycat = %d, fusion = %s, map_width_type = %s, map_height_type = %s WHERE id = %d", $map_title, $map_width, $map_height, $map_start_lat, $map_start_lng, $map_start_location, $map_start_zoom, $map_default_marker, $type, $alignment, $order_markers_by, $order_markers_choice, $show_user_location, $directions_enabled, $kml, $bicycle_enabled, $traffic_enabled, $dbox, $dbox_width, $default_to, $listmarkers, $listmarkers_advanced, $filterbycat, $fusion, $map_width_type, $map_height_type, $map_id) ); update_option('WPGMZA_SETTINGS', $data); echo "
"; _e("Your settings have been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_maker_location'])){ global $wpdb; global $wpgmza_tblname; $mid = esc_attr($_POST['wpgmaps_marker_id']); $wpgmaps_marker_lat = esc_attr($_POST['wpgmaps_marker_lat']); $wpgmaps_marker_lng = esc_attr($_POST['wpgmaps_marker_lng']); $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname SET lat = %s, lng = %s WHERE id = %d", $wpgmaps_marker_lat, $wpgmaps_marker_lng, $mid) ); echo "
"; _e("Your marker location has been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_poly'])){ global $wpdb; global $wpgmza_tblname_poly; $mid = esc_attr($_POST['wpgmaps_map_id']); $wpgmaps_polydata = esc_attr($_POST['wpgmza_polygon']); $linecolor = esc_attr($_POST['poly_line']); $fillcolor = esc_attr($_POST['poly_fill']); $opacity = esc_attr($_POST['poly_opacity']); $rows_affected = $wpdb->query( $wpdb->prepare( "INSERT INTO $wpgmza_tblname_poly SET map_id = %d, polydata = %s, linecolor = %s, fillcolor = %s, opacity = %s ", $mid, $wpgmaps_polydata, $linecolor, $fillcolor, $opacity ) ); echo "
"; _e("Your polygon has been created.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_edit_poly'])){ global $wpdb; global $wpgmza_tblname_poly; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_id']); $wpgmaps_polydata = esc_attr($_POST['wpgmza_polygon']); $linecolor = esc_attr($_POST['poly_line']); $fillcolor = esc_attr($_POST['poly_fill']); $opacity = esc_attr($_POST['poly_opacity']); $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_poly SET polydata = %s, linecolor = %s, fillcolor = %s, opacity = %s WHERE `id` = %d" , $wpgmaps_polydata, $linecolor, $fillcolor, $opacity, $pid ) ); echo "
"; _e("Your polygon has been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_polyline'])){ global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); $linecolor = esc_attr($_POST['poly_line']); $linethickness = esc_attr($_POST['poly_thickness']); $opacity = esc_attr($_POST['poly_opacity']); $rows_affected = $wpdb->query( $wpdb->prepare( "INSERT INTO $wpgmza_tblname_polylines SET map_id = %d, polydata = %s, linecolor = %s, linethickness = %s, opacity = %s ", $mid, $wpgmaps_polydata, $linecolor, $linethickness, $opacity ) ); echo "
"; _e("Your polyline has been created.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_edit_polyline'])){ global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_id']); $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); $linecolor = esc_attr($_POST['poly_line']); $linethickness = esc_attr($_POST['poly_thickness']); $opacity = esc_attr($_POST['poly_opacity']); $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_polylines SET polydata = %s, linecolor = %s, linethickness = %s, opacity = %s WHERE `id` = %d" , $wpgmaps_polydata, $linecolor, $linethickness, $opacity, $pid ) ); echo "
"; _e("Your polyline has been saved.","wp-google-maps"); echo "
"; } else if (isset($_POST['wpgmza_save_settings'])){ global $wpdb; $wpgmza_data['wpgmza_settings_image_width'] = esc_attr($_POST['wpgmza_settings_image_width']); $wpgmza_data['wpgmza_settings_image_height'] = esc_attr($_POST['wpgmza_settings_image_height']); $wpgmza_data['wpgmza_settings_use_timthumb'] = esc_attr($_POST['wpgmza_settings_use_timthumb']); $wpgmza_data['wpgmza_settings_infowindow_width'] = esc_attr($_POST['wpgmza_settings_infowindow_width']); $wpgmza_data['wpgmza_settings_infowindow_links'] = esc_attr($_POST['wpgmza_settings_infowindow_links']); $wpgmza_data['wpgmza_settings_infowindow_address'] = esc_attr($_POST['wpgmza_settings_infowindow_address']); $wpgmza_data['wpgmza_settings_infowindow_link_text'] = esc_attr($_POST['wpgmza_settings_infowindow_link_text']); $wpgmza_data['wpgmza_settings_map_streetview'] = esc_attr($_POST['wpgmza_settings_map_streetview']); $wpgmza_data['wpgmza_settings_map_zoom'] = esc_attr($_POST['wpgmza_settings_map_zoom']); $wpgmza_data['wpgmza_settings_map_pan'] = esc_attr($_POST['wpgmza_settings_map_pan']); $wpgmza_data['wpgmza_settings_map_type'] = esc_attr($_POST['wpgmza_settings_map_type']); $wpgmza_data['wpgmza_settings_map_scroll'] = esc_attr($_POST['wpgmza_settings_map_scroll']); $wpgmza_data['wpgmza_settings_map_draggable'] = esc_attr($_POST['wpgmza_settings_map_draggable']); $wpgmza_data['wpgmza_settings_map_clickzoom'] = esc_attr($_POST['wpgmza_settings_map_clickzoom']); $wpgmza_data['wpgmza_settings_ugm_striptags'] = esc_attr($_POST['wpgmza_settings_map_striptags']); $wpgmza_data['wpgmza_settings_force_jquery'] = esc_attr($_POST['wpgmza_settings_force_jquery']); $wpgmza_data['wpgmza_settings_markerlist_category'] = esc_attr($_POST['wpgmza_settings_markerlist_category']); $wpgmza_data['wpgmza_settings_markerlist_icon'] = esc_attr($_POST['wpgmza_settings_markerlist_icon']); $wpgmza_data['wpgmza_settings_markerlist_title'] = esc_attr($_POST['wpgmza_settings_markerlist_title']); $wpgmza_data['wpgmza_settings_markerlist_address'] = esc_attr($_POST['wpgmza_settings_markerlist_address']); $wpgmza_data['wpgmza_settings_markerlist_description'] = esc_attr($_POST['wpgmza_settings_markerlist_description']); update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data); echo "
"; _e("Your settings have been saved.","wp-google-maps"); echo "
"; } } function wpgmaps_admin_menu() { $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_access_level'])) { $access_level = $wpgmza_settings['wpgmza_settings_access_level']; } else { $access_level = "manage_options"; } add_menu_page('WPGoogle Maps', __('Maps','wp-google-maps'), $access_level, 'wp-google-maps-menu', 'wpgmaps_menu_layout', wpgmaps_get_plugin_url()."/images/map_app_small.png"); if (function_exists('wpgmaps_menu_category_layout')) { add_submenu_page('wp-google-maps-menu', 'WP Google Maps - Categories', __('Categories','wp-google-maps'), $access_level , 'wp-google-maps-menu-categories', 'wpgmaps_menu_category_layout'); } if (function_exists('wpgmza_register_pro_version')) { add_submenu_page('wp-google-maps-menu', 'WP Google Maps - Advanced Options', __('Advanced','wp-google-maps'), $access_level , 'wp-google-maps-menu-advanced', 'wpgmaps_menu_advanced_layout'); } add_submenu_page('wp-google-maps-menu', 'WP Google Maps - Settings', __('Settings','wp-google-maps'), $access_level , 'wp-google-maps-menu-settings', 'wpgmaps_menu_settings_layout'); add_submenu_page('wp-google-maps-menu', 'WP Google Maps - Support', __('Support','wp-google-maps'), $access_level , 'wp-google-maps-menu-support', 'wpgmaps_menu_support_layout'); } function wpgmaps_menu_layout() { $handle = 'avia-google-maps-api'; $list = 'enqueued'; if (wp_script_is( $handle, $list )) { wp_deregister_script('avia-google-maps-api'); } /*check to see if we have write permissions to the plugin folder*/ if (!isset($_GET['action'])) { wpgmza_map_page(); } else { echo"
".__("Experiencing problems with the plugin?","wp-google-maps")."
".__("See the troubleshooting manual.","wp-google-maps")."
".__("Or ask a question on our ","wp-google-maps")." ".__("Support forum.","wp-google-maps")."
"; if ($_GET['action'] == "trash" && isset($_GET['map_id'])) { if ($_GET['s'] == "1") { if (wpgmaps_trash_map($_GET['map_id'])) { echo ""; } else { _e("There was a problem deleting the map.","wp-google-maps"); } } else { $res = wpgmza_get_map_data($_GET['map_id']); echo "

".__("Delete your map","wp-google-maps")."

".__("Are you sure you want to delete the map","wp-google-maps")." \"".$res->map_title."?\"
".__("Yes","wp-google-maps")." | ".__("No","wp-google-maps")."

"; } } if ($_GET['action'] == "duplicate" && isset($_GET['map_id'])) { if (function_exists('wpgmaps_duplicate_map')) { $new_id = wpgmaps_duplicate_map($_GET['map_id']); if ($new_id > 0) { wpgmza_map_page(); } else { _e("There was a problem duplicating the map.","wp-google-maps"); wpgmza_map_page(); } } } else if ($_GET['action'] == "edit_marker" && isset($_GET['id'])) { wpgmza_edit_marker(sanitize_text_field($_GET['id'])); } else if ($_GET['action'] == "add_poly" && isset($_GET['map_id'])) { if (function_exists("wpgmza_b_real_pro_add_poly")) { wpgmza_b_real_pro_add_poly(sanitize_text_field($_GET['map_id'])); } else { wpgmza_b_pro_add_poly(sanitize_text_field($_GET['map_id'])); } } else if ($_GET['action'] == "edit_poly" && isset($_GET['map_id'])) { if (function_exists("wpgmza_b_real_pro_edit_poly")) { wpgmza_b_real_pro_edit_poly(sanitize_text_field($_GET['map_id'])); } else { wpgmza_b_pro_edit_poly(sanitize_text_field($_GET['map_id'])); } } else if ($_GET['action'] == "add_polyline" && isset($_GET['map_id'])) { wpgmza_b_pro_add_polyline(sanitize_text_field($_GET['map_id'])); } else if ($_GET['action'] == "edit_polyline" && isset($_GET['map_id'])) { wpgmza_b_pro_edit_polyline(sanitize_text_field($_GET['map_id'])); } else if ($_GET['action'] == 'welcome_page') { $file = dirname(__FILE__).'/base/classes/WPGM_templates.php'; include ($file); $wpgmc = new WPGMAPS_templates(); $wpgmc->welcome_page(); } else { if (function_exists('wpgmza_register_pro_version')) { $prov = get_option("WPGMZA_PRO"); $wpgmza_pro_version = $prov['version']; if (floatval($wpgmza_pro_version) < 5.41) { wpgmaps_upgrade_notice(); wpgmza_pro_menu(); } else { wpgmza_pro_menu(); } } else { wpgmza_basic_menu(); } } } } function wpgmaps_menu_marker_layout() { if (!$_GET['action']) { wpgmza_marker_page(); } else { echo"
".__("Experiencing problems with the plugin?","wp-google-maps")."
".__("See the troubleshooting manual.","wp-google-maps")."
"; if ($_GET['action'] == "trash" && isset($_GET['marker_id'])) { if ($_GET['s'] == "1") { if (wpgmaps_trash_marker(sanitize_text_field($_GET['marker_id']))) { echo ""; } else { _e("There was a problem deleting the marker.");; } } else { $res = wpgmza_get_marker_data(sanitize_text_field($_GET['map_id'])); echo "

".__("Delete Marker","wp-google-maps")."

".__("Are you sure you want to delete this marker:","wp-google-maps")." \"".$res->address."?\"
".__("Yes","wp-google-maps")." | ".__("No","wp-google-maps")."

"; } } } } function wpgmaps_menu_settings_layout() { if (function_exists('wpgmza_register_pro_version')) { if (function_exists('wpgmaps_settings_page_pro')) { wpgmaps_settings_page_pro(); } } else { wpgmaps_settings_page_basic(); } } function wpgmaps_settings_page_basic() { echo"

".__("WP Google Map Settings","wp-google-maps")."

"; $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_map_streetview'])) { $wpgmza_settings_map_streetview = $wpgmza_settings['wpgmza_settings_map_streetview']; } if (isset($wpgmza_settings['wpgmza_settings_map_zoom'])) { $wpgmza_settings_map_zoom = $wpgmza_settings['wpgmza_settings_map_zoom']; } if (isset($wpgmza_settings['wpgmza_settings_map_pan'])) { $wpgmza_settings_map_pan = $wpgmza_settings['wpgmza_settings_map_pan']; } if (isset($wpgmza_settings['wpgmza_settings_map_type'])) { $wpgmza_settings_map_type = $wpgmza_settings['wpgmza_settings_map_type']; } if (isset($wpgmza_settings['wpgmza_settings_force_jquery'])) { $wpgmza_force_jquery = $wpgmza_settings['wpgmza_settings_force_jquery']; } if (isset($wpgmza_settings['wpgmza_settings_map_scroll'])) { $wpgmza_settings_map_scroll = $wpgmza_settings['wpgmza_settings_map_scroll']; } if (isset($wpgmza_settings['wpgmza_settings_map_draggable'])) { $wpgmza_settings_map_draggable = $wpgmza_settings['wpgmza_settings_map_draggable']; } if (isset($wpgmza_settings['wpgmza_settings_map_clickzoom'])) { $wpgmza_settings_map_clickzoom = $wpgmza_settings['wpgmza_settings_map_clickzoom']; } if (isset($wpgmza_settings['wpgmza_api_version'])) { $wpgmza_api_version = $wpgmza_settings['wpgmza_api_version']; } if (isset($wpgmza_settings['wpgmza_custom_css'])) { $wpgmza_custom_css = $wpgmza_settings['wpgmza_custom_css']; } else { $wpgmza_custom_css = ""; } $wpgmza_api_version_selected = array(); $wpgmza_api_version_selected[0] = ""; $wpgmza_api_version_selected[1] = ""; $wpgmza_api_version_selected[2] = ""; if (isset($wpgmza_api_version) && $wpgmza_api_version == "3.14") { $wpgmza_api_version_selected[0] = "selected"; } else if (isset($wpgmza_api_version) && $wpgmza_api_version == "3.15") { $wpgmza_api_version_selected[1] = "selected"; } else if (isset($wpgmza_api_version) && $wpgmza_api_version == "3.exp") { $wpgmza_api_version_selected[2] = "selected"; } else { $wpgmza_api_version_selected[0] = "selected"; } $wpgmza_settings_map_open_marker_by_checked[0] = ""; $wpgmza_settings_map_open_marker_by_checked[1] = ""; if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_settings_map_open_marker_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_settings_map_open_marker_by = false; } if ($wpgmza_settings_map_open_marker_by == '1') { $wpgmza_settings_map_open_marker_by_checked[0] = "checked='checked'"; } else if ($wpgmza_settings_map_open_marker_by == '2') { $wpgmza_settings_map_open_marker_by_checked[1] = "checked='checked'"; } else { $wpgmza_settings_map_open_marker_by_checked[0] = "checked='checked'"; } $show_advanced_marker_tr = 'style="visibility:hidden; display:none;"'; $wpgmza_settings_marker_pull_checked[0] = ""; $wpgmza_settings_marker_pull_checked[1] = ""; if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $wpgmza_settings_marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $wpgmza_settings_marker_pull = false; } if ($wpgmza_settings_marker_pull == '0' || $wpgmza_settings_marker_pull == 0) { $wpgmza_settings_marker_pull_checked[0] = "checked='checked'"; $show_advanced_marker_tr = 'style="visibility:hidden; display:none;"'; } else if ($wpgmza_settings_marker_pull == '1' || $wpgmza_settings_marker_pull == 1) { $wpgmza_settings_marker_pull_checked[1] = "checked='checked'"; $show_advanced_marker_tr = 'style="visibility:visible; display:table-row;"'; } else { $wpgmza_settings_marker_pull_checked[0] = "checked='checked'"; $show_advanced_marker_tr = 'style="visibility:hidden; display:none;"'; } $wpgmza_access_level_checked[0] = ""; $wpgmza_access_level_checked[1] = ""; $wpgmza_access_level_checked[2] = ""; $wpgmza_access_level_checked[3] = ""; $wpgmza_access_level_checked[4] = ""; if (isset($wpgmza_settings['wpgmza_settings_access_level'])) { $wpgmza_access_level = $wpgmza_settings['wpgmza_settings_access_level']; } else { $wpgmza_access_level = ""; } if ($wpgmza_access_level == "manage_options") { $wpgmza_access_level_checked[0] = "selected"; } else if ($wpgmza_access_level == "edit_pages") { $wpgmza_access_level_checked[1] = "selected"; } else if ($wpgmza_access_level == "publish_posts") { $wpgmza_access_level_checked[2] = "selected"; } else if ($wpgmza_access_level == "edit_posts") { $wpgmza_access_level_checked[3] = "selected"; } else if ($wpgmza_access_level == "read") { $wpgmza_access_level_checked[4] = "selected"; } else { $wpgmza_access_level_checked[0] = "selected"; } if (isset($wpgmza_settings_map_scroll)) { if ($wpgmza_settings_map_scroll == "yes") { $wpgmza_scroll_checked = "checked='checked'"; } else { $wpgmza_scroll_checked = ""; } } else { $wpgmza_scroll_checked = ""; } if (isset($wpgmza_settings_map_draggable)) { if ($wpgmza_settings_map_draggable == "yes") { $wpgmza_draggable_checked = "checked='checked'"; } else { $wpgmza_draggable_checked = ""; } } else { $wpgmza_draggable_checked = ""; } if (isset($wpgmza_settings_map_clickzoom)) { if ($wpgmza_settings_map_clickzoom == "yes") { $wpgmza_clickzoom_checked = "checked='checked'"; } else { $wpgmza_clickzoom_checked = ""; } } else { $wpgmza_clickzoom_checked = ""; } if (isset($wpgmza_settings_map_streetview)) { if ($wpgmza_settings_map_streetview == "yes") { $wpgmza_streetview_checked = "checked='checked'"; } else { $wpgmza_streetview_checked = ""; } } else { $wpgmza_streetview_checked = ""; } if (isset($wpgmza_settings_map_zoom)) { if ($wpgmza_settings_map_zoom == "yes") { $wpgmza_zoom_checked = "checked='checked'"; } else { $wpgmza_zoom_checked = ""; } } else { $wpgmza_zoom_checked = ""; } if (isset($wpgmza_settings_map_pan)) { if ($wpgmza_settings_map_pan == "yes") { $wpgmza_pan_checked = "checked='checked'"; } else { $wpgmza_pan_checked = ""; } } else { $wpgmza_pan_checked = ""; } if (isset($wpgmza_settings_map_type)) { if ($wpgmza_settings_map_type == "yes") { $wpgmza_type_checked = "checked='checked'"; } else { $wpgmza_type_checked = ""; } } else { $wpgmza_type_checked = ""; } if (isset($wpgmza_force_jquery)) { if ($wpgmza_force_jquery == "yes") { $wpgmza_force_jquery_checked = "checked='checked'"; } else { $wpgmza_force_jquery_checked = ""; } } else { $wpgmza_force_jquery_checked = ""; } if (function_exists('wpgmza_register_pro_version')) { $pro_settings1 = wpgmaps_settings_page_sub('infowindow'); $prov = get_option("WPGMZA_PRO"); $wpgmza_pro_version = $prov['version']; if (floatval($wpgmza_pro_version) < 3.9) { $prov_msg = "

Please note that these settings will only work with the Pro Addon version 3.9 and above. Your current version is $wpgmza_pro_version. To download the latest version, please email nick@wpgmaps.com

"; } } else { $pro_settings1 = ""; $prov_msg = ""; } $marker_location = wpgmza_return_marker_path(); $marker_url = wpgmza_return_marker_url(); $wpgmza_file_perms = substr(sprintf('%o', @fileperms($marker_location)), -4); $fpe = false; $fpe_error = ""; if ($wpgmza_file_perms == "0777" || $wpgmza_file_perms == "0755" || $wpgmza_file_perms == "0775" || $wpgmza_file_perms == "0705" || $wpgmza_file_perms == "2777" || $wpgmza_file_perms == "2755" || $wpgmza_file_perms == "2775" || $wpgmza_file_perms == "2705") { $fpe = true; $fpe_error = ""; } else if ($wpgmza_file_perms == "0") { $fpe = false; $fpe_error = __("This folder does not exist. Please create it.","wp-google-maps"). " ($marker_location)"; } else { $fpe = false; $fpe_error = __("File Permissions:","wp-google-maps").$wpgmza_file_perms." ".__(" - The plugin does not have write access to this folder. Please CHMOD this folder to 755 or 777, or change the location","wp-google-maps"); } if (!$fpe) { $wpgmza_file_perms_check = "$fpe_error"; } else { $wpgmza_file_perms_check = "$fpe_error"; } $upload_dir = wp_upload_dir(); $ret = "
"; $ret .= "

$prov_msg

"; $ret .= "
"; $ret .= " "; $ret .= "
"; $ret .= "

".__("Map Settings")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("General Map Settings","wp-google-maps").":"; $ret .= " ".__("Disable StreetView")."
"; $ret .= " ".__("Disable Zoom Controls")."
"; $ret .= " ".__("Disable Pan Controls")."
"; $ret .= " ".__("Disable Map Type Controls")."
"; $ret .= " ".__("Disable Mouse Wheel Zoom","wp-google-maps")."
"; $ret .= " ".__("Disable Mouse Dragging","wp-google-maps")."
"; $ret .= " ".__("Disable Mouse Double Click Zooming","wp-google-maps")."
"; $ret .= "
".__("Troubleshooting Options","wp-google-maps").":"; $ret .= " ".__("Over-ride current jQuery with version 1.8.3 (Tick this box if you are receiving jQuery related errors)")."
"; $ret .= "
".__("Use Google Maps API","wp-google-maps").":"; $ret .= " "; $ret .= "
".__("Lowest level of access to the map editor","wp-google-maps").":"; $ret .= " "; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= "

".__("Marker InfoWindow Settings")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("Open Marker InfoWindows by","wp-google-maps")." Click
Hover
"; $ret .= "
"; $ret .= "
"; $ret .= " "; $ret .= "

".__("Marker Listing Settings","wp-google-maps")."

"; $ret .= "

".__("Changing these settings will alter the way the marker list appears on your website.","wp-google-maps")."

"; $ret .= "
"; $ret .= "
    "; $ret .= "
  • "; $ret .= " Add Beautiful Marker Listings to your maps with the Pro version for only $19.99 once off. Support and updates included forever."; $ret .= "
  • "; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= "

".__("Advanced Marker Listing","wp-google-maps")."

"; $ret .= "
"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("Column settings","wp-google-maps").""; $ret .= " ".__("Hide the Icon column","wp-google-maps")."
"; $ret .= " ".__("Hide the Title column","wp-google-maps")."
"; $ret .= " ".__("Hide the Address column","wp-google-maps")."
"; $ret .= " ".__("Hide the Category column","wp-google-maps")."
"; $ret .= " ".__("Hide the Description column","wp-google-maps")."
"; $ret .= "
"; $ret .= "
"; $ret .= "

".__("Carousel Marker Listing","wp-google-maps")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("Theme selection","wp-google-maps").""; $ret .= " "; $ret .= "
".__("Carousel settings","wp-google-maps").""; $ret .= " ".__("Hide the Image","wp-google-maps")."
"; $ret .= " ".__("Hide the Title","wp-google-maps")."
"; $ret .= " ".__("Hide the Marker Icon","wp-google-maps")."
"; $ret .= " ".__("Hide the Address","wp-google-maps")."
"; $ret .= " ".__("Hide the Description","wp-google-maps")."
"; $ret .= " ".__("Hide the Marker Link","wp-google-maps")."
"; $ret .= " ".__("Hide the Directions Link","wp-google-maps")."
"; $ret .= "
".__("Resize Images with Timthumb","wp-google-maps")."
"; $ret .= "
".__("Enable lazyload of images","wp-google-maps")."
"; $ret .= " ".__("Enable autoheight","wp-google-maps")."
"; $ret .= " ".__("Enable pagination","wp-google-maps")."
"; $ret .= " ".__("Enable navigation","wp-google-maps")."
"; $ret .= " ".__("Items","wp-google-maps")."
"; $ret .= " ".__("Autoplay after x milliseconds (1000 = 1 second)","wp-google-maps")."
"; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= "

".__("Advanced Settings","wp-google-maps")."

"; $ret .= "

".__("Marker Data Location","wp-google-maps")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "

".__("We suggest that you change the two fields below ONLY if you are experiencing issues when trying to save the marker XML files.","wp-google-maps")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("Pull marker data from","wp-google-maps")." " . " ".__("Database (Great for small amounts of markers)","wp-google-maps")."
" . " ".__("XML File (Great for large amounts of markers)","wp-google-maps") . "
".__("Marker data XML directory","wp-google-maps").":"; $ret .= " $wpgmza_file_perms_check"; $ret .= "
"; $ret .= " ".__("You can use the following","wp-google-maps").": {wp_content_dir},{plugins_dir},{uploads_dir}

"; $ret .= " ".__("Currently using","wp-google-maps").": $marker_location
"; $ret .= "
".__("Marker data XML URL","wp-google-maps").":"; $ret .= " "; $ret .= "
"; $ret .= "
"; $ret .= " ".__("You can use the following","wp-google-maps").": {wp_content_url},{plugins_url},{uploads_url}

"; $ret .= " ".__("Currently using","wp-google-maps").": $marker_url
"; $ret .= "
"; $ret .= "

".__("Custom CSS","wp-google-maps")."

"; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= " "; $ret .= "
".__("Custom CSS","wp-google-maps").":"; $ret .= " "; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= " "; $ret .= "

".__("WP Google Maps Error log","wp-google-maps")."

"; $ret .= "

".__("Having issues? Perhaps something below can give you a clue as to what's wrong. Alternatively, email this through to nick@wpgmaps.com for help!","wp-google-maps")."

"; $ret .= " "; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= "

"; $ret .= "
"; $ret .= "
"; echo $ret; } function wpgmaps_menu_advanced_layout() { if (function_exists('wpgmza_register_pro_version')) { wpgmza_pro_advanced_menu(); } } function wpgmaps_menu_support_layout() { if (function_exists('wpgmza_pro_support_menu')) { wpgmza_pro_support_menu(); } else { wpgmza_basic_support_menu(); } } function wpgmza_map_page() { if (function_exists('wpgmza_register_pro_version')) { echo"

".__("My Maps","wp-google-maps")." ".__("Add New","wp-google-maps")."

"; wpgmaps_check_versions(); wpgmaps_list_maps(); } else { echo"

".__("My Maps","wp-google-maps")."

"; echo"

".__("Create unlimited maps","wp-google-maps")." ".__("with the","wp-google-maps")." ".__("Pro Version","wp-google-maps")." ".__("of WP Google Maps for only","wp-google-maps")." $19.99!

"; wpgmaps_list_maps(); } echo "
"; echo"
".__("Problems with the plugin? See the troubleshooting manual.","wp-google-maps")."
"; } function wpgmaps_list_maps() { global $wpdb; global $wpgmza_tblname_maps; if (function_exists('wpgmaps_list_maps_pro')) { wpgmaps_list_maps_pro(); return; } if ($wpgmza_tblname_maps) { $table_name = $wpgmza_tblname_maps; } else { $table_name = $wpdb->prefix . "wpgmza_maps"; } $results = $wpdb->get_results( " SELECT * FROM $table_name WHERE `active` = 0 ORDER BY `id` DESC " ); echo " "; foreach ( $results as $result ) { if ($result->type == "1") { $map_type = __("Roadmap","wp-google-maps"); } else if ($result->type == "2") { $map_type = __("Satellite","wp-google-maps"); } else if ($result->type == "3") { $map_type = __("Hybrid","wp-google-maps"); } else if ($result->type == "4") { $map_type = __("Terrain","wp-google-maps"); } if (function_exists('wpgmza_register_pro_version')) { $trashlink = "| id."\" title=\"Trash\">".__("Trash","wp-google-maps").""; } else { $trashlink = ""; } echo "id."\">"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
".__("ID","wp-google-maps")." ".__("Title","wp-google-maps")." ".__("Width","wp-google-maps")." ".__("Height","wp-google-maps")." ".__("Type","wp-google-maps")."
".$result->id."id."\" title=\"".__("Edit","wp-google-maps")."\">".$result->map_title."
id."\" title=\"".__("Edit","wp-google-maps")."\">".__("Edit","wp-google-maps")." $trashlink
".$result->map_width."".stripslashes($result->map_width_type)."".$result->map_height."".stripslashes($result->map_height_type)."".$map_type."
"; } function wpgmza_marker_page() { echo"

".__("My Markers","wp-google-maps")." ".__("Add New","wp-google-maps")."

"; wpgmaps_list_markers(); echo "
"; echo"
".__("Problems with the plugin? See the troubleshooting manual.","wp-google-maps")."
"; } function wpgmaps_list_markers() { global $wpdb; global $wpgmza_tblname; $results = $wpdb->get_results( " SELECT * FROM $wpgmza_tblname ORDER BY `address` DESC " ); echo " "; foreach ( $results as $result ) { echo "id."\">"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
".__("ID","wp-google-maps")." ".__("Icon","wp-google-maps")." ".__("Linked to","wp-google-maps")." ".__("Title","wp-google-maps")." ".__("Address","wp-google-maps")." ".__("GPS","wp-google-maps")." ".__("Pic","wp-google-maps")." ".__("Link","wp-google-maps")."
".$result->id."".$result->icon."".$result->map_id."".$result->title."".$result->address."".$result->lat.",".$result->lng."".$result->pic."".$result->link."
"; } function wpgmaps_check_versions() { $prov = get_option("WPGMZA_PRO"); $wpgmza_pro_version = $prov['version']; if (floatval($wpgmza_pro_version) < 4.51 || $wpgmza_pro_version == null) { wpgmaps_upgrade_notice(); } } function wpgmza_basic_menu() { global $wpgmza_tblname_maps; global $wpdb; /* deprecated * if (!wpgmaps_check_permissions()) { wpgmaps_permission_warning(); } */ if ($_GET['action'] == "edit" && isset($_GET['map_id'])) { $res = wpgmza_get_map_data(sanitize_text_field($_GET['map_id'])); if (function_exists("wpgmaps_marker_permission_check")) { wpgmaps_marker_permission_check(); } $other_settings_data = maybe_unserialize($res->other_settings); if (isset($other_settings_data['store_locator_enabled'])) { $wpgmza_store_locator_enabled = $other_settings_data['store_locator_enabled']; } else { $wpgmza_store_locator_enabled = 0; } if (isset($other_settings_data['store_locator_distance'])) { $wpgmza_store_locator_distance = $other_settings_data['store_locator_distance']; } else { $wpgmza_store_locator_distance = 0; } if (isset($other_settings_data['store_locator_bounce'])) { $wpgmza_store_locator_bounce = $other_settings_data['store_locator_bounce']; } else { $wpgmza_store_locator_bounce = 1; } if (isset($other_settings_data['store_locator_query_string'])) { $wpgmza_store_locator_query_string = stripslashes($other_settings_data['store_locator_query_string']); } else { $wpgmza_store_locator_query_string = __("ZIP / Address:","wp-google-maps"); } if (isset($other_settings_data['wpgmza_store_locator_restrict'])) { $wpgmza_store_locator_restrict = $other_settings_data['wpgmza_store_locator_restrict']; } else { $wpgmza_store_locator_restrict = ""; } if (isset($other_settings_data['weather_layer'])) { $wpgmza_weather_option = $other_settings_data['weather_layer']; } else { $wpgmza_weather_option = 2; } if (isset($other_settings_data['weather_layer_temp_type'])) { $wpgmza_weather_option_temp_type = $other_settings_data['weather_layer_temp_type']; } else { $wpgmza_weather_option_temp_type = 1; } if (isset($other_settings_data['cloud_layer'])) { $wpgmza_cloud_option = $other_settings_data['cloud_layer']; } else { $wpgmza_cloud_option = 2; } if (isset($other_settings_data['transport_layer'])) { $wpgmza_transport_option = $other_settings_data['transport_layer']; } else { $wpgmza_transport_option = 2; } if (isset($other_settings_data['map_max_zoom'])) { $wpgmza_max_zoom[intval($other_settings_data['map_max_zoom'])] = "SELECTED"; } else { $wpgmza_max_zoom[3] = "SELECTED"; } if (isset($res->map_start_zoom)) { $wpgmza_zoom[intval($res->map_start_zoom)] = "SELECTED"; } else { $wpgmza_zoom[8] = "SELECTED"; } if (isset($res->map_max_zoom)) { $wpgmza_max_zoom[intval($res->map_max_zoom)] = "SELECTED"; } else { $wpgmza_max_zoom[3] = "SELECTED"; } if (isset($res->type)) { $wpgmza_map_type[intval($res->type)] = "SELECTED"; } else { $wpgmza_map_type[1] = "SELECTED"; } if (isset($res->alignment)) { $wpgmza_map_align[intval($res->alignment)] = "SELECTED"; } else { $wpgmza_map_align[1] = "SELECTED"; } if (isset($res->bicycle)) { $wpgmza_bicycle[intval($res->bicycle)] = "SELECTED"; } else { $wpgmza_bicycle[2] = "SELECTED"; } if (isset($res->traffic)) { $wpgmza_traffic[intval($res->traffic)] = "SELECTED"; } else { $wpgmza_traffic[2] = "SELECTED"; } if (stripslashes($res->map_width_type) == "%") { $wpgmza_map_width_type_percentage = "SELECTED"; $wpgmza_map_width_type_px = ""; } else { $wpgmza_map_width_type_px = "SELECTED"; $wpgmza_map_width_type_percentage = ""; } if (stripslashes($res->map_height_type) == "%") { $wpgmza_map_height_type_percentage = "SELECTED"; $wpgmza_map_height_type_px = ""; } else { $wpgmza_map_height_type_px = "SELECTED"; $wpgmza_map_height_type_percentage = ""; } for ($i=0;$i<22;$i++) { if (!isset($wpgmza_zoom[$i])) { $wpgmza_zoom[$i] = ""; } } for ($i=0;$i<22;$i++) { if (!isset($wpgmza_max_zoom[$i])) { $wpgmza_max_zoom[$i] = ""; } } for ($i=0;$i<5;$i++) { if (!isset($wpgmza_map_type[$i])) { $wpgmza_map_type[$i] = ""; } } for ($i=0;$i<5;$i++) { if (!isset($wpgmza_map_align[$i])) { $wpgmza_map_align[$i] = ""; } } for ($i=0;$i<3;$i++) { if (!isset($wpgmza_bicycle[$i])) { $wpgmza_bicycle[$i] = ""; } } for ($i=0;$i<3;$i++) { if (!isset($wpgmza_traffic[$i])) { $wpgmza_traffic[$i] = ""; } } $wpgmza_store_locator_enabled_checked[0] = ''; $wpgmza_store_locator_enabled_checked[1] = ''; $wpgmza_store_locator_distance_checked[0] = ''; $wpgmza_store_locator_distance_checked[1] = ''; $wpgmza_store_locator_bounce_checked[0] = ''; $wpgmza_store_locator_bounce_checked[1] = ''; if ($wpgmza_store_locator_enabled == 1) { $wpgmza_store_locator_enabled_checked[0] = 'selected'; } else { $wpgmza_store_locator_enabled_checked[1] = 'selected'; } if ($wpgmza_store_locator_distance == 1) { $wpgmza_store_locator_distance_checked[0] = 'selected'; } else { $wpgmza_store_locator_distance_checked[1] = 'selected'; } if ($wpgmza_store_locator_bounce == 1) { $wpgmza_store_locator_bounce_checked[0] = 'selected'; } else { $wpgmza_store_locator_bounce_checked[1] = 'selected'; } $wpgmza_weather_layer_checked[0] = ''; $wpgmza_weather_layer_checked[1] = ''; $wpgmza_weather_layer_temp_type_checked[0] = ''; $wpgmza_weather_layer_temp_type_checked[1] = ''; $wpgmza_cloud_layer_checked[0] = ''; $wpgmza_cloud_layer_checked[1] = ''; $wpgmza_transport_layer_checked[0] = ''; $wpgmza_transport_layer_checked[1] = ''; if ($wpgmza_weather_option == 1) { $wpgmza_weather_layer_checked[0] = 'selected'; } else { $wpgmza_weather_layer_checked[1] = 'selected'; } if ($wpgmza_weather_option_temp_type == 1) { $wpgmza_weather_layer_temp_type_checked[0] = 'selected'; } else { $wpgmza_weather_layer_temp_type_checked[1] = 'selected'; } if ($wpgmza_cloud_option == 1) { $wpgmza_cloud_layer_checked[0] = 'selected'; } else { $wpgmza_cloud_layer_checked[1] = 'selected'; } if ($wpgmza_transport_option == 1) { $wpgmza_transport_layer_checked[0] = 'selected'; } else { $wpgmza_transport_layer_checked[1] = 'selected'; } $wpgmza_act = "disabled readonly"; $wpgmza_act_msg = "
".__("Add custom icons, titles, descriptions, pictures and links to your markers with the","wp-google-maps")." \"".__("Pro Edition","wp-google-maps")."\" ".__("of this plugin for just","wp-google-maps")." $19.99
"; $wpgmza_csv = "

".__("Purchase the Pro Edition","wp-google-maps")." ".__("of WP Google Maps and save your markers to a CSV file!","wp-google-maps")."

"; } /* check if they are using W3 Total Cache and that wp-google-maps appears in the rejected files list */ if (class_exists("W3_Plugin_TotalCache")) { $wpgmza_w3_check = new W3_Plugin_TotalCache; if (function_exists("w3_instance")) { $modules = w3_instance('W3_ModuleStatus'); $cdn_check = $modules->is_enabled('cdn'); if (strpos(esc_textarea(implode("\r\n", $wpgmza_w3_check->_config->get_array('cdn.reject.files'))),'wp-google-maps') !== false) { $does_cdn_contain_our_plugin = true; } else { $does_cdn_contain_our_plugin = false; } if ($cdn_check == 1 && !$does_cdn_contain_our_plugin) { echo "

".__("Please note","wp-google-maps").":

".__("We've noticed that you are using W3 Total Cache and that you have CDN enabled.

In order for the markers to show up on your map, you need to add '{uploads_dir}/wp-google-maps*' to the 'rejected files' list in the CDN settings page of W3 Total Cache","wp-google-maps")."
"; } } } echo "

WP Google Maps

".__("Map Settings","wp-google-maps")."

".__("Short code","wp-google-maps").": ".__("copy this into your post or page to display the map","wp-google-maps")."
".__("Map Name","wp-google-maps").":
".__("Width","wp-google-maps").": ".__("Set to 100% for a responsive map","wp-google-maps")."
".__("Height","wp-google-maps").":
".__("Zoom Level","wp-google-maps").": map_start_zoom\">
".__("Map Alignment","wp-google-maps").":
".__("Map type","wp-google-maps").":
  • Enable directions with the Pro version for only $19.99 once off. Support and updates included forever.
".__("Enable Directions?","wp-google-maps").":
".__("Directions Box Open by Default?","wp-google-maps").":
".__("Directions Box Width","wp-google-maps").": px
".__("Enable Store Locator","wp-google-maps").":
".__("Restrict to country","wp-google-maps").": ".__("Insert country TLD. For example, use DE for Germany.","wp-google-maps")." ".__("Leave blank for no restrictions.","wp-google-maps")."
".__("Show distance in","wp-google-maps").":
".__("Query string","wp-google-maps").":
".__("Show bouncing icon","wp-google-maps").":

".__('View','wp-google-maps')." ".__('Store Locator Documentation','wp-google-maps')."

".__("Enable Bicycle Layer?","wp-google-maps").":
".__("Enable Traffic Layer?","wp-google-maps").":
".__("Enable Weather Layer?","wp-google-maps").":
".__("Enable Cloud Layer?","wp-google-maps").":
".__("Enable Public Transport Layer?","wp-google-maps").":
".__("Maximum Zoom Level","wp-google-maps").":
  • ".__("Get the rest of these advanced features with the Pro version for only $19.99 once off. Support and updates included forever.","wp-google-maps")."
".__("Default Marker Image","wp-google-maps").": -reset-
".__("Show User's Location?","wp-google-maps").":
".__("KML/GeoRSS URL","wp-google-maps").": ".__("The KML/GeoRSS layer will over-ride most of your map settings","wp-google-maps")."
".__("Fusion table ID","wp-google-maps").": ".__("Read data directly from your Fusion Table.","wp-google-maps")."
".__("List Markers","wp-google-maps").": ".__("None","wp-google-maps")."
".__("Basic table","wp-google-maps")."
".__("Advanced table with real time search and filtering","wp-google-maps")."
".__("Carousel","wp-google-maps")." (".__("beta","wp-google-maps").")
".__("Filter by Category","wp-google-maps").": ".__("Allow users to filter by category?","wp-google-maps")."
".__("Order markers by","wp-google-maps").":
".__("Move list inside map","wp-google-maps").": ".__("Move your marker list inside the map area","wp-google-maps")."
".__("Placement: ","wp-google-maps")."

".__("Basic","wp-google-maps")."

".__("Show a basic list of your markers","wp-google-maps")."

".__("Carousel","wp-google-maps")."

".__("Beautiful, responsive, mobile-friendly carousel marker listing","wp-google-maps")."

".__("Tabular","wp-google-maps")."

".__("Advanced, tabular marker listing functionality with real time filtering","wp-google-maps")."

12 Amazing Reasons to Upgrade to our Pro Version

We've spent over two years upgrading our plugin to ensure that it is the most user-friendly and comprehensive map plugin in the WordPress directory. Enjoy the peace of mind knowing that you are getting a truly premium product for all your mapping requirements. Did we also mention that we have fantastic support?

Create custom markers with detailed info windows

Add titles, descriptions, HTML, images, animations and custom icons to your markers.

Enable directions

Allow your visitors to get directions to your markers. Either use their location as the starting point or allow them to type in an address.

Unlimited maps

Create as many maps as you like.

List your markers

Choose between three methods of listing your markers.

Add categories to your markers

Create and assign categories to your markers which can then be filtered on your map.

Advanced options

Enable advanced options such as showing your visitor's location, marker sorting, bicycle layers, traffic layers and more!

Import / Export

Export your markers to a CSV file for quick and easy editing. Import large quantities of markers at once.

Add KML & Fusion Tables

Add your own KML layers or Fusion Table data to your map

Polygons and Polylines

Add custom polygons and polylines to your map by simply clicking on the map. Perfect for displaying routes and serviced areas.

Amazing Support

We pride ourselves on providing quick and amazing support. Read what some of our users think of our support.

Easy Upgrade

You'll receive a download link immediately. Simply upload and activate the Pro plugin to your WordPress admin area and you're done!

Free updates and support forever

Once you're a pro user, you'll receive free updates and support forever! You'll also receive amazing specials on any future plugins we release.


Get all of this and more for only $19.99 once off


Upgrade Now

View the demos.

Have a sales question? Contact either Nick or Jarryd on nick@wpgmaps.com or use our contact form.

Need help? Ask a question on our support forum.

".__("Tip: Use your mouse to change the layout of your map. When you have positioned the map to your desired location, press \"Save Map\" to keep your settings.","wp-google-maps")."

".__("Markers","wp-google-maps")."

".__("Address/GPS","wp-google-maps").":
".__("Or right click on the map","wp-google-maps")."

".__("Animation","wp-google-maps").":
".__("InfoWindow open by default","wp-google-maps").":
".__("Adding","wp-google-maps")."... ".__("Saving","wp-google-maps")."...

".__("Remember to save your marker","wp-google-maps")."

".__("Please add the current marker before trying to add another marker","wp-google-maps")."

".__("Advanced markers","wp-google-maps")."

".__("Address/GPS","wp-google-maps").":  
".__("Animation","wp-google-maps").":
".__("InfoWindow open by default","wp-google-maps").":
".__("Title","wp-google-maps").":
".__("Description","wp-google-maps").":  
".__("Pic URL","wp-google-maps").":
".__("Link URL","wp-google-maps").":
".__("Custom Marker","wp-google-maps").":  
".__("Category","wp-google-maps").":

$wpgmza_act_msg



$wpgmza_csv

".__("Polygons","wp-google-maps")."

".__("Add a New Polygon","wp-google-maps")."
".wpgmza_b_return_polygon_list(sanitize_text_field($_GET['map_id']))."

".__("Polylines","wp-google-maps")."

".__("Add a New Polyline","wp-google-maps")."
".wpgmza_b_return_polyline_list(sanitize_text_field($_GET['map_id']))."
  • ".__("The map could not load.","wp-google-maps")."
    ".__("This is normally caused by a conflict with another plugin or a JavaScript error that is preventing our plugin's Javascript from executing. Please try disable all plugins one by one and see if this problem persists.","wp-google-maps")."
  • ".__("Remember to save your map!","wp-google-maps")."

".__("Your Markers","wp-google-maps")."

".wpgmza_return_marker_list(sanitize_text_field($_GET['map_id']))."
\"".__("Add

".__("Add detailed information to your markers for only","wp-google-maps")." $19.99. ".__("Click","wp-google-maps")." ".__("here","wp-google-maps")."
\"".__("Add

".__("Add different marker icons, or your own icons to make your map really stand out!","wp-google-maps")." ".__("Click","wp-google-maps")." ".__("here","wp-google-maps")."
\"".__("Add

".__("Allow your visitors to get directions to your markers!","wp-google-maps")." ".__("Click","wp-google-maps")." ".__("here","wp-google-maps")."



".__("WP Google Maps encourages you to make use of the amazing icons created by Nicolas Mollet's Maps Icons Collection","wp-google-maps")." http://mapicons.nicolasmollet.com/ ".__("and to credit him when doing so.","wp-google-maps")."

"; } function wpgmza_edit_marker($mid) { global $wpgmza_tblname_maps; global $wpdb; if ($_GET['action'] == "edit_marker" && isset($mid)) { $res = wpgmza_get_marker_data($mid); echo "

WP Google Maps

".__("Edit Marker Location","wp-google-maps")." ".__("ID","wp-google-maps")."#$mid

".__("Marker Latitude","wp-google-maps").":
".__("Marker Longitude","wp-google-maps").":

".__("Tip: Use your mouse to change the location of the marker. Simply click and drag it to your desired location.","wp-google-maps")."

  • ".__("The map could not load.","wp-google-maps")."
    ".__("This is normally caused by a conflict with another plugin or a JavaScript error that is preventing our plugin's Javascript from executing. Please try disable all plugins one by one and see if this problem persists. If it persists, please contact nick@wpgmaps.com for support.","wp-google-maps")."
"; } } function wpgmaps_admin_scripts() { wp_enqueue_script( 'jquery' ); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-slider'); if (function_exists('wp_enqueue_media')) { wp_enqueue_media(); wp_register_script('my-wpgmaps-upload', plugins_url('js/media.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('my-wpgmaps-upload'); } else { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_register_script('my-wpgmaps-upload', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/upload.js', array('jquery','media-upload','thickbox')); wp_enqueue_script('my-wpgmaps-upload'); } if (isset($_GET['action'])) { if ($_GET['action'] == "add_poly" || $_GET['action'] == "edit_poly" || $_GET['action'] == "add_polyline" || $_GET['action'] == "edit_polyline") { wp_register_script('my-wpgmaps-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false); wp_enqueue_script('my-wpgmaps-color'); } if ($_GET['page'] == "wp-google-maps-menu" && $_GET['action'] == "edit") { wp_enqueue_script( 'jquery-ui-tabs'); wp_register_script('my-wpgmaps-tabs', plugins_url('js/wpgmaps_tabs.js',__FILE__), array('jquery-ui-core'), '1.0.1', true); wp_enqueue_script('my-wpgmaps-tabs'); wp_register_script('my-wpgmaps-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false); wp_enqueue_script('my-wpgmaps-color'); } } if (isset($_GET['page'])) { if ($_GET['page'] == "wp-google-maps-menu-settings") { wp_enqueue_script( 'jquery-ui-tabs'); if (wp_script_is('my-wpgmaps-tabs','registered')) { } else { wp_register_style('jquery-ui-smoothness', '//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css'); wp_enqueue_style('jquery-ui-smoothness'); wp_register_script('my-wpgmaps-tabs', WPGMAPS_DIR.'js/wpgmaps_tabs.js', array('jquery-ui-core'), '1.0.1', true); wp_enqueue_script('my-wpgmaps-tabs'); } } if ($_GET['page'] == "wp-google-maps-menu-support" && !function_exists('wpgmaps_admin_styles_pro')) { wp_register_style('fontawesome', plugins_url('css/font-awesome.min.css', __FILE__)); wp_enqueue_style('fontawesome'); wp_register_style('wpgmaps-admin-style', plugins_url('css/wpgmaps-admin.css', __FILE__)); wp_enqueue_style('wpgmaps-admin-style'); } } } function wpgmaps_user_styles() { if (!function_exists('wpgmaps_admin_styles_pro')) { wp_register_style( 'wpgmaps-style', plugins_url('css/wpgmza_style.css', __FILE__) ); wp_enqueue_style( 'wpgmaps-style' ); } } function wpgmaps_admin_styles() { wp_enqueue_style('thickbox'); wp_register_style( 'wpgmaps-style', plugins_url('css/wpgmza_style.css', __FILE__) ); wp_enqueue_style( 'wpgmaps-style' ); wp_register_style( 'fontawesome', plugins_url('css/font-awesome.min.css', __FILE__) ); wp_enqueue_style( 'fontawesome' ); } if (isset($_GET['page'])) { if ($_GET['page'] == 'wp-google-maps-menu' || $_GET['page'] == 'wp-google-maps-menu-settings' || $_GET['page'] == "wp-google-maps-menu-support") { add_action('admin_print_scripts', 'wpgmaps_admin_scripts'); add_action('admin_print_styles', 'wpgmaps_admin_styles'); } } add_action('wp_print_styles', 'wpgmaps_user_styles'); function wpgmza_return_marker_list($map_id,$admin = true,$width = "100%",$mashup = false,$mashup_ids = false) { global $wpdb; global $wpgmza_tblname; if ($mashup) { $map_ids = $mashup_ids; $wpgmza_cnt = 0; if ($mashup_ids[0] == "ALL") { $wpgmza_sql1 = " SELECT * FROM $wpgmza_tblname ORDER BY `id` DESC "; } else { $wpgmza_id_cnt = count($map_ids); $sql_string1 = ""; foreach ($map_ids as $wpgmza_map_id) { $wpgmza_cnt++; if ($wpgmza_cnt == 1) { $sql_string1 .= "`map_id` = '$wpgmza_map_id' "; } elseif ($wpgmza_cnt > 1 && $wpgmza_cnt < $wpgmza_id_cnt) { $sql_string1 .= "OR `map_id` = '$wpgmza_map_id' "; } else { $sql_string1 .= "OR `map_id` = '$wpgmza_map_id' "; } } $wpgmza_sql1 = " SELECT * FROM $wpgmza_tblname WHERE $sql_string1 ORDER BY `id` DESC "; } } else { $wpgmza_sql1 = " SELECT * FROM $wpgmza_tblname WHERE `map_id` = '$map_id' ORDER BY `id` DESC "; } $marker_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpgmza_tblname WHERE map_id = %d",$map_id ) ); if ($marker_count > 5000) { return __("There are too many markers to make use of the live edit function. The maximum amount for this functionality is 5000 markers. Anything more than that could crash your browser. In order to edit your markers, you would need to download the table in CSV format, edit it and re-upload it.","wp-google-maps"); } else { $results = $wpdb->get_results($wpgmza_sql1); $wpgmza_tmp_body = ""; $wpgmza_tmp_head = ""; $wpgmza_tmp_footer = ""; $res = wpgmza_get_map_data($map_id); if (!$res->default_marker) { $default_marker = ""; } else { $default_marker = ""; } foreach ( $results as $result ) { $img = $result->pic; $link = $result->link; $icon = $result->icon; if (isset($result->approved)) { $approved = $result->approved; if ($approved == 0) { $show_approval_button = true; } else { $show_approval_button = false; } } else { $show_approval_button = false; } $category_icon = wpgmza_get_category_icon($result->category); if (!$img) { $pic = ""; } else { $pic = "pic."\" width=\"40\" />"; } if (!$category_icon) { if (!$icon) { $icon = $default_marker; } else { $icon = ""; } } else { if (!$icon) { $icon = ""; } else { $icon = ""; } } if (!$link) { $linktd = ""; } else { $linktd = "link."\" target=\"_BLANK\" title=\"".__("View this link","wp-google-maps")."\">>>"; } if ($admin) { $wpgmza_tmp_body .= "id."\" class=\"gradeU\">"; $wpgmza_tmp_body .= "".$result->id.""; $wpgmza_tmp_body .= "".$icon."id."\" value=\"".$result->icon."\" />id."\" value=\"".$result->anim."\" />id."\" value=\"".$result->category."\" />id."\" value=\"".$result->infoopen."\" />id."\" value=\"".$result->retina."\" />"; $wpgmza_tmp_body .= "".stripslashes($result->title)."id."\" value=\"".stripslashes($result->title)."\" />"; $wpgmza_tmp_body .= "".wpgmza_return_category_name($result->category)."id."\" value=\"".$result->category."\" />"; $wpgmza_tmp_body .= "".stripslashes($result->address)."id."\" value=\"".stripslashes($result->address)."\" />id."\" value=\"".$result->lat."\" />id."\" value=\"".$result->lng."\" />"; $wpgmza_tmp_body .= "".stripslashes($result->description)."id."\" value=\"". htmlspecialchars(stripslashes($result->description))."\" />"; $wpgmza_tmp_body .= "$picid."\" value=\"".$result->pic."\" />"; $wpgmza_tmp_body .= "$linktdid."\" value=\"".$result->link."\" />"; $wpgmza_tmp_body .= ""; $wpgmza_tmp_body .= " id."\"> "; $wpgmza_tmp_body .= " id."\" title=\"".__("Edit this marker","wp-google-maps")."\" class=\"wpgmza_edit_btn button\" id=\"".$result->id."\"> "; if ($show_approval_button) { $wpgmza_tmp_body .= " id."\"> "; } $wpgmza_tmp_body .= " id."\"> "; $wpgmza_tmp_body .= ""; $wpgmza_tmp_body .= ""; } else { $wpgmza_tmp_body .= "id."\" mid=\"".$result->id."\" mapid=\"".$result->map_id."\" class=\"wpgmaps_mlist_row\">"; $wpgmza_tmp_body .= " ".sprintf('%02d', $result->id).""; $wpgmza_tmp_body .= " ".str_replace("'","\"",$icon).""; $wpgmza_tmp_body .= " ".stripslashes($result->title).""; $wpgmza_tmp_body .= " ".wpgmza_return_category_name($result->category).""; $wpgmza_tmp_body .= " ".stripslashes($result->address).""; $wpgmza_tmp_body .= " ".stripslashes($result->description).""; $wpgmza_tmp_body .= ""; } } if ($admin) { $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; } else { $wpgmza_tmp_head .= "
"; $wpgmza_tmp_head .= "
".__("ID","wp-google-maps")."".__("Icon","wp-google-maps")."".__("Title","wp-google-maps")."".__("Category","wp-google-maps")."".__("Address","wp-google-maps")."".__("Description","wp-google-maps")."".__("Image","wp-google-maps")."".__("Link","wp-google-maps")."".__("Action","wp-google-maps")."
"; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= " "; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; $wpgmza_tmp_head .= ""; } if ($admin) { $wpgmza_tmp_footer .= "
".__("Title","wp-google-maps")."".__("Category","wp-google-maps")."".__("Address","wp-google-maps")."".__("Description","wp-google-maps")."
"; } else { $wpgmza_tmp_footer .= "
"; } return $wpgmza_tmp_head.$wpgmza_tmp_body.$wpgmza_tmp_footer; } } function wpgmza_return_category_name($cid) { global $wpdb; global $wpgmza_tblname_categories; $pos = strpos($cid, ","); if ($pos === false) { $results = $wpdb->get_results("SELECT * FROM `$wpgmza_tblname_categories` WHERE `id` = '$cid' LIMIT 1"); foreach ( $results as $result ) { return $result->category_name; } } else { $categories = explode(",",$cid); $ret_cat = ""; $tot_cnt = count($categories); $countr = 0; foreach ($categories as $cid) { $countr++; $results = $wpdb->get_results("SELECT * FROM `$wpgmza_tblname_categories` WHERE `id` = '$cid' LIMIT 1"); foreach ( $results as $result ) { if ($countr >= $tot_cnt) { $ret_cat .= $result->category_name; } else { $ret_cat .= $result->category_name.","; } } } return $ret_cat; } } function wpgmaps_chmodr($path, $filemode) { /* removed in 6.0.25. is_dir caused fatal errors on some hosts */ } if (function_exists('wpgmza_register_pro_version')) { add_action('wp_ajax_add_marker', 'wpgmaps_action_callback_pro'); add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_pro'); add_action('wp_ajax_edit_marker', 'wpgmaps_action_callback_pro'); add_action('wp_ajax_approve_marker', 'wpgmaps_action_callback_pro'); add_action('wp_ajax_delete_poly', 'wpgmaps_action_callback_pro'); add_action('wp_ajax_delete_polyline', 'wpgmaps_action_callback_pro'); add_action('template_redirect','wpgmaps_check_shortcode'); if (function_exists('wpgmza_register_gold_version')) { add_action('admin_head', 'wpgmaps_admin_javascript_gold'); } else { add_action('admin_head', 'wpgmaps_admin_javascript_pro'); } add_action('wp_footer', 'wpgmaps_user_javascript_pro'); if (function_exists('wpgmza_register_ugm_version')) { } add_shortcode( 'wpgmza', 'wpgmaps_tag_pro' ); } else { add_action('admin_head', 'wpgmaps_admin_javascript_basic'); add_action('wp_ajax_add_marker', 'wpgmaps_action_callback_basic'); add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_basic'); add_action('wp_ajax_edit_marker', 'wpgmaps_action_callback_basic');+ add_action('wp_ajax_delete_poly', 'wpgmaps_action_callback_basic'); add_action('wp_ajax_delete_polyline', 'wpgmaps_action_callback_basic'); add_action('template_redirect','wpgmaps_check_shortcode'); add_action('wp_footer', 'wpgmaps_user_javascript_basic'); add_shortcode( 'wpgmza', 'wpgmaps_tag_basic' ); } function wpgmaps_check_shortcode() { global $posts; global $short_code_active; $short_code_active = false; $pattern = get_shortcode_regex(); foreach ($posts as $wpgmpost) { preg_match_all('/'.$pattern.'/s', $wpgmpost->post_content, $matches); foreach ($matches as $match) { if (is_array($match)) { foreach($match as $key => $val) { $pos = strpos($val, "wpgmza"); if ($pos === false) { } else { $short_code_active = true; } } } } } } function wpgmaps_check_permissions() { $filename = dirname( __FILE__ ).'/wpgmaps.tmp'; $testcontent = "Permission Check\n"; $handle = @fopen($filename, 'w'); if (@fwrite($handle, $testcontent) === FALSE) { @fclose($handle); add_option("wpgmza_permission","n"); return false; } else { @fclose($handle); add_option("wpgmza_permission","y"); return true; } } function wpgmaps_permission_warning() { echo "
"; _e("The plugin directory does not have 'write' permissions. Please enable 'write' permissions (755) for "); echo "\"".c."\" "; _e("in order for this plugin to work! Please see "); echo ""; _e("this page"); echo " "; _e("for help on how to do it."); echo "
"; } /* handle database check upon upgrade */ function wpgmaps_update_db_check() { global $wpgmza_version; if (get_option('wpgmza_db_version') != $wpgmza_version) { wpgmaps_handle_db(); } } add_action('plugins_loaded', 'wpgmaps_update_db_check'); function wpgmaps_handle_db() { global $wpdb; global $wpgmza_version; global $wpgmza_tblname_poly; global $wpgmza_tblname_polylines; global $wpgmza_tblname_categories; global $wpgmza_tblname_category_maps; global $wpgmza_tblname; $table_name = $wpdb->prefix . "wpgmza"; $sql = " CREATE TABLE `".$table_name."` ( id int(11) NOT NULL AUTO_INCREMENT, map_id int(11) NOT NULL, address varchar(700) NOT NULL, description mediumtext NOT NULL, pic varchar(700) NOT NULL, link varchar(700) NOT NULL, icon varchar(700) NOT NULL, lat varchar(100) NOT NULL, lng varchar(100) NOT NULL, anim varchar(3) NOT NULL, title varchar(700) NOT NULL, infoopen varchar(3) NOT NULL, category varchar(500) NOT NULL, approved tinyint(1) DEFAULT '1', retina tinyint(1) DEFAULT '0', PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); $sql = " CREATE TABLE `".$wpgmza_tblname_poly."` ( id int(11) NOT NULL AUTO_INCREMENT, map_id int(11) NOT NULL, polydata LONGTEXT NOT NULL, linecolor VARCHAR(7) NOT NULL, lineopacity VARCHAR(7) NOT NULL, fillcolor VARCHAR(7) NOT NULL, opacity VARCHAR(3) NOT NULL, title VARCHAR(250) NOT NULL, link VARCHAR(700) NOT NULL, ohfillcolor VARCHAR(7) NOT NULL, ohlinecolor VARCHAR(7) NOT NULL, ohopacity VARCHAR(3) NOT NULL, polyname VARCHAR(100) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; dbDelta($sql); $sql = " CREATE TABLE `".$wpgmza_tblname_polylines."` ( id int(11) NOT NULL AUTO_INCREMENT, map_id int(11) NOT NULL, polydata LONGTEXT NOT NULL, linecolor VARCHAR(7) NOT NULL, linethickness VARCHAR(3) NOT NULL, opacity VARCHAR(3) NOT NULL, polyname VARCHAR(100) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; dbDelta($sql); $sql = " CREATE TABLE `".$wpgmza_tblname_categories."` ( id int(11) NOT NULL AUTO_INCREMENT, active TINYINT(1) NOT NULL, category_name VARCHAR(50) NOT NULL, category_icon VARCHAR(700) NOT NULL, retina TINYINT(1) DEFAULT '0', PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; dbDelta($sql); $sql = " CREATE TABLE `".$wpgmza_tblname_category_maps."` ( id int(11) NOT NULL AUTO_INCREMENT, cat_id INT(11) NOT NULL, map_id INT(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; dbDelta($sql); $table_name = $wpdb->prefix . "wpgmza_maps"; $sql = " CREATE TABLE `".$table_name."` ( id int(11) NOT NULL AUTO_INCREMENT, map_title varchar(50) NOT NULL, map_width varchar(6) NOT NULL, map_height varchar(6) NOT NULL, map_start_lat varchar(700) NOT NULL, map_start_lng varchar(700) NOT NULL, map_start_location varchar(700) NOT NULL, map_start_zoom INT(10) NOT NULL, default_marker varchar(700) NOT NULL, type INT(10) NOT NULL, alignment INT(10) NOT NULL, directions_enabled INT(10) NOT NULL, styling_enabled INT(10) NOT NULL, styling_json mediumtext NOT NULL, active INT(1) NOT NULL, kml VARCHAR(700) NOT NULL, bicycle INT(10) NOT NULL, traffic INT(10) NOT NULL, dbox INT(10) NOT NULL, dbox_width varchar(10) NOT NULL, listmarkers INT(10) NOT NULL, listmarkers_advanced INT(10) NOT NULL, filterbycat TINYINT(1) NOT NULL, ugm_enabled INT(10) NOT NULL, ugm_category_enabled TINYINT(1) NOT NULL, fusion VARCHAR(100) NOT NULL, map_width_type VARCHAR(3) NOT NULL, map_height_type VARCHAR(3) NOT NULL, mass_marker_support INT(10) NOT NULL, ugm_access INT(10) NOT NULL, order_markers_by INT(10) NOT NULL, order_markers_choice INT(10) NOT NULL, show_user_location INT(3) NOT NULL, default_to VARCHAR(700) NOT NULL, other_settings longtext NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; "; dbDelta($sql); /* check for previous versions containing 'desc' instead of 'description' */ $results = $wpdb->get_results("DESC $wpgmza_tblname"); $founded = 0; foreach ($results as $row ) { if ($row->Field == "desc") { $founded++; } } if ($founded>0) { $wpdb->query("ALTER TABLE $wpgmza_tblname CHANGE `desc` `description` MEDIUMTEXT"); } /* check for older version of "category" and change to varchar instead of int */ $results = $wpdb->get_results("DESC $wpgmza_tblname"); $founded = 0; foreach ($results as $row ) { if ($row->Field == "category") { if ($row->Type == "int(11)") { $founded++; } } } if ($founded>0) { $wpdb->query("ALTER TABLE $wpgmza_tblname CHANGE `category` `category` VARCHAR(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0'"); } add_option("wpgmza_db_version", $wpgmza_version); update_option("wpgmza_db_version",$wpgmza_version); } function wpgmza_get_map_data($map_id) { global $wpdb; global $wpgmza_tblname_maps; $result = $wpdb->get_results(" SELECT * FROM $wpgmza_tblname_maps WHERE `id` = '".$map_id."' LIMIT 1 "); if (isset($result[0])) { return $result[0]; } } function wpgmza_get_marker_data($mid) { global $wpdb; global $wpgmza_tblname; $result = $wpdb->get_results(" SELECT * FROM $wpgmza_tblname WHERE `id` = '".$mid."' LIMIT 1 "); $res = $result[0]; return $res; } function wpgmaps_upgrade_notice() { global $wpgmza_pro_version; echo "

Dear Pro User

We have recently added new functionality to the Pro version of this plugin. You are currently using the latest Basic version which needs the latest Pro version for all functionality to work correctly. Your current Pro version is $wpgmza_pro_version - The latest Pro version is 5.41

You should be able to update your Pro version the same way you update all other WordPress plugins.

If you run into any problems updating your pro version, please view this page.

Kind regards,
WP Google Maps

"; } function wpgmaps_trash_map($map_id) { global $wpdb; global $wpgmza_tblname_maps; if (isset($map_id)) { $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET active = %d WHERE id = %d", 1, $map_id) ); return true; } else { return false; } } function wpgmaps_filter(&$array) { $clean = array(); foreach($array as $key => &$value ) { if( is_array($value) ) { wpgmaps_filter($value); } else { if (get_magic_quotes_gpc()) { $data = stripslashes($value); } $data = esc_sql($value); } } } function wpgmaps_debugger($section) { global $debug; global $debug_start; global $debug_step; if ($debug) { $end = (float) array_sum(explode(' ',microtime())); echo ""; } } function wpgmaps_load_jquery() { if (!is_admin()) { $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_force_jquery'])) { if ($wpgmza_settings['wpgmza_settings_force_jquery'] == "yes") { wp_deregister_script('jquery'); wp_register_script('jquery', plugins_url("js/jquery.min.js",__FILE__), false, "1.8.3"); } } wp_enqueue_script('jquery'); } } add_action('wp_enqueue_scripts', 'wpgmaps_load_jquery', 9999); function wpgmza_get_category_data($cat_id) { global $wpgmza_tblname_categories; global $wpdb; $result = $wpdb->get_row(" SELECT `category_icon`,`retina` FROM `$wpgmza_tblname_categories` WHERE `id` = '$cat_id' AND `active` = 0 LIMIT 1 "); return $result; } function wpgmza_get_category_icon($cat_id) { global $wpgmza_tblname_categories; global $wpdb; $result = $wpdb->get_var(" SELECT `category_icon` FROM `$wpgmza_tblname_categories` WHERE `id` = '$cat_id' AND `active` = 0 LIMIT 1 "); return $result; } function wpgmza_return_error($data) { echo "

".$data->get_error_message()."

".$data->get_error_data()."

"; wpgmza_write_to_error_log($data); } function wpgmza_write_to_error_log($data) { if (wpgmza_error_directory()) { if (is_multisite()) { $upload_dir = wp_upload_dir(); $content = "\r\n".date("Y-m-d H:i:s").": ".$data->get_error_message() . " -> ". $data->get_error_data(); $fp = @fopen($upload_dir['basedir'].'/wp-google-maps'."/error_log.txt","a+"); fwrite($fp,$content); } else { $content = "\r\n".date("Y-m-d H:i:s").": ".$data->get_error_message() . " -> ". $data->get_error_data(); $fp = @fopen(ABSPATH.'wp-content/uploads/wp-google-maps'."/error_log.txt","a+"); fwrite($fp,$content); } } error_log(date("Y-m-d H:i:s"). ": WP Google Maps : " . $data->get_error_message() . "->" . $data->get_error_data()); } function wpgmza_error_directory() { $upload_dir = wp_upload_dir(); if (is_multisite()) { if (!file_exists($upload_dir['basedir'].'/wp-google-maps')) { wp_mkdir_p($upload_dir['basedir'].'/wp-google-maps'); $content = "Error log created"; $fp = @fopen($upload_dir['basedir'].'/wp-google-maps'."/error_log.txt","w+"); fwrite($fp,$content); } } else { if (!file_exists(ABSPATH.'wp-content/uploads/wp-google-maps')) { wp_mkdir_p(ABSPATH.'wp-content/uploads/wp-google-maps'); $content = "Error log created"; $fp = @fopen(ABSPATH.'wp-content/uploads/wp-google-maps'."/error_log.txt","w+"); fwrite($fp,$content); } } return true; } function wpgmza_return_error_log() { $fh = @fopen(ABSPATH.'wp-content/uploads/wp-google-maps'."/error_log.txt","r"); $ret = ""; if ($fh) { for ($i=0;$i<10;$i++) { $visits = fread($fh,4096); $ret .= $visits; } } else { $ret .= "No errors to report on"; } return $ret; } function wpgmaps_marker_permission_check() { $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS"); if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') { /* using db method, do nothing */ return; } if (function_exists("wpgmza_register_pro_version")) { global $wpgmza_pro_version; if (floatval($wpgmza_pro_version) < 5.41) { $marker_location = get_option("wpgmza_xml_location"); } else { $marker_location = wpgmza_return_marker_path(); } } else { $marker_location = wpgmza_return_marker_path(); } $wpgmza_file_perms = substr(sprintf('%o', fileperms($marker_location)), -4); $fpe = false; $fpe_error = ""; if ($wpgmza_file_perms == "0777" || $wpgmza_file_perms == "0755" || $wpgmza_file_perms == "0775" || $wpgmza_file_perms == "0705" || $wpgmza_file_perms == "2705" || $wpgmza_file_perms == "2775" || $wpgmza_file_perms == "2777" ) { $fpe = true; $fpe_error = ""; } else if ($wpgmza_file_perms == "0") { $fpe = false; $fpe_error = __("This folder does not exist. Please create it.","wp-google-maps"). ": ". $marker_location; } else { $fpe = false; $fpe_error = __("WP Google Maps does not have write permission to the marker location directory. This is required to store marker data. Please CHMOD the folder ","wp-google-maps").$marker_location.__(" to 755 or 777, or change the directory in the Maps->Settings page. (Current file permissions are ","wp-google-maps").$wpgmza_file_perms.")"; } if (!$fpe) { echo "

".$fpe_error."

"; } } function wpgmza_basic_support_menu() { ?>