diff --git a/admin/css/lbry-admin.css b/admin/css/lbry-admin.css index c69f6ed..6419836 100644 --- a/admin/css/lbry-admin.css +++ b/admin/css/lbry-admin.css @@ -13,3 +13,35 @@ height: 1.2em; margin-bottom: -.2em; } + + .lbry-pub-metabox { + margin: 0 0 0 -.2em; + padding: 0 .2em 0 0 ; + } + .meta-icon-lbry { + height: 1.55em; + margin-bottom: -.4em; + padding-left: .1em; + } + .lbry-meta-checkbox-wrapper { + padding: .5em .8em .6em; + } + + .lbry-meta-checkbox-wrapper-last { + padding: .5em .8em 1.5em; + } + .lbry-meta-label { + padding-left: .3em; + padding-right: .6em; + } + + .lbry-meta-bx-label { + margin: .5em .8em .6em; + } + + .lbry-meta-bx-option { + padding: .5em .8em .6em; + } + .lbry-meta-bx-option-last { + padding: .5em .8em 1.5em; + } diff --git a/admin/images/lbry-icon.png b/admin/images/lbry-icon.png new file mode 100644 index 0000000..44ccd56 Binary files /dev/null and b/admin/images/lbry-icon.png differ diff --git a/admin/images/lbry.png b/admin/images/lbry.png new file mode 100644 index 0000000..20aeea3 Binary files /dev/null and b/admin/images/lbry.png differ diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index ed57234..de08a65 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -4,6 +4,7 @@ * * @package LBRYPress */ +defined('ABSPATH') || die(); // Exit if accessed directly class LBRY_Admin { @@ -32,7 +33,7 @@ class LBRY_Admin 'manage_options', LBRY_ADMIN_PAGE, array( $this, 'options_page_html' ), - plugin_dir_url(LBRY_PLUGIN_FILE) . '/admin/images/lbry-logo.svg' + plugin_dir_url( LBRY_PLUGIN_FILE ) . '/admin/images/lbry-icon.png' ); // Admin stylesheet enqueue @@ -338,6 +339,55 @@ class LBRY_Admin

Set Default to always Publish to LBRY, this can be adjusted when publishing a New Post.

', + 'lbry_default_publish_setting', + LBRY_SETTINGS, + + ); + } + + /** + * Prints select to choose a default to publish to channel + */ + public function default_channel_callback() + { + $options = ''; + $channel_list = LBRY()->daemon->channel_list(); + + if ( $channel_list ) { + foreach ( $channel_list as $channel ) { + $selected = $this->options['default_lbry_channel'] === $channel->claim_id; + + $options .= ''; + } + + printf( + '', + 'default_lbry_channel', + LBRY_SETTINGS, + $options + ); + } else { ?> +

Looks like you haven't added any channels yet, you can do that now on the Channels Tab

+ ID; + + if ( get_post_type( $post_id ) != 'post' ) { + return $post; + } + $default_value = get_option( LBRY_SETTINGS )['lbry_default_publish_setting']; + $new_value = get_post_meta( $post_id, LBRY_WILL_PUBLISH, true ); + if ( ( $new_value ) ? $new_value : $new_value = $default_value ); + $value = $new_value; + if ( ( $value ) ? $value : 0 ); + + // nonce set on page meta-box.php + printf ( + '
+ +
', + plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png', + 'Publish to', + 'LBRY', + 'lbrypress', + checked( $value, true, false ), + LBRY_WILL_PUBLISH + ); + } + /** * Returns the HTML for the LBRY Meta Box * @param WP_POST $post