Skip to content

Commit

Permalink
fix: itunes:explicit RSS tag content
Browse files Browse the repository at this point in the history
Must have changed from yes/no/clean to the more sensible true/false at some point without us noticing. This updates it.
  • Loading branch information
eteubert committed Apr 26, 2024
1 parent 26cf969 commit 44255c1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion includes/explicit_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'type' => 'checkbox',
'html' => ['style' => 'width: 200px;'],
'default' => '-1',
'options' => [0 => 'no', 1 => 'yes', 2 => 'clean'],
'options' => [0 => 'false', 1 => 'true'],
],
'position' => 770,
];
Expand Down
2 changes: 1 addition & 1 deletion lib/feeds/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function override_feed_head($hook, $podcast, $feed, $format)
echo "\t".apply_filters('podlove_feed_itunes_block', $block);
echo PHP_EOL;

$explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', ($podcast->explicit == 2) ? 'clean' : (($podcast->explicit) ? 'yes' : 'no'));
$explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', $podcast->explicit_text());
echo "\t".apply_filters('podlove_feed_itunes_explicit', $explicit);
echo PHP_EOL;

Expand Down
5 changes: 3 additions & 2 deletions lib/model/episode.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ public function categories($args = [])

public function explicit_text()
{
// backwards compatibility
if ($this->explicit == 2) {
return 'clean';
return 'false';
}

return $this->explicit ? 'yes' : 'no';
return $this->explicit ? 'true' : 'false';
}

public function media_files($args = [])
Expand Down
10 changes: 10 additions & 0 deletions lib/model/podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ public function default_copyright_claim()
return '© '.date('Y').' '.($this->author_name ?? $this->title);
}

public function explicit_text()
{
// backwards compatibility
if ($this->explicit == 2) {
return 'false';
}

return $this->explicit ? 'true' : 'false';
}

/**
* Episodes.
*
Expand Down
5 changes: 2 additions & 3 deletions lib/settings/podcast/tab/directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ public function register_page()

$wrapper->select('explicit', [
'label' => __('Explicit Content?', 'podlove-podcasting-plugin-for-wordpress'),
'description' => __('', 'podlove-podcasting-plugin-for-wordpress'),
'type' => 'checkbox',
'options' => [0 => 'no', 1 => 'yes', 2 => 'clean'],
'description' => __('True: If you specify true, indicating the presence of explicit content, directories may display an Explicit parental advisory graphic for your podcast. False: If you specify false, indicating that your podcast does not contain explicit language or adult content, directories may display a Clean parental advisory graphic for your podcast.', 'podlove-podcasting-plugin-for-wordpress'),
'options' => [0 => 'false', 1 => 'true'],
]);

$wrapper->checkbox('complete', [
Expand Down
2 changes: 1 addition & 1 deletion lib/template/episode.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function recordingDate($format = '')
/**
* Explicit status.
*
* "yes", "no" or "clean"
* "true" or "false"
*
* @accessor
*/
Expand Down
12 changes: 11 additions & 1 deletion lib/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

use Podlove\Jobs\CronJobRunner;

define('Podlove\DATABASE_VERSION', 156);
define('Podlove\DATABASE_VERSION', 157);

add_action('admin_init', '\Podlove\maybe_run_database_migrations');
add_action('admin_init', '\Podlove\run_database_migrations', 5);
Expand Down Expand Up @@ -1653,6 +1653,16 @@ function run_migrations_for_version($version)
$podcast->feed_transcripts = 'generated';
$podcast->save();

break;
case 157:
$podcast = Model\Podcast::get();

// update deprecated "clean" value to "false"
if ($podcast->explicit == 2) {
$podcast->explicit = 0;
$podcast->save();
}

break;
}
}
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ This product includes GeoLite2 data created by MaxMind, available from http://ww

= 4.1.7 =

* fix `itunes:explicit` RSS tag. It now contains the valid values "true" or "false".
* fix typo in API: `explicit` field was mistyped as `expicit`

= 4.1.6 =
Expand Down

0 comments on commit 44255c1

Please sign in to comment.