Merge branch 'initial-pub-amount'

This commit is contained in:
Lem Smyth 2022-02-17 13:51:18 -06:00
commit 152aad9b8a
5 changed files with 43 additions and 8 deletions

View file

@ -14,6 +14,12 @@
margin-bottom: -.2em;
}
.channel-bid-icon-lbc {
height: 1.1em;
margin-right: .1em;
margin-bottom: -.2em;
}
.lbry-pub-metabox {
margin: 0 0 0 -.2em;
padding: 0 .2em 0 0 ;
@ -21,7 +27,7 @@
.meta-icon-lbry {
height: 1.55em;
margin-bottom: -.4em;
padding-left: .1em;
padding: 0 .1em 0 0;
}
.lbry-meta-checkbox-wrapper {
padding: .5em .8em .6em;
@ -79,4 +85,4 @@
.lbry-meta-bx-content-last {
padding: .2em .8em 1em .1em;
}
}

View file

@ -256,8 +256,28 @@ class LBRY_Admin
if ( $channel_list ) { ?>
<ul class="lbry-channel-list">
<?php foreach ( $channel_list as $channel ) { ?>
<li><?php esc_html_e( $channel->name ) ?></li>
<?php foreach ( $channel_list as $channel ) {
$claim_id = $channel->claim_id;
$results = LBRY()->daemon->claim_search( $claim_id );
$lbry_url = $results->items[0]->canonical_url;
if ($lbry_url) {
$open_url = str_replace( 'lbry://', 'open.lbry.com/', $lbry_url );
}
$support_amount = $results->items[0]->meta->support_amount;
if ( ( $support_amount < 0.001 ) ) {
( $support_amount = '0' );
} elseif ( ( $support_amount < 0.01 ) && ( $support_amount >= 0.001 ) ) {
( $support_amount = '<0.01' );
} elseif ( ( $support_amount <= 0.099 ) && ( $support_amount >= 0.01) ) {
( $support_amount = number_format( floatval( $support_amount ), 2, '.', '' ) );
} elseif ( ( $support_amount <= 0.999 ) && ( $support_amount >= 0.1 ) ) {
( $support_amount = number_format( floatval( $support_amount ), 1, '.', '' ) );
} else {
( $support_amount = number_format( intval( $support_amount ) ) );
}
$init_bid = $results->items[0]->amount; ?>
<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>
<?php } ?>
</ul>
<?php } else { ?>

View file

@ -173,7 +173,7 @@ class LBRY_Network
} else {
printf (
'<div class="misc-pub-section lbry-meta-checkbox-wrapper lbry-meta-wrapper-last">
<span class="lbry-pub-metabox"><img src="' . __( '%1$s', 'lbrypress' ) . '" class="icon icon-lbry meta-icon-lbry"></span><span class="lbry-meta-label"> Publish to: <strong>' . esc_html__('LBRY', 'lbrypress') . '</strong></span><input type="checkbox" class="lbry-meta-checkbox" value="1"' . esc_attr('%2$s') . ' name="' . esc_attr('%3$s') . '">
<span class="lbry-pub-metabox"><img src="' . __( '%1$s', 'lbrypress' ) . '" class="icon icon-lbry meta-icon-lbry"></span><span class="lbry-meta-label">Publish to: <strong> LBRY </strong></span><input type="checkbox" class="lbry-meta-checkbox" value="1"' . esc_attr('%2$s') . ' name="' . esc_attr('%3$s') . '">
</div>',
plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png',
checked( $value, true, false ),

View file

@ -92,7 +92,7 @@ class LBRY_Network_Publisher
// Set License Published under
$published_license = $output->value->license;
if ( isset( $published_license ) && ( $published_license !== null ) ) {
if ( ( $published_license ) && ( $published_license !== null ) ) {
update_post_meta( $post->ID, '_lbry_post_published_license', $published_license );
}

View file

@ -39,9 +39,18 @@ usort( $channels, array( 'LBRYPress', 'channel_name_comp' ) );
<input type="hidden" id="_lbrynonce" name="_lbrynonce" value="<?php echo $lbrynonce ?>"><?php
if ( ( ( $lbry_published == true ) || ( $lbry_published_channel ) ) && ( $lbry_published_license != null) ) {
if ( ( ( $will_publish == true ) && ( $lbry_channel_claim_id ) ) || ( ( ( $lbry_published == true ) || ( $lbry_claim_id ) || ( $lbry_published_channel ) ) && ( $lbry_published_license != null ) ) ) {
$results = LBRY()->daemon->claim_search( $lbry_claim_id );
$init_bid = $results->items[0]->amount;
printf(
'<div class="lbry-meta-label lbry-meta-bx-channel"><strong>' . __( 'LBRY channel published at:', 'lbrypress' ) . '</strong> <div class="lbry-meta-bx-content lbry-meta-bx-channel"><a href="' . esc_url( '%2$s', 'lbrypress' ) . '">' . esc_html__( '%1$s', 'lbrypress' ) . '</a></div><div class="lbry-meta-label lbry-meta-bx-license"><strong>' . __( 'License published under:', 'lbrypress' ) .'</strong> </div><div class="lbry-meta-bx-content lbry-meta-bx-license lbry-meta-bx-content-last">' . esc_html__( '%3$s', 'lbrypress' ) . '</div></div>',
'<div class="lbry-meta-label lbry-meta-bx-channel"><strong>' . __( 'Initial bid amount:', 'lbrypress' ) . ' </strong>
<span class="lbry-meta-bx-content lbry-meta-bx-channel"><img src="' . esc_url( plugin_dir_url( LBRY_PLUGIN_FILE ) ) . 'admin/images/lbc.png" class="icon icon-lbc bid-icon-lbc bid-icon-lbc"> ' . esc_html__( '%1$s', 'lbrypress' ) . '</span></div>
<div class="lbry-meta-label lbry-meta-bx-channel"><strong>' . __( 'LBRY channel published at:', 'lbrypress' ) . '</strong></div>
<div class="lbry-meta-bx-content lbry-meta-bx-channel"><a href="' . esc_url( '%4$s', 'lbrypress' ) . '">' . esc_html__( '%3$s', 'lbrypress' ) . '</a></div>
<div class="lbry-meta-label lbry-meta-bx-license"><strong>' . __( 'License published under:', 'lbrypress' ) .'</strong> </div>
<div class="lbry-meta-bx-content lbry-meta-bx-license lbry-meta-bx-content-last">' . esc_html__( '%5$s', 'lbrypress' ) . '</div>',
$init_bid,
$lbry_published_channel,
$chan_open_url,
$lbry_published_license,