| 1 |
<?php |
| 2 |
/** |
| 3 |
* Outputs settings for a specific profile and action. |
| 4 |
* |
| 5 |
* @package WPZinc\Social |
| 6 |
* @author WP Zinc |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
<!-- Action --> |
| 14 |
<div id="profile-<?php echo esc_attr( $profile_id ); ?>-<?php echo esc_attr( $post_action ); ?>" class="postbox"> |
| 15 |
<header> |
| 16 |
<h3> |
| 17 |
<?php |
| 18 |
if ( $profile_id === 'default' ) { |
| 19 |
echo esc_html( |
| 20 |
sprintf( |
| 21 |
/* translators: Translated Action (Publish, Update, Repost, Bulk Publish) */ |
| 22 |
__( 'Defaults: ', 'wp-to-buffer' ), |
| 23 |
$action_label |
| 24 |
) |
| 25 |
); |
| 26 |
} else { |
| 27 |
echo esc_html( sprintf( '%s: %s: %s', $profile['formatted_service'], $profile['formatted_username'], $action_label ) ); |
| 28 |
} |
| 29 |
?> |
| 30 |
|
| 31 |
<label for="<?php echo esc_attr( $profile_id ); ?>_<?php echo esc_attr( $post_action ); ?>_enabled"> |
| 32 |
<input type="checkbox" id="<?php echo esc_attr( $profile_id ); ?>_<?php echo esc_attr( $post_action ); ?>_enabled" class="enable" name="<?php echo esc_attr( $this->base->plugin->name ); ?>[<?php echo esc_attr( $profile_id ); ?>][<?php echo esc_attr( $post_action ); ?>][enabled]" value="1"<?php checked( $this->get_setting( $post_type, '[' . $profile_id . '][' . $post_action . '][enabled]', 0 ), 1, true ); ?> data-tab="profile-<?php echo esc_attr( $profile_id ); ?>-<?php echo esc_attr( $post_action ); ?>" data-conditional="<?php echo esc_attr( $post_type ); ?>-<?php echo esc_attr( $profile_id ); ?>-<?php echo esc_attr( $post_action ); ?>-statuses" /> |
| 33 |
<?php esc_html_e( 'Enabled', 'wp-to-buffer' ); ?> |
| 34 |
</label> |
| 35 |
</h3> |
| 36 |
|
| 37 |
<p class="description"> |
| 38 |
<?php |
| 39 |
echo esc_html( |
| 40 |
sprintf( |
| 41 |
/* translators: %1$s: Social Media Service Name (Buffer, Hootsuite), %2$s: Post Type, Singular, %3$s: Translated Action (Publish, Update, Repost, Bulk Publish), %4$s: Additional Translated Message */ |
| 42 |
__( 'If enabled, any status(es) defined here will be sent to %1$s when a WordPress %2$s is %3$s %4$s', 'wp-to-buffer' ), |
| 43 |
$this->base->plugin->account, |
| 44 |
$post_type_object->labels->singular_name, |
| 45 |
strtolower( $actions_plural[ $post_action ] ), |
| 46 |
( $profile_id === 'default' ? '' : sprintf( |
| 47 |
/* translators: Social Media Service Name (Buffer, Hootsuite) */ |
| 48 |
__( 'to %s. These override the status(es) specified on the Defaults tab.', 'wp-to-buffer' ), |
| 49 |
$profile['formatted_username'] |
| 50 |
) ) |
| 51 |
) |
| 52 |
); |
| 53 |
?> |
| 54 |
</p> |
| 55 |
</header> |
| 56 |
|
| 57 |
<div id="<?php echo esc_attr( $post_type ); ?>-<?php echo esc_attr( $profile_id ); ?>-<?php echo esc_attr( $post_action ); ?>-statuses" class="statuses" data-profile-id="<?php echo esc_attr( $profile_id ); ?>" data-profile='<?php echo ( isset( $profile ) ? wp_json_encode( $profile, JSON_HEX_APOS ) : '' ); ?>' data-action="<?php echo esc_attr( $post_action ); ?>"> |
| 58 |
<div class="wpzinc-option"> |
| 59 |
<div class="full"> |
| 60 |
<table class="widefat striped"> |
| 61 |
<thead> |
| 62 |
<tr> |
| 63 |
<th> </th> |
| 64 |
<th><?php esc_html_e( 'Actions', 'wp-to-buffer' ); ?></th> |
| 65 |
<th><?php esc_html_e( 'Type', 'wp-to-buffer' ); ?></th> |
| 66 |
<th><?php esc_html_e( 'Text', 'wp-to-buffer' ); ?></th> |
| 67 |
<th><?php esc_html_e( 'Schedule', 'wp-to-buffer' ); ?></th> |
| 68 |
</tr> |
| 69 |
</thead> |
| 70 |
<tbody> |
| 71 |
<?php |
| 72 |
// Fetch Publish / Update / Repost Statuses. |
| 73 |
$statuses = $this->get_setting( $post_type, '[' . $profile_id . '][' . $post_action . '][status]' ); |
| 74 |
|
| 75 |
if ( ! is_array( $statuses ) || ! count( $statuses ) ) { |
| 76 |
$statuses = array( |
| 77 |
$this->base->get_class( 'settings' )->get_default_status( $post_type, false, $this->base->plugin->default_schedule ), |
| 78 |
); |
| 79 |
} |
| 80 |
|
| 81 |
// Iterate through saved statuses. |
| 82 |
foreach ( $statuses as $key => $status ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 83 |
$status = $this->base->get_class( 'settings' )->get_status( $status, $post_type ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 84 |
$labels = $this->base->get_class( 'settings' )->get_status_value_labels( $status, $post_type ); |
| 85 |
$row = $this->base->get_class( 'settings' )->get_status_row( $status, $post_type, $post_action ); |
| 86 |
|
| 87 |
// Load sub view. |
| 88 |
require $this->base->plugin->folder . 'lib/social/views/settings-post-action-status-row.php'; |
| 89 |
} |
| 90 |
?> |
| 91 |
<tr class="hidden status-form-container"><td colspan="6"></td></tr> |
| 92 |
</tbody> |
| 93 |
</table> |
| 94 |
</div> |
| 95 |
</div> |
| 96 |
|
| 97 |
<?php |
| 98 |
// Upgrade Notice. |
| 99 |
if ( class_exists( 'WP_To_Buffer' ) || class_exists( 'WP_To_Hootsuite' ) ) { |
| 100 |
require $this->base->plugin->folder . 'lib/social/views/settings-post-action-status-upgrade.php'; |
| 101 |
} |
| 102 |
?> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|