Skip to content

Commit

Permalink
Merge pull request #736 from ConvertKit/broadcasts-importer-image-cap…
Browse files Browse the repository at this point in the history
…tion-markup

Broadcasts Importer: Retain `figure` and `figcaption`
  • Loading branch information
n7studios authored Nov 1, 2024
2 parents c78d80f + 6cbe16b commit d39882c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions includes/class-convertkit-broadcasts-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ private function permitted_html_tags( $disable_styles = false ) {
's',
'a',
'img',
'figure',
'figcaption',
'br',
'style', // Deliberate; we'll use DOMDocument to remove inline styles and their contents.
);
Expand Down
6 changes: 6 additions & 0 deletions tests/wpunit/BroadcastsImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ private function assertImportValid($post)
// Confirm tracking image has been removed.
$this->assertStringNotContainsString('<img src="https://preview.convertkit-mail2.com/open" alt="">', $post->post_content);

// Confirm images included retain their <figure> and <figcaption> elements.
$this->assertStringContainsString('<figure', $post->post_content);
$this->assertStringContainsString('<figcaption', $post->post_content);
$this->assertStringContainsString('A Sample Caption</figcaption>', $post->post_content);
$this->assertStringContainsString('</figure>', $post->post_content);

// Confirm unsubscribe link section has been removed.
$this->assertStringNotContainsString('<div class="ck-section ck-hide-in-public-posts"', $post->post_content);

Expand Down

0 comments on commit d39882c

Please sign in to comment.