diff --git a/assets/js/addressValidator.bundle.js b/assets/js/addressValidator.bundle.js index 3e67f71..1a7d060 100644 --- a/assets/js/addressValidator.bundle.js +++ b/assets/js/addressValidator.bundle.js @@ -753,7 +753,7 @@ document.addEventListener('DOMContentLoaded', () => { // Find the wallet address input field by its ID. - const addressInput = document.getElementById('pb_paywall_admin_wallet_address'); + const addressInput = document.getElementById('paybutton_admin_wallet_address'); if (!addressInput) return; // Find or create a span for validation feedback. diff --git a/includes/class-paybutton-activator.php b/includes/class-paybutton-activator.php index abd515a..3d29114 100644 --- a/includes/class-paybutton-activator.php +++ b/includes/class-paybutton-activator.php @@ -23,13 +23,27 @@ public static function activate() { } private static function migrate_old_option() { - $old_value = get_option( 'paybutton_paywall_ecash_address', '' ); - $new_value = get_option( 'pb_paywall_admin_wallet_address', '' ); - - // If old_value is present and new_value is empty, copy old to new and remove old. - if ( ! empty( $old_value ) && empty( $new_value ) ) { - update_option( 'pb_paywall_admin_wallet_address', $old_value ); - delete_option( 'paybutton_paywall_ecash_address' ); + // --- 1. admin wallet address --- + $old_admin_addr = get_option( 'pb_paywall_admin_wallet_address', '' ); + $new_admin_addr = get_option( 'paybutton_admin_wallet_address', '' ); + if ( ! empty( $old_admin_addr ) && empty( $new_admin_addr ) ) { + update_option( 'paybutton_admin_wallet_address', $old_admin_addr ); + delete_option( 'pb_paywall_admin_wallet_address' ); + } + + // --- 2. unlocked‑indicator colours --- + $bg_old = get_option( 'unlocked_indicator_bg_color', '' ); + $bg_new = get_option( 'paybutton_unlocked_indicator_bg_color', '' ); + if ( ! empty( $bg_old ) && empty( $bg_new ) ) { + update_option( 'paybutton_unlocked_indicator_bg_color', $bg_old ); + delete_option( 'unlocked_indicator_bg_color' ); + } + + $txt_old = get_option( 'unlocked_indicator_text_color', '' ); + $txt_new = get_option( 'paybutton_unlocked_indicator_text_color', '' ); + if ( ! empty( $txt_old ) && empty( $txt_new ) ) { + update_option( 'paybutton_unlocked_indicator_text_color', $txt_old ); + delete_option( 'unlocked_indicator_text_color' ); } } diff --git a/includes/class-paybutton-admin.php b/includes/class-paybutton-admin.php index 7f3d8b9..965b750 100644 --- a/includes/class-paybutton-admin.php +++ b/includes/class-paybutton-admin.php @@ -78,7 +78,7 @@ public function handle_save_settings() { current_user_can( 'manage_options' ) ) { $this->save_settings(); - wp_cache_delete( 'pb_paywall_admin_wallet_address', 'options' ); + wp_cache_delete( 'paybutton_admin_wallet_address', 'options' ); wp_redirect( admin_url( 'admin.php?page=paybutton-paywall&settings-updated=true' ) ); exit; } @@ -198,7 +198,7 @@ public function paywall_settings_page() { $args = array( 'settings_saved' => $settings_saved, - 'admin_wallet_address' => get_option( 'pb_paywall_admin_wallet_address', '' ), + 'admin_wallet_address' => get_option( 'paybutton_admin_wallet_address', '' ), 'default_price' => get_option( 'paybutton_paywall_default_price', 5.5 ), 'current_unit' => get_option( 'paybutton_paywall_unit', 'XEC' ), 'btn_text' => get_option( 'paybutton_text', 'Pay to Unlock' ), @@ -230,7 +230,7 @@ public function admin_notice_missing_wallet_address() { return; } - $address = get_option('pb_paywall_admin_wallet_address', ''); + $address = get_option('paybutton_admin_wallet_address', ''); if (empty($address)) { echo '
'; echo '

NOTICE: Please set your wallet address in Paywall Settings. If you don\'t have an address yet, create a wallet using Cashtab, Electrum ABC or Electron Cash.

'; @@ -242,7 +242,7 @@ public function admin_notice_missing_wallet_address() { * Save settings submitted via the Paywall Settings page. */ private function save_settings() { - $address = sanitize_text_field( $_POST['pb_paywall_admin_wallet_address'] ); + $address = sanitize_text_field( $_POST['paybutton_admin_wallet_address'] ); $unit = sanitize_text_field( $_POST['unit'] ); $raw_price = floatval( $_POST['default_price'] ); $button_text = sanitize_text_field( $_POST['paybutton_text'] ); @@ -251,14 +251,14 @@ private function save_settings() { $color_secondary = sanitize_hex_color( $_POST['paybutton_color_secondary'] ); $color_tertiary = sanitize_hex_color( $_POST['paybutton_color_tertiary'] ); $hide_comments = isset( $_POST['paybutton_hide_comments_until_unlocked'] ) ? '1' : '0'; - $unlocked_indicator_bg_color = sanitize_hex_color( $_POST['unlocked_indicator_bg_color'] ); - $unlocked_indicator_text_color = sanitize_hex_color( $_POST['unlocked_indicator_text_color'] ); + $paybutton_unlocked_indicator_bg_color = sanitize_hex_color( $_POST['paybutton_unlocked_indicator_bg_color'] ); + $paybutton_unlocked_indicator_text_color = sanitize_hex_color( $_POST['paybutton_unlocked_indicator_text_color'] ); if ( $unit === 'XEC' && $raw_price < 5.5 ) { $raw_price = 5.5; } - update_option( 'pb_paywall_admin_wallet_address', $address ); + update_option( 'paybutton_admin_wallet_address', $address ); update_option( 'paybutton_paywall_unit', $unit ); update_option( 'paybutton_paywall_default_price', $raw_price ); update_option( 'paybutton_text', $button_text ); @@ -278,8 +278,8 @@ private function save_settings() { // New unlocked content indicator option: update_option( 'paybutton_scroll_to_unlocked', isset( $_POST['paybutton_scroll_to_unlocked'] ) ? '1' : '0' ); // Default to #007bff for background, #ffffff for text - update_option('unlocked_indicator_bg_color', $unlocked_indicator_bg_color ?: '#007bff'); - update_option('unlocked_indicator_text_color', $unlocked_indicator_text_color ?: '#ffffff'); + update_option('paybutton_unlocked_indicator_bg_color', $paybutton_unlocked_indicator_bg_color ?: '#007bff'); + update_option('paybutton_unlocked_indicator_text_color', $paybutton_unlocked_indicator_text_color ?: '#ffffff'); // Save the blacklist if ( isset( $_POST['paybutton_blacklist'] ) ) { diff --git a/includes/class-paybutton-public.php b/includes/class-paybutton-public.php index 8b8f4ed..e089bd8 100644 --- a/includes/class-paybutton-public.php +++ b/includes/class-paybutton-public.php @@ -43,8 +43,8 @@ public function enqueue_public_assets() { wp_enqueue_style( 'paywall-styles', PAYBUTTON_PLUGIN_URL . 'assets/css/paywall-styles.css', array(), '1.0' ); // Read the admin-chosen colors for the unlocked content indicator from options - $indicator_bg_color = get_option('unlocked_indicator_bg_color', '#007bff'); - $indicator_text_color = get_option('unlocked_indicator_text_color', '#ffffff'); + $indicator_bg_color = get_option('paybutton_unlocked_indicator_bg_color', '#007bff'); + $indicator_text_color = get_option('paybutton_unlocked_indicator_text_color', '#ffffff'); // Add inline CSS variables. $custom_css = " @@ -113,7 +113,7 @@ public function enqueue_public_assets() { 'nonce' => wp_create_nonce( 'paybutton_paywall_nonce' ), 'isUserLoggedIn' => ! empty( $_SESSION['pb_paywall_user_wallet_address'] ) ? 1 : 0, 'userAddress' => ! empty( $_SESSION['pb_paywall_user_wallet_address'] ) ? sanitize_text_field( $_SESSION['pb_paywall_user_wallet_address'] ) : '', - 'defaultAddress' => get_option( 'pb_paywall_admin_wallet_address', '' ), + 'defaultAddress' => get_option( 'paybutton_admin_wallet_address', '' ), 'scrollToUnlocked' => get_option( 'paybutton_scroll_to_unlocked', '1' ), ) ); } @@ -189,7 +189,7 @@ public function paybutton_paywall_shortcode( $atts, $content = null ) { $atts = shortcode_atts( array( 'price' => $default_price, - 'address' => get_option( 'pb_paywall_admin_wallet_address', '' ), + 'address' => get_option( 'paybutton_admin_wallet_address', '' ), 'unit' => $default_unit, 'button_text' => $default_text, 'hover_text' => $default_hover, diff --git a/templates/admin/paybutton-generator.php b/templates/admin/paybutton-generator.php index e2f7884..d631ef1 100644 --- a/templates/admin/paybutton-generator.php +++ b/templates/admin/paybutton-generator.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly //Get admin's wallet address from paywall settings - $admin_address = get_option( 'pb_paywall_admin_wallet_address', '' ); + $admin_address = get_option( 'paybutton_admin_wallet_address', '' ); ?>
diff --git a/templates/admin/paywall-settings.php b/templates/admin/paywall-settings.php index 567ec9b..7ae4576 100644 --- a/templates/admin/paywall-settings.php +++ b/templates/admin/paywall-settings.php @@ -15,10 +15,10 @@ - +
- +

Enter your wallet address to receive paywall payments.

@@ -82,13 +82,13 @@
- + - +

Controls the background color of the indicator.

@@ -96,13 +96,13 @@
- + - +

Controls the text color of the indicator.

diff --git a/templates/public/sticky-header.php b/templates/public/sticky-header.php index 4aa6383..c6f2c52 100644 --- a/templates/public/sticky-header.php +++ b/templates/public/sticky-header.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // Check if the admin has set a wallet address - $admin_wallet_address = get_option('pb_paywall_admin_wallet_address', ''); + $admin_wallet_address = get_option('paybutton_admin_wallet_address', ''); if ( empty( $admin_wallet_address ) ) { // If no valid address is set, do not display the sticky header. return;