/** * Process form input for widget * * @access public * @return Mixed */ function post($args, $options) { extract($args); if (isset($geo_mashup_location)) { $geo_mashup_location = trim($geo_mashup_location); } if (!isset($geo_mashup_location) || $options['required'] && (empty($geo_mashup_location) || $geo_mashup_location == ',')) { return __("You must specific a location using the map!", "tdomf"); } if (!empty($geo_mashup_location) && $geo_mashup_location != ',') { if (class_exists('GeoMashupDB')) { /* latest version: 1.2beta1x */ if (!empty($args['geo_mashup_location_id'])) { $ok = GeoMashupDB::set_post_location($post_ID, $geo_mashup_location_id); } else { list($lat, $lng) = split(',', $geo_mashup_location); $post_location = array(); $post_location['lat'] = trim($lat); $post_location['lng'] = trim($lng); $post_location['saved_name'] = $geo_mashup_location_name; $post_location['geoname'] = $geo_mashup_geoname; $post_location['address'] = $geo_mashup_address; $post_location['postal_code'] = $geo_mashup_postal_code; $post_location['country_code'] = $geo_mashup_country_code; $post_location['admin_code'] = $geo_mashup_admin_code; $post_location['admin_name'] = $geo_mashup_admin_name; $post_location['sub_admin_code'] = $geo_mashup_sub_admin_code; $post_location['sub_admin_name'] = $geo_mashup_sub_admin_name; $post_location['locality_name'] = $geo_mashup_locality_name; $ok = GeoMashupDB::set_post_location($post_ID, $post_location); } if (!$ok) { return __('GeoMashup reported an error when attempting to process location', 'tdomf'); } } else { /* old version: 1.1.2.0 */ add_post_meta($post_ID, '_geo_location', $geo_mashup_location); } if ($options['append']) { $post = wp_get_single_post($post_ID, ARRAY_A); if (!empty($post['post_content'])) { $post = add_magic_quotes($post); } $postdata = array("ID" => $post_ID, "post_content" => $post['post_content'] . '[geo_mashup_map]'); sanitize_post($postdata, "db"); wp_update_post($postdata); } } return NULL; }