bluesky-Connector/templates/post-meta-box.php
2024-11-21 01:05:37 -08:00

58 lines
2.5 KiB
PHP

<div class="bluesky-post-status">
<?php wp_nonce_field('bluesky_post_meta_box', 'bluesky_post_meta_box_nonce'); ?>
<?php if (!empty($status)) : ?>
<p>
<strong><?php _e('Status:', 'bluesky-connector'); ?></strong>
<?php
switch ($status) {
case 'success':
echo '<span class="bluesky-status-success">' . esc_html__('Posted', 'bluesky-connector') . '</span>';
break;
case 'error':
echo '<span class="bluesky-status-error">' . esc_html__('Error', 'bluesky-connector') . '</span>';
break;
case 'queued':
echo '<span class="bluesky-status-pending">' . esc_html__('Queued', 'bluesky-connector') . '</span>';
break;
default:
echo '<span class="bluesky-status-unknown">' . esc_html__('Unknown', 'bluesky-connector') . '</span>';
}
?>
</p>
<?php if ($posted_date) : ?>
<p>
<strong><?php _e('Posted:', 'bluesky-connector'); ?></strong>
<?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($posted_date))); ?>
</p>
<?php endif; ?>
<?php if ($post_id) : ?>
<p>
<strong><?php _e('Bluesky Post ID:', 'bluesky-connector'); ?></strong>
<code><?php echo esc_html($post_id); ?></code>
</p>
<?php endif; ?>
<?php if ($error) : ?>
<p class="bluesky-error-message">
<strong><?php _e('Error:', 'bluesky-connector'); ?></strong>
<?php echo esc_html($error); ?>
</p>
<?php endif; ?>
<div class="bluesky-actions">
<?php if ($status === 'error' || empty($post_id)) : ?>
<button type="button" class="button bluesky-retry-post" data-post-id="<?php echo esc_attr($post->ID); ?>">
<?php _e('Retry Post', 'bluesky-connector'); ?>
</button>
<?php endif; ?>
</div>
<?php else : ?>
<p><?php _e('This post has not been shared to Bluesky yet.', 'bluesky-connector'); ?></p>
<button type="button" class="button bluesky-share-post" data-post-id="<?php echo esc_attr($post->ID); ?>">
<?php _e('Share to Bluesky', 'bluesky-connector'); ?>
</button>
<?php endif; ?>
</div>