Skip to content

Commit

Permalink
fix: title escaping in RSS feed when using native titles
Browse files Browse the repository at this point in the history
  • Loading branch information
eteubert committed Sep 15, 2020
1 parent 2e599ee commit f42a811
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 2 additions & 3 deletions includes/auto_post_titles.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Podlove\Model\Podcast;

add_filter('the_title', 'podlove_maybe_override_post_titles', 10, 2);
// low prio is important so the_title_rss sanitizer filters work
add_filter('the_title_rss', 'podlove_maybe_override_rss_post_titles', 3);
add_filter('podlove_get_episode_title', 'podlove_maybe_override_post_titles', 10, 2);
add_action('admin_print_scripts', 'podlove_override_post_title_script');

function podlove_maybe_override_post_titles($original_title, $post_id = null)
Expand Down Expand Up @@ -119,7 +118,7 @@ function podlove_override_post_title_script()
<script type="text/javascript">
var PODLOVE = PODLOVE || {};
PODLOVE.override_post_title = <?php echo json_encode($data); ?>;
</script>
</script>
<?php
}

Expand Down
8 changes: 8 additions & 0 deletions lib/feeds/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ function override_feed_language($feed)
});
}

function get_episode_title($post = 0)
{
$post = get_post($post);
$title = $post->post_title ?? '';

return apply_filters('podlove_get_episode_title', $title);
}

/**
* Prepare content for display in feed.
*
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ This product includes GeoLite2 data created by MaxMind, available from http://ww

== Changelog ==

= 3.0.3 =

* fix: title escaping in RSS feed when using native (not auto-generated) titles

= 3.0.2 =

* add: Untappd social service
Expand Down
2 changes: 1 addition & 1 deletion templates/feed-rss2.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
the_post(); ?>

<item>
<title><?php the_title_rss(); ?></title>
<?php echo \Podlove\Feeds\get_xml_text_node('title', \Podlove\Feeds\get_episode_title())."\n"; ?>
<link><?php the_permalink(); ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<guid isPermaLink="false"><?php echo htmlspecialchars(get_the_guid()); ?></guid>
Expand Down

0 comments on commit f42a811

Please sign in to comment.