delete( $wpdb->prefix.'options', array( 'option_name' => 'dew_display_options' ) ); } require_once('admin-panel/dew_admin_options.php'); $dp = get_option('dew_display_options'); $maxrows = $dp['max_rows']; $tabwidth = $dp['table_width']; $headheight = $dp['header_height']; $rowheight = $dp['row_height']; $headcolor = $dp['table_header_color']; $prirow = $dp['primary_row_color']; $altrow = $dp['alt_row_color']; $showno = $dp['show_no_column']; $showsize = $dp['show_size_column']; $showlength = $dp['show_duration_column']; $noheader = $dp['header_name_for_no']; $nameheader = $dp['header_name_for_name']; $playerheader = $dp['header_name_for_player']; $sizeheader = $dp['header_name_for_size']; $lengthheader = $dp['header_name_for_duration']; $downloadheader = $dp['header_name_for_download']; $downloadimg = $dp['download_img']; add_shortcode('musicdirectory','music_procedure'); function music_procedure($atts) { extract( shortcode_atts( array( 'path' => '', ), $atts ) ); global $maxrows; global $tabwidth; global $headheight; global $rowheight; global $headcolor; global $prirow; global $altrow; global $showno; global $showsize; global $showlength; global $noheader; global $nameheader; global $playerheader; global $sizeheader; global $lengthheader; global $downloadheader; global $downloadimg; include_once("library/getid3.php"); if ($handle = opendir(ABSPATH . $path)) { $count=1; $getID3 = new getID3; $getID3->encoding = 'UTF-8'; $html = ''; $html .= ''; $html .= ''; if( '1' == $showno) { $html .= ''; } $html .= ''; if( '1' == $showsize) { $html .= ''; } if( '1' == $showlength) { $html .= ''; } $html .= ''; while (false !== ($file = readdir($handle))) { $dirFiles[] = $file; } closedir($handle); } sort($dirFiles); foreach($dirFiles as $file) { if ($file == "." || $file == "..") continue; if ( strtolower(substr(strrchr($file,"."),1)) != 'mp3' ) continue; $name = substr(str_replace('_', ' ', $file), 0 , -4); $ThisFileInfo = $getID3->analyze(ABSPATH.$path.$file); $playtime = $ThisFileInfo [ 'playtime_string' ]; $size = round((filesize(ABSPATH.$path.$file))/(1024*1024),2); $html .= ''; if( '1' == $showno) { $html .= ''; } $html .= ''; $html .= ''; if( '1' == $showsize) { $html .= ''; } if( '1' == $showlength) { $html .= ''; } $html .= ''; $html .= ''; if(isset($maxrows)) { if($count==$maxrows) { break; } } $count++; } $html .= '
'.$noheader.''.$nameheader.''.$playerheader.''.$sizeheader.''.$lengthheader.''.$downloadheader.'
'.$count.'' . $name . ' ' .$size.' MB ' .$playtime.'
' ; return $html; } // add shortcode for displaying single mp3 file with all options add_shortcode('musicsingle','music_procedure_single'); function music_procedure_single($atts) { extract( shortcode_atts( array( 'file' => '', ), $atts ) ); global $tabwidth; global $rowheight; global $showsize; global $showlength; global $downloadimg; $html = ''; $html .= ''; $html .= ''; if ( strtolower(substr(strrchr($file,"."),1)) != 'mp3' ) continue; $parts = pathinfo($file); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' .$parts['basename'] . '
' ; return $html; } ?>