$_SERVER[‘HTTP_USER_AGENT’] is not setup.
-
When parsing website through https://achecker.ca/checker/index.php (widely used app to check WCAG validity), $_SERVER[‘HTTP_USER_AGENT’] is not set up therefore there is an error on wah-front-functions.php
Quick fix: (hope you add it on next update)
if ( ! function_exists( 'wp_access_helper_body_class' ) ) { /** * Add front body classes * * @param array $classes CSS classes. * @return array CSS classes */ function wp_access_helper_body_class( $classes ) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if ( $is_lynx ) { $classes[] = 'lynx'; } elseif ( $is_gecko ) { $classes[] = 'gecko'; } elseif ( $is_opera ) { $classes[] = 'opera'; } elseif ( $is_NS4 ) { $classes[] = 'ns4'; } elseif ( $is_safari ) { $classes[] = 'safari'; } elseif ( $is_chrome ) { $classes[] = 'chrome'; } elseif ( $is_IE ) { $classes[] = 'ie'; if(isset($_SERVER['HTTP_USER_AGENT'])) { if ( preg_match( '/MSIE ( [0-11]+ )( [a-zA-Z0-9.]+ )/', $_SERVER['HTTP_USER_AGENT'], $browser_version ) ) { $classes[] = 'ie' . $browser_version[1]; } } } else { $classes[] = 'unknown'; } if ( $is_iphone ) { $classes[] = 'iphone'; } if(isset($_SERVER['HTTP_USER_AGENT'])) { if ( stristr( $_SERVER['HTTP_USER_AGENT'], 'mac' ) ) { $classes[] = 'osx'; } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], 'linux' ) ) { $classes[] = 'linux'; } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], 'windows' ) ) { $classes[] = 'windows'; } } $classes[] = 'wp-accessibility-helper'; $contrast_setup = get_option( 'wah_contrast_setup' ) ? get_option( 'wah_contrast_setup' ) : 0; $font_setup_type = get_option( 'wah_font_setup_type' ) ? get_option( 'wah_font_setup_type' ) : 'script'; $remove_styles_setup = get_option( 'wah_remove_styles_setup' ) ? get_option( 'wah_remove_styles_setup' ) : 0; $location_setup = get_option( 'wah_left_side' ) ? 'left' : 'right'; $underline_links_setup = get_option( 'wah_underline_links_setup' ) ? get_option( 'wah_underline_links_setup' ) : 0; $wah_left_side = get_option( 'wah_left_side' ); if ( $contrast_setup ) { $classes[] = 'accessibility-contrast_mode_on'; } if ( $font_setup_type ) { $classes[] = 'wah_fstype_' . $font_setup_type; } if ( $remove_styles_setup ) { $classes[] = 'accessibility-remove-styles-setup'; } if ( $underline_links_setup ) { $classes[] = 'accessibility-underline-setup'; } if ( 'left' === $location_setup ) { $classes[] = 'accessibility-location-left'; } else { $classes[] = 'accessibility-location-right'; } return $classes; } add_filter( 'body_class', 'wp_access_helper_body_class' ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘$_SERVER[‘HTTP_USER_AGENT’] is not setup.’ is closed to new replies.