Hi,
There seems to be a couple of bugs in this plugin that’s preventing me from updating (and one of them is that the support for maptoolkit got removed (and i don’t even want to mention the satellite-view but alright – still a very good plugin.
1) Missing track when a gpx got multiple tracks.
One nasty bug that I mentioned a couple times but does not seems to be picked up by the authors is that when a gpx got multiple track, one of them is not show. This is a very simple bug to file:
Change line 21 of ./js/WP-GPX-Maps.js form
for ( i = 0; i < _len; i++ ) {
to
for ( i = 0; i <= _len; i++ ) {
This is a very simple fix.
2) Saving unchecked ‘show elevation’ this shows as checked.
For this bug I had to dive in to the code bit deeper and see what was going on. Since I do not have too much experience with plugins I used ‘show speed’ as a reference since that is working fine as far as I know.
First I started with how the admin-page was saving the option. On about line 523 of ./wp-gpx-maps-admin-settings.php the way the “show elevation” checkbox is being saved is a bit weird and does not use the same method as how “show speed” is save so I altered that to make it more consitent. This is the code for the table-cell starting at line 523:
<td>
<input name="wpgpxmaps_show_elevation" type="checkbox" value="true" <?php if ( true == $showEle ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i><?php esc_html_e( 'Show altitude', 'wp-gpx-maps' ); ?></i>
</td>
Then is still isn’t working properly. I was debugging the main file (./wp-gpx-maps.php) because I wanted to know what got returned from line 261:
$showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', true );
It seems when show elevation is enabled it return “true” but when it is disabled it returns “1”. Therefore I changed line 261 of ./wp-gpx-maps.php into this:
$showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', false );
I did some tests with these and it does work I think – When you add the option showele=”true” in the shortcode it also works when it is set disabled on the admin-page.
How this helps.
Regards
Sjoerd (k1600gt.nl)
-
This reply was modified 2 years, 9 months ago by
sjoerd72.
-
This reply was modified 2 years, 9 months ago by
sjoerd72.
-
This reply was modified 2 years, 9 months ago by
sjoerd72. Reason: improved readability