| 1 |
<?php |
| 2 |
/** |
| 3 |
* Outputs the settings screen. |
| 4 |
* |
| 5 |
* @package WP_To_Social_Pro |
| 6 |
* @author WP Zinc |
| 7 |
*/ |
| 8 |
|
| 9 |
?> |
| 10 |
<div class="wrap"> |
| 11 |
<h1 class="wp-heading-inline"> |
| 12 |
<?php echo esc_html( $this->base->plugin->displayName ); ?> |
| 13 |
|
| 14 |
<span> |
| 15 |
<?php esc_html_e( 'Settings', 'wp-to-buffer' ); ?> |
| 16 |
</span> |
| 17 |
</h1> |
| 18 |
|
| 19 |
<?php |
| 20 |
// Output notices. |
| 21 |
$this->base->get_class( 'notices' )->set_key_prefix( $this->base->plugin->filter_name . '_' . wp_get_current_user()->ID ); |
| 22 |
$this->base->get_class( 'notices' )->output_notices(); |
| 23 |
|
| 24 |
// Get access token. |
| 25 |
$access_token = $this->get_setting( '', 'access_token' ); |
| 26 |
?> |
| 27 |
|
| 28 |
<!-- Container for JS notices --> |
| 29 |
<div class="js-notices"></div> |
| 30 |
|
| 31 |
<div class="wrap-inner"> |
| 32 |
<!-- Tabs --> |
| 33 |
<h2 class="nav-tab-wrapper wpzinc-horizontal-tabbed-ui"> |
| 34 |
<!-- Settings --> |
| 35 |
<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' : '' ) . ( ! empty( $access_token ) ? ' enabled' : ' error' ); ?>" title="<?php esc_attr_e( 'Settings', 'wp-to-buffer' ); ?>"> |
| 36 |
<span class="dashicons dashicons-lock"></span> |
| 37 |
<?php |
| 38 |
if ( ! empty( $access_token ) ) { |
| 39 |
?> |
| 40 |
<span class="dashicons dashicons-yes"></span> |
| 41 |
<?php |
| 42 |
} else { |
| 43 |
?> |
| 44 |
<span class="dashicons dashicons-warning"></span> |
| 45 |
<?php |
| 46 |
} |
| 47 |
?> |
| 48 |
<span class="text"> |
| 49 |
<?php esc_html_e( 'Settings', 'wp-to-buffer' ); ?> |
| 50 |
</span> |
| 51 |
</a> |
| 52 |
|
| 53 |
<!-- Public Post Types --> |
| 54 |
<?php |
| 55 |
// Go through all Post Types, if authenticated. |
| 56 |
if ( ! empty( $access_token ) ) { |
| 57 |
foreach ( $post_types as $public_post_type => $post_type_obj ) { |
| 58 |
// Work out the icon to display. |
| 59 |
$icon = ''; |
| 60 |
if ( ! empty( $post_type_obj->menu_icon ) ) { |
| 61 |
$icon = 'dashicons ' . $post_type_obj->menu_icon; |
| 62 |
} else { |
| 63 |
if ( $public_post_type === 'post' || $public_post_type === 'page' ) { |
| 64 |
$icon = 'dashicons dashicons-admin-' . $public_post_type; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
// Determine if the Post Type is set to post. |
| 69 |
$is_post_type_enabled = $this->base->get_class( 'settings' )->is_post_type_enabled( $public_post_type ); |
| 70 |
?> |
| 71 |
<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 ); ?>"> |
| 72 |
<span class="<?php echo esc_attr( $icon ); ?>"></span> |
| 73 |
<span class="dashicons dashicons-yes"></span> |
| 74 |
<span class="text"> |
| 75 |
<?php echo esc_attr( $post_type_obj->labels->name ); ?> |
| 76 |
</span> |
| 77 |
</a> |
| 78 |
<?php |
| 79 |
} |
| 80 |
} |
| 81 |
?> |
| 82 |
|
| 83 |
<!-- Documentation --> |
| 84 |
<a href="<?php echo esc_attr( $documentation_url ); ?>" class="nav-tab last documentation" title="<?php esc_html_e( 'Documentation', 'wp-to-buffer' ); ?>" target="_blank"> |
| 85 |
<span class="text"> |
| 86 |
<?php esc_html_e( 'Documentation', 'wp-to-buffer' ); ?> |
| 87 |
</span> |
| 88 |
<span class="text-mobile"> |
| 89 |
<?php esc_html_e( 'Docs', 'wp-to-buffer' ); ?> |
| 90 |
</span> |
| 91 |
<span class="dashicons dashicons-admin-page"></span> |
| 92 |
</a> |
| 93 |
</h2> |
| 94 |
|
| 95 |
<!-- Form Start --> |
| 96 |
<?php |
| 97 |
// id is deliberate; to ensure CSS, JS etc. works for all versions. |
| 98 |
?> |
| 99 |
<div id="poststuff"> |
| 100 |
<div id="post-body" class="metabox-holder columns-2"> |
| 101 |
<!-- Content --> |
| 102 |
<form name="post" method="post" action="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ); ?>" id="<?php echo esc_attr( $this->base->plugin->name ); ?>" class="wp-to-social-pro"> |
| 103 |
<div id="post-body-content"> |
| 104 |
<div id="normal-sortables" class="meta-box-sortables ui-sortable publishing-defaults"> |
| 105 |
<?php |
| 106 |
// Load sub view. |
| 107 |
require_once $this->base->plugin->folder . 'lib/views/settings-' . $tab . '.php'; |
| 108 |
?> |
| 109 |
</div> |
| 110 |
<!-- /normal-sortables --> |
| 111 |
|
| 112 |
<?php |
| 113 |
if ( ! $disable_save_button ) { |
| 114 |
?> |
| 115 |
<!-- Save --> |
| 116 |
<div> |
| 117 |
<?php wp_nonce_field( $this->base->plugin->name, $this->base->plugin->name . '_nonce' ); ?> |
| 118 |
<input type="submit" name="submit" value="<?php esc_attr_e( 'Save', 'wp-to-buffer' ); ?>" class="button button-primary" /> |
| 119 |
</div> |
| 120 |
<?php |
| 121 |
} |
| 122 |
?> |
| 123 |
</div> |
| 124 |
<!-- /post-body-content --> |
| 125 |
</form> |
| 126 |
|
| 127 |
<!-- Sidebar --> |
| 128 |
<div id="postbox-container-1" class="postbox-container"> |
| 129 |
<?php require $this->base->plugin->folder . '/_modules/dashboard/views/sidebar-upgrade.php'; ?> |
| 130 |
</div> |
| 131 |
<!-- /Sidebar --> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
|
| 135 |
<!-- Upgrade --> |
| 136 |
<div class="metabox-holder columns-1"> |
| 137 |
<div id="post-body-content"> |
| 138 |
<?php require $this->base->plugin->folder . '/_modules/dashboard/views/footer-upgrade.php'; ?> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
</div><!-- ./wrap-inner --> |
| 142 |
</div> |
| 143 |
|