Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for custom title #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Place the folder containing the handler into your handlers directory located at
## Configuration
To configure the handler you can change the corresponding settings in your configuration file located at `./user/config/config.php`.

### Podcast Title
You can set the following value to a string to define the podcast's title (defaults to sitename):
```
Handlers::set("podcast_title", NULL);
```

### Podcast Author
You can set the following value to a string to define the podcast's author:
```
Expand Down
16 changes: 12 additions & 4 deletions handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class PodcastFeedHandler extends FeedHandler {
// see https://help.apple.com/itc/podcasts_connect/#/itcb54353390

// these have to be set via Handlers::set()
const PODCAST_TITLE = "podcast_title";
const PODCAST_AUTHOR = "podcast_author";
const PODCAST_BLOCK = "podcast_block";
const PODCAST_CATEGORY = "podcast_category"; // see https://help.apple.com/itc/podcasts_connect/#/itc9267a2f12
Expand Down Expand Up @@ -74,17 +75,24 @@ public static function run() {
print(fhtml("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>".NL.
"<rss xmlns:itunes=\"http://www.itunes.com/dtds/podcast-1.0.dtd\" version=\"2.0\">".NL.
" <channel>".NL.
" <title>%s</title>".NL.
" <itunes:title>%s</itunes:title>".NL.
" <copyright>%s</copyright>".NL.
" <link>%s</link>".NL.
" <language>%s</language>".NL,
value(Themes::class, SITENAME),
value(Themes::class, SITENAME),
value(Themes::class, COPYRIGHT),
absoluteurl("/"),
strtr(value(Main::class, LANGUAGE), "_", "-")));

if (null !== value(Handlers::class, static::PODCAST_TITLE)) {
print(fhtml(" <title>%s</title>".NL.
" <itunes:title>%s</itunes:title>".NL.,
value(Handlers::class, static::PODCAST_TITLE),
value(Handlers::class, static::PODCAST_TITLE)));
} else {
print(fhtml(" <title>%s</title>".NL.
" <itunes:title>%s</itunes:title>".NL.,
value(Handlers::class, static::SITENAME),
value(Handlers::class, static::SITENAME)));
}
if (null !== value(Handlers::class, static::PODCAST_AUTHOR)) {
print(fhtml(" <itunes:author>%s</itunes:author>".NL,
value(Handlers::class, static::PODCAST_AUTHOR)));
Expand Down