Skip to content

Commit

Permalink
Merge pull request #225 from plausible/fix_event_name_htmlspecialchars
Browse files Browse the repository at this point in the history
Fixed: HTML would break if taxonomy name contained apostrophies.
  • Loading branch information
Dan0sz authored Sep 25, 2024
2 parents 2102421 + 0610414 commit ff82abc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function maybe_add_custom_params( $params ) {
// Loop through the terms.
foreach ( $terms as $term ) {
if ( $term instanceof WP_Term ) {
$params .= " event-{$taxonomy}='{$term->name}'";
$params .= " event-{$taxonomy}=\"{$term->name}\"";
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/Integrations/WooCommerceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

namespace Plausible\Analytics\Tests\Integration;

use AllowDynamicProperties;
use Plausible\Analytics\Tests\TestCase;
use Plausible\Analytics\WP\Integrations\WooCommerce;
use function Brain\Monkey\Functions\when;

#[AllowDynamicProperties]
class WooCommerceTest extends TestCase {
/**
* @see WooCommerce::track_entered_checkout()
Expand Down Expand Up @@ -63,7 +65,7 @@ public function testTrackPurchase() {

when( 'wc_get_order' )->justReturn( $mock );

$this->expectOutputContains( '{"revenue":{"amount":"10.00","currency":"EUR"}}' );
$this->expectOutputContains( '{"revenue":{"amount":"10","currency":"EUR"}}' );

$class->track_purchase( 1 );
}
Expand Down

0 comments on commit ff82abc

Please sign in to comment.