wp plugin refacotr
This commit is contained in:
@@ -105,6 +105,13 @@ class Igny8Admin {
|
||||
'sanitize_callback' => array($this, 'sanitize_modules'),
|
||||
'default' => array_keys(igny8_get_available_modules())
|
||||
));
|
||||
|
||||
// Default post status for IGNY8 published content
|
||||
register_setting('igny8_bridge_controls', 'igny8_default_post_status', array(
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array($this, 'sanitize_post_status'),
|
||||
'default' => 'draft'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,6 +624,17 @@ class Igny8Admin {
|
||||
|
||||
return !empty($clean) ? $clean : $supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize post status
|
||||
*
|
||||
* @param string $value Post status value
|
||||
* @return string Sanitized post status
|
||||
*/
|
||||
public function sanitize_post_status($value) {
|
||||
$allowed = array('draft', 'publish');
|
||||
return in_array($value, $allowed, true) ? $value : 'draft';
|
||||
}
|
||||
}
|
||||
|
||||
// Register AJAX handlers
|
||||
|
||||
@@ -58,6 +58,7 @@ $pending_links = array_filter($link_queue, function($item) {
|
||||
return $item['status'] === 'pending';
|
||||
});
|
||||
$webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
|
||||
$default_post_status = get_option('igny8_default_post_status', 'draft');
|
||||
|
||||
?>
|
||||
|
||||
@@ -325,6 +326,34 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
|
||||
<span class="description"><?php _e('Allow editors to update content in WordPress and sync back to IGNY8.', 'igny8-bridge'); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="automation-block">
|
||||
<h3><?php _e('Default Post Status for IGNY8 Content', 'igny8-bridge'); ?></h3>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="igny8_default_post_status"
|
||||
value="draft"
|
||||
<?php checked($default_post_status, 'draft'); ?>
|
||||
/>
|
||||
<strong><?php _e('Draft', 'igny8-bridge'); ?></strong>
|
||||
<span class="description"><?php _e('Save content as draft for review before publishing.', 'igny8-bridge'); ?></span>
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="igny8_default_post_status"
|
||||
value="publish"
|
||||
<?php checked($default_post_status, 'publish'); ?>
|
||||
/>
|
||||
<strong><?php _e('Publish', 'igny8-bridge'); ?></strong>
|
||||
<span class="description"><?php _e('Publish content immediately when received from IGNY8.', 'igny8-bridge'); ?></span>
|
||||
</label>
|
||||
<p class="description" style="margin-top: 8px;">
|
||||
<?php _e('Choose whether content published from IGNY8 should be saved as draft or published immediately in WordPress.', 'igny8-bridge'); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="automation-column-right">
|
||||
|
||||
Reference in New Issue
Block a user