From e49670732cfb13c66f9b3b5299f80fd63df54d06 Mon Sep 17 00:00:00 2001 From: Lemuel Smyth <36257395+lemsmyth@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:56:59 -0600 Subject: [PATCH] Basic tabbed structure (#45) * gitignore rm vscode * structure for tabbed admin * options-page rewrite * comment out unused include * define LBRY_SPEECH_SETTINGS * amend commit to rm style enqueue --- .gitignore | 1 + classes/LBRYPress.php | 1 + classes/LBRY_Admin.php | 16 ++++++++---- templates/options-page.php | 50 ++++++++++++++++++++++++++++++++++++ templates/options_page.php | 52 -------------------------------------- 5 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 templates/options-page.php delete mode 100644 templates/options_page.php diff --git a/.gitignore b/.gitignore index 70d3e4c..835c159 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ !*.* .DS_Store +.vscode/* tmp/* logs/* 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 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 new file mode 100644 index 0000000..578453d --- /dev/null +++ b/templates/options-page.php @@ -0,0 +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 +?> + +
Wallet Available Balance= number_format($available_balance, 2, '.', ','); ?>
-
- Looks like you haven't added any channels yet, feel free to do so below:
- -