$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'; ob_start(); ?>
id == 'settings_page_awb-options' ) { ?>