Skip to content

Commit

Permalink
Merge pull request #215 from TheCraigHewitt/feature/new-itunes-tags
Browse files Browse the repository at this point in the history
Feature / New iTunes Tags
  • Loading branch information
simondowdles authored Sep 28, 2017
2 parents 37e7c60 + e2e2f3f commit e71a533
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 25 deletions.
76 changes: 76 additions & 0 deletions includes/class-ssp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,18 @@ public function meta_box_content() {
$html .= '<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
</p>' . "\n";
break;

case 'select':
$html .= '<p>
<span class="ssp-episode-details-label">' . wp_kses_post( $v['name'] ) . '</span><br/>';
$html .= '<select name="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" id="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '">';
foreach ( $v['options'] as $option => $label ) {
$html .= '<option ' . selected( $option, $data, false ) . ' value="' . esc_attr( $option ) . '">' . esc_attr( $label ) . '</option>';
}
$html .= '</select>';
$html .= '<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
</p>' . "\n";
break;

case 'datepicker':
$display_date = '';
Expand Down Expand Up @@ -626,6 +638,16 @@ public function meta_box_content() {
<input name="' . esc_attr( $k ) . '" type="hidden" id="' . esc_attr( $k ) . '" value="' . esc_attr( $data ) . '" />
</p>' . "\n";
break;

case 'number':
$html .= '<p>
<label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . wp_kses_post( $v['name'] ) . '</label>
<br/>
<input name="' . esc_attr( $k ) . '" type="number" min="0" id="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $data ) . '" />
<br/>
<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
</p>' . "\n";
break;

default:
$html .= '<p>
Expand Down Expand Up @@ -762,6 +784,48 @@ public function custom_fields() {
'section' => 'info',
'meta_description' => __( 'The type of podcast episode - either Audio or Video', 'seriously-simple-podcasting' ),
);

/**
* New iTunes Tag Announced At WWDC 2017
*/
$fields['itunes_title'] = array(
'name' => __( 'iTunes Episode Title (Exclude Your Series / Show Number):', 'seriously-simple-podcasting' ),
'description' => __( 'The iTunes Episode Title. NO Series / Show Number Should Be Included.', 'seriously-simple-podcasting' ),
'type' => 'text',
'default' => '',
'section' => 'info',
'meta_description' => __( 'The iTunes Episode Title. NO Series / Show Number Should Be Included', 'seriously-simple-podcasting' ),
);

/**
* New iTunes Tag Announced At WWDC 2017
*/
$fields['itunes_season_number'] = array(
'name' => __( 'iTunes Season Number:', 'seriously-simple-podcasting' ),
'description' => __( 'The iTunes Season Number. Leave Blank If None.', 'seriously-simple-podcasting' ),
'type' => 'number',
'default' => '',
'section' => 'info',
'meta_description' => __( 'The iTunes Season Number. Leave Blank If None.', 'seriously-simple-podcasting' ),
);

/**
* New iTunes Tag Announced At WWDC 2017
*/
$fields['itunes_episode_type'] = array(
'name' => __( 'iTunes Episode Type:', 'seriously-simple-podcasting' ),
'description' => '',
'type' => 'select',
'default' => '',
'options' => array(
'' => __( 'Please Select', 'seriously-simple-podcasting' ),
'full' => __( 'Full: For Normal Episodes', 'seriously-simple-podcasting' ),
'trailer' => __( 'Trailer: Promote an Upcoming Show', 'seriously-simple-podcasting' ),
'bonus' => __( 'Bonus: For Extra Content Related To a Show', 'seriously-simple-podcasting' )
),
'section' => 'info',
'meta_description' => __( 'The iTunes Episode Type', 'seriously-simple-podcasting' ),
);

// In v1.14+ the `audio_file` field can actually be either audio or video, but we're keeping the field name here for backwards compatibility
$fields['audio_file'] = array(
Expand Down Expand Up @@ -800,6 +864,18 @@ public function custom_fields() {
'section' => 'info',
'meta_description' => __( 'The size of the podcast episode for display purposes.', 'seriously-simple-podcasting' ),
);

/**
* New iTunes Tag Announced At WWDC 2017
*/
$fields['itunes_episode_number'] = array(
'name' => __( 'iTunes Episode Number:', 'seriously-simple-podcasting' ),
'description' => __( 'The iTunes Episode Number. Leave Blank If None.', 'seriously-simple-podcasting' ),
'type' => 'number',
'default' => '',
'section' => 'info',
'meta_description' => __( 'The iTunes Episode Number. Leave Blank If None.', 'seriously-simple-podcasting' ),
);

if ( ssp_is_connected_to_podcastmotor() ) {
$fields['filesize_raw'] = array(
Expand Down
15 changes: 15 additions & 0 deletions includes/class-ssp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,21 @@ private function settings_fields() {
'options' => array( 'published' => __( 'Published date', 'seriously-simple-podcasting' ), 'recorded' => __( 'Recorded date', 'seriously-simple-podcasting' ) ),
'default' => 'published',
),
/**
* New iTunes Tag Announced At WWDC 2017
*/
array(
'id' => 'consume_order',
'label' => __( 'Series Consume Order', 'seriously-simple-podcasting' ),
'description' => __( 'The order in which you want your episodes to be consumed by iTunes', 'seriously-simple-podcasting' ),
'type' => 'select',
'options' => array(
'' => __( 'Please Select', 'seriously-simple-podcasting' ),
'episodic' => __( 'Latest Episode First', 'seriously-simple-podcasting' ),
'serial' => __( 'Oldest to Newest', 'seriously-simple-podcasting' )
),
'default' => '',
),
array(
'id' => 'redirect_feed',
'label' => __( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ),
Expand Down
2 changes: 1 addition & 1 deletion 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.17.3
* Version: 1.18.0
* Plugin URI: https://www.seriouslysimplepodcasting.com/
* Description: Podcasting the way it's meant to be. No mess, no fuss - just you and your content taking over the world.
* Author: PodcastMotor
Expand Down
77 changes: 53 additions & 24 deletions templates/feed-podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@
// 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 ) );
?>

<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
Expand All @@ -276,8 +280,15 @@
<lastBuildDate><?php echo esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ) ); ?></lastBuildDate>
<language><?php echo esc_html( $language ); ?></language>
<copyright><?php echo esc_html( $copyright ); ?></copyright>
<itunes:subtitle><?php echo esc_html( $subtitle ); ?></itunes:subtitle>
<itunes:subtitle><?php echo esc_html( $subtitle ); ?></itunes:subtitle>
<itunes:author><?php echo esc_html( $author ); ?></itunes:author>
<?php
if( $itunes_type ){
?>
<itunes:type><?php echo $itunes_type; ?></itunes:type>
<?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>
Expand Down Expand Up @@ -445,37 +456,55 @@
$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'
$pubDate = esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_meta( get_the_ID(), 'date_recorded', true ), false ) );

// New iTunes WWDC 2017 Tags
$itunes_episode_type = get_post_meta( get_the_ID(), 'itunes_episode_type', true );
$itunes_title = get_post_meta( get_the_ID(), 'itunes_title', true );
$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 );

?>
<item>
<title><?php esc_html( the_title_rss() ); ?></title>
<link><?php esc_url( the_permalink_rss() ); ?></link>
<pubDate><?php echo $pubDate; ?></pubDate>
<dc:creator><?php echo $author; ?></dc:creator>
<guid isPermaLink="false"><?php esc_html( the_guid() ); ?></guid>
<description><![CDATA[<?php echo $description; ?>]]></description>
<itunes:subtitle><![CDATA[<?php echo $itunes_subtitle; ?>]]></itunes:subtitle>
<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 ( $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>
<title><?php esc_html( the_title_rss() ); ?></title>
<link><?php esc_url( the_permalink_rss() ); ?></link>
<pubDate><?php echo $pubDate; ?></pubDate>
<dc:creator><?php echo $author; ?></dc:creator>
<guid isPermaLink="false"><?php esc_html( the_guid() ); ?></guid>
<description><![CDATA[<?php echo $description; ?>]]></description>
<itunes:subtitle><![CDATA[<?php echo $itunes_subtitle; ?>]]></itunes:subtitle>
<?php if( $itunes_episode_type ) : ?>
<itunes:episodeType><?php echo $itunes_episode_type; ?></itunes:episodeType>
<?php endif; ?>
<?php if( $itunes_title ): ?>
<itunes:title><![CDATA[<?php echo $itunes_title; ?>]]></itunes:title>
<?php endif; ?>
<?php if( $itunes_episode_number ): ?>
<itunes:episode><?php echo $itunes_episode_number; ?></itunes:episode>
<?php endif; ?>
<?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 ( $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>
</item>
<?php }
} ?>
Expand Down

0 comments on commit e71a533

Please sign in to comment.