Function Reference: geodir_custom_gmaps_update_style
Summary
This function has not been documented yet.
Source File
geodir_custom_gmaps_update_style() is located in geodir_custom_google_maps/geodir_custom_gmaps_functions.php [Line: 171]
Source Code
function geodir_custom_gmaps_update_style() { $msg = __('Map style not saved, please try again!', GEODIRCUSTOMGMAPS_TEXTDOMAIN); if (current_user_can('manage_options') && isset($_POST['custom_gmaps_update_nonce'])) { $gd_map = isset($_POST['gd_map']) ? trim($_POST['gd_map']) : ''; $gd_gmap_style = isset($_POST['gd_gmap_style']) ? $_POST['gd_gmap_style'] : ''; if (empty($gd_gmap_style)) { $msg = __('Map style not saved, please add atleast one style!', GEODIRCUSTOMGMAPS_TEXTDOMAIN); //wp_redirect(admin_url().'admin.php?page=geodirectory&tab=custom_gmaps_manager&subtab=geodir_custom_gmaps_manage_styles&gd_map='.$gd_map); //exit; } if (wp_verify_nonce($_POST['custom_gmaps_update_nonce'], 'custom_gmaps_update')) { $save_params = array(); foreach ($gd_gmap_style as $index => $row) { $featureType = isset($row['featureType']) && $row['featureType'] != '' ? $row['featureType'] : ''; $elementType = isset($row['elementType']) && $row['elementType'] != '' ? $row['elementType'] : ''; $stylers = isset($row['stylers']) && !empty($row['stylers']) != '' ? $row['stylers'] : ''; $parse_stylers = array(); foreach ($stylers as $styler => $value) { if ($value!='' && strlen($value) > 0) { $parse_stylers[][$styler] = $value; } } if ($featureType != '' && !empty($parse_stylers)) { $save_param = array(); $save_param['featureType'] = $featureType; if ($elementType!='') { $save_param['elementType'] = $elementType; } $save_param['stylers'] = $parse_stylers; $save_params[] = $save_param; } } if (empty($save_params)) { $msg = __('Map style not saved, please choose atleast one styler!', GEODIRCUSTOMGMAPS_TEXTDOMAIN); //return $msg; } $return = false; switch($gd_map) { case 'home': { $option_value = get_option('geodir_custom_gmaps_style_home'); // hook $save_params = apply_filters('geodir_custom_gmaps_save_style_home', $save_params); update_option('geodir_custom_gmaps_style_home', $save_params); $return = true; } break; case 'listing': { $option_value = get_option('geodir_custom_gmaps_style_listing'); // hook $save_params = apply_filters('geodir_custom_gmaps_save_style_listing', $save_params); update_option('geodir_custom_gmaps_style_listing', $save_params); $return = true; } break; case 'detail': { $option_value = get_option('geodir_custom_gmaps_style_detail'); // hook $save_params = apply_filters('geodir_custom_gmaps_save_style_detail', $save_params); update_option('geodir_custom_gmaps_style_detail', $save_params); $return = true; } break; } if ($return) { $msg = __('Map style saved.', GEODIRCUSTOMGMAPS_TEXTDOMAIN); } } } return $msg; }