<?php if (!defined('ABSPATH')) { exit; } function gt_bogo_render_license_section() { $license_manager = gt_bogo_license_manager(); $license_key = $license_manager->get_license_key(); $status = $license_manager->get_status_details(); if (isset($_POST['gt_bogo_save_license']) && check_admin_referer('gt_bogo_license_save', 'gt_bogo_license_nonce')) { $new_key = isset($_POST['gt_bogo_license_key']) ? sanitize_text_field($_POST['gt_bogo_license_key']) : ''; $license_manager->save_license_key($new_key); $license_manager->refresh(); echo '<div class="notice notice-success"><p>License key saved and verified!</p></div>'; $license_key = $new_key; $status = $license_manager->get_status_details(); } ?> <div class="gt-bogo-license-section" style="background: #070C1C; padding: 30px; border-radius: 8px; margin: 20px 0;"> <h2 style="color: #fff; margin-top: 0;">License Activation</h2> <form method="post" action=""> <?php wp_nonce_field('gt_bogo_license_save', 'gt_bogo_license_nonce'); ?> <table class="form-table" style="background: transparent;"> <tr> <th scope="row" style="color: #fff;"> <label for="gt_bogo_license_key">License Key</label> </th> <td> <input type="text" id="gt_bogo_license_key" name="gt_bogo_license_key" value="<?php echo esc_attr($license_key); ?>" class="regular-text" placeholder="GTBOGO-XXXX-XXXX-XXXX" style="font-family: monospace; font-size: 14px;" /> <p class="description" style="color: #ccc;"> Enter your GT BOGO Engine PRO license key. <a href="https://graphictshirts.shop/purchase" target="_blank" style="color: #E10000;">Purchase License</a> </p> </td> </tr> <?php if (!empty($license_key)): ?> <tr> <th scope="row" style="color: #fff;">License Status</th> <td> <?php $status_color = '#ccc'; $status_text = 'Unknown'; if (isset($status['status'])) { switch ($status['status']) { case 'active': $status_color = '#4CAF50'; $status_text = '✓ Active'; break; case 'expiring': $status_color = '#FF9800'; $status_text = '⚠ Expiring Soon'; break; case 'expired': $status_color = '#F44336'; $status_text = '✗ Expired'; break; case 'invalid': $status_color = '#F44336'; $status_text = '✗ Invalid'; break; } } ?> <span style="color: <?php echo esc_html( $status_color ); ?>; font-weight: bold; font-size: 16px;"> <?php echo esc_html( $status_text ); ?> </span> <?php if (isset($status['expires_human'])): ?> <p style="color: #ccc; margin: 5px 0 0 0;"> Expires: <?php echo esc_html($status['expires_human']); ?> </p> <?php endif; ?> <?php if (isset($status['days_remaining'])): ?> <p style="color: #ccc; margin: 5px 0 0 0;"> Days Remaining: <?php echo intval($status['days_remaining']); ?> </p> <?php endif; ?> <?php if (isset($status['customer']['email'])): ?> <p style="color: #ccc; margin: 5px 0 0 0;"> Registered to: <?php echo esc_html($status['customer']['email']); ?> </p> <?php endif; ?> </td> </tr> <?php if ($status['status'] === 'expired' || $status['status'] === 'expiring'): ?> <tr> <th scope="row"></th> <td> <a href="<?php echo esc_url($license_manager->get_renewal_url()); ?>" class="button button-primary" target="_blank" style="background: #E10000; border-color: #E10000;"> Renew License Now </a> </td> </tr> <?php endif; ?> <?php endif; ?> </table> <p class="submit"> <input type="submit" name="gt_bogo_save_license" class="button button-primary" value="Save & Verify License" style="background: #E10000; border-color: #E10000; padding: 10px 30px; height: auto; font-size: 14px;" /> </p> </form> <?php if (!empty($license_key)): ?> <div style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #333;"> <h3 style="color: #fff;">PRO Features Status</h3> <p style="color: #ccc;"> <?php if (gt_bogo_has_pro()): ?> <span style="color: #4CAF50;">✓ PRO Features Unlocked</span> <?php else: ?> <span style="color: #F44336;">✗ PRO Features Locked</span> <?php endif; ?> </p> </div> <?php endif; ?> </div> <?php }