@@ -26,7 +26,7 @@ class Setup_Wizard {
2626 * Wizard steps.
2727 *
2828 * @since 3.0.0
29-
29+ *
3030 * @var array
3131 */
3232 private $ steps = array ();
@@ -35,17 +35,29 @@ class Setup_Wizard {
3535 * Current step.
3636 *
3737 * @since 3.0.0
38-
38+ *
3939 * @var string
4040 */
4141 private $ current_step = '' ;
4242
43+ /**
44+ * Whether Pro is active.
45+ *
46+ * @since 3.0.0
47+ *
48+ * @var bool
49+ */
50+ private bool $ is_pro_active = false ;
51+
4352 /**
4453 * Constructor.
4554 *
4655 * @since 3.0.0
4756 */
4857 public function __construct () {
58+ $ main = \WebberZone \Knowledge_Base \wzkb ();
59+ $ this ->is_pro_active = ! empty ( $ main ->pro );
60+
4961 Hook_Registry::add_action ( 'admin_menu ' , array ( $ this , 'admin_menus ' ), PHP_INT_MAX );
5062 Hook_Registry::add_action ( 'admin_init ' , array ( $ this , 'setup_wizard ' ), PHP_INT_MAX );
5163 Hook_Registry::add_action ( 'admin_init ' , array ( $ this , 'redirect_on_activation ' ) );
@@ -374,7 +386,7 @@ public function structure_step() {
374386 );
375387 ?>
376388 </p>
377- <?php if ( class_exists ( ' WebberZone \\ Knowledge_Base \\ Pro \\ Pro ' ) ) : ?>
389+ <?php if ( $ this -> is_pro_active ) : ?>
378390 <p class="wzkb-setup-pro-enabled">
379391 <span class="dashicons dashicons-yes-alt"></span>
380392 <span>
@@ -685,7 +697,7 @@ public function pro_features_step() {
685697 $ rating_system = $ settings ['rating_system ' ] ?? 'disabled ' ;
686698 $ tracking_method = $ settings ['rating_tracking_method ' ] ?? 'cookie ' ;
687699 $ show_rating_stats = $ settings ['show_rating_stats ' ] ?? 1 ;
688- $ is_pro = class_exists ( ' WebberZone \\ Knowledge_Base \\ Pro \\ Pro ' ) ;
700+ $ is_pro = $ this -> is_pro_active ;
689701
690702 // Beacon settings for Pro.
691703 $ beacon_enabled = $ settings ['beacon_enabled ' ] ?? 0 ;
@@ -785,69 +797,110 @@ public function pro_features_step() {
785797 </tr>
786798 </table>
787799
788- <?php if ( $ is_pro ) : ?>
789800 <h2><?php esc_html_e ( 'Beacon Help Widget ' , 'knowledgebase ' ); ?> </h2>
790801 <table class="form-table">
791802 <tr>
792- <th scope="row"><label for="beacon_enabled"><?php esc_html_e ( 'Enable Beacon ' , 'knowledgebase ' ); ?> </label></th>
803+ <th scope="row">
804+ <label for="beacon_enabled">
805+ <?php esc_html_e ( 'Enable Beacon ' , 'knowledgebase ' ); ?>
806+ <?php if ( ! $ is_pro ) : ?>
807+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
808+ <?php endif ; ?>
809+ </label>
810+ </th>
793811 <td>
794812 <input type="hidden" name="beacon_enabled" value="0" />
795- <input type="checkbox" id="beacon_enabled" name="beacon_enabled" value="1" <?php checked ( $ beacon_enabled , 1 ); ?> />
813+ <input type="checkbox" id="beacon_enabled" name="beacon_enabled" value="1" <?php checked ( $ beacon_enabled , 1 ); ?> <?php disabled ( ! $ is_pro ); ?> />
796814 <p class="description"><?php esc_html_e ( 'Display the floating help widget with search, suggested articles, and contact form. ' , 'knowledgebase ' ); ?> </p>
815+ <?php if ( ! $ is_pro ) : ?>
816+ <p class="description wzkb-pro-feature-desc">
817+ <?php esc_html_e ( '✨ Engage visitors with a modern floating help widget featuring instant search, context-aware article suggestions, and an integrated contact form—all beautifully designed and mobile-responsive. ' , 'knowledgebase ' ); ?>
818+ </p>
819+ <?php endif ; ?>
797820 </td>
798821 </tr>
799822 <tr>
800- <th scope="row"><label for="beacon_display_location"><?php esc_html_e ( 'Display Location ' , 'knowledgebase ' ); ?> </label></th>
823+ <th scope="row">
824+ <label for="beacon_display_location">
825+ <?php esc_html_e ( 'Display Location ' , 'knowledgebase ' ); ?>
826+ <?php if ( ! $ is_pro ) : ?>
827+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
828+ <?php endif ; ?>
829+ </label>
830+ </th>
801831 <td>
802- <select id="beacon_display_location" name="beacon_display_location">
832+ <select id="beacon_display_location" name="beacon_display_location" <?php disabled ( ! $ is_pro ); ?> >
803833 <option value="kb_only" <?php selected ( $ beacon_display_location , 'kb_only ' ); ?> ><?php esc_html_e ( 'Knowledge Base Only ' , 'knowledgebase ' ); ?> </option>
804834 <option value="sitewide" <?php selected ( $ beacon_display_location , 'sitewide ' ); ?> ><?php esc_html_e ( 'Entire Site ' , 'knowledgebase ' ); ?> </option>
805835 </select>
806836 <p class="description"><?php esc_html_e ( 'Control where the beacon button appears. ' , 'knowledgebase ' ); ?> </p>
807837 </td>
808838 </tr>
809839 <tr>
810- <th scope="row"><label for="beacon_position"><?php esc_html_e ( 'Button Position ' , 'knowledgebase ' ); ?> </label></th>
840+ <th scope="row">
841+ <label for="beacon_position">
842+ <?php esc_html_e ( 'Button Position ' , 'knowledgebase ' ); ?>
843+ <?php if ( ! $ is_pro ) : ?>
844+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
845+ <?php endif ; ?>
846+ </label>
847+ </th>
811848 <td>
812- <select id="beacon_position" name="beacon_position">
849+ <select id="beacon_position" name="beacon_position" <?php disabled ( ! $ is_pro ); ?> >
813850 <option value="right" <?php selected ( $ beacon_position , 'right ' ); ?> ><?php esc_html_e ( 'Bottom Right ' , 'knowledgebase ' ); ?> </option>
814851 <option value="left" <?php selected ( $ beacon_position , 'left ' ); ?> ><?php esc_html_e ( 'Bottom Left ' , 'knowledgebase ' ); ?> </option>
815852 </select>
816853 </td>
817854 </tr>
818855 <tr>
819- <th scope="row"><label for="beacon_color"><?php esc_html_e ( 'Primary Color ' , 'knowledgebase ' ); ?> </label></th>
856+ <th scope="row">
857+ <label for="beacon_color">
858+ <?php esc_html_e ( 'Primary Color ' , 'knowledgebase ' ); ?>
859+ <?php if ( ! $ is_pro ) : ?>
860+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
861+ <?php endif ; ?>
862+ </label>
863+ </th>
820864 <td>
821- <input type="text" id="beacon_color" name="beacon_color" value="<?php echo esc_attr ( $ beacon_color ); ?> " class="color-field" />
865+ <input type="text" id="beacon_color" name="beacon_color" value="<?php echo esc_attr ( $ beacon_color ); ?> " class="color-field" <?php disabled ( ! $ is_pro ); ?> />
822866 <p class="description"><?php esc_html_e ( 'Main brand color for the beacon button. Other colors will be generated automatically. ' , 'knowledgebase ' ); ?> </p>
823867 </td>
824868 </tr>
825869 <tr>
826- <th scope="row"><label for="beacon_greeting"><?php esc_html_e ( 'Greeting Message ' , 'knowledgebase ' ); ?> </label></th>
870+ <th scope="row">
871+ <label for="beacon_greeting">
872+ <?php esc_html_e ( 'Greeting Message ' , 'knowledgebase ' ); ?>
873+ <?php if ( ! $ is_pro ) : ?>
874+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
875+ <?php endif ; ?>
876+ </label>
877+ </th>
827878 <td>
828- <input type="text" id="beacon_greeting" name="beacon_greeting" value="<?php echo esc_attr ( $ beacon_greeting ); ?> " class="large-text" />
879+ <input type="text" id="beacon_greeting" name="beacon_greeting" value="<?php echo esc_attr ( $ beacon_greeting ); ?> " class="large-text" <?php disabled ( ! $ is_pro ); ?> />
829880 <p class="description"><?php esc_html_e ( 'Welcome message shown when users open the beacon. ' , 'knowledgebase ' ); ?> </p>
830881 </td>
831882 </tr>
832883 <tr>
833- <th scope="row"><label for="beacon_contact_enabled"><?php esc_html_e ( 'Enable Contact Form ' , 'knowledgebase ' ); ?> </label></th>
884+ <th scope="row">
885+ <label for="beacon_contact_enabled">
886+ <?php esc_html_e ( 'Enable Contact Form ' , 'knowledgebase ' ); ?>
887+ <?php if ( ! $ is_pro ) : ?>
888+ <span class="wzkb-pro-badge"><?php esc_html_e ( 'PRO ' , 'knowledgebase ' ); ?> </span>
889+ <?php endif ; ?>
890+ </label>
891+ </th>
834892 <td>
835893 <input type="hidden" name="beacon_contact_enabled" value="0" />
836- <input type="checkbox" id="beacon_contact_enabled" name="beacon_contact_enabled" value="1" <?php checked ( $ beacon_contact_enabled , 1 ); ?> />
894+ <input type="checkbox" id="beacon_contact_enabled" name="beacon_contact_enabled" value="1" <?php checked ( $ beacon_contact_enabled , 1 ); ?> <?php disabled ( ! $ is_pro ); ?> />
837895 <p class="description"><?php esc_html_e ( 'Allow visitors to send messages from the beacon. ' , 'knowledgebase ' ); ?> </p>
838896 </td>
839897 </tr>
840898 </table>
841- <?php endif ; ?>
842899
843900 <p class="wzkb-setup-actions step">
844901 <?php wp_nonce_field ( 'wzkb-setup ' ); ?>
845902 <a href="<?php echo esc_url ( $ this ->get_previous_step_link () ); ?> " class="button button-large"><?php esc_html_e ( 'Previous ' , 'knowledgebase ' ); ?> </a>
846- <?php if ( $ is_pro ) : ?>
847- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e ( 'Continue ' , 'knowledgebase ' ); ?> " name="wzkb_save_step" />
848- <?php else : ?>
849- <a href="<?php echo esc_url ( $ this ->get_next_step_link () ); ?> " class="button-primary button button-large button-next"><?php esc_html_e ( 'Skip to Finish ' , 'knowledgebase ' ); ?> </a>
850- <?php endif ; ?>
903+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e ( 'Continue ' , 'knowledgebase ' ); ?> " name="wzkb_save_step" />
851904 </p>
852905 </form>
853906 <?php
@@ -864,7 +917,7 @@ public function pro_features_save() {
864917 check_admin_referer ( 'wzkb-setup ' );
865918
866919 // Only save if Pro is active.
867- if ( ! class_exists ( ' WebberZone \\ Knowledge_Base \\ Pro \\ Pro ' ) ) {
920+ if ( ! $ this -> is_pro_active ) {
868921 wp_safe_redirect ( esc_url_raw ( $ this ->get_next_step_link () ) );
869922 exit ;
870923 }
@@ -1060,7 +1113,7 @@ public function complete_step() {
10601113 update_option ( 'wzkb_setup_completed ' , true );
10611114 update_option ( 'wzkb_setup_current_step ' , '' );
10621115 $ multi_product = \wzkb_get_option ( 'multi_product ' );
1063- $ pro_active = class_exists ( ' WebberZone \\ Knowledge_Base \\ Pro \\ Pro ' ) ;
1116+ $ pro_active = $ this -> is_pro_active ;
10641117 $ beacon_enabled = $ pro_active && wzkb_get_option ( 'beacon_enabled ' );
10651118 $ rating_enabled = $ pro_active && 'disabled ' !== wzkb_get_option ( 'rating_system ' );
10661119 ?>
0 commit comments