'video/avi', // 'mov|qt' => 'video/quicktime', // 'mpeg|mpg|mpe' => 'video/mpeg', // 'asf|asx|wax|wmv|wmx' => 'video/asf', // 'swf' => 'application/x-shockwave-flash', // 'flv' => 'video/x-flv' // )); // // $overrides = array('action'=>'save','mimes'=>$mimes); // // $file = wp_handle_upload($_FILES['video'], $overrides); // // if ( !isset($file['error']) ) { // // $url = $file['url']; // $type = $file['type']; // $file = $file['file']; // $filename = basename($file); // // // Construct the attachment array // $attachment = array( // 'post_title' => $_POST['videotitle'] ? $_POST['videotitle'] : $filename, // 'post_content' => $_POST['descr'], // 'post_status' => 'attachment', // 'post_parent' => $_GET['post'], // 'post_mime_type' => $type, // 'guid' => $url // ); // // // Save the data // $id = wp_insert_attachment($attachment, $file, $post); // // if ( preg_match('!^image/!', $attachment['post_mime_type']) ) { // // Generate the attachment's postmeta. // $imagesize = getimagesize($file); // $imagedata['width'] = $imagesize['0']; // $imagedata['height'] = $imagesize['1']; // list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']); // $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'"; // $imagedata['file'] = $file; // // add_post_meta($id, '_wp_attachment_metadata', $imagedata); // // if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { // if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) // $thumb = wp_create_thumbnail($file, 128); // elseif ( $imagedata['height'] > 96 ) // $thumb = wp_create_thumbnail($file, 96); // // if ( @file_exists($thumb) ) { // $newdata = $imagedata; // $newdata['thumb'] = basename($thumb); // update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata); // } else { // $error = $thumb; // } // } // } else { // add_post_meta($id, '_wp_attachment_metadata', array()); // } // // $_GET['tab'] = 'select'; // } // // } // // if (! current_user_can('edit_others_posts') ) // $and_user = "AND post_author = " . $user_ID; // $and_type = "AND (post_mime_type = 'video/avi' OR post_mime_type = 'video/quicktime' OR post_mime_type = 'video/mpeg' OR post_mime_type = 'video/asf' OR post_mime_type = 'video/x-flv' OR post_mime_type = 'application/x-shockwave-flash')"; // if ( 3664 <= $wp_db_version ) // $attachments = $wpdb->get_results("SELECT post_title, guid FROM $wpdb->posts WHERE post_type = 'attachment' $and_type $and_user ORDER BY post_date_gmt DESC LIMIT 0, 10", ARRAY_A); // else // $attachments = $wpdb->get_results("SELECT post_title, guid FROM $wpdb->posts WHERE post_status = 'attachment' $and_type $and_user ORDER BY post_date_gmt DESC LIMIT 0, 10", ARRAY_A); ?> <?php echo _e('Embed Video','embeddedvideo'); ?>