Skip to content

Commit

Permalink
Issue #25 Only call bw_googlemap_v3 when lat and long are numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed May 27, 2017
1 parent 605d3b2 commit 7b1f0d2
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions includes/oik-fields-virtual-google-map.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?php // (C) Copyright Bobbing Wide 2015
<?php // (C) Copyright Bobbing Wide 2015, 2017
/**
* Return the Google Map for the given _post_code, _lat and _long
*
* Use [bw_show_googlemap] to display a Google Map
* passing the values of _post_code, _lat and _long
* so it doesn't need to get them from oik options
* This is similar to using [bw_show_googlemap] to display a Google Map
* except we pass the values of _post_code, _lat and _long
* so it doesn't need to get them from oik options.
*
* @param array -
* @param string $post_code
* @param string $lat
* @param string $long
* @param integer $ID
* @return string - Google Map
*/
function bw_fields_get_google_map( $post_code, $lat=null, $long=null, $ID=null ) {

bw_trace2();
bw_backtrace();


oik_require( "shortcodes/oik-googlemap.php" );



$google_map = bw_googlemap_v3( get_the_title( $ID )
, $lat
, $long
, $post_code
, "100%"
, "400px"
);

//bw_trace2();
//bw_backtrace();

if ( is_numeric( $lat ) && is_numeric( $long ) ) {
oik_require( "shortcodes/oik-googlemap.php" );
$google_map = bw_googlemap_v3( get_the_title( $ID )
, $lat
, $long
, $post_code
, "100%"
, "400px"
);
} else {
$google_map = null;
}

return( $google_map );
return( $google_map );
}

0 comments on commit 7b1f0d2

Please sign in to comment.