mkgd_footer
The MK Google Directions mkgd footer function.
Description
mkgd_footer();
Usage
if ( !function_exists( 'mkgd_footer' ) ) { require_once ABSPATH . PLUGINDIR . 'mk-google-directions/mk-google-directions.php'; } // NOTICE! Understand what this does before running. $result = mkgd_footer();
Defined (1)
The function is defined in the following location(s).
- /mk-google-directions.php
- function mkgd_footer() {
- wp_enqueue_script('mkgd-google-map', plugins_url('/js/mkgd-google-map.js', __FILE__), array('jquery'));
- ?>
- <script type="text/javascript">
- jQuery("#btnMkgdSubmit").click(function() {
- var start = document.getElementById('origin').value;
- var end = document.getElementById('destination').value;
- if (start == "" || end == "") {
- alert("Please enter start and end points of your destination.");
- return false;
- }
- jQuery('#directions').html('<center><br/><img src="<?php echo plugins_url('mk-google-directions/images/loader.gif') ?>" alt="Loading Directions" title="Loading Directions"/></center>');
- 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) {
- jQuery('#directions').html(data);
- });
- });
- </script>
- <script type="text/javascript">
- /*
- * Load the google map
- */
- function initialize() {
- directionsDisplay = new google.maps.DirectionsRenderer();
- var chicago = new google.maps.LatLng(<?php echo get_option('mkgd_latitude', '43.6525'); ?>, <?php echo get_option('mkgd_longitude', '-79.3816667'); ?>);
- var mapOptions = {
- zoom: 7,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- center: chicago
- }
- map = new google.maps.Map(document.getElementById('mkgd-map-canvas'), mapOptions);
- directionsDisplay.setMap(map);
- }
- </script>
- <?php