delete($wpdb->prefix . 'options', array('option_name' => 'dew_display_options')); } define('PLUGIN_PATH', plugins_url('', __FILE__)); define('SITE_PATH', get_bloginfo('url') . "/"); 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'; $tabWidth = ( isset($tabwidth) && $tabwidth > 0 ) ? $tabwidth : '100%'; $headHeight = ( isset($headheight) && $headheight > 0 ) ? $headheight : '100%'; $rowHeight = ( isset($rowheight) && $rowheight > 0 ) ? $rowheight : '100%'; $headColor = isset($headcolor) ? $headcolor : '#eeeeee'; $priRow = isset($prirow) ? $prirow : '#fff'; $altRow = isset($altrow) ? $altrow : '#fff'; $html = ''; $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 .= ''; } //$download=rawurlencode(SITE_PATH.$path.$file); $html .= ''; $html .= ''; if (isset($maxrows)) { if ($count == $maxrows) { break; } } $count++; } $html .= ''; $html .= '
' . $noheader . '' . $nameheader . '' . $playerheader . '' . $sizeheader . '' . $lengthheader . '' . $downloadheader . '
' . $count . '' . $name . ' ' . $size . ' MB ' . $playtime . '
'; return $html; } ?>