google_map_tab

The Google Map Tab google map tab function.

Description

google_map_tab(); 

Usage

  1. if ( !function_exists( 'google_map_tab' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-map-tab/inc/gmt-shortcode.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = google_map_tab(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/gmt-shortcode.php  
  1. function google_map_tab() {  
  2.  
  3. // General 
  4. $id_tabs = get_option('id_tabs'); 
  5. if(!$id_tabs) { $id_tabs = 'tabs';} 
  6.  
  7. $max_width = get_option('max_width'); 
  8. if(!$max_width) { $max_width = '';} 
  9.  
  10. $min_width = get_option('min_width'); 
  11. if(!$min_width) { $min_width = '';} 
  12.  
  13. $height = get_option('height'); 
  14. if(!$height) { $height = '300';} 
  15.  
  16. // structure 
  17. $map_type = get_option('map_type'); 
  18. if(!$map_type) { $map_type = 'ROADMAP';} 
  19.  
  20. $all = get_option('all'); 
  21. if(!$all) { $all = 'View All';} 
  22.  
  23. $view_all = get_option('view_all'); 
  24. if(!$view_all) { $view_all = 'true';} 
  25.  
  26. $start = $view_all=='true'?'0':'1'; 
  27.  
  28. $info = get_option('info'); 
  29. if(!$info) { $info = '0';} 
  30.  
  31. // color 
  32. $background_color = get_option('background_color'); 
  33. if(!$background_color) { $background_color = 'F9F9F9';} 
  34.  
  35. $active = get_option('active'); 
  36. if(!$active) { $active = 'B82200';} 
  37.  
  38. $text_color = get_option('text_color'); 
  39. if(!$text_color) { $text_color = '333333';} 
  40.  
  41. echo '<section id="'.$id_tabs.'" class="row">'; 
  42. echo '<div id="controls-'.$id_tabs.'"></div>'; 
  43. echo $info == '1'?'<div id="info-'.$id_tabs.'"></div>':''; 
  44. echo '<div id="gmap-'.$id_tabs.'"></div>'; 
  45. echo '</section>'; 
  46. ?> 
  47. <script> 
  48. var <?php echo $id_tabs;?> = [ 
  49. <?php  
  50. global $wpdb; 
  51. $table = $wpdb->prefix.'gmt_tab';  
  52. $lsql = "SELECT * FROM $table"; 
  53. $itens = $wpdb->get_results( $lsql ); 
  54. foreach($itens as $iten):  
  55. $lat = $iten->lat; 
  56. $lon = $iten->lon; 
  57. $title = $iten->title; 
  58. $content = $iten->content; 
  59. $zoom = $iten->zoom; 
  60. if(!$zoom) { $zoom = '12';} 
  61. ?> 
  62. lat: <?php echo $lat; ?>,  
  63. lon: <?php echo $lon; ?>,  
  64. title: '<?php echo $title; ?>',  
  65. html: [ 
  66. '<h3><?php echo $title; ?></h3>',  
  67. '<p><?php echo $content; ?></p>' 
  68. ].join(''),  
  69. zoom: <?php echo $zoom; ?> 
  70. },  
  71. <?php endforeach; ?> 
  72. ]; 
  73. $jquery = jQuery.noConflict(); 
  74. $jquery(function() { 
  75. new Maplace({ 
  76. locations: <?php echo $id_tabs;?>,  
  77. map_div: '#gmap-<?php echo $id_tabs;?>',  
  78. controls_div: '#controls-<?php echo $id_tabs;?>',  
  79. controls_type: 'list',  
  80. controls_on_map: false,  
  81. show_infowindow: true,  
  82. view_all: <?php echo $view_all; ?>,  
  83. view_all_text: '<?php echo $all; ?>',  
  84. start: <?php echo $start; ?>,  
  85. map_options: { 
  86. mapTypeId: google.maps.MapTypeId.<?php echo $map_type; ?> 
  87. },  
  88. afterShow: function(index, location, marker) { 
  89. $jquery('#info-<?php echo $id_tabs;?>').html(location.html); 
  90. }).Load(); 
  91. });  
  92. </script> 
  93. <style>#<?php echo $id_tabs;?> {<?php echo 'max-width:'.$max_width.'px;';?>width:100%;<?php echo 'min-width:'.$min_width.'px;';?>min-height:1px;padding:0;margin:0;position:relative;float:left;}#<?php echo $id_tabs;?> h3 {margin:0 0 5px 0 !important;line-height: 1 !important}#<?php echo $id_tabs;?> p {margin:0 !important;}#<?php echo $id_tabs;?> .row {width:auto;max-width:none;min-width:0;}#controls-<?php echo $id_tabs;?> {list-style:none;display:block;min-height:1px;padding:0;margin:0;}#controls-<?php echo $id_tabs;?> .ullist {width:100%;}#controls-<?php echo $id_tabs;?> .ullist {margin-bottom:17px;line-height:1.6;list-style-position:outside;}#controls-<?php echo $id_tabs;?> .ullist li {display:block;padding:0;margin:0;list-style-type:none;font-size:14px;direction:ltr;float:left;}#controls-<?php echo $id_tabs;?> .ullist li:first-child {margin-left: 0;}#controls-<?php echo $id_tabs;?> .ullist li.active {border-top:3px solid #<?php echo $active;?> !important;font-weight:bold;background-color:#fff !important;}#controls-<?php echo $id_tabs;?> .ullist li a {min-height:1px;line-height:35px;padding:0px 20px !important;}#controls-<?php echo $id_tabs;?> .ullist li.active a {font-weight:bold;line-height: 32px;cursor:default;font-weight:bold;}#<?php echo $id_tabs;?> *, *:before, *:after {box-sizing:border-box;}#info-<?php echo $id_tabs;?> {width:100%;min-height:1px;padding:10px 10px 0 10px;margin:0;position:relative;float:left;}#gmap-<?php echo $id_tabs;?> {width:97.3% !important;height:<?php echo $height;?>px !important;padding:3px;border:5px solid #<?php echo $background_color;?>;box-sizing:content-box;}#<?php echo $id_tabs;?> img {max-width: none;}#info-<?php echo $id_tabs;?>, #controls-<?php echo $id_tabs;?> .ullist li.active a {background-color:#<?php echo $background_color;?>;}#<?php echo $id_tabs;?> h3, #<?php echo $id_tabs;?> p, #controls-<?php echo $id_tabs;?> .ullist li a, #controls-<?php echo $id_tabs;?> .ullist li.active a {color:#<?php echo $text_color;?> !important;}</style> 
  94. <?php