ID; echo ""; } add_action('wp_ajax_ex_aa', 'ex_aa_callback'); function ex_aa_callback() { global $wpdb; $nonce = $_POST['nonce']; $post_id = $_POST['post_id']; $post_meta = $_POST['post_meta']; $durum = $_POST['durum']; if (!wp_verify_nonce($nonce,'ajax-nonce')){ die ( 'Busted!');} else { if ($durum == "resim") { update_post_meta($post_id,'ex_rsm',$post_meta); } if ($durum == "muzik") { update_post_meta($post_id,'ex_muz',$post_meta); } if ($durum == "video") { update_post_meta($post_id,'ex_vid',$post_meta); } if ($durum == "dosya"){ update_post_meta($post_id,'ex_dosya',$post_meta); } } die(); } add_action('wp_ajax_get_imgs', 'ex_getimgs'); function ex_getimgs() { global $wpdb; $post_id = $_GET['post_id']; $postmim = $_GET['postmim']; $args = array( 'post_type'=> 'attachment', 'post_parent'=> $post_id, 'post_mime_type'=> $postmim, 'numberposts' => -1 ); $imgs = get_posts($args); $c = count($imgs); if ($c > 0) { foreach ($imgs as $img) { $ret[]= array('id' =>$img->ID, 'post_name' => $img->post_name); } } else { $ret[] = array('id' => '-', 'post_name' => 'Nope'); } $output = $ret; echo json_encode($output); die(); } // Shortcode for Images function getimages_aa($atts) { global $post; $opts = get_option('auto_attachments_options'); $gmeta = get_post_meta($post->ID,'aa_post_meta', TRUE); if (isset($gmeta['gshow'])){$gshow = $gmeta['gshow'];} if ($opts['galeri'] == 'yes') { extract(shortcode_atts(array("id" => ''), $atts)); $dis = explode(',',$id); $ex_rsm = get_post_meta($post->ID,'ex_rsm',true); $imageaa = ""; if($gshow == 'yes' || $gshow == '') { if ($ex_rsm != "") { $imageaa .= "
"; foreach ($dis as $di){ $posti = get_post($di); $aath = wp_get_attachment_image_src($posti->ID, 'aa_thumb'); $aabg = wp_get_attachment_image_src($posti->ID, 'aa_big'); $imageaa .= ""; } $imageaa .="
 
"; } } return $imageaa; } } add_shortcode('imageaa', 'getimages_aa'); // Shortcode for Images // Shortcode for Files function getfiles_aa($atts) { global $post; $opts = get_option('auto_attachments_options'); $gmeta = get_post_meta($post->ID,'aa_post_meta', TRUE); if (isset($gmeta['fshow'])){$fshow = $gmeta['fshow'];} if ($opts['hidefilesall'] == 'no'){ extract(shortcode_atts(array("id" => ''), $atts)); $dis = explode(',',$id); $ex_dosya = get_post_meta($post->ID,'ex_dosya',true); $urlp = plugins_url('/auto-attachments/includes'); $filesaa = ""; if($fshow == 'yes' || $fshow == '') { if ($ex_dosya != "") { $filesaa .= "
"; foreach ($dis as $di){ $posti = get_post($di); $fhh = $opts['fhh']; $fhw = $opts['fhw']; if ($opts['newwindow'] == 'yes') {$target = 'target="_blank"';} else {$target = "";} $_link = wp_get_attachment_url($posti->ID); //get the url for linkage $_name_array = explode("/", $_link); $_post_mime = str_replace("/", "-", $posti->post_mime_type); $_name = array_reverse($_name_array); $filesaa .= "
" . $posti->post_title . "
"; } $filesaa .="
 
"; } } return $filesaa; } } add_shortcode('filesaa', 'getfiles_aa'); // Shortcode for Audio function getmusic_aa($atts) { global $post; $opts = get_option('auto_attachments_options'); $gmeta = get_post_meta($post->ID,'aa_post_meta', TRUE); if (isset($gmeta['ashow'])){$ashow = $gmeta['ashow'];} if ($opts['hideaudioall'] == 'no'){ extract(shortcode_atts(array("id" => ''), $atts)); $dis = explode(',',$id); $ex_muz = get_post_meta($post->ID,'ex_muz',true); $urlp = plugins_url('/auto-attachments/includes'); $skin = $opts['jwskin']; $jhw = $opts['jhw']; $musicaa = ""; if($ashow == 'yes' || $ashow == '') { wp_enqueue_script('mel',''.$urlp.'/js/mel/mediaelement-and-player.min.js',array('jquery')); wp_enqueue_script('melsc-a',''.$urlp.'/js/mel/mscript-a.js',array('jquery')); wp_enqueue_style('melcss',''.$urlp.'/js/mel/mediaelementplayer.min.css', __FILE__); wp_enqueue_style('melcsss',''.$urlp.'/js/mel/mejs-skins.css', __FILE__); if ($ex_muz != "") { $musicaa .= "
"; foreach ($dis as $di){ $posti = get_post($di); $musicaa .= ""; } $musicaa .="
 
"; } } return $musicaa; } } add_shortcode('musicaa', 'getmusic_aa'); // Shortcode for Videos function getvideo_aa($atts) { global $post; $opts = get_option('auto_attachments_options'); $gmeta = get_post_meta($post->ID,'aa_post_meta', TRUE); if (isset($gmeta['vshow'])){$vshow = $gmeta['vshow'];} if ($opts['hidevideoall'] == 'no'){ extract(shortcode_atts(array("id" => ''), $atts)); $dis = explode(',',$id); $ex_vid = get_post_meta($post->ID,'ex_vid',true); $urlp = plugins_url('/auto-attachments/includes'); $skin = $opts['jwskin']; $jhw = $opts['jhw']; $jhh = $opts['jhh']; $videoaa = ""; if($vshow == 'yes' || $vshow == '') { wp_enqueue_script('mel',''.$urlp.'/js/mel/mediaelement-and-player.min.js',array('jquery')); wp_enqueue_script('melsc',''.$urlp.'/js/mel/mscript.js',array('jquery')); wp_enqueue_style('melcss',''.$urlp.'/js/mel/mediaelementplayer.min.css', __FILE__); wp_enqueue_style('melcsss',''.$urlp.'/js/mel/mejs-skins.css', __FILE__); if ($ex_vid != "") { $videoaa .= "
"; foreach ($dis as $di){ $posti = get_post($di); $videoaa .= ""; } $videoaa .="
 
"; } } return $videoaa; } } add_shortcode('videoaa', 'getvideo_aa'); // End Of shortcodes.php ?>