Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Jul 27, 2022
2 parents 5c3b3b4 + f821d56 commit 56fc27f
Show file tree
Hide file tree
Showing 22 changed files with 290 additions and 46 deletions.
Binary file modified .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).

## [Unreleased] - TBD

## [1.2.4] - 2022-07-27
### Added
- Season number, episode number and episode type attributes can now be stored with a Podcast (props [@zamanq](https://github.com/zamanq), [@dchucks](https://github.com/dchucks), [@cadic](https://github.com/cadic) via [#175](https://github.com/10up/simple-podcasting/pull/175)).

### Changed
- Bump WordPress version "tested up to" 6.0 (props [@cadic](https://github.com/cadic) via [#171](https://github.com/10up/simple-podcasting/issues/171)).

### Fixed
- Incorrect Language value in the Feed (props [@zamanq](https://github.com/zamanq), [@dchucks](https://github.com/dchucks), [@cadic](https://github.com/cadic) via [#176](https://github.com/10up/simple-podcasting/pull/176)).

### Security
- Bump `terser` from 5.12.1 to 5.14.2 (props [@dependabot](https://github.com/apps/dependabot) via [#180](https://github.com/10up/simple-podcasting/pull/180)).

## [1.2.3] - 2022-04-28
### Added
- Compatibility tests against PHP 7 and 8 (props [@cadic](https://github.com/cadic), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#150](https://github.com/10up/simple-podcasting/pull/150)).
Expand Down Expand Up @@ -110,6 +125,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Initial plugin release.

[Unreleased]: https://github.com/10up/simple-podcasting/compare/trunk...develop
[1.2.4]: https://github.com/10up/simple-podcasting/compare/1.2.3-deploy...1.2.4
[1.2.3]: https://github.com/10up/simple-podcasting/compare/1.2.2...1.2.3-deploy
[1.2.2]: https://github.com/10up/simple-podcasting/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/10up/simple-podcasting/compare/1.2.0...1.2.1
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Jon Christensen (@Firestorm980)](https://github.com/Firestorm980), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Noah Halstead (@nhalstead)](https://github.com/nhalstead), [Matthew Haines-Young (@mattheu)](https://github.com/mattheu), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [David Chabbi](https://www.linkedin.com/in/david-chabbi-985719b4/), [Pablo Amato (@pabamato)](https://github.com/pabamato), [(@monomo111)](https://github.com/monomo111), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Mark Jaquith (@markjaquith)](https://github.com/markjaquith), [Riad Benguella (@youknowriad)](https://github.com/youknowriad), [Mészáros Róbert (@meszarosrob)](https://github.com/meszarosrob), [Max Lyuchin (@cadic)](https://github.com/cadic), [@iamdharmesh](https://github.com/iamdharmesh), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Felipe Elia (@felipeelia)](https://github.com/felipeelia), [Mehidi Hassan (@mehidi258)](https://github.com/mehidi258), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [@davexpression](https://github.com/davexpression).
[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Jon Christensen (@Firestorm980)](https://github.com/Firestorm980), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Noah Halstead (@nhalstead)](https://github.com/nhalstead), [Matthew Haines-Young (@mattheu)](https://github.com/mattheu), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [David Chabbi](https://www.linkedin.com/in/david-chabbi-985719b4/), [Pablo Amato (@pabamato)](https://github.com/pabamato), [(@monomo111)](https://github.com/monomo111), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Mark Jaquith (@markjaquith)](https://github.com/markjaquith), [Riad Benguella (@youknowriad)](https://github.com/youknowriad), [Mészáros Róbert (@meszarosrob)](https://github.com/meszarosrob), [Max Lyuchin (@cadic)](https://github.com/cadic), [@iamdharmesh](https://github.com/iamdharmesh), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Felipe Elia (@felipeelia)](https://github.com/felipeelia), [Mehidi Hassan (@mehidi258)](https://github.com/mehidi258), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [@davexpression](https://github.com/davexpression), [Zaman.Q (@zamanq)](https://github.com/zamanq), [Debashish (@dchucks)](https://github.com/dchucks).

## Libraries

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Repeat for each podcast you would like to create.

* Create a new post and assign it to one or more Podcasts using the panel labeled Podcasts.
* Upload or embed an audio file into this post using any of the usual WordPress methods. If using the new block-based WordPress editor (sometimes referred to as Gutenberg), insert a Podcast block. Only one Podcast block can be inserted per post.
* For more advanced settings, use the Podcasting meta box to mark explicit content or closed captioning available and to optionally specify one media item if the post if you have more than one in your post. In the block-based editor, these are the block settings that appear in the sidebar when the podcast block is selected.
* For more advanced settings, use the Podcasting meta box to mark explicit content or closed captioning available, season number, episode number, episode type and to optionally specify one media item in the post if you have more than one in your post. In the block-based editor, these are the block settings that appear in the sidebar when the podcast block is selected.

## Submit your podcast feed to Apple Podcasts

Expand Down
4 changes: 4 additions & 0 deletions assets/css/podcasting-editor-screen.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.components-input-control,
.components-base-control {
width: 100%;
}
16 changes: 16 additions & 0 deletions assets/js/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { registerBlockType } from '@wordpress/blocks';
// Split the Edit component out.
import Edit from './edit';
import transforms from './transforms';
import '../css/podcasting-editor-screen.css';

/**
* Register example block
Expand Down Expand Up @@ -73,6 +74,21 @@ export default registerBlockType(
source: 'meta',
meta: 'enclosure',
},
seasonNumber: {
type: 'string',
source: 'meta',
meta: 'podcast_season_number',
},
episodeNumber: {
type: 'string',
source: 'meta',
meta: 'podcast_episode_number',
},
episodeType: {
type: 'string',
source: 'meta',
meta: 'podcast_episode_type',
}
},
transforms,

Expand Down
31 changes: 31 additions & 0 deletions assets/js/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
PanelRow,
SelectControl,
TextControl,
RadioControl,
} = wp.components;
const { Fragment } = wp.element;

Expand Down Expand Up @@ -43,6 +44,9 @@ class Edit extends Component {
const { caption, explicit } = attributes;
const duration = attributes.duration || '';
const captioned = attributes.captioned || '';
const seasonNumber = attributes.seasonNumber || '';
const episodeNumber = attributes.episodeNumber || '';
const episodeType = attributes.episodeType || '';
const { className, src } = this.state;

const onSelectAttachment = ( attachment ) => {
Expand Down Expand Up @@ -161,6 +165,33 @@ class Edit extends Component {
onChange={ duration => setAttributes( { duration } ) }
/>
</PanelRow>
<PanelRow>
<TextControl
label={ __( 'Season Number', 'simple-podcasting' ) }
value={ seasonNumber }
onChange={ seasonNumber => setAttributes( { seasonNumber } ) }
/>
</PanelRow>
<PanelRow>
<TextControl
label={ __( 'Episode Number', 'simple-podcasting' ) }
value={ episodeNumber }
onChange={ episodeNumber => setAttributes( { episodeNumber } ) }
/>
</PanelRow>
<PanelRow>
<RadioControl
label={ __( 'Episode Type', 'simple-podcasting' ) }
selected={ episodeType }
options={ [
{ label: __( 'None', 'simple-podcasting' ), value: 'none' },
{ label: __( 'Full', 'simple-podcasting' ), value: 'full' },
{ label: __( 'Trailer', 'simple-podcasting' ), value: 'trailer' },
{ label: __( 'Bonus', 'simple-podcasting' ), value: 'bonus' },
] }
onChange={ episodeType => setAttributes( { episodeType } ) }
/>
</PanelRow>
</PanelBody>
</InspectorControls>
<div className={ className }>
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
"10up/wp_mock": "^0.4.2",
"phpunit/phpunit": "^9.5",
"phpcompatibility/phpcompatibility-wp": "*"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
12 changes: 12 additions & 0 deletions includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ function init() {
true
);

wp_register_style(
'podcasting-block-editor',
PODCASTING_URL . 'dist/blocks.css',
array(),
$block_asset['version'],
'all'
);

register_block_type(
'podcasting/podcast',
array(
'editor_script' => 'podcasting-block-editor',
'editor_style' => 'podcasting-block-editor',
)
);
}
Expand All @@ -41,6 +50,9 @@ function register_js_strings() {
__( 'Podcast Settings', 'simple-podcasting' );
__( 'Length (MM:SS)', 'simple-podcasting' );
__( 'a podcast episode', 'simple-podcasting' );
__( 'Season Number', 'simple-podcasting' );
__( 'Episode Number', 'simple-podcasting' );
__( 'Episode Type', 'simple-podcasting' );
}
add_action( 'init', __NAMESPACE__ . '\register_js_strings' );

Expand Down
48 changes: 32 additions & 16 deletions includes/customize-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function bloginfo_rss_lang( $output, $requested ) {
if ( 'language' === $requested ) {
$lang = get_term_meta( $term->term_id, 'podcasting_language', true );
if ( $lang ) {
$lang = str_replace( '_', '-', $lang );
$output = $lang;
}
}
Expand Down Expand Up @@ -172,14 +173,17 @@ function feed_item() {
}

$feed_item = array(
'author' => get_option( 'podcasting_talent_name' ),
'explicit' => get_post_meta( $post->ID, 'podcast_explicit', true ),
'captioned' => get_post_meta( $post->ID, 'podcast_captioned', true ),
'keywords' => '',
'image' => '',
'summary' => '',
'subtitle' => '',
'duration' => get_post_meta( $post->ID, 'podcast_duration', true ),
'author' => get_option( 'podcasting_talent_name' ),
'explicit' => get_post_meta( $post->ID, 'podcast_explicit', true ),
'captioned' => get_post_meta( $post->ID, 'podcast_captioned', true ),
'keywords' => '',
'image' => '',
'summary' => '',
'subtitle' => '',
'duration' => get_post_meta( $post->ID, 'podcast_duration', true ),
'season' => get_post_meta( $post->ID, 'podcast_season_number', true ),
'episode' => get_post_meta( $post->ID, 'podcast_episode_number', true ),
'episodeType' => get_post_meta( $post->ID, 'podcast_episode_type', true ),
);

if ( empty( $feed_item['author'] ) ) {
Expand Down Expand Up @@ -221,14 +225,17 @@ function feed_item() {
* @param array $feed_item {
* Item data to filter.
*
* @type string $author Podcast author.
* @type string $explicit Explicit content (yes|no|clean).
* @type string $captioned Closed Captioned ("1"|"0"). Optional.
* @type string $keywords Episode keywords. Optional.
* @type string $image Episode image. Optional.
* @type string $summary Episode summary.
* @type string $subtitle Episode subtitle.
* @type string $duration Episode duration (HH:MM). Optional.
* @type string $author Podcast author.
* @type string $explicit Explicit content (yes|no|clean).
* @type string $captioned Closed Captioned ("1"|"0"). Optional.
* @type string $keywords Episode keywords. Optional.
* @type string $image Episode image. Optional.
* @type string $summary Episode summary.
* @type string $subtitle Episode subtitle.
* @type string $duration Episode duration (HH:MM). Optional.
* @type string $season Season number Optional.
* @type string $episode Episode number Optional.
* @type string $episodeType Episode type Optional.
* }
* @param int $post->ID Podcast episode post ID.
* @param int $term->term_id Podcast term ID.
Expand Down Expand Up @@ -258,6 +265,15 @@ function feed_item() {
if ( ! empty( $feed_item['duration'] ) ) {
echo '<itunes:duration>' . esc_html( $feed_item['duration'] ) . "</itunes:duration>\n";
}
if ( ! empty( $feed_item['season'] ) ) {
echo '<itunes:season>' . esc_html( $feed_item['season'] ) . "</itunes:season>\n";
}
if ( ! empty( $feed_item['episode'] ) ) {
echo '<itunes:episode>' . esc_html( $feed_item['episode'] ) . "</itunes:episode>\n";
}
if ( ! empty( $feed_item['episodeType'] ) && 'none' !== $feed_item['episodeType'] ) {
echo '<itunes:episodeType>' . esc_html( $feed_item['episodeType'] ) . "</itunes:episodeType>\n";
}
}
add_action( 'rss2_item', __NAMESPACE__ . '\feed_item' );

Expand Down
30 changes: 30 additions & 0 deletions includes/datatypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,36 @@ function register_meta() {
'single' => true,
)
);

\register_meta(
'post',
'podcast_season_number',
array(
'show_in_rest' => true,
'type' => 'string',
'single' => true,
)
);

\register_meta(
'post',
'podcast_episode_number',
array(
'show_in_rest' => true,
'type' => 'string',
'single' => true,
)
);

\register_meta(
'post',
'podcast_episode_type',
array(
'show_in_rest' => true,
'type' => 'string',
'single' => true,
)
);
}
add_action( 'init', __NAMESPACE__ . '\register_meta' );

Expand Down
3 changes: 3 additions & 0 deletions includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@ function delete_all_podcast_meta( $post_id ) {
delete_post_meta( $post_id, 'podcast_captioned' );
delete_post_meta( $post_id, 'podcast_explicit' );
delete_post_meta( $post_id, 'enclosure' );
delete_post_meta( $post_id, 'podcast_season_number' );
delete_post_meta( $post_id, 'podcast_episode_number' );
delete_post_meta( $post_id, 'podcast_episode_type' );
}
}
35 changes: 34 additions & 1 deletion includes/post-meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function meta_box_html( $post ) {
$podcast_url = get_post_meta( $post->ID, 'podcast_url', true );
$podcast_explicit = get_post_meta( $post->ID, 'podcast_explicit', true );
$podcast_captioned = get_post_meta( $post->ID, 'podcast_captioned', true );
$season_number = get_post_meta( $post->ID, 'podcast_season_number', true );
$episode_number = get_post_meta( $post->ID, 'podcast_episode_number', true );
$episode_type = get_post_meta( $post->ID, 'podcast_episode_type', true );

wp_nonce_field( plugin_basename( __FILE__ ), 'simple-podcasting' );
?>
Expand All @@ -54,7 +57,31 @@ function meta_box_html( $post ) {
</select>
</label>
</p>

<p>
<label for="podcast_season_number">
<?php esc_html_e( 'Season Number', 'simple-podcasting' ); ?>
<input type="text" id="podcast_season_number" name="podcast_season_number" value="<?php echo esc_attr( $season_number ); ?>" />
</label>
</p>
<p>
<label for="podcast_episode_number">
<?php esc_html_e( 'Episode Number', 'simple-podcasting' ); ?>
<input type="text" id="podcast_episode_number" name="podcast_episode_number" value="<?php echo esc_attr( $episode_number ); ?>" />
</label>
</p>
<div style="display: flex; align-items: center;">
<p style="margin-right: 5px;"><?php esc_html_e( 'Episode Type', 'simple-podcasting' ); ?></p>
<p>
<input type="radio" id="none" name="podcast_episode_type" value="none" <?php echo isset( $episode_type ) && 'none' === $episode_type ? 'checked' : ''; ?>>
<label for="none"><?php esc_html_e( 'None', 'simple-podcasting' ); ?></label><br>
<input type="radio" id="full" name="podcast_episode_type" value="full" <?php echo isset( $episode_type ) && 'full' === $episode_type ? 'checked' : ''; ?>>
<label for="full"><?php esc_html_e( 'Full', 'simple-podcasting' ); ?></label><br>
<input type="radio" id="trailer" name="podcast_episode_type" value="trailer" <?php echo isset( $episode_type ) && 'trailer' === $episode_type ? 'checked' : ''; ?>>
<label for="trailer"><?php esc_html_e( 'Trailer', 'simple-podcasting' ); ?></label><br>
<input type="radio" id="bonus" name="podcast_episode_type" value="bonus" <?php echo isset( $episode_type ) && 'bonus' === $episode_type ? 'checked' : ''; ?>>
<label for="bonus"><?php esc_html_e( 'Bonus', 'simple-podcasting' ); ?></label>
</p>
</div>
<p>
<label for="podcasting-enclosure-url"><?php esc_html_e( 'Enclosure', 'simple-podcasting' ); ?></label>
<input type="text" id="podcasting-enclosure-url" name="podcast_enclosure_url" value="<?php echo esc_url( $podcast_url ); ?>" size="35" />
Expand Down Expand Up @@ -90,6 +117,9 @@ function save_meta_box( $post_id ) {
$url = false;
$podcast_captioned = 0;
$podcast_explicit = 'no';
$season_number = isset( $_post['podcast_season_number'] ) ? sanitize_text_field( $_post['podcast_season_number'] ) : '';
$episode_number = isset( $_post['podcast_episode_number'] ) ? sanitize_text_field( $_post['podcast_episode_number'] ) : '';
$episode_type = isset( $_post['podcast_episode_type'] ) && in_array( $_post['podcast_episode_type'], array( 'none', 'full', 'trailer', 'bonus' ), true ) ? sanitize_text_field( $_post['podcast_episode_type'] ) : '';

if ( isset( $_post['podcast_closed_captioned'] ) && 'on' === $_post['podcast_closed_captioned'] ) {
$podcast_captioned = 1;
Expand Down Expand Up @@ -141,6 +171,9 @@ function save_meta_box( $post_id ) {

update_post_meta( $post_id, 'podcast_explicit', $podcast_explicit );
update_post_meta( $post_id, 'podcast_captioned', $podcast_captioned );
update_post_meta( $post_id, 'podcast_season_number', $season_number );
update_post_meta( $post_id, 'podcast_episode_number', $episode_number );
update_post_meta( $post_id, 'podcast_episode_type', $episode_type );

}
add_action( 'save_post_post', __NAMESPACE__ . '\save_meta_box' );
Expand Down
Loading

0 comments on commit 56fc27f

Please sign in to comment.