ItunesNamespace
\Benecaster\Feed\Namespaces\ItunesNamespace
The feed handler for the itunes: namespace, prefix itunes, URI http://www.itunes.com/dtds/podcast-1.0.dtd. The plugin registers it at boot. It implements both DataDrivenNamespaceInterface and TierAwareFeedNamespaceInterface.
Inside the feed compiler it is data-driven: the compiler merges the keys this class supplies into the benecaster_feed_channel_data and benecaster_feed_episode_data arrays, runs those filters, then calls render_channel() and render_episode() with the filtered arrays. A callback on either filter that changes artwork, author, category, new_feed_url and the rest therefore changes the itunes: tags an app reads, not only the plain RSS tags. Because the compiler tests for the data-driven interface first, it never calls channel_tags_for_tier() or episode_tags() on this class. Those methods read the settings directly for callers outside the compiler and produce what the unfiltered data would.
Channel tags: itunes:title, itunes:author, itunes:summary, itunes:subtitle (when set), itunes:owner (name and email), itunes:image, itunes:category (nested when a subcategory is set), itunes:explicit, itunes:type, itunes:block (when the show is private), itunes:complete (when the show is marked complete) and itunes:new-feed-url (when set). The channel summary is the show’s page content with any [benecaster_access_gate] and then any [benecaster_tier_gate] resolved for the slug being compiled, or the short description when the show has no content.
Item tags: itunes:title, itunes:author, itunes:summary, itunes:duration, itunes:explicit, itunes:image, itunes:episode (when a number is set), itunes:episodeType and itunes:season (when the show has seasons enabled and the episode has a season). The item summary is the episode’s Podcatcher Description only, never the episode’s page content, so nothing at item level is tier-gated.
Constructor Dependencies
| Type | Description |
|---|---|
\Benecaster\Episode\EpisodeTypeRepository |
Maps the show's episode type slugs to iTunes types (full, trailer or bonus) for itunes:episodeType. |
?\Benecaster\Feed\FeedTierGate |
Resolves a tier gate in the show's content for the channel summary. Optional; without one every gate takes its else branch. |
?\Benecaster\Feed\FeedAccessGate |
Resolves an access gate in the show's content for the channel summary, before the tier gate runs. Optional; without one every access gate takes its else branch. |
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
get_xmlns(): array |
Public | — | Returns [ 'itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd' ]. |
channel_tags( int $show_id ): array |
Public | — | Channel fragments as the public feed would render them. Calls channel_tags_for_tier() with the public tier. |
channel_tags_for_tier( int $show_id, string $tier_slug, array $available_episode_ids ): array |
Public | — | Channel fragments for one tier, built from the show's settings directly. Only the channel summary depends on the tier, and $available_episode_ids is unused. Returns an empty array when the show post does not exist. |
episode_tags( int $episode_id, int $show_id ): array |
Public | — | Item fragments built from the episode and show settings directly, in one string, or an empty array when nothing renders. |
channel_data( int $show_id, string $tier_slug ): array |
Public | — | The channel keys this class contributes to benecaster_feed_channel_data: title, author, author_email, subtitle, summary, artwork, category, subcategory, explicit, type, is_private, is_complete and new_feed_url. Artwork falls back to the show's featured image. The compiler merges these in after its own keys, so a key the compiler already sets wins. Returns an empty array when the show post does not exist. |
render_channel( array $channel_data, int $show_id ): array |
Public | — | Renders the channel fragment from the filtered channel array. itunes:type is checked again here and falls back to episodic for any value other than episodic or serial, because a filter callback can supply any string. |
episode_data( int $episode_id, int $show_id, string $tier_slug ): array |
Public | — | The item keys this class contributes to benecaster_feed_episode_data: title, author, summary, duration, explicit, artwork, episode_number, episode_type and season. The keys pass through the benecaster_episode_title, benecaster_episode_description_rss, benecaster_episode_duration, benecaster_episode_artwork_url and benecaster_episode_itunes_type filters as they are built. Author falls back to the show's author, and artwork to the show's artwork, then its featured image. $tier_slug is unused. |
render_episode( array $episode_data, int $episode_id, int $show_id ): array |
Public | — | Renders the item fragment from the filtered episode array. Season is emitted only when the show has seasons enabled. itunes:episodeType is checked again here and falls back to full for any value outside the valid iTunes types. Returns an empty array when nothing renders. |
render_channel_data( array $data ): string |
Public | — | Renders a channel data array to an XML string. Nothing in the plugin calls it now; render_channel() gives the same output. |
render_item_data( array $data, bool $seasons_enabled ): string |
Public | — | Renders an episode data array to an XML string, with the season tag controlled by $seasons_enabled. Nothing in the plugin calls it now; render_episode() renders the same tags. It reads summary, and falls back to description when summary is absent. |
Hooks Fired
Notes
A benecaster_feed_channel_data or benecaster_feed_episode_data callback can set an itunes: tag only through the keys listed above. A key that is not one of them is ignored by this class.
itunes:episodeType is validated after the filters run and any value outside the valid iTunes types becomes full, so a callback cannot emit an invalid type.