$value ) { // Check to see if the current option has a value. If so, process it. if( isset( $input[ $key ] ) ) { // Sanitize phone number if ( $key == 'phone_number' ) { preg_replace('/[^0-9]/', '', $input[$key]); if ( !preg_match("/^\d+$/", $input[$key]) ) { add_settings_error( 'awb_phone_number_invalid', esc_attr( 'settings_updated' ), esc_html__( 'The value you entered in the phone number field is invalid. Please enter a valid number.', 'add-whatsapp-button' ) ); add_action( 'admin_notices', 'print_errors' ); $input[$key] = ''; } } // Strip all HTML and PHP tags and properly handle quoted strings $output[ $key ] = strip_tags( stripslashes( $input[ $key ] ) ); } // end if } // end foreach // Return the array processing any additional functions filtered by this action return apply_filters( 'awb_sanitize_inputs', $output, $input ); } /** * Validate Limiting Hours * * @since 2.0.0 * * @param $hour */ private function validate_limiting_hours( $hour ) { if ( is_numeric( $hour ) && $hour >= 0 && $hour <= 24 ) { return $hour; } else { return ''; } } /** * Print Options Page Content * * Called as a callback in `add_options_page()` for the plugin's settings page. * * @since 2.0.0 */ public function print_options_page_content() { $settings = Plugin::$instance->get_plugin_options(); // Set default button style for Settings Page Preview $button_style = ! empty( $settings['button_type'] ) ? $settings['button_type'] : 'wab-side-rectangle'; // Create default button text $button_text = ! empty( $settings['button_text'] ) ? sanitize_text_field( $settings['button_text'] ) : __('Message Us on WhatsApp', 'add-whatsapp-button'); // Hide Text if selected button style is "Icon" $displayNoneIfIcon = ( $settings['button_type'] == 'wab-icon-plain' || $settings['button_type'] == 'wab-icon-styled' ) ? 'class="awb-displaynone"' : ''; // Set default icon size if the button type is WhatsApp icon $icon_size = ! empty( $settings['icon_size'] ) ? sanitize_text_field( $settings['icon_size'] ) : '80'; // If the breakpoint setting is inactive (the "enable breakpoint" checkbox is checked), hide the breakpoint settings. $bp_no_show_class = empty( $settings['enable_breakpoint'] ) ? ' class="awb-hide"' : ''; // If the 'limit hours' setting is inactive, hide the hour controls. $lh_no_show_class = empty( $settings['limit_hours'] ) ? ' class="awb-hide"' : ''; // If the 'Hide Button' setting is inactive, hide the radio buttons with the hiding settings. $hb_no_show_class = empty( $settings['enable_hide_button'] ) ? ' class="awb-hide"' : ''; // If the 'Enable Message' setting is inactive, hide the textarea. $em_no_show_class = empty( $settings['enable_message'] ) ? ' class="awb-hide"' : ''; // If the saved button type is not a plain WhatsApp icon, hide the icon size control. $is_no_show_class = ! empty( $settings['button_type'] ) && 'wab-icon-plain' !== $settings['button_type'] ? ' class="awb-hide"' : ''; $button_inline_styles = ''; // Inline Style if ( $settings['button_bg_color'] || $settings['button_text_color'] ) { $button_inline_styles = ' style="'; // If there is a saved background color, add it to the button with a style tag. if ( ! empty( $settings['button_bg_color'] ) ) { $button_inline_styles .= 'background-color: ' . $settings['button_bg_color'] . ';'; } // If there is a saved text color, add it to the button with a style tag. if ( ! empty( $settings['button_text_color'] ) ) { $button_inline_styles .= ' color: ' . $settings['button_text_color'] . ';'; } $button_inline_styles .= '"'; } ob_start(); ?>


>

>

>

>

> /> Full Remove

/> Hide with toggle button


>

>

>

>

>

>

id == 'settings_page_awb-options' ) { ?>