osure = explode("\n", $enc);
// only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3'
$t = preg_split('/[ \t]/', trim($enclosure[2]) );
$type = $t[0];
/**
* Filters the RSS enclosure HTML link tag for the current post.
*
* @since 2.2.0
*
* @param string $html_link_tag The HTML link tag with a URI and other attributes.
*/
echo apply_filters( 'rss_enclosure', '' . "\n" );
}
}
}
}
/**
* Display the atom 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.
*
* Also uses the function get_post_custom() to get the post's 'enclosure'
* metadata field and parses the value to display the enclosure(s). The
* enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
*
* @since 2.2.0
*/
function atom_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);
/**
* Filters the atom enclosure HTML link tag for the current post.
*
* @since 2.2.0
*
* @param string $html_link_tag The HTML link tag with a URI and other attributes.
*/
echo apply_filters( 'atom_enclosure', '' . "\n" );
}
}
}
}
/**
* Determine the type of a string of data with the data formatted.
*
* Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1.
*
* In the case of WordPress, text is defined as containing no markup,
* xhtml is defined as "well formed", and html as tag soup (i.e., the rest).
*
* Container div tags are added to xhtml values, per section 3.1.1.3.
*
* @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1
*
* @since 2.5.0
*
* @param string $data Input string
* @return array array(type, value)
*/
function prep_atom_text_construct($data) {
if (strpos($data, '<') === false && strpos($data, '&') === false) {
return array('text', $data);
}
if ( ! function_exists( 'xml_parser_create' ) ) {
trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
return array( 'html', "" );
}
$parser = xml_parser_create();
xml_parse($parser, '