Explorar o código

Radcliffe 2: Fix the Contact Info email masking generating PHP warnings

Danny Dudzic %!s(int64=5) %!d(string=hai) anos
pai
achega
09ea105cee
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      radcliffe-2/contact-info/contact-info-functions.php

+ 4 - 3
radcliffe-2/contact-info/contact-info-functions.php

@@ -7,7 +7,8 @@ function radcliffe_2_contact_info( $section ) {
 	$location = get_theme_mod( 'radcliffe_2_contact_info_location',  'header' );
 	$location = get_theme_mod( 'radcliffe_2_contact_info_location',  'header' );
 	$address  = get_option( 'site_contact_info' )['address'] ?: get_theme_mod( 'radcliffe_2_contact_info_address', '' );
 	$address  = get_option( 'site_contact_info' )['address'] ?: get_theme_mod( 'radcliffe_2_contact_info_address', '' );
 	$phone    = get_option( 'site_contact_info' )['phone'] ?: get_theme_mod( 'radcliffe_2_contact_info_phone',   '' );
 	$phone    = get_option( 'site_contact_info' )['phone'] ?: get_theme_mod( 'radcliffe_2_contact_info_phone',   '' );
-	$email    = get_option( 'site_contact_info' )['email'] ?: antispambot( get_theme_mod( 'radcliffe_2_contact_info_email' ),   '' );
+	$email    = get_option( 'site_contact_info' )['email'] ?: get_theme_mod( 'radcliffe_2_contact_info_email',   '' );
+	$email    = $email ? antispambot( $email ) : '';
 	$hours    = get_theme_mod( 'radcliffe_2_contact_info_hours',   '' );
 	$hours    = get_theme_mod( 'radcliffe_2_contact_info_hours',   '' );
 
 
 	// If Address, Phone, Email and Hours are empty, return.
 	// If Address, Phone, Email and Hours are empty, return.
@@ -75,9 +76,9 @@ function radcliffe_2_contact_info( $section ) {
 
 
 			<?php if ( $email || is_customize_preview() ) : ?>
 			<?php if ( $email || is_customize_preview() ) : ?>
 			<span class="contact-info-email">
 			<span class="contact-info-email">
-				<a href="mailto:<?php echo sanitize_email( $email ); ?>">
+				<a href="mailto:<?php echo esc_html( $email ); ?>">
 					<?php echo radcliffe_2_get_svg( array( 'icon' => 'mail', 'title' => esc_html__( 'E-mail', 'radcliffe-2' ) ) ); ?>
 					<?php echo radcliffe_2_get_svg( array( 'icon' => 'mail', 'title' => esc_html__( 'E-mail', 'radcliffe-2' ) ) ); ?>
-					<span class="contact-info-label"><?php echo sanitize_email( $email ); ?></span>
+					<span class="contact-info-label"><?php echo esc_html( $email ); ?></span>
 				</a>
 				</a>
 			</span>
 			</span>
 			<?php endif; ?>
 			<?php endif; ?>