Used by the view.
Author: Inpsyde GmbH, toscho, tf
 /**
  *
  * @wp-hook mlp_translation_meta_box_registered
  *
  * @param WP_Post $post
  * @param int     $blog_id
  *
  * @return void
  */
 public function register_metabox_view_details(WP_Post $post, $blog_id)
 {
     // get the current remote post status
     $remote_post = $this->basic_data->get_remote_post($post, $blog_id);
     $is_trashed = isset($remote_post->post_status) && $remote_post->post_status == 'trash';
     // set the base
     $base = 'mlp_translation_meta_box_';
     // check if the remote post is trashed
     // if it is so, show the warning
     if ($is_trashed) {
         add_action($base . 'top_' . $blog_id, array($this->view, 'show_trashed_message'), 10, 3);
         return;
     }
     // add the actions if the remote is not trashed
     add_action($base . 'top_' . $blog_id, array($this->view, 'blog_id_input'), 10, 3);
     if (post_type_supports($post->post_type, 'title')) {
         add_action($base . 'top_' . $blog_id, array($this->view, 'show_title'), 10, 3);
     }
     add_action($base . 'top_' . $blog_id, array($this->view, 'show_name'), 10, 3);
     if (post_type_supports($post->post_type, 'editor')) {
         add_action($base . 'main_' . $blog_id, array($this->view, 'show_editor'), 10, 3);
     } else {
         remove_action('media_buttons', array($this->view, 'show_copy_button'), 20);
     }
     if (post_type_supports($post->post_type, 'excerpt')) {
         add_action($base . 'main_' . $blog_id, array($this->view, 'show_excerpt'), 10, 3);
     }
     if (post_type_supports($post->post_type, 'thumbnail')) {
         add_action($base . 'main_' . $blog_id, array($this->view, 'show_thumbnail_checkbox'), 11, 3);
     }
     $taxonomies = get_object_taxonomies($post, 'objects');
     if (!empty($taxonomies)) {
         add_action($base . 'bottom_' . $blog_id, array($this->view, 'show_taxonomies'), 10, 3);
     }
 }
 /**
  * Create the default post data for the save() method.
  *
  * @param  array  $post_data Post data.
  * @param  string $post_type Post type.
  * @param  int    $blog_id   Blog ID.
  *
  * @return array
  */
 private function create_post_to_send(array $post_data, $post_type, $blog_id)
 {
     $title = $this->get_remote_post_title($post_data);
     $content = $this->get_remote_post_content($post_data);
     if ($this->is_empty_remote_post($title, $content, $post_type)) {
         return array();
     }
     $new = array('post_type' => $post_type, 'post_title' => $title, 'post_content' => $content, 'post_parent' => $this->basic_data->get_post_parent($blog_id));
     if (!empty($post_data['remote_post_id'])) {
         $new['ID'] = $post_data['remote_post_id'];
         /**
          * Filter post data before it is saved to database.
          *
          * @param array $new_post
          * @param array $save_context
          */
         $new = apply_filters('mlp_pre_save_post', $new, $this->save_context);
         return $new;
     }
     // new post
     $new['post_status'] = 'draft';
     /**
      * Filter post data before it is insert to database.
      *
      * @param array $new_post
      * @param array $save_context
      */
     $new = apply_filters('mlp_pre_insert_post', $new, $this->save_context);
     return $new;
 }
 /**
  * Create the default post data for the save() method.
  *
  * @param  array  $post_data Post data.
  * @param  string $post_type Post type.
  * @param  int    $blog_id   Blog ID.
  *
  * @return array
  */
 private function create_post_to_send(array $post_data, $post_type, $blog_id)
 {
     $title = $this->get_remote_post_title($post_data);
     $name = $this->get_remote_post_name($post_data);
     $content = $this->get_remote_post_content($post_data);
     $excerpt = $this->get_remote_post_excerpt($post_data);
     if ($this->is_empty_remote_post($title, $content, $post_type)) {
         return array();
     }
     $new_post_data = array('post_type' => $post_type, 'post_title' => $title, 'post_name' => $name, 'post_content' => $content, 'post_excerpt' => $excerpt, 'post_parent' => $this->basic_data->get_post_parent($blog_id));
     if (!empty($post_data['remote_post_id'])) {
         $new_post_data['ID'] = $post_data['remote_post_id'];
         /**
          * Filter the post data before saving the post.
          *
          * @param array $post_data    Post data.
          * @param array $save_context Context of the to-be-saved post.
          *
          * @return array
          */
         $new_post_data = apply_filters('mlp_pre_save_post', $new_post_data, $this->save_context);
         return $new_post_data;
     }
     // new post
     $new_post_data['post_status'] = 'draft';
     // add post_author if override is available
     if (isset($this->post_request_data['post_author_override'])) {
         $new_post_data['post_author'] = $this->post_request_data['post_author_override'];
     }
     /**
      * Filter the new post data before inserting the post into the database.
      *
      * @param array $post_data    Post data.
      * @param array $save_context Context of the to-be-saved post.
      *
      * @return array
      */
     $new_post_data = apply_filters('mlp_pre_insert_post', $new_post_data, $this->save_context);
     return $new_post_data;
 }
 /**
  * Create the default post data for the save() method.
  *
  * @param  array  $post_data
  * @param  string $post_type
  * @param  int    $blog_id
  * @return array
  */
 private function create_post_to_send(array $post_data, $post_type, $blog_id)
 {
     $title = $this->get_remote_post_title($post_data);
     $content = $this->get_remote_post_content($post_data);
     if ($this->is_empty_remote_post($title, $content, $post_type)) {
         return array();
     }
     $new = array('post_type' => $post_type, 'post_title' => $title, 'post_content' => $content, 'post_parent' => $this->basic_data->get_post_parent($blog_id));
     if (!empty($post_data['remote_post_id'])) {
         $new['ID'] = $post_data['remote_post_id'];
         // deprecated notice for filter "mlp_pre_update_post"
         if (has_filter('mlp_pre_update_post')) {
             _doing_it_wrong('mlp_pre_update_post', 'mlp_pre_update_post is deprecated and will be removed in MultilingualPress 2.2, please use mlp_pre_save_post instead.', '2.1');
         }
         /**
          * Filter post data before it is saved to the database.
          *
          * @param       array $new_post
          * @deprecated
          * @see         mlp_pre_save_post
          */
         $new = apply_filters('mlp_pre_update_post', $new);
         /**
          * Filter post data before it is saved to database.
          * @param       array $new_post
          * TODO:        Adding 2. param context! See 'mlp_pre_save_post' in Mlp_Translatable_Post_Data.php
          */
         $new = apply_filters('mlp_pre_save_post', $new);
         return $new;
     }
     // new post
     $new['post_status'] = 'draft';
     /**
      * Filter post data before it is insert to database.
      * @param       array $new_post
      * TODO:        Adding 2. param context! See 'mlp_pre_insert_post' in Mlp_Translatable_Post_Data.php
      */
     return apply_filters('mlp_pre_insert_post', $new);
 }