Skip to content

Commit

Permalink
Merge pull request #385 from TheCraigHewitt/release/1.20.5
Browse files Browse the repository at this point in the history
Release/1.20.5
  • Loading branch information
jonathanbossenger authored Jul 19, 2019
2 parents c700a48 + debe4bc commit 4ae113e
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 56 deletions.
8 changes: 8 additions & 0 deletions php/classes/handlers/class-settings-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@ public function settings_fields() {
'default' => '',
'callback' => 'wp_strip_all_tags',
),
array(
'id' => 'turbocharge_feed',
'label' => __( 'Turbocharge podcast feed', 'seriously-simple-podcasting' ),
'description' => sprintf( __( 'When enabled, this setting will speed up your feed loading time. %1$sMore details here.%2$s', 'seriously-simple-podcasting' ), '<a href="' . esc_url( 'https://support.castos.com/article/89-turbocharging-your-feed-to-maximize-available-episodes' ) . '" target="' . wp_strip_all_tags( '_blank' ) . '">', '</a>' ),
'type' => 'checkbox',
'default' => '',
'callback' => 'wp_strip_all_tags',
),
array(
'id' => 'new_feed_url',
'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ),
Expand Down
8 changes: 7 additions & 1 deletion php/includes/ssp-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ function ssp_episodes( $n = 10, $series = '', $return_args = false, $context = '
);

if ( $series ) {
$args['series'] = esc_attr( $series );
$args['tax_query'] = array(
array(
'taxonomy' => 'series',
'field' => 'slug',
'terms' => esc_attr( $series )
)
);
}

$args = apply_filters( 'ssp_episode_query_args', $args, $context );
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: podcast, audio, video, vodcast, rss, mp3, mp4, feed, itunes, podcasting, m
Requires at least: 4.4
Tested up to: 5.2
Requires PHP: 5.6
Stable tag: 1.20.4
Stable tag: 1.20.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -102,7 +102,13 @@ You can find complete user and developer documentation (along with the FAQs) on

== Changelog ==

= 1.20.4=
= 1.20.5 =
* 2019-07-10
* [NEW] Add the ability to turbo charge the load times of the RSS feed, by limiting certain fields
* [CHANGE] Updated the RSS feed description tag, itunes:summary tag and googleplay:description tag to meet RSS feed requirements
* [FIX] Fixes a bug when retrieving posts by series

= 1.20.4 =
* 2019-07-01
* [FIX] Fixes a bug introduced by 1.20.0 which breaks password protecting a feed

Expand Down
4 changes: 2 additions & 2 deletions seriously-simple-podcasting.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: Seriously Simple Podcasting
* Version: 1.20.4
* Version: 1.20.5
* Plugin URI: https://www.castos.com/seriously-simple-podcasting
* Description: Podcasting the way it's meant to be. No mess, no fuss - just you and your content taking over the world.
* Author: Castos
Expand All @@ -26,7 +26,7 @@
use SeriouslySimplePodcasting\Controllers\Options_Controller;
use SeriouslySimplePodcasting\Rest\Rest_Api_Controller;

define( 'SSP_VERSION', '1.20.4' );
define( 'SSP_VERSION', '1.20.5' );
define( 'SSP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SSP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );

Expand Down
123 changes: 72 additions & 51 deletions templates/feed-podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,17 @@
$category2 = ssp_get_feed_category_output( 2, $series_id );
$category3 = ssp_get_feed_category_output( 3, $series_id );

// Get stylehseet URL (filterable to allow custom RSS stylesheets)
$stylehseet_url = apply_filters( 'ssp_rss_stylesheet', $ss_podcasting->template_url . 'feed-stylesheet.xsl' );

// Set RSS content type and charset headers
header( 'Content-Type: ' . feed_content_type( 'podcast' ) . '; charset=' . get_option( 'blog_charset' ), true );

// Use `echo` for first line to prevent any extra characters at start of document
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?>' . "\n";

// Include RSS stylesheet
if ( $stylehseet_url ) {
echo '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylehseet_url ) . '"?>';
}

// Get iTunes Type
$itunes_type = get_option( 'ss_podcasting_consume_order' . ( $series_id > 0 ? '_' . $series_id : null ) );

$turbo = get_option( 'ss_podcasting_turbocharge_feed', 'off' );

?>

<rss version="2.0"
Expand Down Expand Up @@ -289,22 +284,17 @@
<?php
}
?>
<googleplay:author><?php echo esc_html( $author ); ?></googleplay:author>
<googleplay:email><?php echo esc_html( $owner_email ); ?></googleplay:email>
<itunes:summary><?php echo esc_html( $podcast_description ); ?></itunes:summary>
<googleplay:description><?php echo esc_html( $podcast_description ); ?></googleplay:description>
<itunes:owner>
<itunes:name><?php echo esc_html( $owner_name ); ?></itunes:name>
<itunes:email><?php echo esc_html( $owner_email ); ?></itunes:email>
</itunes:owner>
<itunes:explicit><?php echo esc_html( $itunes_explicit ); ?></itunes:explicit>
<googleplay:explicit><?php echo esc_html( $googleplay_explicit ); ?></googleplay:explicit>
<?php if ( $complete ) { ?>
<itunes:complete><?php echo esc_html( $complete ); ?></itunes:complete><?php }
if ( $image ) {
?>
<itunes:image href="<?php echo esc_url( $image ); ?>"></itunes:image>
<googleplay:image href="<?php echo esc_url( $image ); ?>"></googleplay:image>
<image>
<url><?php echo esc_url( $image ); ?></url>
<title><?php echo esc_html( $title ); ?></title>
Expand Down Expand Up @@ -334,8 +324,18 @@
<?php } ?>
<?php if ( $new_feed_url ) { ?>
<itunes:new-feed-url><?php echo esc_url( $new_feed_url ); ?></itunes:new-feed-url>
<?php }
<?php } ?>
<?php if ( 'off' === $turbo ) { ?>
<googleplay:author><?php echo esc_html( $author ); ?></googleplay:author>
<googleplay:email><?php echo esc_html( $owner_email ); ?></googleplay:email>
<googleplay:description><?php echo esc_html( $podcast_description ); ?></googleplay:description>
<googleplay:explicit><?php echo esc_html( $googleplay_explicit ); ?></googleplay:explicit>
<?php if ( $image ) { ?>
<googleplay:image href="<?php echo esc_url( $image ); ?>"></googleplay:image>
<?php } ?>
<?php } ?>

<?php
// Prevent WP core from outputting an <image> element
remove_action( 'rss2_head', 'rss2_site_icon' );

Expand All @@ -349,6 +349,10 @@

$qry = new WP_Query( $args );

if ( 'on' === $turbo ) {
$post_count = 0;
}

if ( $qry->have_posts() ) {
while ( $qry->have_posts() ) {
$qry->the_post();
Expand Down Expand Up @@ -399,7 +403,6 @@
}
$size = apply_filters( 'ssp_feed_item_size', $size, get_the_ID() );


// File MIME type (default to MP3/MP4 to ensure there is always a value for this)
$mime_type = $ss_podcasting->get_attachment_mimetype( $audio_file );
if ( ! $mime_type ) {
Expand Down Expand Up @@ -441,51 +444,58 @@
$author = esc_html( get_the_author() );
$author = apply_filters( 'ssp_feed_item_author', $author, get_the_ID() );

// Episode content (with iframes removed)
// Episode content (with shortcodes and iframes removed)
$content = get_the_content_feed( 'rss2' );
$content = strip_shortcodes( $content );
$content = preg_replace( '/<\/?iframe(.|\s)*?>/', '', $content );
$content = apply_filters( 'ssp_feed_item_content', $content, get_the_ID() );

// iTunes summary is the full episode content, but must be shorter than 4000 characters
$itunes_summary = mb_substr( $content, 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() );

// Episode description
ob_start();
the_excerpt_rss();
$description = ob_get_clean();
// Description is the full episode content, includes HTML, but must be shorter than 4000 characters
$description = mb_substr( $content, 0, 3999 );
$description = apply_filters( 'ssp_feed_item_description', $description, get_the_ID() );

// iTunes subtitle does not allow any HTML and must be shorter than 255 characters
$itunes_subtitle = strip_tags( strip_shortcodes( $description ) );
$itunes_subtitle = str_replace( array(
'>',
'<',
'\'',
'"',
'`',
'[andhellip;]',
'[&hellip;]',
'[&#8230;]'
), array( '', '', '', '', '', '', '', '' ), $itunes_subtitle );
// iTunes summary excludes HTML and must be shorter than 4000 characters
$itunes_summary = wp_strip_all_tags( $content );
$itunes_summary = mb_substr( $itunes_summary, 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );

// Google Play description is the same as iTunes summary, but must be shorter than 1000 characters
$gp_description = mb_substr( $itunes_summary, 0, 999 );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $gp_description, get_the_ID() );

// iTunes subtitle excludes HTML and must be shorter than 255 characters
$itunes_subtitle = wp_strip_all_tags( $description );
$itunes_subtitle = str_replace(
array(
'>',
'<',
'\'',
'"',
'`',
'[andhellip;]',
'[&hellip;]',
'[&#8230;]',
),
array( '', '', '', '', '', '', '', '' ),
$itunes_subtitle
);
$itunes_subtitle = mb_substr( $itunes_subtitle, 0, 254 );
$itunes_subtitle = apply_filters( 'ssp_feed_item_itunes_subtitle', $itunes_subtitle, get_the_ID() );

// Date recorded
$pubDateType = get_option( 'ss_podcasting_publish_date', 'published' );
if ( $pubDateType === 'published' ) {
$pubDate = esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) );
} else // 'recorded'
$pub_date_type = get_option( 'ss_podcasting_publish_date', 'published' );
if ( 'published' === $pub_date_type ) {
$pub_date = esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) );
} else // 'recorded'.
{
$pubDate = esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_meta( get_the_ID(), 'date_recorded', true ), false ) );
$pub_date = esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_meta( get_the_ID(), 'date_recorded', true ), false ) );
}

// Tags/keywords
$post_tags = get_the_tags( get_the_ID() );
if ( $post_tags ) {
$tags = array();
foreach( $post_tags as $tag ) {
foreach ( $post_tags as $tag ) {
$tags[] = $tag->name;
}
$tags = apply_filters( 'ssp_feed_item_itunes_keyword_tags', $tags, get_the_ID() );
Expand All @@ -502,11 +512,14 @@
$itunes_episode_number = get_post_meta( get_the_ID(), 'itunes_episode_number', true );
$itunes_season_number = get_post_meta( get_the_ID(), 'itunes_season_number', true );
}
if ( isset( $post_count ) ) {
$post_count ++;
}
?>
<item>
<title><?php esc_html( the_title_rss() ); ?></title>
<link><?php esc_url( the_permalink_rss() ); ?></link>
<pubDate><?php echo $pubDate; ?></pubDate>
<pubDate><?php echo $pub_date; ?></pubDate>
<dc:creator><?php echo $author; ?></dc:creator>
<guid isPermaLink="false"><?php esc_html( the_guid() ); ?></guid>
<description><![CDATA[<?php echo $description; ?>]]></description>
Expand All @@ -526,20 +539,28 @@
<?php if ( $itunes_season_number ): ?>
<itunes:season><?php echo $itunes_season_number; ?></itunes:season>
<?php endif; ?>
<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
<itunes:summary><![CDATA[<?php echo $itunes_summary; ?>]]></itunes:summary>
<googleplay:description><![CDATA[<?php echo $gp_description; ?>]]></googleplay:description>
<?php if ( isset( $post_count ) && $post_count <= 10 ) { ?>
<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
<?php } ?>
<enclosure url="<?php echo esc_url( $enclosure ); ?>" length="<?php echo esc_attr( $size ); ?>" type="<?php echo esc_attr( $mime_type ); ?>"></enclosure>
<?php if ( isset( $post_count ) && $post_count <= 10 ) { ?>
<itunes:summary><![CDATA[<?php echo $itunes_summary; ?>]]></itunes:summary>
<?php } ?>
<?php if ( $episode_image ) { ?>
<itunes:image href="<?php echo esc_url( $episode_image ); ?>"></itunes:image>
<googleplay:image href="<?php echo esc_url( $episode_image ); ?>"></googleplay:image>
<?php } ?>
<enclosure url="<?php echo esc_url( $enclosure ); ?>" length="<?php echo esc_attr( $size ); ?>" type="<?php echo esc_attr( $mime_type ); ?>"></enclosure>
<itunes:explicit><?php echo esc_html( $itunes_explicit_flag ); ?></itunes:explicit>
<googleplay:explicit><?php echo esc_html( $googleplay_explicit_flag ); ?></googleplay:explicit>
<itunes:block><?php echo esc_html( $block_flag ); ?></itunes:block>
<googleplay:block><?php echo esc_html( $block_flag ); ?></googleplay:block>
<itunes:duration><?php echo esc_html( $duration ); ?></itunes:duration>
<itunes:author><?php echo $author; ?></itunes:author>
<?php if ( 'off' === $turbo ) { ?>
<googleplay:description><![CDATA[<?php echo $gp_description; ?>]]></googleplay:description>
<?php if ( $episode_image ) { ?>
<googleplay:image href="<?php echo esc_url( $episode_image ); ?>"></googleplay:image>
<?php } ?>
<googleplay:explicit><?php echo esc_html( $googleplay_explicit_flag ); ?></googleplay:explicit>
<googleplay:block><?php echo esc_html( $block_flag ); ?></googleplay:block>
<?php } ?>
</item>
<?php }
} ?>
Expand Down

0 comments on commit 4ae113e

Please sign in to comment.