the_audio( get_the_ID(), false ); } function enclosure( $mime, $url, $song ) { printf( '"%s"', $mime, base64_encode( $url ), $song ); echo "\n"; } function shortcode( $atts, $content = null ) { extract( shortcode_atts( array(), $atts ) ); return $this->the_audio( 0, false ); } function styles() { if ( !is_admin() ) { $local = STYLESHEETPATH . '/audio.css'; if ( is_file( $local ) ) { wp_enqueue_style( 'audio-override', get_stylesheet_directory_uri() . '/audio.css' ); } else { wp_enqueue_style( 'audio', WP_PLUGIN_URL . '/audio/css/audio.css' ); } } } function scripts() { if ( !is_admin() ) { wp_enqueue_script( 'base64', WP_PLUGIN_URL . '/audio/js/base64.js', '', '', true ); wp_enqueue_script( 'jplayer', WP_PLUGIN_URL . '/audio/js/jquery.jplayer.min.js', array( 'jquery' ), '', true ); wp_enqueue_script( 'audio', WP_PLUGIN_URL . '/audio/js/audio.js', array( 'jplayer', 'base64' ), '', true ); } } function get_attachment_post_id( $parent_id, $mime_type = 'audio/mp3' ) { global $wpdb; $search = is_array( $mime_type ) ? "IN ('%s')" : '= %s'; $sql = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_mime_type {$search} AND post_status = 'publish'", $parent_id, is_array( $mime_type ) ? join( "','", $mime_type ) : $mime_type ); return $wpdb->get_var( $sql ); } function ogg_object( $mp3_id ) { $ogg_id = $this->get_attachment_post_id( $mp3_id, 'audio/ogg' ); if ( !empty( $ogg_id ) ) return get_post( $ogg_id ); } function image_id( $mp3_id ) { return $this->get_attachment_post_id( $mp3_id, array( 'image/jpg', 'image/gif', 'image/png' ) ); } function image( $mp3_id, $title ) { $image = $this->image_id( $mp3_id ); if ( !empty( $image ) ) { $meta = wp_get_attachment_image_src( $image, array( A_THUMB_WIDTH, A_THUMB_HEIGHT ), true ); if ( !empty( $meta ) ) printf( '%s', $meta[0], $meta[1], $meta[2], apply_filters( 'the_title_attribute', $title ) ); } } function item_formatted( $mp3 ) { $song = apply_filters( 'the_title', $mp3->post_title ); $artist = $mp3->post_excerpt; $album = $mp3->post_content; $url = wp_get_attachment_url( $mp3->ID ); ?>
image( $mp3->ID, $song ); ?> enclosure( $mp3->post_mime_type, $url, $song ); $ogg = $this->ogg_object( $mp3->ID ); if ( !empty( $ogg ) ) { $url = wp_get_attachment_url( $ogg->ID ); $song = apply_filters( 'the_title', $ogg->post_title ); $this->enclosure( $ogg->post_mime_type, $url, $song ); } ?>
$the_id, 'post_mime_type'=> 'audio/mpeg', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'post_status' => 'inherit', 'numberposts' => -1 ) ); if ( !empty( $audio ) ): if ( $display ): ?>
item_formatted( $a ); ?>
init(); function has_audio() { global $_audio_wp_plugin; return $_audio_wp_plugin->has_audio(); } function the_audio( $id = 0, $display = true ) { global $_audio_wp_plugin; return $_audio_wp_plugin->the_audio( $id, $display ); }