From 1795b57a1fc73b42bb3bff8ed52e253324843b3d Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Wed, 9 Feb 2022 06:09:27 -0600 Subject: [PATCH 1/8] gitignore rm vscode --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 70d3e4c..835c159 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ !*.* .DS_Store +.vscode/* tmp/* logs/* -- 2.45.2 From 39170a3262cd92ce25f26f947410ca2eb076b434 Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Wed, 9 Feb 2022 07:13:33 -0600 Subject: [PATCH 2/8] structure for tabbed admin --- classes/LBRY_Admin.php | 16 +++++++++++----- templates/{options_page.php => options-page.php} | 0 2 files changed, 11 insertions(+), 5 deletions(-) rename templates/{options_page.php => options-page.php} (100%) diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index 23c5303..a715bf4 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -41,13 +41,17 @@ class LBRY_Admin public function page_init() { // Register the LBRY Setting array - register_setting(LBRY_SETTINGS_GROUP, LBRY_SETTINGS, array('sanitize_callback' => array($this, 'sanitize'))); + register_setting( + LBRY_SETTINGS_GROUP, + LBRY_SETTINGS, + array( $this, 'sanitize_general_settings' ) + ); // Add Required Settings Sections add_settings_section( LBRY_SETTINGS_SECTION_GENERAL, // ID 'General Settings', // Title - array( $this, 'general_section_info' ), // Callback + array( $this, 'general_section_callback' ), // Callback LBRY_ADMIN_PAGE // Page ); @@ -108,14 +112,16 @@ class LBRY_Admin { // Set class property to be referenced in callbacks $this->options = get_option(LBRY_SETTINGS); - require_once(LBRY_ABSPATH . 'templates/options_page.php'); + require_once( LBRY_ABSPATH . 'templates/options-page.php' ); } + /** * Sanitizes setting input * // COMBAK Potentially sanitize more */ - public function sanitize($input) + + public function sanitize_general_settings( $input ) { if (!empty($input[LBRY_SPEECH_CHANNEL])) { $channel = $input[LBRY_SPEECH_CHANNEL]; @@ -139,7 +145,7 @@ class LBRY_Admin /** * Section info for the General Section */ - public function general_section_info() + public function general_section_callback() { print 'This is where you can configure how LBRYPress will distribute your content:'; } diff --git a/templates/options_page.php b/templates/options-page.php similarity index 100% rename from templates/options_page.php rename to templates/options-page.php -- 2.45.2 From c89405bbd409f7ce777a830552a8e248a66a6a1b Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Wed, 9 Feb 2022 07:30:41 -0600 Subject: [PATCH 3/8] options-page rewrite --- templates/options-page.php | 86 +++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/templates/options-page.php b/templates/options-page.php index a8cf308..23058ce 100644 --- a/templates/options-page.php +++ b/templates/options-page.php @@ -1,52 +1,50 @@ daemon->wallet_balance(); $available_balance = $wallet_balance->result->available; +$lbry_active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general'; $channel_list = $LBRY->daemon->channel_list(); // TODO: Make this page look cleaner ?> +
-

-

Your wallet amount:

- -
- -
-

Your Publishable Channels

- -
    - -
  • name ?>
  • - -
- -

Looks like you haven't added any channels yet, feel free to do so below:

- -

Add a new channel to publish to:

-
- - - - - - - - - - - - - -
New Channel Name - @ - -
Amount of LBC to Bid - -
- -
-
+

+ +

Wallet Available Balance

+ + +
+ +
+ + -- 2.45.2 From e894c3b6fc24293a4883c7f79bafddff5f95c231 Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Wed, 9 Feb 2022 07:44:27 -0600 Subject: [PATCH 4/8] comment out unused include --- templates/options-page.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/options-page.php b/templates/options-page.php index 23058ce..25437e7 100644 --- a/templates/options-page.php +++ b/templates/options-page.php @@ -23,7 +23,7 @@ $channel_list = $LBRY->daemon->channel_list();
@@ -34,7 +34,7 @@ $channel_list = $LBRY->daemon->channel_list(); do_settings_sections( LBRY_ADMIN_PAGE ); submit_button(); } elseif ( $lbry_active_tab == 'channels' ) { - include_once( 'partials/channel-page.php' ); +// include_once( 'partials/channel-page.php' ); } elseif ( $lbry_active_tab == 'speech' ) { settings_fields( LBRY_SPEECH_SETTINGS ); do_settings_sections( 'lbrypress-speech' ); -- 2.45.2 From 6657c8281a11a6bfbf7537ae3a5091cf457ef3fc Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Wed, 9 Feb 2022 07:49:36 -0600 Subject: [PATCH 5/8] define LBRY_SPEECH_SETTINGS --- classes/LBRYPress.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/LBRYPress.php b/classes/LBRYPress.php index 02cb819..8feb5d8 100644 --- a/classes/LBRYPress.php +++ b/classes/LBRYPress.php @@ -112,6 +112,7 @@ class LBRYPress $this->define('LBRY_SETTINGS_SECTION_GENERAL', 'lbry_settings_section_general'); $this->define('LBRY_ADMIN_PAGE', 'lbrypress'); $this->define('LBRY_WALLET', 'lbry_wallet'); // the wallet address + $this->define('LBRY_SPEECH_SETTINGS', 'lbry_speech_settings'); $this->define('LBRY_SPEECH', 'lbry_speech'); // the spee.ch address $this->define('LBRY_SPEECH_CHANNEL', 'lbry_speech_channel'); // The spee.ch channel $this->define('LBRY_SPEECH_PW', 'lbry_speech_pw'); // The password for the spee.ch channel -- 2.45.2 From 9b3a95741fb64207e9616cca026d9e404ded8bc4 Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Thu, 10 Feb 2022 09:31:11 -0600 Subject: [PATCH 6/8] amend commit to rm style enqueue --- templates/options-page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/options-page.php b/templates/options-page.php index 25437e7..578453d 100644 --- a/templates/options-page.php +++ b/templates/options-page.php @@ -34,7 +34,7 @@ $channel_list = $LBRY->daemon->channel_list(); do_settings_sections( LBRY_ADMIN_PAGE ); submit_button(); } elseif ( $lbry_active_tab == 'channels' ) { -// include_once( 'partials/channel-page.php' ); +/// include_once( 'partials/channel-page.php' ); } elseif ( $lbry_active_tab == 'speech' ) { settings_fields( LBRY_SPEECH_SETTINGS ); do_settings_sections( 'lbrypress-speech' ); -- 2.45.2 From 429f52c75b8ff9929f33b6e4ee804e7ab60f8a49 Mon Sep 17 00:00:00 2001 From: Lem Smyth Date: Thu, 10 Feb 2022 09:54:58 -0600 Subject: [PATCH 7/8] enqueue admin stylesheet --- admin/css/lbry-admin.css | 10 ++++++++++ classes/LBRY_Admin.php | 15 +++++++++++++++ templates/options-page.php | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 admin/css/lbry-admin.css diff --git a/admin/css/lbry-admin.css b/admin/css/lbry-admin.css new file mode 100644 index 0000000..7b261b6 --- /dev/null +++ b/admin/css/lbry-admin.css @@ -0,0 +1,10 @@ +/** + * Stylesheet for the admin options page + * @package LBRYPress + */ + + .wallet-icon-lbc { + height: 1.8em; + margin-right: .5em; + margin-bottom: -.5em; + } \ No newline at end of file diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index a715bf4..67c8c1b 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -33,6 +33,21 @@ class LBRY_Admin array($this, 'options_page_html'), plugin_dir_url(LBRY_PLUGIN_FILE) . '/admin/images/lbry-logo.svg' ); + + // Admin stylesheet enqueue + function load_admin_stylesheet( $hook ) { + + if ( ( $_GET['page'] == 'lbrypress' ) ) { + wp_enqueue_style( + 'lbry-admin', + plugins_url( '/admin/css/lbry-admin.css', LBRY_PLUGIN_FILE ), + array(), + LBRY_VERSION, + 'all' + ); + } + } + add_action( 'admin_enqueue_scripts', 'load_admin_stylesheet' ); } /** diff --git a/templates/options-page.php b/templates/options-page.php index 578453d..e812c2b 100644 --- a/templates/options-page.php +++ b/templates/options-page.php @@ -16,7 +16,7 @@ $channel_list = $LBRY->daemon->channel_list();

-

Wallet Available Balance

+

Wallet Available Balance

@@ -34,7 +33,7 @@ $channel_list = $LBRY->daemon->channel_list(); do_settings_sections( LBRY_ADMIN_PAGE ); submit_button(); } elseif ( $lbry_active_tab == 'channels' ) { -// include_once( 'partials/channel-page.php' ); + include_once( 'channel-page.php' ); } elseif ( $lbry_active_tab == 'speech' ) { settings_fields( LBRY_SPEECH_SETTINGS ); do_settings_sections( 'lbrypress-speech' ); -- 2.45.2