2018-09-01 03:14:12 +02:00
|
|
|
<?php
|
2022-02-09 14:30:41 +01:00
|
|
|
/**
|
|
|
|
* The Options Page with tabs
|
|
|
|
* @package LBRYPress
|
|
|
|
*/
|
|
|
|
defined('ABSPATH') || die(); // Exit if accessed directly
|
|
|
|
|
2018-09-11 22:10:15 +02:00
|
|
|
$LBRY = LBRY();
|
|
|
|
$wallet_balance = $LBRY->daemon->wallet_balance();
|
2022-01-25 21:27:12 +01:00
|
|
|
$available_balance = $wallet_balance->result->available;
|
2022-02-14 02:07:25 +01:00
|
|
|
$total_balance = $wallet_balance->result->total;
|
2022-02-09 14:30:41 +01:00
|
|
|
$lbry_active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
|
2018-09-01 03:14:12 +02:00
|
|
|
?>
|
2022-02-09 14:30:41 +01:00
|
|
|
|
2018-08-21 01:39:57 +02:00
|
|
|
<div class="wrap">
|
2022-02-09 14:30:41 +01:00
|
|
|
<h1><?php esc_html_e( get_admin_page_title(), 'lbrypress' ); ?></h1>
|
2022-02-14 02:07:25 +01:00
|
|
|
<h2><img src="<?php echo esc_url( plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbc.png' ) ?>" class="icon icon-lbc wallet-icon-lbc" title="<?php echo esc_attr( number_format( $total_balance, 3, '.', ',' ) ); ?> Wallet Total Balance"><code title="<?php echo esc_attr( number_format( $total_balance, 3, '.', ',' ) ); ?> Wallet Total Balance"><?php esc_html_e( number_format( $available_balance, 3, '.', ',' ) ); ?></code> Wallet Available Balance</h2>
|
2022-02-09 14:30:41 +01:00
|
|
|
<nav class="nav-tab-wrapper">
|
|
|
|
<a href="<?php echo esc_url( admin_url( 'options.php?page=lbrypress&tab=general' ) ); ?>" class="nav-tab <?php echo $lbry_active_tab == 'general' || '' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Settings' ); ?></a>
|
|
|
|
<a href="<?php echo esc_url( admin_url( 'admin.php?page=lbrypress&tab=channels' ) ); ?>" class="nav-tab <?php echo $lbry_active_tab == 'channels' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Channels' ); ?></a>
|
|
|
|
<a href="<?php echo esc_url( admin_url( 'options.php?page=lbrypress&tab=speech' ) ); ?>" class="nav-tab <?php echo $lbry_active_tab == 'speech' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Spee.ch' ); ?></a>
|
2022-02-19 20:04:38 +01:00
|
|
|
<?php
|
|
|
|
if ( $lbry_active_tab == 'supports' ) {
|
2022-02-19 23:21:50 +01:00
|
|
|
$admin_url = admin_url( 'admin.php?page=lbrypress&tab=supports' );
|
2022-02-19 20:04:38 +01:00
|
|
|
printf(
|
|
|
|
'<a href="' . esc_url( $admin_url ) . '" class="nav-tab nav-tab-active">' . esc_html__( 'Supports', 'lbrypress') . '</a>',
|
|
|
|
$admin_url,
|
|
|
|
);
|
2022-02-27 20:30:08 +01:00
|
|
|
}
|
|
|
|
if ( $lbry_active_tab == 'channel-edit' ) {
|
|
|
|
$admin_url = admin_url( 'admin.php?page=lbrypress&tab=channel-edit' );
|
|
|
|
printf(
|
|
|
|
'<a href="' . esc_url( $admin_url ) . '" class="nav-tab nav-tab-active">' . esc_html__( 'Channel', 'lbrypress' ) . '</a>',
|
|
|
|
$admin_url,
|
|
|
|
);
|
2022-02-19 20:04:38 +01:00
|
|
|
} ?>
|
2022-02-09 14:30:41 +01:00
|
|
|
</nav>
|
|
|
|
<?php if ( $lbry_active_tab == 'channels' ) {
|
2022-02-09 17:17:45 +01:00
|
|
|
include_once( 'channels-page.php' );
|
2022-02-19 20:04:38 +01:00
|
|
|
} elseif ( $lbry_active_tab == 'supports' ) {
|
|
|
|
include_once( 'supports-add-form.php' );
|
2022-02-27 20:30:08 +01:00
|
|
|
} elseif ( $lbry_active_tab == 'channel-edit' ) {
|
|
|
|
include_once( 'channel-edit-page.php' );
|
2022-02-09 14:30:41 +01:00
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<form class="form-table" action="<?php echo esc_url( admin_url( 'options.php' ) ); ?>" method="post">
|
2022-02-27 20:30:08 +01:00
|
|
|
<?php // TODO: write this as a switch?
|
2022-02-09 14:30:41 +01:00
|
|
|
}
|
|
|
|
if ( $lbry_active_tab == 'general' ) {
|
|
|
|
settings_fields( 'lbry_general_settings' );
|
|
|
|
do_settings_sections( LBRY_ADMIN_PAGE );
|
|
|
|
submit_button();
|
|
|
|
} elseif ( $lbry_active_tab == 'channels' ) {
|
2022-02-19 20:04:38 +01:00
|
|
|
//include_once( 'channels-page.php' );
|
|
|
|
} elseif ( $lbry_active_tab == 'supports' ) {
|
2022-02-19 23:21:50 +01:00
|
|
|
//include_once( 'supports-add-form.php' );
|
2022-02-27 20:30:08 +01:00
|
|
|
} elseif ( $lbry_active_tab == 'channel-edit' ) {
|
|
|
|
//include_once( 'supports-add-form.php' );
|
2022-02-09 14:30:41 +01:00
|
|
|
} elseif ( $lbry_active_tab == 'speech' ) {
|
|
|
|
settings_fields( LBRY_SPEECH_SETTINGS );
|
|
|
|
do_settings_sections( 'lbrypress-speech' );
|
|
|
|
submit_button();
|
|
|
|
} else {
|
|
|
|
settings_fields( 'lbry_general_settings' );
|
|
|
|
do_settings_sections( LBRY_ADMIN_PAGE );
|
|
|
|
submit_button();
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</form>
|
|
|
|
</div><!-- wrap -->
|