bluesky-Connector/templates/settings-page.php
enki 3bb8217690 Major cleanup: Image handling fixes and plugin updates
- Fixed featured image upload and handling
- Added detailed debug logging
- Cleaned up fallback image functionality
- Updated README.md with new MIT license
- Added .gitignore file
- Fixed image reposting functionality
- Improved error handling and logging
- Added proper WordPress coding standards
2024-12-17 15:00:47 -08:00

145 lines
7.5 KiB
PHP

<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<?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>
<?php endif; ?>
<div class="card">
<h2><?php esc_html_e('Connection Settings', 'bluesky-connctor'); ?></h2>
<form method="post" action="">
<?php wp_nonce_field('bluesky_connector_settings'); ?>
<input type="hidden" name="action" value="update_bluesky_settings">
<table class="form-table" role="presentation">
<tr>
<th scope="row">
<label for="bluesky_domain"><?php esc_html_e('Bluesky Domain', 'bluesky-connctor'); ?></label>
</th>
<td>
<input name="bluesky_connector_settings[domain]" type="url" id="bluesky_domain"
value="https://bsky.social" class="regular-text" readonly>
<p class="description">
<?php esc_html_e('The Bluesky API domain (fixed to https://bsky.social)', 'bluesky-connctor'); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bluesky_identifier"><?php esc_html_e('Bluesky Handle', 'bluesky-connctor'); ?></label>
</th>
<td>
<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>
<p class="description">
<?php esc_html_e('Your full Bluesky handle (e.g., username.bsky.social)', 'bluesky-connctor'); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bluesky_password"><?php esc_html_e('App Password', 'bluesky-connctor'); ?></label>
</th>
<td>
<input name="bluesky_connector_settings[password]" type="password" id="bluesky_password"
class="regular-text" <?php echo empty($settings['identifier']) ? 'required' : ''; ?>>
<p class="description">
<?php esc_html_e('Your Bluesky app password (will not be stored)', 'bluesky-connctor'); ?>
</p>
</td>
</tr>
</table>
<?php submit_button(esc_html__('Save Connection Settings', 'bluesky-connctor')); ?>
</form>
</div>
<?php if (!empty($settings['connection_status']) && $settings['connection_status'] === 'connected'): ?>
<div class="card" style="margin-top: 20px;">
<h2><?php esc_html_e('Post Format Settings', 'bluesky-connctor'); ?></h2>
<form method="post" action="options.php">
<?php
settings_fields('bluesky-connector');
do_settings_sections('bluesky-connector');
?>
<table class="form-table" role="presentation">
<tr>
<th scope="row">
<label for="bluesky_post_format"><?php esc_html_e('Post Layout', 'bluesky-connctor'); ?></label>
</th>
<td>
<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'); ?>
</option>
<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'); ?>
</option>
</select>
<p class="description">
<?php esc_html_e('bluesky-connctor'); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bluesky_include_title"><?php esc_html_e('Include Title', 'bluesky-connctor'); ?></label>
</th>
<td>
<input type="checkbox" name="bluesky_connector_settings[include_title]"
id="bluesky_include_title" value="1" <?php checked($settings['include_title'] ?? true); ?>>
<p class="description">
<?php esc_html_e('Include post title in the Bluesky post', 'bluesky-connctor'); ?>
</p>
</td>
</tr>
</table>
<?php submit_button(esc_html__('Save Format Settings', 'bluesky-connctor')); ?>
</form>
</div>
<div class="card" style="margin-top: 20px;">
<h2><?php esc_html_e('Debug Information', 'bluesky-connctor'); ?></h2>
<table class="form-table" role="presentation">
<tr>
<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>
</tr>
<?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; ?>
</table>
</div>
<?php endif; ?>
</div>