Files
Instagram-Gallery-Sync-Pro/admin/views/tab-instagram.php

154 lines
7.2 KiB
PHP

<?php
/**
* Instagram Settings Tab
*
* @package Instagram_Gallery_Sync_Pro
*/
// Prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$cron = new IGSP_Cron();
$intervals = $cron->get_intervals();
?>
<form method="post" action="options.php" class="igsp-settings-form">
<?php settings_fields( 'igsp_instagram_settings' ); ?>
<div class="igsp-section">
<h2><?php esc_html_e( 'Account Settings', 'instagram-gallery-sync-pro' ); ?></h2>
<table class="form-table">
<tr>
<th scope="row">
<label for="igsp_username"><?php esc_html_e( 'Instagram Username', 'instagram-gallery-sync-pro' ); ?></label>
</th>
<td>
<div class="igsp-input-wrapper">
<span class="igsp-input-prefix">@</span>
<input type="text"
id="igsp_username"
name="igsp_username"
value="<?php echo esc_attr( get_option( 'igsp_username', '' ) ); ?>"
class="regular-text"
placeholder="username">
</div>
<p class="description"><?php esc_html_e( 'Enter the Instagram username without the @ symbol. The profile must be public.', 'instagram-gallery-sync-pro' ); ?></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="igsp_max_images"><?php esc_html_e( 'Maximum Images to Fetch', 'instagram-gallery-sync-pro' ); ?></label>
</th>
<td>
<select id="igsp_max_images" name="igsp_max_images">
<?php
$max_images = get_option( 'igsp_max_images', 12 );
$options = array( 12, 24, 36, 48, 100 );
foreach ( $options as $option ) :
?>
<option value="<?php echo esc_attr( $option ); ?>" <?php selected( $max_images, $option ); ?>>
<?php echo esc_html( $option === 100 ? __( 'All available', 'instagram-gallery-sync-pro' ) : $option ); ?>
</option>
<?php endforeach; ?>
</select>
<p class="description"><?php esc_html_e( 'Number of images to fetch from Instagram.', 'instagram-gallery-sync-pro' ); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Save Images Locally', 'instagram-gallery-sync-pro' ); ?></th>
<td>
<fieldset>
<label>
<input type="radio"
name="igsp_save_locally"
value="yes"
<?php checked( get_option( 'igsp_save_locally', 'yes' ), 'yes' ); ?>>
<?php esc_html_e( 'Yes - Download and store images on your server (recommended)', 'instagram-gallery-sync-pro' ); ?>
</label>
<br>
<label>
<input type="radio"
name="igsp_save_locally"
value="no"
<?php checked( get_option( 'igsp_save_locally', 'yes' ), 'no' ); ?>>
<?php esc_html_e( 'No - Link directly to Instagram (may cause loading issues)', 'instagram-gallery-sync-pro' ); ?>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<label for="igsp_image_quality"><?php esc_html_e( 'Image Quality', 'instagram-gallery-sync-pro' ); ?></label>
</th>
<td>
<select id="igsp_image_quality" name="igsp_image_quality">
<?php
$quality = get_option( 'igsp_image_quality', 'high' );
$quality_options = array(
'thumbnail' => __( 'Thumbnail (150px)', 'instagram-gallery-sync-pro' ),
'medium' => __( 'Medium (320px)', 'instagram-gallery-sync-pro' ),
'high' => __( 'High (640px+)', 'instagram-gallery-sync-pro' ),
);
foreach ( $quality_options as $value => $label ) :
?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $quality, $value ); ?>>
<?php echo esc_html( $label ); ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
</table>
</div>
<div class="igsp-section">
<h2><?php esc_html_e( 'Synchronization', 'instagram-gallery-sync-pro' ); ?></h2>
<table class="form-table">
<tr>
<th scope="row">
<label for="igsp_sync_interval"><?php esc_html_e( 'Sync Interval', 'instagram-gallery-sync-pro' ); ?></label>
</th>
<td>
<select id="igsp_sync_interval" name="igsp_sync_interval">
<?php
$current_interval = get_option( 'igsp_sync_interval', 'daily' );
foreach ( $intervals as $value => $label ) :
?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $current_interval, $value ); ?>>
<?php echo esc_html( $label ); ?>
</option>
<?php endforeach; ?>
</select>
<p class="description"><?php esc_html_e( 'How often to check for new posts.', 'instagram-gallery-sync-pro' ); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Manual Sync', 'instagram-gallery-sync-pro' ); ?></th>
<td>
<button type="button" id="igsp-sync-now" class="button button-primary">
<span class="dashicons dashicons-update"></span>
<?php esc_html_e( 'Sync Now', 'instagram-gallery-sync-pro' ); ?>
</button>
<div id="igsp-sync-progress" class="igsp-progress-wrapper" style="display: none;">
<div class="igsp-progress-bar">
<div class="igsp-progress-fill"></div>
</div>
<span class="igsp-progress-text"><?php esc_html_e( 'Syncing...', 'instagram-gallery-sync-pro' ); ?></span>
</div>
<div id="igsp-sync-result" class="igsp-sync-result" style="display: none;"></div>
</td>
</tr>
</table>
</div>
<?php submit_button(); ?>
</form>