jaredatch / Shared-Counts

WordPress plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
GNU General Public License v2.0
47 stars 16 forks source link

Shared link invalid href attribute #130

Closed matsonc closed 8 months ago

matsonc commented 8 months ago

The shared link can have an invalid href attribute because the url is escaped using esc_attr instead of esc_url

Plugin version 1.4.1

Possible Solution

In wp-content\plugins\shared-counts\includes\class-shared-counts-front.php on line 685 replace esc_attr with esc_url

$elements['wrap_open']  = sprintf(
  '<a href="%s"%s%s%s class="%s"%s>',
  esc_attr( $link['link'] ),
  $attr_title,
  $target,
  $rel,
  $css_classes,
  $data
 );
$elements['wrap_open']  = sprintf(
  '<a href="%s"%s%s%s class="%s"%s>',
  esc_url( $link['link'] ),
  $attr_title,
  $target,
  $rel,
  $css_classes,
  $data
 );
billerickson commented 6 months ago

@matsonc I think I figured out why we were using esc_attr() . With this update, the print button no longer works.

See #133