add lbry protocol to list of accepted protocols
This commit is contained in:
parent
a1dba8bea7
commit
170f2ebd07
2 changed files with 17 additions and 3 deletions
|
@ -164,6 +164,7 @@ class LBRYPress
|
||||||
{
|
{
|
||||||
register_activation_hook( LBRY_PLUGIN_FILE, array( $this, 'activate' ) );
|
register_activation_hook( LBRY_PLUGIN_FILE, array( $this, 'activate' ) );
|
||||||
register_deactivation_hook( LBRY_PLUGIN_FILE, array( $this, 'deactivate' ) );
|
register_deactivation_hook( LBRY_PLUGIN_FILE, array( $this, 'deactivate' ) );
|
||||||
|
add_filter( 'kses_allowed_protocols' , array( $this, 'lbry_add_additional_protocols' ) );
|
||||||
|
|
||||||
// Banner output for published posts
|
// Banner output for published posts
|
||||||
// NOTE: move this to its own class to reduce clutter?
|
// NOTE: move this to its own class to reduce clutter?
|
||||||
|
@ -227,6 +228,19 @@ class LBRYPress
|
||||||
error_log( 'Deactivated LBRYPress' );
|
error_log( 'Deactivated LBRYPress' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowing additional URL protocols to list of allowed protocols.
|
||||||
|
*
|
||||||
|
* @param array $protocols List of protocols allowed by (default WordPress.)
|
||||||
|
*
|
||||||
|
* @return array $protocols Updated list including additional protocols.
|
||||||
|
*/
|
||||||
|
public function lbry_add_additional_protocols( $protocols )
|
||||||
|
{
|
||||||
|
$protocols[] = 'lbry';
|
||||||
|
return $protocols;
|
||||||
|
}
|
||||||
|
|
||||||
public function published_on_lbry_banner($content)
|
public function published_on_lbry_banner($content)
|
||||||
{
|
{
|
||||||
if ( ! is_single() || ! in_the_loop() || ! is_main_query() ) {
|
if ( ! is_single() || ! in_the_loop() || ! is_main_query() ) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ if ( current_user_can( 'manage_options' ) ) {
|
||||||
$results = LBRY()->daemon->claim_search( $claim_id );
|
$results = LBRY()->daemon->claim_search( $claim_id );
|
||||||
$lbry_url = $results->items[0]->canonical_url;
|
$lbry_url = $results->items[0]->canonical_url;
|
||||||
if ( $lbry_url ) {
|
if ( $lbry_url ) {
|
||||||
$open_url = str_replace( 'lbry://', 'open.lbry.com/', $lbry_url );
|
$open_url = str_replace( 'lbry://', 'https://open.lbry.com/', $lbry_url );
|
||||||
}
|
}
|
||||||
$timestamp = $results->items[0]->meta->creation_timestamp;
|
$timestamp = $results->items[0]->meta->creation_timestamp;
|
||||||
$created_date = date( 'm-d-y', $timestamp );
|
$created_date = date( 'm-d-y', $timestamp );
|
||||||
|
@ -69,12 +69,12 @@ if ( current_user_can( 'manage_options' ) ) {
|
||||||
$init_bid = $results->items[0]->amount; ?>
|
$init_bid = $results->items[0]->amount; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?php echo esc_url( $open_url, 'lbrypress' ); ?>"><?php esc_html_e( $channel->name, 'lbrypress' ); ?></a></td>
|
<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( esc_url( $lbry_url ), 'lbrypress' ); ?></td>
|
||||||
<td><?php esc_html_e( $claim_id, 'lbrypress' ); ?></td>
|
<td><?php esc_html_e( $claim_id, 'lbrypress' ); ?></td>
|
||||||
<td><?php esc_html_e( $created_date, 'lbrypress' ); ?></td>
|
<td><?php esc_html_e( $created_date, 'lbrypress' ); ?></td>
|
||||||
<td><?php esc_html_e( $claims_published, '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><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="<?php echo admin_url( add_query_arg( array( 'page' => 'lbrypress', 'tab' => 'supports', 'claim_id' => $claim_id, 'supporting_channel' => $channel->name, 'current_support' => $support_amount, 'init_bid' => $init_bid, 'lbry_url' => urlencode($lbry_url) ), 'admin.php' ) ); ?>">Add</a></td>
|
<td><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'lbrypress', 'tab' => 'supports', 'claim_id' => urlencode( esc_html__( $claim_id, 'lbrypress' ) ), 'supporting_channel' => urlencode( esc_html__($channel->name, 'lbrypress' ) ), 'current_support' => urlencode( floatval($support_amount) ), 'init_bid' => urlencode( floatval($init_bid) ), 'lbry_url' => urlencode( esc_url($lbry_url) ) ), 'admin.php' ) ) ); ?>">Add</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Add table
Reference in a new issue