/**
  * Callback that renders the Cross-post meta box.
  */
 public static function meta_box_callback($post, $args)
 {
     global $current_user;
     $medium_logo_url = MEDIUM_PLUGIN_URL . 'i/logo.png';
     $medium_post = Medium_Post::get_by_wp_id($post->ID);
     $medium_user = Medium_User::get_by_wp_id($post->post_author);
     if ($medium_post->id) {
         // Already connected.
         if ($medium_user->id) {
             $medium_post->author_url = $medium_user->url;
             $medium_post->author_image_url = $medium_user->image_url;
         }
         Medium_View::render("form-post-box-linked", array("medium_post" => $medium_post, "medium_logo_url" => $medium_logo_url));
     } else {
         if ($medium_user->token && $medium_user->id) {
             // Can be connected.
             if (!$medium_post->license) {
                 $medium_post->license = $medium_user->default_license;
             }
             if (!$medium_post->status) {
                 $medium_post->status = $medium_user->default_status;
             }
             if (!$medium_post->cross_link) {
                 // Default to no cross-linking, per WordPress guidelines.
                 $medium_post->cross_link = $medium_user->default_cross_link;
             }
             $options_visibility_class = $medium_post->status == "none" ? "hidden" : "";
             Medium_View::render("form-post-box-actions", array("medium_post" => $medium_post, "medium_user" => $medium_user, "medium_logo_url" => $medium_logo_url, "medium_post_statuses" => self::_get_post_statuses(), "medium_post_licenses" => self::_get_post_licenses(), "medium_post_cross_link_options" => self::_get_post_cross_link_options(), "options_visibility_class" => $options_visibility_class));
         } else {
             // Needs token.
             Medium_View::render("form-post-box-actions-disabled", array("edit_profile_url" => get_edit_user_link($current_user->ID) . '#medium'));
         }
     }
 }
 /**
  * Callback that renders the Cross-post meta box.
  */
 public static function meta_box_callback($post, $args)
 {
     global $current_user;
     $medium_logo_url = MEDIUM_PLUGIN_URL . 'i/logo.png';
     $medium_post = Medium_Post::get_by_wp_id($post->ID);
     $medium_user = Medium_User::get_by_wp_id($post->post_author);
     if ($medium_post->id) {
         // Already connected.
         if ($medium_user->id) {
             $medium_post->author_url = $medium_user->url;
             $medium_post->author_image_url = $medium_user->image_url;
         }
         Medium_View::render("form-post-box-linked", array("medium_post" => $medium_post, "medium_logo_url" => $medium_logo_url));
     } else {
         if ($medium_user->token && $medium_user->id) {
             // Can be connected.
             if (!$medium_post->license) {
                 $medium_post->license = $medium_user->default_license;
             }
             if (!$medium_post->cross_link) {
                 // Default to no cross-linking, per WordPress guidelines.
                 $medium_post->cross_link = $medium_user->default_cross_link;
             }
             if (!$medium_post->follower_notification) {
                 // Default to notifying Medium followers.
                 $medium_post->follower_notification = $medium_user->default_follower_notification;
             }
             if (!$medium_post->publication_id) {
                 // Default to none.
                 $medium_post->publication_id = $medium_user->default_publication_id ? $medium_user->default_publication_id : NO_PUBLICATION;
             }
             $publication_options = self::_get_user_publication_options($medium_user);
             $publishable = $publication_options[$medium_post->publication_id]->publishable;
             if (!$medium_post->status) {
                 $medium_post->status = $medium_user->default_status;
             }
             if (($medium_post->status == "unlisted" || $medium_post->status == "public") && !$publishable) {
                 $medium_post->status = "draft";
             }
             $options_visibility_class = $medium_post->status == "none" ? "hidden" : "";
             Medium_View::render("form-post-box-actions", array("medium_post" => $medium_post, "medium_user" => $medium_user, "medium_logo_url" => $medium_logo_url, "medium_post_statuses" => self::_get_post_statuses(), "medium_post_licenses" => self::_get_post_licenses(), "medium_boolean_options" => self::_get_boolean_options(), "medium_publication_options" => $publication_options, "options_visibility_class" => $options_visibility_class, "default_publication_publishable" => $publishable));
         } else {
             // Needs token.
             Medium_View::render("form-post-box-actions-disabled", array("edit_profile_url" => get_edit_user_link($current_user->ID) . '#medium'));
         }
     }
 }