Files
wpa-superstar-plugin/admin/settings/tabs/class-seoprostack-tab-workflow.php

132 lines
7.4 KiB
PHP

<?php
/**
* The Workflow tab for plugin settings.
*
* @package SEO_Pro_Stack
* @subpackage SEO_Pro_Stack/Admin/Settings/Tabs
*/
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
/**
* The Workflow tab for plugin settings.
*/
class SEOProStack_Tab_Workflow {
/**
* Render the tab content.
*/
public function render() {
$options = get_option('seoprostack_workflow_options', array(
'auto_upload_images' => true,
'max_width' => 1200,
'max_height' => 1200,
'exclude_urls' => '',
'image_name_pattern' => '%filename%',
'image_alt_pattern' => '%filename%'
));
?>
<div class="seoprostack-settings-content tab-content" id="workflow">
<form method="post" action="options.php" id="seoprostack-workflow-form">
<?php settings_fields('seoprostack_settings'); ?>
<div class="seoprostack-setting-section">
<h2><?php esc_html_e('Image Auto-Upload Settings', 'seoprostack'); ?></h2>
<p class="description"><?php esc_html_e('Configure how external images are automatically uploaded to your media library.', 'seoprostack'); ?></p>
<div class="seoprostack-toggle">
<div class="seoprostack-toggle-header">
<div class="seoprostack-toggle-main">
<div class="seoprostack-toggle-left">
<div class="wp-toggle-switch">
<input type="checkbox"
id="auto_upload_images"
name="seoprostack_workflow_options[auto_upload_images]"
value="1"
<?php checked(isset($options['auto_upload_images']) ? $options['auto_upload_images'] : true); ?>
/>
<label for="auto_upload_images" class="toggle-label"></label>
</div>
<label for="auto_upload_images">
<?php esc_html_e('Enable Auto Upload Images', 'seoprostack'); ?>
</label>
</div>
</div>
<p class="seoprostack-setting-description">
<?php esc_html_e('Import images that have external URLs into your Media Library when saving content. Consider disabling during large data imports with many external image URLs.', 'seoprostack'); ?>
</p>
</div>
<div class="seoprostack-toggle-settings">
<div class="seoprostack-setting-row">
<label for="max_width"><?php esc_html_e('Max Width', 'seoprostack'); ?></label>
<input type="number"
id="max_width"
name="seoprostack_workflow_options[max_width]"
value="<?php echo esc_attr(isset($options['max_width']) ? $options['max_width'] : 1200); ?>"
/>
<p class="description"><?php esc_html_e('Maximum width for uploaded images in pixels.', 'seoprostack'); ?></p>
</div>
<div class="seoprostack-setting-row">
<label for="max_height"><?php esc_html_e('Max Height', 'seoprostack'); ?></label>
<input type="number"
id="max_height"
name="seoprostack_workflow_options[max_height]"
value="<?php echo esc_attr(isset($options['max_height']) ? $options['max_height'] : 1200); ?>"
/>
<p class="description"><?php esc_html_e('Maximum height for uploaded images in pixels.', 'seoprostack'); ?></p>
</div>
<div class="seoprostack-setting-row">
<label for="exclude_urls"><?php esc_html_e('Exclude URLs', 'seoprostack'); ?></label>
<textarea id="exclude_urls"
name="seoprostack_workflow_options[exclude_urls]"
rows="3"
class="large-text"
><?php echo esc_textarea(isset($options['exclude_urls']) ? $options['exclude_urls'] : ''); ?></textarea>
<p class="description"><?php esc_html_e('Enter domains to exclude (one per line). Images from these domains will not be imported.', 'seoprostack'); ?></p>
</div>
<div class="seoprostack-setting-row">
<label for="image_name_pattern"><?php esc_html_e('Image Name Pattern', 'seoprostack'); ?></label>
<input type="text"
id="image_name_pattern"
name="seoprostack_workflow_options[image_name_pattern]"
value="<?php echo esc_attr(isset($options['image_name_pattern']) ? $options['image_name_pattern'] : '%filename%'); ?>"
class="regular-text"
/>
<p class="description">
<?php esc_html_e('Available patterns:', 'seoprostack'); ?> %filename%, %post_id%, %postname%, %timestamp%, %date%, %year%, %month%, %day%
</p>
</div>
<div class="seoprostack-setting-row">
<label for="image_alt_pattern"><?php esc_html_e('Image Alt Pattern', 'seoprostack'); ?></label>
<input type="text"
id="image_alt_pattern"
name="seoprostack_workflow_options[image_alt_pattern]"
value="<?php echo esc_attr(isset($options['image_alt_pattern']) ? $options['image_alt_pattern'] : '%filename%'); ?>"
class="regular-text"
/>
<p class="description">
<?php esc_html_e('Available patterns:', 'seoprostack'); ?> %filename%, %post_title%, %post_id%, %postname%, %timestamp%
</p>
</div>
</div>
</div>
<div class="seoprostack-setting-actions">
<button type="submit" class="button button-primary">
<?php esc_html_e('Save Changes', 'seoprostack'); ?>
</button>
</div>
</div>
</form>
</div>
<?php
}
}