Skip to main content

FeedNamespaceInterface

\Benecaster\Feed\Namespaces\FeedNamespaceInterface

Interface Free

The contract every registered XML namespace handler must implement. NamespaceRegistry::get_all() silently drops anything in the benecaster_feed_namespaces filter result that does not implement it. Benecaster pre-registers four handlers at boot in Plugin::register_feed(): ItunesNamespace, ContentNamespace, PodcastIndexNamespace and PodloveNamespace. PodcastNamespace is a deprecated filter shim, not a handler, and is never registered.

A handler whose output depends on the tier being compiled can additionally implement one of two opt-in extensions: TierAwareFeedNamespaceInterface (channel level) or TierAwareEpisodeNamespaceInterface (episode level).

Methods

Method Visibility Since Description
get_xmlns(): array Public — Returns the xmlns declarations this handler contributes — prefix => full URI, e.g. [ 'podcast' => 'https://podcastindex.org/namespace/1.0' ]. A handler may declare more than one namespace. Return the declarations even when a given feed produces no tags from this handler.
channel_tags( int $show_id ): array Public — Channel-level XML fragments (string[]). Each element is a complete, ready-to-emit XML string including its trailing newline; FeedCompiler concatenates every handler's fragments into after the standard RSS 2.0 and iTunes channel tags. Return [] for no channel-level output.
episode_tags( int $episode_id, int $show_id ): array Public — Episode-level XML fragments (string[]), same shape, concatenated into that episode's . Return [] for no output on this episode.

Notes

A handler implements the methods above. A handler written with get_namespace_uri()/get_prefix()/string-returning channel_tags()/item_tags() fatals on registration.