| 1 |
<?php |
| 2 |
/** |
| 3 |
* Outputs the settings screen. |
| 4 |
* |
| 5 |
* @package WPZinc\Social |
| 6 |
* @author WP Zinc |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
<header> |
| 14 |
<h1> |
| 15 |
<?php echo esc_html( $this->base->plugin->displayName ); ?> |
| 16 |
|
| 17 |
<span> |
| 18 |
<?php esc_html_e( 'Settings', 'wp-to-buffer' ); ?> |
| 19 |
</span> |
| 20 |
</h1> |
| 21 |
</header> |
| 22 |
|
| 23 |
<div class="wrap"> |
| 24 |
<?php |
| 25 |
// Output notices. |
| 26 |
$this->base->get_class( 'notices' )->set_key_prefix( $this->base->plugin->filter_name . '_' . wp_get_current_user()->ID ); |
| 27 |
$this->base->get_class( 'notices' )->output_notices(); |
| 28 |
?> |
| 29 |
|
| 30 |
<!-- Container for JS notices --> |
| 31 |
<div class="js-notices"></div> |
| 32 |
|
| 33 |
<div class="wrap-inner"> |
| 34 |
<!-- Notices --> |
| 35 |
<hr class="wp-header-end" /> |
| 36 |
|
| 37 |
<!-- Tabs --> |
| 38 |
<h2 class="nav-tab-wrapper wpzinc-horizontal-tabbed-ui"> |
| 39 |
<!-- Settings --> |
| 40 |
<a href="admin.php?page=<?php echo esc_attr( $this->base->plugin->name ); ?>-settings" class="nav-tab<?php echo esc_attr( $tab === 'auth' ? ' nav-tab-active' : '' ) . ( $this->base->get_class( 'settings' )->account_connected() ? ' enabled' : ' error' ); ?>" title="<?php esc_attr_e( 'Settings', 'wp-to-buffer' ); ?>"> |
| 41 |
<span class="dashicons dashicons-lock"></span> |
| 42 |
<?php |
| 43 |
if ( $this->base->get_class( 'settings' )->account_connected() ) { |
| 44 |
?> |
| 45 |
<span class="dashicons dashicons-yes"></span> |
| 46 |
<?php |
| 47 |
} else { |
| 48 |
?> |
| 49 |
<span class="dashicons dashicons-warning"></span> |
| 50 |
<?php |
| 51 |
} |
| 52 |
?> |
| 53 |
<span class="text"> |
| 54 |
<?php esc_html_e( 'Settings', 'wp-to-buffer' ); ?> |
| 55 |
</span> |
| 56 |
</a> |
| 57 |
|
| 58 |
<!-- Public Post Types --> |
| 59 |
<?php |
| 60 |
// Go through all Post Types, if authenticated. |
| 61 |
if ( $this->base->get_class( 'settings' )->account_connected() ) { |
| 62 |
foreach ( $post_types as $public_post_type => $post_type_obj ) { |
| 63 |
// Work out the icon to display. |
| 64 |
$icon = ''; |
| 65 |
if ( ! empty( $post_type_obj->menu_icon ) ) { |
| 66 |
$icon = 'dashicons ' . $post_type_obj->menu_icon; |
| 67 |
} elseif ( $public_post_type === 'post' || $public_post_type === 'page' ) { |
| 68 |
$icon = 'dashicons dashicons-admin-' . $public_post_type; |
| 69 |
} |
| 70 |
|
| 71 |
// Determine if the Post Type is set to post. |
| 72 |
$is_post_type_enabled = $this->base->get_class( 'settings' )->is_post_type_enabled( $public_post_type ); |
| 73 |
?> |
| 74 |
<a href="admin.php?page=<?php echo esc_attr( $this->base->plugin->name ); ?>-settings&tab=post&type=<?php echo esc_attr( $public_post_type ); ?>" class="nav-tab<?php echo esc_attr( $post_type === $public_post_type ? ' nav-tab-active' : '' ) . ( $is_post_type_enabled ? ' enabled' : '' ); ?>" title="<?php echo esc_attr( $post_type_obj->labels->name ); ?>" data-post-type="<?php echo esc_attr( $public_post_type ); ?>"> |
| 75 |
<span class="<?php echo esc_attr( $icon ); ?>"></span> |
| 76 |
<span class="dashicons dashicons-yes"></span> |
| 77 |
<span class="text"> |
| 78 |
<?php echo esc_attr( $post_type_obj->labels->name ); ?> |
| 79 |
</span> |
| 80 |
</a> |
| 81 |
<?php |
| 82 |
} |
| 83 |
} |
| 84 |
?> |
| 85 |
|
| 86 |
<!-- Documentation --> |
| 87 |
<a href="<?php echo esc_attr( $documentation_url ); ?>" class="nav-tab last documentation" title="<?php esc_html_e( 'Documentation', 'wp-to-buffer' ); ?>" target="_blank"> |
| 88 |
<span class="text"> |
| 89 |
<?php esc_html_e( 'Documentation', 'wp-to-buffer' ); ?> |
| 90 |
</span> |
| 91 |
<span class="text-mobile"> |
| 92 |
<?php esc_html_e( 'Docs', 'wp-to-buffer' ); ?> |
| 93 |
</span> |
| 94 |
<span class="dashicons dashicons-admin-page"></span> |
| 95 |
</a> |
| 96 |
</h2> |
| 97 |
|
| 98 |
<!-- Form Start --> |
| 99 |
<?php |
| 100 |
// id is deliberate; to ensure CSS, JS etc. works for all versions. |
| 101 |
?> |
| 102 |
<div id="poststuff"> |
| 103 |
<div id="post-body" class="metabox-holder columns-2"> |
| 104 |
<!-- Content --> |
| 105 |
<form name="post" method="post" action="<?php echo ( isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' ); ?>" id="<?php echo esc_attr( $this->base->plugin->name ); ?>" class="wpzinc-social"> |
| 106 |
<div id="post-body-content"> |
| 107 |
<div id="normal-sortables" class="meta-box-sortables ui-sortable publishing-defaults"> |
| 108 |
<?php |
| 109 |
// Load sub view. |
| 110 |
require_once $this->base->plugin->folder . 'lib/social/views/settings-' . $tab . '.php'; |
| 111 |
?> |
| 112 |
</div> |
| 113 |
<!-- /normal-sortables --> |
| 114 |
|
| 115 |
<?php |
| 116 |
if ( ! $disable_save_button ) { |
| 117 |
?> |
| 118 |
<!-- Save --> |
| 119 |
<div> |
| 120 |
<?php wp_nonce_field( $this->base->plugin->name, $this->base->plugin->name . '_nonce' ); ?> |
| 121 |
<input type="submit" name="submit" value="<?php esc_attr_e( 'Save', 'wp-to-buffer' ); ?>" class="button button-primary" /> |
| 122 |
</div> |
| 123 |
<?php |
| 124 |
} |
| 125 |
?> |
| 126 |
</div> |
| 127 |
<!-- /post-body-content --> |
| 128 |
</form> |
| 129 |
|
| 130 |
<!-- Sidebar --> |
| 131 |
<div id="postbox-container-1" class="postbox-container"> |
| 132 |
<?php |
| 133 |
// Define the default upgrade content. |
| 134 |
$upgrade_title = __( 'Keep Updated', 'wp-to-buffer' ); |
| 135 |
$upgrade_content = esc_html__( 'Subscribe to the newsletter and receive updates on our WordPress Plugins.', 'wp-to-buffer' ) . '<script async data-uid="' . $this->base->plugin->convertkit_form_uid . '" src="https://dedicated-crafter-4782.ck.page/' . $this->base->plugin->convertkit_form_uid . '/index.js"></script>'; |
| 136 |
|
| 137 |
// If a free Buffer account is connected, show the switch to Social Post Flow upgrade. |
| 138 |
foreach ( $accounts as $account ) { |
| 139 |
if ( $account['plan'] === 'free' ) { |
| 140 |
$upgrade_title = esc_html__( 'Switch to Social Post Flow', 'wp-to-buffer' ); |
| 141 |
$upgrade_content = esc_html__( 'Up to 5 channels for $49/year. Our own scheduling tool replaces Buffer entirely. The same 5 channels on Buffer\'s paid plan would cost around $360/year, so you save over $300 a year and remove the per channel fee for good.', 'wp-to-buffer' ); |
| 142 |
$upgrade_url = 'https://www.socialpostflow.com/?utm_source=wp-to-buffer&utm_medium=settings&utm_campaign=sidebar-upgrade'; |
| 143 |
$upgrade_button_text = esc_html__( 'Try Social Post Flow', 'wp-to-buffer' ); |
| 144 |
break; |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
require $this->base->plugin->folder . '/lib/shared/views/sidebar-upgrade.php'; |
| 149 |
?> |
| 150 |
</div> |
| 151 |
<!-- /Sidebar --> |
| 152 |
</div> |
| 153 |
</div> |
| 154 |
|
| 155 |
<!-- Upgrade --> |
| 156 |
<div class="metabox-holder columns-1"> |
| 157 |
<div id="post-body-content"> |
| 158 |
<?php |
| 159 |
require $this->base->plugin->folder . '/lib/shared/views/footer-upgrade.php'; |
| 160 |
|
| 161 |
do_action( 'wpzinc_settings_footer_upgrade' ); |
| 162 |
?> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
</div><!-- ./wrap-inner --> |
| 166 |
</div> |
| 167 |
|