}, 10, 3);
-// Getting the current admin theme colors as set by Wordpress.
-// This will be useful for styling our menu when we figure out how best to use
+// Getting the current admin theme colors as set by Wordpress.
+// This will be useful for styling our menu when we figure out how best to use
// the available data.
-//
+//
//$admin_colors;
//add_action('admin_head', function(){global $_wp_admin_css_colors; $admin_colors = $_wp_admin_css_colors;});
//$admin_colors[get_user_option('admin_color')]['colors'];
-
+
function get_member_id_by_name( $name = null )
{
if ( $name ) {
return $memberId;
}
}
+add_filter( 'glm-member-lat-lon-dms', function( $d, $LatLon, $type, $precision ){
+ $sign = +1;
+ if ($d < 0) {
+ $sign = -1;
+ }
+
+ switch ($LatLon) {
+ case 'Lat':
+ // Is it N or S?
+ $dir = 'N';
+ if ($d < 0) {
+ $dir = 'S';
+ }
+
+ $deg_size = 2;
+ $dir_opts = array('1' => 'N', '-1' => 'S');
+ break;
+ case 'Lon':
+ // Is it E or W?
+ $dir = 'E';
+ if ($d < 0) {
+ $dir = 'W';
+ }
+
+ $deg_size = 3;
+ $dir_opts = array('1' => 'E', '-1' => 'W');
+ break;
+ }
+ $d = abs($d);
+ $deg = 0;
+ $min = 0;
+ $sec = 0;
+ $format = "%s %0" . $deg_size . "." . $precision . "f°";
+
+ if ($type == 'D') {
+ $deg = $d;
+ } elseif ($type == 'DM' || $type == 'DMS') {
+ $deg = (int) $d;
+ $d = ($d - $deg) * 60;
+ $min = $d;
+ $format = "%s %02d° %02.".$precision."f'";
+ if ($type == 'DMS') {
+ $min = (int) $d;
+ $sec = ($d - $min) * 60;
+ $format = "%s %0".$deg_size."d° %02d' %02.".$precision."f\"";
+ }
+ }
+
+ // Setup possible direction selection
+ $dir_select = array(
+ array(
+ 'value' => 1,
+ 'name' => $dir_opts[1],
+ 'default' => ($sign == 1)
+ ),
+ array(
+ 'value' => - 1,
+ 'name' => $dir_opts[-1],
+ 'default' => ($sign == - 1)
+ )
+ );
+
+ return array(
+ 'text' => $dms = sprintf($format, $dir, $deg, $min, $sec),
+ 'd_only' => ($sign * ($deg + ($min + $sec / 60) / 60)),
+ 'dir' => $sign,
+ 'dir_list' => $dir_select,
+ 'deg' => $deg,
+ 'min' => $min,
+ 'sec' => $sec,
+ );
+},
+10,
+4
+);