new WpCustomControlEnableBar( $customNoti, 'njt_nofi_enable_bar', array( 'label' => __('Enable/Disable Notibar', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_general', 'settings' => 'njt_nofi_enable_bar' ) )); // Option Alignment $customNoti->add_setting('njt_nofi_alignment', array( 'default' => $this->valueDefault['align_content'], 'sanitize_callback' => array($this,'njt_nofi_sanitizeSelect'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_alignment_control', array( 'label' => __( 'Alignment Option', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_general', 'settings' => 'njt_nofi_alignment', 'type' => 'select', 'choices' => array( 'center' => esc_html__( 'Center', NJT_NOFI_DOMAIN ), 'left' => esc_html__( 'Left', NJT_NOFI_DOMAIN ), 'right' => esc_html__( 'Right', NJT_NOFI_DOMAIN ), 'space_around' => esc_html__( 'Space around', NJT_NOFI_DOMAIN ), ), )); // Hide/Close Button (No button, Toggle button, Close button) $customNoti->add_setting('njt_nofi_hide_close_button', array( 'default' => $this->valueDefault['hide_close_button'], 'sanitize_callback' => array($this,'njt_nofi_sanitizeSelect'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_hide_close_button_control', array( 'label' => __( 'Hide/Close Button', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_general', 'settings' => 'njt_nofi_hide_close_button', 'type' => 'select', 'choices' => array( 'no_button' => esc_html__( 'No button', NJT_NOFI_DOMAIN ), 'toggle_button' => esc_html__( 'Toggle button', NJT_NOFI_DOMAIN ), 'close_button' => esc_html__( 'Close button', NJT_NOFI_DOMAIN ), ), )); // Content Width (px) $customNoti->add_setting('njt_nofi_content_width', array( 'default' => $this->valueDefault['content_width'], 'sanitize_callback' => 'absint', //converts value to a non-negative integer 'transport' => 'postMessage' )); $customNoti->add_control( 'njt_nofi_content_width_control', array( 'label' => __( 'Content Width (px)', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_general', 'settings' => 'njt_nofi_content_width', 'type' => 'number', )); //Position Type $customNoti->add_setting('njt_nofi_position_type', array( 'default' => $this->valueDefault['position_type'], 'sanitize_callback' => 'wp_filter_nohtml_kses', 'transport' => 'postMessage' )); $customNoti->add_control( new WpCustomControlPositionType( $customNoti, 'njt_nofi_position_type', array( 'label' => __( 'Position Type', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_general', 'settings' => 'njt_nofi_position_type' ) )); /*Content*/ $customNoti->add_section( 'njt_nofi_content', array( 'title' => __( 'Content Options',NJT_NOFI_DOMAIN), 'priority' => 10, 'panel' => 'njt_notification-bar', )); //Text $customNoti->add_setting('njt_nofi_text', array( 'default' => $this->valueDefault['text'], 'sanitize_callback' => 'wp_kses_post', //keeps only HTML tags that are allowed in post content 'transport' => 'postMessage', )); $customNoti->selective_refresh->add_partial( 'njt_nofi_text', array( 'selector' => '.njt-display-deskop', 'primarySetting' => 'njt_nofi_text', 'container_inclusive' => true, 'fallback_refresh' => false, ) ); $customNoti->add_control( 'njt_nofi_text_control', array( 'label' => __('Text', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_text', 'type' => 'textarea', )); //Switch on/off button $customNoti->add_setting('njt_nofi_handle_button', array( 'default' => 1, 'transport' => 'postMessage', )); $customNoti->add_control( new WpCustomControlHandleButton( $customNoti, 'njt_nofi_handle_button', array( 'label' => __( 'On/Off Button', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_handle_button' ) )); //Link/Button Text $customNoti->add_setting('njt_nofi_lb_text', array( 'default' => $this->valueDefault['lb_text'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage', )); $customNoti->add_control('njt_nofi_lb_text_control', array( 'label' => __('Button Text', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_text', 'type' => 'text', )); //Link/Button URL $customNoti->add_setting('njt_nofi_lb_url', array( 'default' => $this->valueDefault['lb_url'], 'sanitize_callback' => 'esc_url_raw', //cleans URL from all invalid characters 'transport' => 'postMessage', )); $customNoti->add_control('njt_nofi_lb_url_control', array( 'label' => __('Button URL', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_url', 'type' => 'text', )); //Link/Button Font Weight $customNoti->add_setting('njt_nofi_lb_font_weight', array( 'default' => $this->valueDefault['font_weight_display'], 'sanitize_callback' => array($this,'njt_nofi_sanitizeSelect'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_lb_font_weight_control', array( 'label' => __( 'Font Weight:', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_font_weight', 'type' => 'select', 'choices' => array( '400' => esc_html__( 'Normal', NJT_NOFI_DOMAIN ), '500' => esc_html__( 'Medium', NJT_NOFI_DOMAIN ), '600' => esc_html__( 'Semi Bold', NJT_NOFI_DOMAIN ), '700' => esc_html__( 'Bold', NJT_NOFI_DOMAIN ), ), )); //Open in new window $customNoti->add_setting('njt_nofi_open_new_windown', array( 'default' => $this->valueDefault['new_windown'], 'sanitize_callback' => array($this, 'njt_nofi_sanitizeCheckbox'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_open_new_windown_control', array( 'label' => __( 'Open in new window', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_open_new_windown', 'type' => 'checkbox', )); //You want different content for mobile $customNoti->add_setting('njt_nofi_content_mobile', array( 'default' => 0, 'transport' => 'postMessage', )); $customNoti->add_control( new WpCustomControlContentMobile( $customNoti, 'njt_nofi_content_mobile', array( 'label' => __( 'You want different content for mobile?', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_content_mobile' ) )); //text mobile $customNoti->add_setting('njt_nofi_text_mobile', array( 'default' => $this->valueDefault['text_mobile'], 'sanitize_callback' => 'wp_kses_post', //keeps only HTML tags that are allowed in post content 'transport' => 'postMessage', )); $customNoti->selective_refresh->add_partial( 'njt_nofi_text_mobile', array( 'selector' => '.njt-display-mobile', 'primarySetting' => 'njt_nofi_text_mobile', 'container_inclusive' => true, 'fallback_refresh' => false, ) ); $customNoti->add_control( 'njt_nofi_text_mobile_control', array( 'label' => __('Text', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_text_mobile', 'type' => 'textarea', )); //Switch on/off button mobiile $customNoti->add_setting('njt_nofi_handle_button_mobile', array( 'default' => 0, 'transport' => 'postMessage', )); $customNoti->add_control( new WpCustomControlHandleButtonMobile( $customNoti, 'njt_nofi_handle_button_mobile', array( 'label' => __( 'On/Off Button', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_handle_button_mobile' ) )); //Link/Button Text Mobile $customNoti->add_setting('njt_nofi_lb_text_mobile', array( 'default' => $this->valueDefault['lb_text_mobile'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage', )); $customNoti->add_control('njt_nofi_lb_text_mobile_control', array( 'label' => __('Button Text', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_text_mobile', 'type' => 'text', )); //Link/Button URL Mobile $customNoti->add_setting('njt_nofi_lb_url_mobile', array( 'default' => $this->valueDefault['lb_url_mobile'], 'sanitize_callback' => 'esc_url_raw', //cleans URL from all invalid characters 'transport' => 'postMessage', )); $customNoti->add_control('njt_nofi_lb_url_mobile_control', array( 'label' => __('Button URL', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_url_mobile', 'type' => 'text', )); //Link/Button Font Weight Mobild $customNoti->add_setting('njt_nofi_lb_font_weight_mobile', array( 'default' => $this->valueDefault['font_weight_display'], 'sanitize_callback' => array($this,'njt_nofi_sanitizeSelect'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_lb_font_weight_mobile_control', array( 'label' => __( 'Font Weight:', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_lb_font_weight_mobile', 'type' => 'select', 'choices' => array( '400' => esc_html__( 'Normal', NJT_NOFI_DOMAIN ), '500' => esc_html__( 'Medium', NJT_NOFI_DOMAIN ), '600' => esc_html__( 'Semi Bold', NJT_NOFI_DOMAIN ), '700' => esc_html__( 'Bold', NJT_NOFI_DOMAIN ), ), )); //Open in new window mobile $customNoti->add_setting('njt_nofi_open_new_windown_mobile', array( 'default' => $this->valueDefault['new_windown_mobile'], 'sanitize_callback' => array($this, 'njt_nofi_sanitizeCheckbox'), 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_open_new_windown_mobile_control', array( 'label' => __( 'Open in new window', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_content', 'settings' => 'njt_nofi_open_new_windown_mobile', 'type' => 'checkbox', )); /*Style*/ $customNoti->add_section( 'njt_nofi_style', array( 'title' => __( 'Style Options',NJT_NOFI_DOMAIN), 'priority' => 10, 'panel' => 'njt_notification-bar', )); //Preset Color $customNoti->add_setting( 'njt_nofi_preset_color', array( 'default' => $this->valueDefault['preset_color'], 'transport' => 'postMessage', ) ); $customNoti->add_control( new WpCustomControlColorPreset( $customNoti, 'njt_nofi_preset_color', array( 'label' => __('Preset Color', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_preset_color' ) )); //Background Color $customNoti->add_setting( 'njt_nofi_bg_color', array( 'default' => $this->valueDefault['bg_color'], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $customNoti->add_control( new WpCustomControlColorBg( $customNoti, 'njt_nofi_bg_color', array( 'label' => __('Background Color', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_bg_color' ) )); //Text Color $customNoti->add_setting( 'njt_nofi_text_color', array( 'default' => $this->valueDefault['text_color'], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $customNoti->add_control( new WpCustomControlColorText( $customNoti, 'njt_nofi_text_color', array( 'label' => __('Text Color', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_text_color', ) )); //Button Color $customNoti->add_setting('njt_nofi_lb_color', array( 'default' =>$this->valueDefault['lb_color'], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', )); $customNoti->add_control( new WpCustomControlColorLb( $customNoti, 'njt_nofi_lb_color', array( 'label' => __('Button Color', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_lb_color' ) )); //Button Text Color $customNoti->add_setting('njt_nofi_lb_text_color', array( 'default' =>$this->valueDefault['lb_text_color'], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', )); $customNoti->add_control( new WpCustomControlTextColorLb( $customNoti, 'njt_nofi_lb_text_color', array( 'label' => __('Button Text Color', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_lb_text_color' ) )); //Font Size (px) $customNoti->add_setting('njt_nofi_font_size', array( 'default' => $this->valueDefault['font_size'], 'sanitize_callback' => 'absint', //converts value to a non-negative integer 'transport' => 'postMessage' )); $customNoti->add_control('njt_nofi_font_size_control', array( 'label' => __('Font Size (px)', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_style', 'settings' => 'njt_nofi_font_size', 'type' => 'number', )); /* Display */ $customNoti->add_section( 'njt_nofi_display', array( 'title' => __( 'Display Options',NJT_NOFI_DOMAIN), 'priority' => 10, 'panel' => 'njt_notification-bar', )); //Select devices want to display $customNoti->add_setting('njt_nofi_devices_display', array( 'default' => $this->valueDefault['devices_display'], 'sanitize_callback' => 'wp_filter_nohtml_kses', 'transport' => 'postMessage', )); $customNoti->add_control( 'njt_nofi_devices_display_control', array( 'label' => __( 'Select devices want to display', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_display', 'settings' => 'njt_nofi_devices_display', 'type' => 'select', 'choices' => array( 'all_devices' => esc_html__( 'All devices', NJT_NOFI_DOMAIN ), 'desktop' => esc_html__( 'Only desktop', NJT_NOFI_DOMAIN ), 'mobile' => esc_html__( 'Only mobile', NJT_NOFI_DOMAIN ), ) )); //Logic display Pages $customNoti->add_setting('njt_nofi_logic_display_page', array( 'default' => $this->valueDefault['logic_display_page'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage' )); $customNoti->add_control( 'njt_nofi_logic_display_page', array( 'label' => __( 'Option display pages', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_display', 'settings' => 'njt_nofi_logic_display_page', 'type' => 'select', 'choices' => array( 'dis_all_page' => esc_html__( 'Display on all page', NJT_NOFI_DOMAIN ), 'dis_selected_page' => esc_html__( 'Display on selected page', NJT_NOFI_DOMAIN ), 'hide_all_page' => esc_html__( 'Hide on all page', NJT_NOFI_DOMAIN ), 'hide_selected_page' => esc_html__( 'Hide on selected page', NJT_NOFI_DOMAIN ), ), )); //List display Pages $customNoti->add_setting('njt_nofi_list_display_page', array( 'default' => $this->valueDefault['logic_display_page'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage' )); $customNoti->add_control( new WpCustomControlMultiselect( $customNoti, 'njt_nofi_list_display_page', array( 'label' => __( 'Option display pages', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_display', 'settings' => 'njt_nofi_list_display_page', 'type' => 'multiple-select', ) )); //Logic display Post $customNoti->add_setting('njt_nofi_logic_display_post', array( 'default' => $this->valueDefault['logic_display_post'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage' )); $customNoti->add_control( 'njt_nofi_logic_display_post', array( 'label' => __( 'Option display posts', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_display', 'settings' => 'njt_nofi_logic_display_post', 'type' => 'select', 'choices' => array( 'dis_all_post' => esc_html__( 'Display on all post', NJT_NOFI_DOMAIN ), 'dis_selected_post' => esc_html__( 'Display on selected post', NJT_NOFI_DOMAIN ), 'hide_all_post' => esc_html__( 'Hide on all post', NJT_NOFI_DOMAIN ), 'hide_selected_post' => esc_html__( 'Hide on selected post', NJT_NOFI_DOMAIN ), ), )); //List display Post $customNoti->add_setting('njt_nofi_list_display_post', array( 'default' => $this->valueDefault['dp_pp_id'], 'sanitize_callback' => 'wp_filter_nohtml_kses', //removes all HTML from content 'transport' => 'postMessage' )); $customNoti->add_control( new WpCustomControlMultiselect( $customNoti, 'njt_nofi_list_display_post', array( 'label' => __( 'Option display Post', NJT_NOFI_DOMAIN ), 'section' => 'njt_nofi_display', 'settings' => 'njt_nofi_list_display_post', 'type' => 'multiple-select', ) )); } }