diff --git a/php/classes/handlers/class-settings-handler.php b/php/classes/handlers/class-settings-handler.php index 2126bee3..c36fed34 100644 --- a/php/classes/handlers/class-settings-handler.php +++ b/php/classes/handlers/class-settings-handler.php @@ -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' ), '', '' ), + 'type' => 'checkbox', + 'default' => '', + 'callback' => 'wp_strip_all_tags', + ), array( 'id' => 'new_feed_url', 'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ), diff --git a/php/includes/ssp-functions.php b/php/includes/ssp-functions.php index bf7c6366..ef02519c 100644 --- a/php/includes/ssp-functions.php +++ b/php/includes/ssp-functions.php @@ -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 ); diff --git a/readme.txt b/readme.txt index afea7ded..a216ef65 100644 --- a/readme.txt +++ b/readme.txt @@ -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 @@ -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 diff --git a/seriously-simple-podcasting.php b/seriously-simple-podcasting.php index 714deda3..9077178c 100644 --- a/seriously-simple-podcasting.php +++ b/seriously-simple-podcasting.php @@ -1,7 +1,7 @@ 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 '' . "\n"; -// Include RSS stylesheet -if ( $stylehseet_url ) { - echo ''; -} - // 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' ); + ?> - - - - - <?php echo esc_html( $title ); ?> @@ -334,8 +324,18 @@ - + + + + + + + + + + element remove_action( 'rss2_head', 'rss2_site_icon' ); @@ -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(); @@ -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 ) { @@ -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;]', - '[…]', - '[…]' - ), 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;]', + '[…]', + '[…]', + ), + 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() ); @@ -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 ++; + } ?> <?php esc_html( the_title_rss() ); ?> - + ]]> @@ -526,20 +539,28 @@ - ]]> - ]]> - ]]> + + ]]> + + + + ]]> + - - - - + + ]]> + + + + + +