Definition:
function media_upload_video() {}
Defined filters
- video_send_to_editor_url
apply_filters('video_send_to_editor_url', $html, $href, $title)
Source code
function media_upload_video() {
$errors = array();
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
if ( is_wp_error($id) ) {
$errors['upload_error'] = $id;
$id = false;
}
}
if ( !empty($_POST['insertonlybutton']) ) {
$href = $_POST['insertonly']['href'];
if ( !empty($href) && !strpos($href, '://') )
$href = "http://$href";
$title = esc_attr($_POST['insertonly']['title']);
if ( empty($title) )
$title = esc_attr( basename($href) );
if ( !empty($title) && !empty($href) )
$html = "<a href='" . esc_url($href) . "' >$title</a>";
$html = apply_filters('video_send_to_editor_url', $html, $href, $title);
return media_send_to_editor($html);
}
if ( !empty($_POST) ) {
$return = media_upload_form_handler();
if ( is_string($return) )
return $return;
if ( is_array($return) )
$errors = $return;
}
if ( isset($_POST['save']) ) {
$errors['upload_notice'] = __('Saved.');
return media_upload_gallery();
}
if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );
return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
}
2395

February 12, 2011 


No comments yet... Be the first to leave a reply!