/**
  * WordPress action to perform an ajax edit operation and echo results.
  *
  * @since 1.3
  */
 public static function ajax_edit()
 {
     check_ajax_referer('geo-mashup-edit', 'geo_mashup_nonce');
     unset($_GET['_wpnonce']);
     $status = array('request' => 'ajax-edit', 'code' => 200);
     if (isset($_POST['geo_mashup_object_id'])) {
         $status['object_id'] = $_POST['geo_mashup_object_id'];
     } else {
         $status['code'] = 400;
         $status['message'] = __('No object id posted.', 'GeoMashup');
         $status['object_id'] = '?';
     }
     /** @todo add an option for a user capability check here? */
     if (200 == $status['code'] and !empty($_POST['geo_mashup_ui_manager'])) {
         $ui_manager = GeoMashupUIManager::get_instance($_POST['geo_mashup_ui_manager']);
         $result = $ui_manager->save_posted_object_location($status['object_id']);
         if (is_wp_error($result)) {
             $status['code'] = 500;
             $status['message'] = $result->get_error_message();
         }
     }
     if (200 == $status['code']) {
         if (!empty($_REQUEST['geo_mashup_update_location'])) {
             $status['message'] = __('Location updated.', 'GeoMashup');
         } else {
             if (!empty($_REQUEST['geo_mashup_delete_location'])) {
                 $status['message'] = __('Location deleted.', 'GeoMashup');
             } else {
                 if (!empty($_REQUEST['geo_mashup_add_location'])) {
                     $status['message'] = __('Location added.', 'GeoMashup');
                 }
             }
         }
     }
     echo json_encode(array('status' => $status));
     exit;
 }
 /**
  * Save a posted post or page location.
  * 
  * @since 1.3
  * @uses parent::save_posted_object_location()
  *
  * @param id $post_id 
  * @return bool|WP_Error
  */
 public function save_posted_object_location($post_id)
 {
     return parent::save_posted_object_location('post', $post_id);
 }
 /**
  * Handle old non-strict method calls with only one argument.
  *
  * @param string $object_name
  * @param null|int $object_id
  * @return bool|WP_Error
  */
 public function save_posted_object_location($object_name, $object_id = null)
 {
     // resolve old non-strict one argument calls
     if (is_null($object_id)) {
         $object_id = intval($object_name);
     }
     // We only know how to save posts
     $object_name = 'post';
     return parent::save_posted_object_location($object_name, $object_id);
 }