Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
cadic committed Mar 1, 2022
2 parents c384e7b + b5601de commit 5d6fdd4
Show file tree
Hide file tree
Showing 25 changed files with 919 additions and 79 deletions.
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/gulp-tasks
/node_modules
/tests
/vendor

/.babelrc
/.distignore
Expand All @@ -25,5 +26,6 @@
/LICENSE.md
/package.json
/package-lock.json
/phpunit.xml.dist
/README.md
/webpack.config.js
2 changes: 1 addition & 1 deletion .github/workflows/no-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
token: ${{ github.token }}
daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response
responseRequiredLabel: "reporter feedback" # Label indicating that a response from the original author is required
responseRequiredLabel: "needs:feedback" # Label indicating that a response from the original author is required
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information. With only the
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,46 @@ jobs:

- name: Test
run: npm run cypress:run

phpcs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
coverage: none
tools: composer:v2

- name: Install dependencies
run: composer install

- name: Test
run: ./vendor/bin/phpcs -v

phpunit:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
coverage: none
tools: composer:v2

- name: Install dependencies
run: composer install && npm install

- name: Build
run: npm run build

- name: Test
run: ./vendor/bin/phpunit -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
bower_components
languages
release
vendor
composer.lock
Expand Down
3 changes: 3 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0"?>
<ruleset name="Simple Podcasting">
<rule ref="10up-Default" />
<file>.</file>
<exclude-pattern>dist/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>tests/</exclude-pattern>
</ruleset>
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@

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

## [Unreleased]
## [1.2.2] - 2022-03-01
### Added
- Filter `simple_podcasting_feed_item` to modify RSS feed item data before output (props (props [@cadic](https://github.com/cadic), [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul) via [#144](https://github.com/10up/simple-podcasting/pull/144)).
- Unit tests (props [@cadic](https://github.com/cadic) via [#142](https://github.com/10up/simple-podcasting/pull/142), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul)).
- GitHub action job to run PHPCS (props [@cadic](https://github.com/cadic), [@dkotter](https://github.com/dkotter) via [#136](https://github.com/10up/simple-podcasting/pull/136)).
- Auto-create pot file in languages folder during the build process (props [@dkotter](https://github.com/dkotter), [@cadic](https://github.com/cadic) via [#131](https://github.com/10up/simple-podcasting/pull/131)).

### Changed
- Bump WordPress "tested up to" version 5.9 (props [@sudip-10up](https://github.com/sudip-10up), [@cadic](https://github.com/cadic), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#140](https://github.com/10up/simple-podcasting/pull/140)).

### Fixed
- End-to-end tests with WordPress 5.9 element IDs (props[@cadic](https://github.com/cadic), [@felipeelia](https://github.com/felipeelia), [@dinhtungdu](https://github.com/dinhtungdu) via [#146](https://github.com/10up/simple-podcasting/pull/146)).
- Podcast feed link output on Edit Podcast screen (props [@mehidi258](https://github.com/mehidi258), [@jeffpaul](https://github.com/jeffpaul), [@cadic](https://github.com/cadic) via [#139](https://github.com/10up/simple-podcasting/pull/139)).
- Bug fix for `is_feed` being called too early (props [@tomjn](https://github.com/tomjn), [@jeffpaul](https://github.com/jeffpaul) via [#135](https://github.com/10up/simple-podcasting/pull/135)).
- Missing and incorrect text-domain (props [@dkotter](https://github.com/dkotter), [@cadic](https://github.com/cadic) via [#131](https://github.com/10up/simple-podcasting/pull/131)).

### Security
- Bump `nanoid` from 3.1.25 to 3.2.0 (props [@dependabot](https://github.com/apps/dependabot) via [#143](https://github.com/10up/simple-podcasting/pull/143)).

## [1.2.1] - 2021-12-16
### Added
Expand Down Expand Up @@ -71,6 +88,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.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
[1.2.0]: https://github.com/10up/simple-podcasting/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/10up/simple-podcasting/compare/f8a958c...1.1.1
Expand Down
4 changes: 2 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ The following acknowledges the Maintainers for this repository, those who have C

The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen.

[Jeffrey Paul](https://github.com/jeffpaul)
[Max Lyuchin (@cadic)](https://github.com/cadic), [Jeffrey Paul](https://github.com/jeffpaul).

## Contributors

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).
[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).

## Libraries

Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Easily set up multiple podcast feeds using built-in WordPress posts. Includes a podcast block for the WordPress block editor (aka Gutenberg).
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Test PRs](https://github.com/10up/simple-podcasting/actions/workflows/test-pr.yml/badge.svg)](https://github.com/10up/simple-podcasting/actions/workflows/test-pr.yml) [![Test Branches](https://github.com/10up/simple-podcasting/actions/workflows/test-branch.yml/badge.svg)](https://github.com/10up/simple-podcasting/actions/workflows/test-branch.yml) [![Release Version](https://img.shields.io/github/release/10up/simple-podcasting.svg)](https://github.com/10up/simple-podcasting/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.8.1%20tested-success.svg) [![GPLv2 License](https://img.shields.io/github/license/10up/simple-podcasting.svg)](https://github.com/10up/simple-podcasting/blob/develop/LICENSE.md)
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Test PRs](https://github.com/10up/simple-podcasting/actions/workflows/test-pr.yml/badge.svg)](https://github.com/10up/simple-podcasting/actions/workflows/test-pr.yml) [![Test Branches](https://github.com/10up/simple-podcasting/actions/workflows/test-branch.yml/badge.svg)](https://github.com/10up/simple-podcasting/actions/workflows/test-branch.yml) [![Release Version](https://img.shields.io/github/release/10up/simple-podcasting.svg)](https://github.com/10up/simple-podcasting/releases/latest) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/simple-podcasting?label=WordPress) [![GPLv2 License](https://img.shields.io/github/license/10up/simple-podcasting.svg)](https://github.com/10up/simple-podcasting/blob/develop/LICENSE.md)

## Table of Contents
* [Overview](#overview)
Expand All @@ -11,6 +11,8 @@
* [Create Podcast](#create-your-podcast)
* [Add Content to Podcast](#add-content-to-your-podcast)
* [Submit Podcast Feed to Apple Podcasts](#submit-your-podcast-feed-to-apple-podcasts)
* [Control how many episodes are listed on the feed](#control-how-many-episodes-are-listed-on-the-feed)
* [Customize RSS feed](#customize-rss-feed)
* [Contributing](#contributing)

## Overview
Expand Down Expand Up @@ -72,7 +74,7 @@ Podcast setup | Podcast in editor | Podcast feed

If you want to adjust the default number of episodes included in a podcast RSS feed, then utilize the following to do so...

```
```php
<?php

add_filter( 'simple_podcasting_episodes_per_page', 'podcasting_feed_episodes_per_page' );
Expand All @@ -90,6 +92,22 @@ function podcasting_feed_episodes_per_page( $qty ) {

```

## Customize RSS feed

If you want to modify RSS feed items output, there is a filter for that:

```php
<?php

function podcasting_feed_item_filter( $feed_item = array(), $post_id = null, $term_id = null ) {
if ( 42 === $post_id ) {
$feed_item['keywords'] = 'one,two,three';
}
return $feed_item;
}
add_filter( 'simple_podcasting_feed_item', 'podcasting_feed_item_filter', 10, 3 );
```

## Support Level

**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
Expand Down
2 changes: 1 addition & 1 deletion assets/js/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class Edit extends Component {
{ ( ( caption && caption.length ) || !! isSelected ) && (
<RichText
tagName="figcaption"
placeholder={ __( 'Write caption…' ) }
placeholder={ __( 'Write caption…', 'simple-podcasting' ) }
value={ caption }
onChange={ ( value ) => setAttributes( { caption: value } ) }
isSelected={ isSelected }
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"php": ">=7.0"
},
"require-dev": {
"10up/wp_mock": "dev-master",
"10up/phpcs-composer": "dev-master"
"10up/phpcs-composer": "dev-master",
"phpunit/phpunit": "7.5.20",
"10up/wp_mock": "0.3.0"
}
}
114 changes: 65 additions & 49 deletions includes/customize-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,70 +171,86 @@ function feed_item() {
return false;
}

$author = get_option( 'podcasting_talent_name' );
if ( empty( $author ) ) {
$author = get_the_author();
}

echo '<itunes:author>' . esc_html( $author ) . "</itunes:author>\n";
$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 ),
);

$explicit = get_post_meta( $post->ID, 'podcast_explicit', true );

// fall back to the podcast setting.
if ( empty( $explicit ) ) {
$explicit = get_term_meta( $term->term_id, 'podcasting_explicit', true );
if ( empty( $feed_item['author'] ) ) {
$feed_item['author'] = get_the_author();
}

echo '<itunes:explicit>';

if ( empty( $explicit ) ) {
echo 'no';
} else {
echo esc_html( $explicit );
// fall back to the podcast setting.
if ( empty( $feed_item['explicit'] ) ) {
$feed_item['explicit'] = get_term_meta( $term->term_id, 'podcasting_explicit', true );
}

echo "</itunes:explicit>\n";

$captioned = get_post_meta( $post->ID, 'podcast_captioned', true );

if ( $captioned ) {
echo "<itunes:isClosedCaptioned>Yes</itunes:isClosedCaptioned>\n";
// "no" explicit by default
if ( empty( $feed_item['explicit'] ) ) {
$feed_item['explicit'] = 'no';
}

// Add the featured image if available.
if ( has_post_thumbnail( $post->ID ) ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
if ( ! empty( $image ) ) {
if ( is_array( $image ) ) {
$image = $image[0];
}
echo "<itunes:image href='" . esc_url( $image ) . "' />\n";
$feed_item['image'] = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
if ( ! empty( $feed_item['image'] ) && is_array( $feed_item['image'] ) ) {
$feed_item['image'] = $feed_item['image'][0];
}
}

// @todo add a filter here
$keywords = '';
if ( ! empty( $keywords ) ) {
echo '<itunes:keywords>' . esc_html( $keywords ) . "</itunes:keywords>\n";
}

if ( has_excerpt() ) {
$excerpt = get_the_excerpt();
$feed_item['summary'] = get_the_excerpt();
} else {
$excerpt = get_term_meta( $term->term_id, 'podcasting_summary', true );
$feed_item['summary'] = get_term_meta( $term->term_id, 'podcasting_summary', true );
}
$feed_item['summary'] = apply_filters( 'the_excerpt_rss', $feed_item['summary'] );

$feed_item['subtitle'] = wp_trim_words( $feed_item['summary'], 10, '&#8230;' );

/**
* Filter podcasting feed item data
*
* @since 1.3.0
*
* @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.
* }
* @param int $post->ID Podcast episode post ID.
* @param int $term->term_id Podcast term ID.
*/
$feed_item = apply_filters( 'simple_podcasting_feed_item', $feed_item, $post->ID, $term->term_id );

// Output all custom RSS tags.
echo '<itunes:author>' . esc_html( $feed_item['author'] ) . "</itunes:author>\n";
echo '<itunes:explicit>' . esc_html( $feed_item['explicit'] ) . "</itunes:explicit>\n";
if ( $feed_item['captioned'] ) {
echo "<itunes:isClosedCaptioned>Yes</itunes:isClosedCaptioned>\n";
}
$excerpt = apply_filters( 'the_excerpt_rss', $excerpt );

echo '<itunes:summary>' . esc_html( wp_strip_all_tags( $excerpt ) ) . "</itunes:summary>\n";

$subtitle = wp_trim_words( $excerpt, 10, '&#8230;' );

echo '<itunes:subtitle>' . esc_html( $subtitle ) . "</itunes:subtitle>\n";

// Add an enclosure duration if available.
$duration = get_post_meta( $post->ID, 'podcast_duration', true );
if ( ! empty( $duration ) ) {
echo '<itunes:duration>' . esc_html( $duration ) . "</itunes:duration>\n";
if ( ! empty( $feed_item['image'] ) ) {
echo "<itunes:image href='" . esc_url( $feed_item['image'] ) . "' />\n";
}
if ( ! empty( $feed_item['keywords'] ) ) {
echo '<itunes:keywords>' . esc_html( $feed_item['keywords'] ) . "</itunes:keywords>\n";
}
echo '<itunes:summary>' . esc_html( wp_strip_all_tags( $feed_item['summary'] ) ) . "</itunes:summary>\n";
echo '<itunes:subtitle>' . esc_html( $feed_item['subtitle'] ) . "</itunes:subtitle>\n";
if ( ! empty( $feed_item['duration'] ) ) {
echo '<itunes:duration>' . esc_html( $feed_item['duration'] ) . "</itunes:duration>\n";
}
}
add_action( 'rss2_item', __NAMESPACE__ . '\feed_item' );
Expand Down
7 changes: 3 additions & 4 deletions includes/datatypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function add_top_level_menu() {
*/
function add_podcasting_taxonomy_help_text() {
echo '<div class="notice notice-info"><p>';
esc_html_e( 'Once at least one podcast exists, you can add episodes by creating a post, assigning it to the appropriate podcast, and inserting an audio player or podcast block into the content of the post. You can then submit the feed URL to podcast directories.', 'podcasting' );
esc_html_e( 'Once at least one podcast exists, you can add episodes by creating a post, assigning it to the appropriate podcast, and inserting an audio player or podcast block into the content of the post. You can then submit the feed URL to podcast directories.', 'simple-podcasting' );
echo '</p></div>';
}
add_action( 'after-podcasting_podcasts-table', __NAMESPACE__ . '\add_podcasting_taxonomy_help_text' );
Expand Down Expand Up @@ -397,10 +397,9 @@ function add_podcasting_term_meta_nonce( $term, $taxonomy = false ) {

wp_nonce_field( 'podcasting_edit', 'podcasting_nonce' );
wp_enqueue_media();

if ( $taxonomy ) {
$url = get_term_feed_link( $term->term_id, TAXONOMY_NAME );
__( 'Your Podcast Feed:', 'ads-txt' );
esc_html_e( 'Your Podcast Feed: ', 'simple-podcasting' );
echo '<a href="' . esc_url( $url ) . '" target="_blank">' . esc_url( $url ) . '</a><br />';
esc_html_e( 'This is the URL you submit to iTunes or podcasting service.', 'simple-podcasting' );
}
Expand Down Expand Up @@ -691,7 +690,7 @@ function get_podcasting_categories() {
* Transform podcasting categories into dropdown options
*/
function get_podcasting_categories_options() {
$to_return = array( '' => __( 'None' ) );
$to_return = array( '' => __( 'None', 'simple-podcasting' ) );
$categories = get_podcasting_categories();

foreach ( $categories as $key => $category ) {
Expand Down
Loading

0 comments on commit 5d6fdd4

Please sign in to comment.