Dirty update to support displaying images without GPX track
This commit is contained in:
parent
2b5b268b14
commit
7132bc4b43
|
@ -342,6 +342,8 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
|
|||
$colors_map = "\"" . implode( "\",\"", ( explode( " ", $color_map ) ) ) . "\"";
|
||||
|
||||
$gpxurl = $gpx;
|
||||
|
||||
if ( ! $gpx == null ) {
|
||||
|
||||
/* Add file modification time to cache filename to catch new uploads with same file name */
|
||||
$mtime = wp_gpx_maps_sitePath() . str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, trim( $gpx ) );
|
||||
|
@ -433,9 +435,9 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
|
|||
$gpx = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $gpx );
|
||||
$gpx = $sitePath . $gpx;
|
||||
}
|
||||
if ( $gpx == '' ) {
|
||||
return "No gpx found";
|
||||
}
|
||||
//if ( $gpx == '' ) {
|
||||
// return "No gpx found";
|
||||
//}
|
||||
|
||||
$points = wpgpxmaps_getPoints( $gpx, $pointsoffset, $donotreducegpx, $distanceType );
|
||||
|
||||
|
@ -640,6 +642,14 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
|
|||
$points_graph_grade = '';
|
||||
|
||||
}
|
||||
} else {
|
||||
// $gpx == null (no GPX track to display, only images...)
|
||||
$points_x_time = array();
|
||||
$points_x_lat = array();
|
||||
$points_x_lon = array();
|
||||
$waypoints = '[]';
|
||||
$points_maps = '';
|
||||
}
|
||||
|
||||
$ngimgs_data = '';
|
||||
if ( $ngGalleries != '' || $ngImages != '' ) {
|
||||
|
@ -662,7 +672,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! ( $skipcache == true ) ) {
|
||||
if ( ! ( $skipcache == true ) && ! ( $gpx == null ) ) {
|
||||
|
||||
@file_put_contents( $gpxcache, serialize( array(
|
||||
'points_maps' => $points_maps,
|
||||
|
@ -694,7 +704,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
|
|||
@chmod( $gpxcache, 0755 );
|
||||
}
|
||||
|
||||
$hideGraph = ( $gh == '0' || $gh == '0px' );
|
||||
$hideGraph = ( $gh == '0' || $gh == '0px' || $gpx == null );
|
||||
|
||||
global $post;
|
||||
$r = $post->ID . '_' . rand( 1,5000000 );
|
||||
|
|
Loading…
Reference in New Issue