WordPress atom_enclosure() Function Kodu
WordPress atom_enclosure() Function Kodu
Yazının bir şifre gerektirip gerektirmediğini ve kullanıcının gönderinin şifresini olup olmadığını kontrol etmek için global $post’u kullanır. Değilse, gösterilmeden önce geri dönecektir.
Ayrıca, gönderinin ‘muhafaza’ meta veri alanını almak için get_post_custom() işlevini kullanır ve muhafazaları görüntülemek için değeri ayrıştırır. Ekler, URI ve diğer özelliklere sahip link HTML etiketlerinden oluşur.
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', '<link href="' . esc_url( trim( $enclosure[0] ) ) . '" rel="enclosure" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( trim( $enclosure[2] ) ) . '" />' . "\n" );
}
}
}
}