Skip to content

Commit

Permalink
Late escape Social block (#37881)
Browse files Browse the repository at this point in the history
* First pass social link block

* Remove escaping of hard coded strings

Addresses #37881 (comment)

* Remove escaping of SVG

Addresses #37881 (review)
  • Loading branch information
getdave authored Jan 14, 2022
1 parent 30e57e1 commit 3eb3d1d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function render_block_core_social_link( $attributes, $content, $block ) {
return '';
}

$attribute = '';
$rel_target_attributes = '';
if ( $open_in_new_tab ) {
$attribute = 'rel="noopener nofollow" target="_blank"';
$rel_target_attributes = 'rel="noopener nofollow" target="_blank"';
}

$icon = block_core_social_link_get_icon( $service );
Expand All @@ -45,7 +45,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
)
);

return '<li ' . $wrapper_attributes . '><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" ' . $attribute . ' class="wp-block-social-link-anchor"> ' . $icon . '</a></li>';
return '<li ' . $wrapper_attributes . '><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '" ' . $rel_target_attributes . ' class="wp-block-social-link-anchor">' . $icon . '</a></li>';
}

/**
Expand Down

0 comments on commit 3eb3d1d

Please sign in to comment.