setOption(array('encoding' => 'UTF-8')); $info = $getID3->analyze($file); $total = explode(':', $info['playtime_string']); $mins = $total[0]; $secs = $total[1]; unset($getID3, $total, $info); return array( 'PT' . $mins . 'M' . $secs . 'S', $mins . ' minutes, ' . $secs . ' seconds' ); } function audio_get_ogg_object($id) { $ogg = ''; if (function_exists('shuffle_by_mime_type')): $oggs = get_audio($id); if (is_array($oggs) && count($oggs) > 0) { foreach ($oggs as $o): if ($o->post_mime_type === 'audio/ogg') { $ogg = $o; break; } endforeach; } unset($oggs); endif; return $ogg; } function audio_image($id, $title) { if (function_exists('shuffle_by_mime_type')): $imgs = get_images($id); if (count($imgs)): foreach ($imgs as $img): $meta = wp_get_attachment_image_src($img->ID, array(A_THUMB_WIDTH, A_THUMB_HEIGHT), true); printf('%s', $meta[0], $meta[1], $meta[2], apply_filters('the_title_attribute', $title)); endforeach; endif; unset($imgs); endif; } function audio_enclosure($mime, $path, $song) { printf('"%s"', $mime, base64_encode($path), $song); } function audio_item_formatted($post) { $song = apply_filters('the_title', $post->post_title); $artist = $post->post_excerpt; $album = $post->post_content; $parts = parse_url($post->guid); $local_file = getcwd() . $parts['path']; ?>
ID, $song) ?> post_mime_type, $parts['path'], $song); ?> ID); if (!empty($ogg)): $parts = parse_url($ogg->guid); $song = apply_filters('the_title', $ogg->post_title); audio_enclosure($ogg->post_mime_type, $parts['path'], $song); unset($ogg, $parts); endif; ?>
0): if (function_exists('shuffle_by_mime_type')): $audio = get_audio($coerced_id); else: // this is functionality ported over from Shuffle // you should be using Shuffle!!! $audio = get_posts(array( 'post_parent' => $coerced_id, 'post_mime_type' => 'audio', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'post_status' => 'inherit', 'numberposts' => -1 )); endif; if (count($audio) > 0): ?>
'' ), $atts)); ob_start(); the_audio(0, $layout); $audio = ob_get_contents(); ob_end_clean(); return $audio; } add_shortcode('audio', 'audio_handler'); ?>