Merge branch 'mv-channel-list-to-table'
This commit is contained in:
commit
6199f2eb04
2 changed files with 86 additions and 32 deletions
|
@ -86,3 +86,38 @@
|
||||||
.lbry-meta-bx-content-last {
|
.lbry-meta-bx-content-last {
|
||||||
padding: .2em .8em 1em .1em;
|
padding: .2em .8em 1em .1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.lbry-channel-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-family: Georgia;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbry-channel-table th, .lbry-channel-table td {
|
||||||
|
padding: .4em 1.6em;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
background: #fbd7b4;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.lbry-channel-table thead th {
|
||||||
|
padding: .5em 2em;
|
||||||
|
background: #f69546;
|
||||||
|
text-align: left;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.lbry-channel-table tbody tr:nth-child(odd) *:nth-child(even), .lbry-channel-table tbody tr:nth-child(even) *:nth-child(odd) {
|
||||||
|
background: #f3eddd;
|
||||||
|
}
|
||||||
|
.lbry-channel-table tfoot th {
|
||||||
|
padding: .5em 2em;
|
||||||
|
background: #f69546;
|
||||||
|
text-align: left;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: .9em;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.lbry-channel-table tr *:nth-child(3), .lbry-channel-table tr *:nth-child(4) {
|
||||||
|
/* text-align: right; */
|
||||||
|
}
|
|
@ -254,39 +254,56 @@ class LBRY_Admin
|
||||||
public function available_channels_callback()
|
public function available_channels_callback()
|
||||||
{
|
{
|
||||||
$channel_list = LBRY()->daemon->channel_list();
|
$channel_list = LBRY()->daemon->channel_list();
|
||||||
|
|
||||||
if ( $channel_list ) { ?>
|
if ( $channel_list ) { ?>
|
||||||
<ul class="lbry-channel-list">
|
<table class="lbry-channel-table">
|
||||||
<?php foreach ( $channel_list as $channel ) {
|
<thead>
|
||||||
$claim_id = $channel->claim_id;
|
<tr>
|
||||||
$results = LBRY()->daemon->claim_search( $claim_id );
|
<th>Channel</th>
|
||||||
$lbry_url = $results->items[0]->canonical_url;
|
<th>LBRY URL</th>
|
||||||
if ($lbry_url) {
|
<th>Posts</th>
|
||||||
$open_url = str_replace( 'lbry://', 'open.lbry.com/', $lbry_url );
|
<th colspan="2">Supports</th>
|
||||||
}
|
</tr>
|
||||||
$support_amount = $results->items[0]->meta->support_amount;
|
</thead>
|
||||||
if ( ( $support_amount < 0.001 ) ) {
|
<tbody>
|
||||||
( $support_amount = '0' );
|
<?php foreach ( $channel_list as $channel ):
|
||||||
} elseif ( ( $support_amount < 0.01 ) && ( $support_amount >= 0.001 ) ) {
|
$claim_id = $channel->claim_id;
|
||||||
( $support_amount = '<0.01' );
|
$results = LBRY()->daemon->claim_search( $claim_id );
|
||||||
} elseif ( ( $support_amount <= 0.099 ) && ( $support_amount >= 0.01) ) {
|
$lbry_url = $results->items[0]->canonical_url;
|
||||||
( $support_amount = number_format( floatval( $support_amount ), 2, '.', '' ) );
|
if ( $lbry_url ) {
|
||||||
} elseif ( ( $support_amount <= 0.999 ) && ( $support_amount >= 0.1 ) ) {
|
$open_url = str_replace( 'lbry://', 'open.lbry.com/', $lbry_url );
|
||||||
( $support_amount = number_format( floatval( $support_amount ), 1, '.', '' ) );
|
}
|
||||||
} else {
|
$support_amount = $results->items[0]->meta->support_amount;
|
||||||
( $support_amount = number_format( intval( $support_amount ) ) );
|
$claims_published = $results->items[0]->meta->claims_in_channel;
|
||||||
}
|
if ( ( $support_amount < 0.001 ) ) {
|
||||||
$init_bid = $results->items[0]->amount; ?>
|
( $support_amount = '0' );
|
||||||
<li><a href="<?php echo esc_url( $open_url, 'lbrypress' ); ?>"><?php esc_html_e( $channel->name, 'lbrypress' ) ?></a> <?php esc_html_e( $lbry_url, 'lbrypress'); ?> <span title="Initial Bid Amount: <?php esc_html_e( $init_bid, 'lbrypress' ); ?>"><img src="<?php echo esc_url( plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbc.png' ) ?>" class="icon icon-lbc bid-icon-lbc channel-bid-icon-lbc"><?php esc_html_e( $support_amount, 'lbrypress' ); ?></span></li>
|
} elseif ( ( $support_amount < 0.01 ) && ( $support_amount >= 0.001 ) ) {
|
||||||
|
( $support_amount = '<0.01' );
|
||||||
<?php } ?>
|
} elseif ( ( $support_amount <= 0.099 ) && ( $support_amount >= 0.01) ) {
|
||||||
</ul>
|
( $support_amount = number_format( floatval( $support_amount ), 2, '.', '' ) );
|
||||||
<?php } else { ?>
|
} elseif ( ( $support_amount <= 0.999 ) && ( $support_amount >= 0.1 ) ) {
|
||||||
<p>Looks like you haven't added any channels yet, feel free to do so below:</p>
|
( $support_amount = number_format( floatval( $support_amount ), 1, '.', '' ) );
|
||||||
<?php }
|
} else {
|
||||||
|
( $support_amount = number_format( intval( $support_amount ) ) );
|
||||||
|
}
|
||||||
|
$init_bid = $results->items[0]->amount; ?>
|
||||||
|
<tr>
|
||||||
|
<td><a href="<?php echo esc_url( $open_url, 'lbrypress' ); ?>"><?php esc_html_e( $channel->name, 'lbrypress' ); ?></a></td>
|
||||||
|
<td><?php esc_html_e( $lbry_url, 'lbrypress' ); ?></td>
|
||||||
|
<td><?php esc_html_e( $claims_published, 'lbrypress' ); ?></td>
|
||||||
|
<td><span title="Initial Bid Amount: <?php esc_html_e( $init_bid, 'lbrypress' ); ?>"><img src="<?php echo esc_url( plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbc.png' ) ?>" class="icon icon-lbc bid-icon-lbc channel-bid-icon-lbc"><?php esc_html_e( $support_amount, 'lbrypress' ); ?></span></td>
|
||||||
|
<td><a href="#">Add</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr><th colspan="5">LBRYPress</th></tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<?php } else { ?>
|
||||||
|
<p>Looks like you haven't added any channels yet, feel free to do so below:</p>
|
||||||
|
<?php }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section info for the Speech Channel Section
|
* Section info for the Speech Channel Section
|
||||||
*/
|
*/
|
||||||
|
@ -533,13 +550,15 @@ class LBRY_Admin
|
||||||
{
|
{
|
||||||
// See if we've checked in the past two hours
|
// See if we've checked in the past two hours
|
||||||
if ( ! get_transient( 'lbry_wallet_check' ) ) {
|
if ( ! get_transient( 'lbry_wallet_check' ) ) {
|
||||||
$balance = LBRY()->daemon->wallet_balance();
|
$result = LBRY()->daemon->wallet_balance();
|
||||||
|
$balance = $result->result->available;
|
||||||
|
$site_url = get_site_url();
|
||||||
if ( $balance < get_option( LBRY_SETTINGS )[LBRY_LBC_PUBLISH] * 20 ) {
|
if ( $balance < get_option( LBRY_SETTINGS )[LBRY_LBC_PUBLISH] * 20 ) {
|
||||||
// If LBRY Balance is low, send email, but only once per day
|
// If LBRY Balance is low, send email, but only once per day
|
||||||
if ( ! get_transient( 'lbry_wallet_warning_email' ) ) {
|
if ( ! get_transient( 'lbry_wallet_warning_email' ) ) {
|
||||||
$email = get_option( 'admin_email' );
|
$email = get_option( 'admin_email' );
|
||||||
$subject = 'Your LBRYPress Wallet Balance is Low!';
|
$subject = 'Your LBRYPress Wallet Balance is Low!';
|
||||||
$message = 'Your LBRY Wallet for your WordPress installation at ' . site_url() . ' is running very low.\r\n\r\nYou currently have ' . $balance . ' LBC left in your wallet. In order to keep publishing to the LBRY network, please add some LBC to your account.';
|
$message = 'Your LBRY Wallet for your WordPress installation at ' . esc_html_e( $site_url ) . ' is running very low.\r\n\r\nYou currently have ' . esc_html_e( $balance ) . ' LBC left in your wallet. In order to keep publishing to the LBRY network, please add some LBC to your account.';
|
||||||
wp_mail( $email, $subject, $message );
|
wp_mail( $email, $subject, $message );
|
||||||
set_transient( 'lbry_wallet_warning_email', true, DAY_IN_SECONDS );
|
set_transient( 'lbry_wallet_warning_email', true, DAY_IN_SECONDS );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue