wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_media_upload_handler [ WordPress Function ]
wp_media_upload_handler ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
Ähnliche Funktionen: media_upload_header, media_upload_form_handler, media_upload_gallery, media_upload_file, media_upload_audio
{@internal Missing Short Description}}
Source
<?php
function wp_media_upload_handler() {
$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']) ) {
$src = $_POST['src'];
if ( !empty($src) && !strpos($src, '://') )
$src = "http://$src";
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
$title = esc_html( stripslashes( $_POST['title'] ) );
if ( empty( $title ) )
$title = esc_html( basename( $src ) );
if ( $title && $src )
$html = "<a href='" . esc_url($src) . "'>$title</a>";
$type = 'file';
if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
$type = $ext_type;
$html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
} else {
$align = '';
$alt = esc_attr( stripslashes( $_POST['alt'] ) );
if ( isset($_POST['align']) ) {
$align = esc_attr( stripslashes( $_POST['align'] ) );
$class = " class='align$align'";
}
if ( !empty($src) )
$html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
$html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
}
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' ) {
$type = 'image';
if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )
$type = $_GET['type'];
return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
}
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
}
?>
Beispiele [ wp-snippets.com ]
Top Google Suchergebnisse
- wp_media_upload_handler (WordPress Function) - WPSeek.com
WordPress lookup for wp_media_upload_handler, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - wp_media_upload_handler | A HitchHackers guide through ...
wp_media_upload_handler. December 13, 2011 by Thorsten · 0 Comments · /wp -admin/includes/media.php · PHPdoc ...
hitchhackerguide.com - wp_media_upload_handler
Function and Method Cross Reference. wp_media_upload_handler(). Defined at: /wp-admin/includes/media.php -> line 504. Referenced 8 times: ...
phpxref.ftwr.co.uk - Version 3.3 « WordPress Codex
Dec 12, 2011... type_url_form_(image|audio|video|file)(); these now wrap wp_media_upload_handler() and wp_media_insert_url_form(); Deprecate RSS ...
codex.wordpress.org