['bgcolor'] ) ) { $bgcolor = preg_replace( '/^(0x)?/', '#', $options['bgcolor'] ); $bgcolor = esc_attr( $bgcolor ); } else { $bgcolor = '#FFFFFF'; } if ( isset( $options['width'] ) ) { $width = intval( $options['width'] ); } else { $width = 290; } $loop = ''; $script_loop = 'false'; if ( isset( $options['loop'] ) && 'yes' == $options['loop'] ) { $script_loop = 'true'; if ( 1 == $num_files ) { $loop = 'loop'; } } $volume = 0.6; if ( isset( $options['initialvolume'] ) && 0.0 < floatval( $options['initialvolume'] ) && 100.0 >= floatval( $options['initialvolume'] ) ) { $volume = floatval( $options['initialvolume'] )/100.0; } $file_artists = array_pad( array(), $num_files, '' ); if ( isset( $options['artists'] ) ) { $artists = preg_split( '/,/', $options['artists'] ); foreach ( $artists as $i => $artist ) { $file_artists[$i] = esc_html( $artist ) . ' - '; } } // generate default titles $file_titles = array(); for ( $i = 0; $i < $num_files; $i++ ) { $file_titles[] = 'Track #' . ($i+1); } // replace with real titles if they exist if ( isset( $options['titles'] ) ) { $titles = preg_split( '/,/', $options['titles'] ); foreach ( $titles as $i => $title ) { $file_titles[$i] = esc_html( $title ); } } // fallback for the fallback, just a download link $not_supported = ''; foreach ( $sound_files as $sfile ) { $not_supported .= sprintf( __( 'Download: %s
', 'jetpack' ), esc_url( $sfile ), esc_html( basename( $sfile ) ) ); } // HTML5 audio tag $html5_audio = ''; $all_mp3 = true; $add_audio = true; $num_good = 0; $to_remove = array(); foreach ( $sound_files as $i => $sfile ) { $file_extension = pathinfo( $sfile, PATHINFO_EXTENSION ); if ( ! preg_match( '/^(mp3|wav|ogg|oga|m4a|aac|webm)$/i', $file_extension ) ) { $html5_audio .= ''; if ( 1 == $num_files ) { $html5_audio .= $not_supported; } $to_remove[] = $i; // make a note of the bad files $all_mp3 = false; continue; } elseif ( ! preg_match( '/^mp3$/i', $file_extension ) ) { $all_mp3 = false; } if ( 0 == $i ) { // only need one player $html5_audio .= <<