mkgd_footer

The MK Google Directions mkgd footer function.

Description

mkgd_footer(); 

Usage

  1. if ( !function_exists( 'mkgd_footer' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'mk-google-directions/mk-google-directions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = mkgd_footer(); 
  7.  

Defined (1)

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

/mk-google-directions.php  
  1. function mkgd_footer() { 
  2. wp_enqueue_script('mkgd-google-map', plugins_url('/js/mkgd-google-map.js', __FILE__), array('jquery')); 
  3. ?> 
  4. <script type="text/javascript"> 
  5. jQuery("#btnMkgdSubmit").click(function() { 
  6. var start = document.getElementById('origin').value; 
  7. var end = document.getElementById('destination').value; 
  8. if (start == "" || end == "") { 
  9. alert("Please enter start and end points of your destination."); 
  10. return false; 
  11. jQuery('#directions').html('<center><br/><img src="<?php echo plugins_url('mk-google-directions/images/loader.gif') ?>" alt="Loading Directions" title="Loading Directions"/></center>'); 
  12. jQuery.post('<?php echo plugins_url('/mkgd-ajax-handler.php', __FILE__); ?>', {origin: start, destination: end, language: '<?php echo get_option('mkgd_language', 'en'); ?>', units: '<?php echo get_option('mkgd_units', 'metric'); ?>'}, function(data) { 
  13. jQuery('#directions').html(data); 
  14. }); 
  15. }); 
  16. </script> 
  17. <script type="text/javascript"> 
  18. /* 
  19. * Load the google map 
  20. */ 
  21. function initialize() { 
  22. directionsDisplay = new google.maps.DirectionsRenderer(); 
  23. var chicago = new google.maps.LatLng(<?php echo get_option('mkgd_latitude', '43.6525'); ?>, <?php echo get_option('mkgd_longitude', '-79.3816667'); ?>); 
  24. var mapOptions = { 
  25. zoom: 7,  
  26. mapTypeId: google.maps.MapTypeId.ROADMAP,  
  27. center: chicago 
  28. map = new google.maps.Map(document.getElementById('mkgd-map-canvas'), mapOptions); 
  29. directionsDisplay.setMap(map); 
  30.  
  31. </script> 
  32. <?php 
  33. // If start and destination are set 
  34. if ((get_option('mkgd_show_start_point') == 1) && (get_option('mkgd_show_start_point') == 1)) { 
  35. ?> 
  36. <script type="text/javascript"> 
  37. jQuery("document").ready(function() { 
  38. calcRoute(); 
  39. jQuery("#btnMkgdSubmit").trigger('click'); 
  40. }); 
  41. </script> 
  42. <?php