diff --git a/php/classes/controllers/class-admin-controller.php b/php/classes/controllers/class-admin-controller.php
index 724480f5..d0d30591 100644
--- a/php/classes/controllers/class-admin-controller.php
+++ b/php/classes/controllers/class-admin-controller.php
@@ -57,10 +57,10 @@ public function bootstrap() {
add_action( 'init', array( $this, 'register_post_type' ), 11 );
// Register podcast feed.
- add_action( 'init', array( $this, 'add_feed' ), 1 );
+ add_action( 'init', array( $this, 'add_feed' ), 11 );
// Handle v1.x feed URL as well as feed URLs for default permalinks.
- add_action( 'init', array( $this, 'redirect_old_feed' ) );
+ add_action( 'init', array( $this, 'redirect_old_feed' ), 11 );
// Setup custom permalink structures.
add_action( 'init', array( $this, 'setup_permastruct' ), 10 );
@@ -1260,6 +1260,14 @@ public function feed_template() {
// Prevent 404 on feed
$wp_query->is_404 = false;
+
+ /**
+ * Fix the is_feed attribute on the old feed url structure
+ */
+ if ( ! $wp_query->is_feed ) {
+ $wp_query->is_feed = true;
+ }
+
status_header( 200 );
$file_name = 'feed-podcast.php';
@@ -1324,17 +1332,7 @@ public function update() {
$previous_version = get_option( 'ssp_version', '1.0' );
- if ( version_compare( $previous_version, '1.13.1', '<' ) ) {
- flush_rewrite_rules();
- }
-
- if ( version_compare( $previous_version, '1.19.20', '<=' ) ) {
- $this->upgrade_handler->upgrade_subscribe_links_options();
- }
-
- if ( version_compare( $previous_version, '1.20.3', '<=' ) ) {
- $this->upgrade_handler->upgrade_stitcher_subscribe_link_option();
- }
+ $this->upgrade_handler->run_upgrades( $previous_version );
// always just check if the directory is ok
ssp_get_upload_directory( false );
diff --git a/php/classes/controllers/class-frontend-controller.php b/php/classes/controllers/class-frontend-controller.php
index 1b54cd7f..6f14079f 100644
--- a/php/classes/controllers/class-frontend-controller.php
+++ b/php/classes/controllers/class-frontend-controller.php
@@ -485,7 +485,6 @@ public function media_player( $src_file = '', $episode_id = 0, $player_size = "l
* @return string Media player HTML on success, empty string on failure
*/
public function load_media_player($src_file = '', $episode_id = 0, $player_size){
-
/**
* Check if this player is being loaded via the AMP for WordPress plugin and if so, force the standard player
* https://wordpress.org/plugins/amp/
diff --git a/php/classes/handlers/class-series-handler.php b/php/classes/handlers/class-series-handler.php
index 82d616b5..6415b8cd 100644
--- a/php/classes/handlers/class-series-handler.php
+++ b/php/classes/handlers/class-series-handler.php
@@ -24,18 +24,22 @@ public function maybe_save_series() {
if ( ! isset( $_GET['settings-updated'] ) || 'true' !== $_GET['settings-updated'] ) {
return false;
}
-
- if ( isset( $_GET['feed-series'] ) ) {
- $feed_series_slug = ( isset( $_GET['feed-series'] ) ? filter_var( $_GET['feed-series'], FILTER_SANITIZE_STRING ) : '' );
+ if ( ! isset( $_GET['feed-series'] ) ) {
+ $feed_series_slug = 'default';
+ } else {
+ $feed_series_slug = sanitize_text_field( $_GET['feed-series'] );
if ( empty( $feed_series_slug ) ) {
return false;
}
+ }
+
+ if ( 'default' === $feed_series_slug ) {
+ $series_data = get_series_data_for_castos( 0 );
+ $series_data['series_id'] = 0;
+ } else {
$series = get_term_by( 'slug', $feed_series_slug, 'series' );
$series_data = get_series_data_for_castos( $series->term_id );
$series_data['series_id'] = $series->term_id;
- } else {
- $series_data = get_series_data_for_castos( 0 );
- $series_data['series_id'] = 0;
}
$castos_handler = new Castos_Handler();
diff --git a/php/classes/handlers/class-settings-handler.php b/php/classes/handlers/class-settings-handler.php
index c36fed34..5d934377 100644
--- a/php/classes/handlers/class-settings-handler.php
+++ b/php/classes/handlers/class-settings-handler.php
@@ -569,12 +569,15 @@ public function settings_fields() {
'default' => '',
),
array(
- 'id' => 'redirect_feed',
- 'label' => __( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ),
- 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).', 'seriously-simple-podcasting' ), '
' ),
- 'type' => 'checkbox',
- 'default' => '',
- 'callback' => 'wp_strip_all_tags',
+ 'id' => 'episode_description',
+ 'label' => __( 'Episode description', 'seriously-simple-podcasting' ),
+ 'description' => __( 'Use the excerpt or the post content in the description tag for episodes', 'seriously-simple-podcasting' ),
+ 'type' => 'radio',
+ 'options' => array(
+ 'excerpt' => __( 'Post Excerpt', 'seriously-simple-podcasting' ),
+ 'content' => __( 'Post Content', 'seriously-simple-podcasting' ),
+ ),
+ 'default' => 'excerpt',
),
array(
'id' => 'turbocharge_feed',
@@ -584,6 +587,14 @@ public function settings_fields() {
'default' => '',
'callback' => 'wp_strip_all_tags',
),
+ array(
+ 'id' => 'redirect_feed',
+ 'label' => __( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ),
+ 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).', '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/classes/handlers/class-upgrade-handler.php b/php/classes/handlers/class-upgrade-handler.php
index e39331bb..505b5e4b 100644
--- a/php/classes/handlers/class-upgrade-handler.php
+++ b/php/classes/handlers/class-upgrade-handler.php
@@ -4,6 +4,29 @@
class Upgrade_Handler {
+ /**
+ * Main upgrade method, called from admin controller
+ *
+ * @param $previous_version
+ */
+ public function run_upgrades( $previous_version ) {
+ if ( version_compare( $previous_version, '1.13.1', '<' ) ) {
+ flush_rewrite_rules();
+ }
+
+ if ( version_compare( $previous_version, '1.19.20', '<=' ) ) {
+ $this->upgrade_subscribe_links_options();
+ }
+
+ if ( version_compare( $previous_version, '1.20.3', '<=' ) ) {
+ $this->upgrade_stitcher_subscribe_link_option();
+ }
+
+ if ( version_compare( $previous_version, '1.20.6', '<' ) ) {
+ $this->add_default_episode_description_option();
+ }
+ }
+
/**
* Adds the ss_podcasting_subscribe_options array to the options table
*/
@@ -27,4 +50,11 @@ public function upgrade_stitcher_subscribe_link_option() {
}
update_option( 'ss_podcasting_subscribe_options', $subscribe_links_options );
}
+
+ /**
+ * Adds the default episode_description option
+ */
+ public function add_default_episode_description_option() {
+ update_option( 'ss_podcasting_episode_description', 'excerpt' );
+ }
}
diff --git a/php/classes/shortcodes/class-player.php b/php/classes/shortcodes/class-player.php
index 35acd605..54515751 100644
--- a/php/classes/shortcodes/class-player.php
+++ b/php/classes/shortcodes/class-player.php
@@ -23,6 +23,13 @@ class Player {
*/
public function shortcode() {
+ /**
+ * If we're in an RSS feed, don't render this shortcode
+ */
+ if ( is_feed() ) {
+ return;
+ }
+
global $ss_podcasting;
$current_post = get_post();
diff --git a/readme.txt b/readme.txt
index a216ef65..f014bae2 100644
--- a/readme.txt
+++ b/readme.txt
@@ -102,6 +102,11 @@ You can find complete user and developer documentation (along with the FAQs) on
== Changelog ==
+= 1.20.6-beta =
+* 2019-07-22
+* [NEW] Adds a setting to control how the RSS feed episode description is selected, either post excerpt or full post content
+* [FIX] Fixes a bug where Turbocharge settings were enabled even when it is switched off
+
= 1.20.5 =
* 2019-07-10
* [NEW] Add the ability to turbo charge the load times of the RSS feed, by limiting certain fields
diff --git a/seriously-simple-podcasting.php b/seriously-simple-podcasting.php
index 9077178c..ed4d3172 100644
--- a/seriously-simple-podcasting.php
+++ b/seriously-simple-podcasting.php
@@ -1,7 +1,7 @@
' . "\n";
-
// Get iTunes Type
$itunes_type = get_option( 'ss_podcasting_consume_order' . ( $series_id > 0 ? '_' . $series_id : null ) );
+// Get turbo setting
$turbo = get_option( 'ss_podcasting_turbocharge_feed', 'off' );
+if ( $series_id && $series_id > 0 ) {
+ $series_turbo = get_option( 'ss_podcasting_turbocharge_feed_' . $series_id );
+ if ( false !== $series_turbo ) {
+ $turbo = $series_turbo;
+ }
+}
-?>
+// Get episode description setting
+$episode_description = get_option( 'ss_podcasting_episode_description', 'excerpt' );
+if ( $series_id && $series_id > 0 ) {
+ $series_episode_description = get_option( 'episode_description_' . $series_id );
+ if ( false !== $series_episode_description ) {
+ $episode_description = $series_episode_description;
+ }
+}
-
->
+// 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";
+?>
+>
@@ -350,7 +362,7 @@
$qry = new WP_Query( $args );
if ( 'on' === $turbo ) {
- $post_count = 0;
+ $turbo_post_count = 0;
}
if ( $qry->have_posts() ) {
@@ -450,8 +462,18 @@
$content = preg_replace( '/<\/?iframe(.|\s)*?>/', '', $content );
$content = apply_filters( 'ssp_feed_item_content', $content, get_the_ID() );
- // Description is the full episode content, includes HTML, but must be shorter than 4000 characters
- $description = mb_substr( $content, 0, 3999 );
+ // Description is set based on feed setting
+ if ( 'excerpt' === $episode_description ) {
+ ob_start();
+ the_excerpt_rss();
+ $description = ob_get_clean();
+ } else {
+ $description = $content;
+ if ( isset( $turbo_post_count ) && $turbo_post_count > 10 ) {
+ // If turbo is on, limit the full html description to 4000 chars
+ $description = mb_substr( $description, 0, 3999 );
+ }
+ }
$description = apply_filters( 'ssp_feed_item_description', $description, get_the_ID() );
// iTunes summary excludes HTML and must be shorter than 4000 characters
@@ -512,8 +534,8 @@
$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 ++;
+ if ( isset( $turbo_post_count ) ) {
+ $turbo_post_count ++;
}
?>
-
@@ -539,11 +561,11 @@
-
+
]]>
-
+
]]>