0 ? get_post($edit_id) : null; if (!is_user_logged_in()) { wp_safe_redirect(jio_get_login_url(Core::edit_url($edit_id))); exit; } if ($edit_id > 0 && (!$post instanceof WP_Post || !Access::can_manage_post(get_current_user_id(), $edit_id))) { status_header(403); wp_die(esc_html__('无权编辑此帖子', 'jio')); } wp_enqueue_editor(); $plate_id = $post ? (int) get_post_meta($post->ID, '_jio_forum_plate_id', true) : absint($_GET['plate'] ?? 0); $vote_started = $post ? (int) get_post_meta($post->ID, '_jio_forum_vote_started', true) : 0; $vote_deadline = $post ? (int) get_post_meta($post->ID, '_jio_forum_vote_deadline', true) : 0; $vote_days = $vote_started && $vote_deadline ? (int) round(($vote_deadline - $vote_started) / DAY_IN_SECONDS) : 0; $plates = get_posts(['post_type' => Core::PLATE, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC']); View::open($post ? '编辑帖子' : '发布帖子', 'edit'); ?>