'Files to Listen', // Default inf. bar title (audio) 'video_watch' => 'Files to Watch', // Default inf. bar title (video) 'rarupload' => 'yes', 'showmp3info' => 'yes', 'showvideoinfo' => 'yes', 'galeri' => 'yes', 'thw' => '100', 'thh' => '100', ); //add 2 db add_option('OPTIONS', $aaopts); //reload $aaopts = get_option('OPTIONS'); //Add RAR upload allow $rarupload1 = get_option('rarupload'); if ($rarupload1 == 'yes') { function yeni_mime_type($mimes) { $yeni_mime = array ( 'rar' => 'application/x-rar-compressed'); return array_merge($mimes,$yeni_mime); } add_filter('upload_mimes','yeni_mime_type'); } //Colorbox usage (added with 0.2.7) $colorboxusage = get_option('use_colorbox'); if ($colorboxusage == 'yes') { add_action('wp_print_scripts', 'enqueue_my_scripts'); add_action('wp_print_styles', 'enqueue_my_styles'); } function enqueue_my_scripts() { $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; wp_enqueue_script('jquery'); wp_enqueue_script('colorbox_script', "$urlp/colorbox/jquery.colorbox-min.js" , array('jquery')); wp_enqueue_script('colorbox_js', "$urlp/colorbox/mycolorbox.js" , array('jquery')); } function enqueue_my_styles() { $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; wp_enqueue_style('colorbox_css', "$urlp/colorbox/colorbox.css"); } //Add Css into Header (Header Text Options (added with v0.2.6)) add_action('wp_head', 'addHeaderCode'); function addHeaderCode() { $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; echo '' . "\n"; //With 0.2.6 you can decide show or hide :) if (get_option('showmp3info') == '') {echo '';} if (get_option('showvideoinfo') == '') {echo '';} } //Custom Admin Area Settinngs add_action('admin_menu', 'aa_admin_page'); function aa_admin_page() { add_options_page(__('Auto Attachments', 'autoa'), __('Auto Attachments', 'autoa'), '8', 'auto_attachments', 'aa_settings'); } function aa_settings() { if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } global $aaopts, $_POST; $error_audio =""; $error_video =""; // Check if values filled //Audio Header Text $mp3fill = get_option('mp3_listen'); if ($mp3fill == '') {$error_audio = __('Please Fill Audio Header Text Area.', 'autoa');} else {@$aaopts['mp3_listen'] = $_POST['mp3_listen'];} //Video Header Text $videofill = get_option('video_watch'); if ($videofill == '') {$error_video = __('Please Fill Video Header Text Area.', 'autoa');} else {@$aaopts['video_watch'] = $_POST['video_watch'];} //display it in that fancy fading div if($error_audio != '') { echo '

'.$error_audio.'

'; } if($error_video != '') { echo '

'.$error_video.'

'; } //Checking Finish //Define update (mp3_listen and video watch defined above) @$aaopts['rarupload'] = $_POST['rarupload']; @$aaopts['showmp3info'] = $_POST['showmp3info']; @$aaopts['showvideoinfo'] = $_POST['showvideoinfo']; @$aaopts['galeri'] = $_POST['galeri']; @$aaopts['use_colorbox'] = $_POST['use_colorbox']; @$aaopts['thw'] = $_POST['thw']; @$aaopts['thh'] = $_POST['thh']; update_option('OPTIONS', $aaopts); //Start to write admin area ?>

()


Serkan Algur

Header Texts from here. You can localize to your language :)', 'autoa')?>

*) Highly Required', 'autoa')?>


*


*


/> '.__('Rar File Upload Enabled', 'autoa').''; } else { echo ''.__('Rar File Upload Disabled', 'autoa').'';}?>


/> '.__('Mp3 Info Header Enabled', 'autoa').''; } else { echo ''.__('Mp3 Info Header Disabled', 'autoa').'';}?>
/> '.__('Video Info Header Enabled', 'autoa').''; } else { echo ''.__('Video Info Header Disabled', 'autoa').'';}?>


/> '.__('Gallery Enabled', 'autoa').''; } else { echo ''.__('Gallery Disabled', 'autoa').'';}?>

/> '.__('Colorbox usage is Enabled', 'autoa').''; } else { echo ''.__('Colorbox usage is Disabled', 'autoa').'';}?>

px ()
px ()

"; if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/pdf', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Word Documents if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/msword', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Powerpoint Documents if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/vnd.ms-powerpoint', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Excel Documents if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/vnd.ms-excel', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Zipped Files if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/zip', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Rar files if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/x-rar-compressed', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //x-tar files if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/x-tar', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //x-gzip files if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/x-gzip', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //ODS if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/vnd.oasis.opendocument.spreadsheet', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //ODF if ( $files = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'application/vnd.oasis.opendocument.formula', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "".$file->post_title.""; $sAttachmentString .= "
"; } } //Audio Files $mp3s = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'audio', //MIME Type condition ) ); if (!empty($mp3s)) : $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $sAttachmentString .= "
".get_option('mp3_listen')."
"; endif; //Video Support flv, mp4, etc. added with 0.2 $videoss = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'video', //MIME Type condition ) ); if (!empty($videoss)) : $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $sAttachmentString .= "
".get_option('video_watch')."
"; endif; if (get_option('galeri') == 'yes') { if ( $galeriresim = get_children(array( //do only if there are attachments of these qualifications 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'image', //MIME Type condition ))){ $sAttachmentString .= "
"; foreach( $galeriresim as $galerir ){ //setup array for more than one file attachment $thh = get_option('thh'); $thw = get_option('thw'); $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $file_link = wp_get_attachment_url($galerir->ID); //get the url for linkage $file_name_array=explode("/",$galrerir_link); $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; } } $sAttachmentString .= "
"; } $sAttachmentString .= ""; $sAttachmentString .= "
"; if($echo){ echo $sAttachmentString; } return $sAttachmentString; } //Insert code after the_content (!important) add_filter('the_content', 'insertintoContent'); function insertintoContent($content) { if(is_single()) { $content .= get_attachment_icons(); } return $content; } //Show Plugin Version into Admin Page function plugin_get_version() { if ( ! function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) ); $plugin_file = basename( ( __FILE__ ) ); return $plugin_folder[$plugin_file]['Version']; } ?>