rss_enclosure

Definition:
function rss_enclosure() {}

Display the rss enclosure for the current post.
Uses the global $post to check whether the post requires a password and if the user has the password for the post. If not then it will return before displaying.

Defined filters

  • rss_enclosure
    apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])

Source code

function rss_enclosure() {

	if ( post_password_required() )

		return;



	foreach ( (array) get_post_custom() as $key => $val) {

		if ($key == 'enclosure') {

			foreach ( (array) $val as $enc ) {

				$enclosure = explode("\n", $enc);



				//only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'

				$t = preg_split('/[ \t]/', trim($enclosure[2]) );

				$type = $t[0];



				echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");

			}

		}

	}

}

2755

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: