yesterday i updated the wordpress plugins on our d2h.net and xyzzyxyzzy.net blogs. once done, both blogs would not work anymore…duh! the updated geopress plugin was borked :-( — or so it seemed…
…it turned out that i had added code to the earlier version of geopress to do pretty printing of coordinates, and, of course, the update flushed that code down the drain. thanks to a regular backup running on our web server, however, that code was not gone forever. here are the functions that i added:
the_geo_coord() gets the coordinates via geopress’s the_coord() function and simply substitutes commas for spaces.
likewise,
$coord = the_coord(); $coord = split(” “, $coord);
$coord_lat = intval($coord[0]); $coord_lon = intval($coord[1]); $coord_lat_min = intval(($coord[0] - $coord_lat) * 60); $coord_lon_min = intval(($coord[1] - $coord_lon) * 60); $coord_lat_sec = intval(((($coord[0] - $coord_lat) * 60) - $coord_lat_min) * 60); $coord_lon_sec = intval(((($coord[1] - $coord_lon) * 60) - $coord_lon_min) * 60);
if (0 <= $coord_lat) { $coord_lat = ‘N ’ . $coord_lat; } else { $coord_lat = ‘S ’ . abs($coord_lat); }
if (0 <= $coord_lon) { $coord_lon = ‘E ’ . $coord_lon; } else { $coord_lon = ‘W ’ . abs($coord_lon); }
$coord_tag = “$coord_lat° $coord_lat_min’ $coord_lat_sec", $coord_lon° $coord_lon_min’ $coord_lon_sec"“;
return $coord_tag;
}
takes geopress’s the_coord() and pretty-prints it as human readable “old-style” latitute–longitude coordinates. the_geo_coord_esc() finally, produces a URL escaped longitude–latitude coordinate for use inside a, well, URL:
return $q;
}
just add those PHP functions to geopress/geopress.php, shake, stir, and save.
