2024-11-21 09:05:37 +00:00
|
|
|
<div class="wrap">
|
|
|
|
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
|
2024-12-17 23:00:47 +00:00
|
|
|
|
|
|
|
<?php if ($settings['connection_status'] === 'connected'): ?>
|
|
|
|
<div class="notice notice-success">
|
|
|
|
<p><?php _e('Successfully connected to Bluesky!', 'bluesky-connctor'); ?></p>
|
|
|
|
</div>
|
|
|
|
<?php else: ?>
|
|
|
|
<div class="notice notice-error">
|
|
|
|
<!-- translators: %s: Error message -->
|
|
|
|
<p><?php printf(
|
|
|
|
esc_html__('Connection error: %s', 'bluesky-connctor'),
|
|
|
|
esc_html($settings['last_error'])
|
|
|
|
); ?></p>
|
|
|
|
</div>
|
2024-11-21 09:05:37 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="card">
|
2024-12-17 23:00:47 +00:00
|
|
|
<h2><?php esc_html_e('Connection Settings', 'bluesky-connctor'); ?></h2>
|
2024-11-21 09:05:37 +00:00
|
|
|
<form method="post" action="">
|
|
|
|
<?php wp_nonce_field('bluesky_connector_settings'); ?>
|
|
|
|
<input type="hidden" name="action" value="update_bluesky_settings">
|
2024-12-17 23:00:47 +00:00
|
|
|
|
2024-11-21 09:05:37 +00:00
|
|
|
<table class="form-table" role="presentation">
|
|
|
|
<tr>
|
|
|
|
<th scope="row">
|
2024-12-17 23:00:47 +00:00
|
|
|
<label for="bluesky_domain"><?php esc_html_e('Bluesky Domain', 'bluesky-connctor'); ?></label>
|
2024-11-21 09:05:37 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2024-12-17 23:00:47 +00:00
|
|
|
<input name="bluesky_connector_settings[domain]" type="url" id="bluesky_domain"
|
|
|
|
value="https://bsky.social" class="regular-text" readonly>
|
2024-11-21 09:05:37 +00:00
|
|
|
<p class="description">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php esc_html_e('The Bluesky API domain (fixed to https://bsky.social)', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th scope="row">
|
2024-12-17 23:00:47 +00:00
|
|
|
<label for="bluesky_identifier"><?php esc_html_e('Bluesky Handle', 'bluesky-connctor'); ?></label>
|
2024-11-21 09:05:37 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2024-12-17 23:00:47 +00:00
|
|
|
<input name="bluesky_connector_settings[identifier]" type="text" id="bluesky_identifier"
|
|
|
|
value="<?php echo esc_attr($settings['identifier']); ?>" class="regular-text"
|
|
|
|
placeholder="username.bsky.social" required>
|
2024-11-21 09:05:37 +00:00
|
|
|
<p class="description">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php esc_html_e('Your full Bluesky handle (e.g., username.bsky.social)', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th scope="row">
|
2024-12-17 23:00:47 +00:00
|
|
|
<label for="bluesky_password"><?php esc_html_e('App Password', 'bluesky-connctor'); ?></label>
|
2024-11-21 09:05:37 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2024-12-17 23:00:47 +00:00
|
|
|
<input name="bluesky_connector_settings[password]" type="password" id="bluesky_password"
|
|
|
|
class="regular-text" <?php echo empty($settings['identifier']) ? 'required' : ''; ?>>
|
2024-11-21 09:05:37 +00:00
|
|
|
<p class="description">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php esc_html_e('Your Bluesky app password (will not be stored)', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2024-12-17 23:00:47 +00:00
|
|
|
|
|
|
|
<?php submit_button(esc_html__('Save Connection Settings', 'bluesky-connctor')); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php if (!empty($settings['connection_status']) && $settings['connection_status'] === 'connected'): ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
<div class="card" style="margin-top: 20px;">
|
2024-12-17 23:00:47 +00:00
|
|
|
<h2><?php esc_html_e('Post Format Settings', 'bluesky-connctor'); ?></h2>
|
2024-11-21 09:05:37 +00:00
|
|
|
<form method="post" action="options.php">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php
|
|
|
|
settings_fields('bluesky-connector');
|
|
|
|
do_settings_sections('bluesky-connector');
|
|
|
|
?>
|
2024-11-21 09:05:37 +00:00
|
|
|
<table class="form-table" role="presentation">
|
|
|
|
<tr>
|
|
|
|
<th scope="row">
|
2024-12-17 23:00:47 +00:00
|
|
|
<label for="bluesky_post_format"><?php esc_html_e('Post Layout', 'bluesky-connctor'); ?></label>
|
2024-11-21 09:05:37 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2024-12-17 23:00:47 +00:00
|
|
|
<select name="bluesky_connector_settings[post_format]" id="bluesky_post_format">
|
|
|
|
<option value="title-excerpt-link" <?php selected($settings['post_format'] ?? 'title-excerpt-link', 'title-excerpt-link'); ?>>
|
|
|
|
<?php esc_html_e('Title + Excerpt + Link (No Image)', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</option>
|
2024-12-17 23:00:47 +00:00
|
|
|
<option value="image-title-excerpt-link" <?php selected($settings['post_format'] ?? 'title-excerpt-link', 'image-title-excerpt-link'); ?>>
|
|
|
|
<?php esc_html_e('Image + Title + Excerpt + Link', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
<p class="description">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php esc_html_e('bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th scope="row">
|
2024-12-17 23:00:47 +00:00
|
|
|
<label for="bluesky_include_title"><?php esc_html_e('Include Title', 'bluesky-connctor'); ?></label>
|
2024-11-21 09:05:37 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2024-12-17 23:00:47 +00:00
|
|
|
<input type="checkbox" name="bluesky_connector_settings[include_title]"
|
|
|
|
id="bluesky_include_title" value="1" <?php checked($settings['include_title'] ?? true); ?>>
|
2024-11-21 09:05:37 +00:00
|
|
|
<p class="description">
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php esc_html_e('Include post title in the Bluesky post', 'bluesky-connctor'); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php submit_button(esc_html__('Save Format Settings', 'bluesky-connctor')); ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card" style="margin-top: 20px;">
|
2024-12-17 23:00:47 +00:00
|
|
|
<h2><?php esc_html_e('Debug Information', 'bluesky-connctor'); ?></h2>
|
2024-11-21 09:05:37 +00:00
|
|
|
<table class="form-table" role="presentation">
|
|
|
|
<tr>
|
2024-12-17 23:00:47 +00:00
|
|
|
<th scope="row"><?php esc_html_e('Last Post Status', 'bluesky-connctor'); ?></th>
|
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
echo wp_kses(
|
|
|
|
sprintf(
|
|
|
|
/* translators: %s: Time of last post attempt */
|
|
|
|
esc_html__('Last post attempt: %s', 'bluesky-connctor'),
|
|
|
|
get_option('bluesky_last_post_time')
|
|
|
|
? esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), get_option('bluesky_last_post_time')))
|
|
|
|
: esc_html__('Never', 'bluesky-connctor')
|
|
|
|
),
|
|
|
|
array('b' => array(), 'span' => array('class' => array()))
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
</td>
|
2024-11-21 09:05:37 +00:00
|
|
|
</tr>
|
2024-12-17 23:00:47 +00:00
|
|
|
<?php if (WP_DEBUG): ?>
|
|
|
|
<tr>
|
|
|
|
<th scope="row"><?php esc_html_e('DID', 'bluesky-connctor'); ?></th>
|
|
|
|
<td><code><?php echo esc_html(get_option('bluesky_did')); ?></code></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th scope="row"><?php esc_html_e('Connection Status', 'bluesky-connctor'); ?></th>
|
|
|
|
<td><?php echo esc_html(get_option('bluesky_connection_status')); ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php endif; ?>
|
2024-11-21 09:05:37 +00:00
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|