<?php

/**
 * Add new fields to the "Publish" metabox.
 *
 * @link    https://aiopodcasting.com
 * @since   1.0.0
 *
 * @package AiO_Podcast_Studio
 */

// Exit if accessed directly
if ( ! defined( 'WPINC' ) ) {
	die;
}

$is_featured = get_post_meta( $post_id, 'is_featured', true );
$shortcode   = sprintf( '[aiopod_episode id="%d"]', (int) $post_id );

if ( current_user_can( 'manage_aiopod_options' ) ) : ?>
	<div class="aiopod misc-pub-section misc-pub-is_featured">
		<label>
			<input type="checkbox" name="is_featured" value="1" <?php checked( $is_featured, 1 ); ?> />
			<?php
			printf(
				/* translators: %s: "Featured" label, shown in bold. */
				esc_html__( 'Mark as %s', 'aio-podcast-studio' ),
				'<strong>' . esc_html__( 'Featured', 'aio-podcast-studio' ) . '</strong>'
			);
			?>
		</label>
	</div>

	<?php wp_nonce_field( 'aiopod_save_episode_submitbox', 'aiopod_episode_submitbox_nonce' ); // Nonce ?>
<?php endif; ?>

<hr />

<?php do_action( 'aiopod_episode_submitbox_misc_actions', $post ); ?>

<div class="aiopod misc-pub-section misc-pub-shortcode">
	<label class="aiopod-form-control">
		<strong><?php esc_html_e( 'Episode Shortcode', 'aio-podcast-studio' ); ?></strong>
    	<input type="text" class="widefat" readonly="readonly" value="<?php echo esc_attr( $shortcode ); ?>" />
		<p class="description">
			<?php esc_html_e( 'Use this shortcode to embed this episode player with details on any page or post.', 'aio-podcast-studio' ); ?>
		</p>
    </label>
</div>
