media_upload_type_url_form [ WordPress Function ]
media_upload_type_url_form ( $type = null, $errors = null, $id = null )
| Parameters: |
|
| Defined at: |
|
Soorgelijke functies: media_upload_type_form, media_upload_form, media_upload_gallery_form, media_upload_library_form, media_upload_text_after
{@internal Missing Short Description}}
Source
<?php
function media_upload_type_url_form($type = null, $errors = null, $id = null) {
if ( null === $type )
$type = 'image';
media_upload_header();
$post_id = intval($_REQUEST['post_id']);
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form type-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>
<h3 class="media-title"><?php _e('Insert media from another website'); ?></h3>
<script type="text/javascript">
//<![CDATA[
var addExtImage = {
width : '',
height : '',
align : 'alignnone',
insert : function() {
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
if ( '' == f.src.value || '' == t.width )
return false;
if ( f.title.value ) {
title = f.title.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
title = ' title="'+title+'"';
}
if ( f.alt.value )
alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
if ( f.caption.value ) {
caption = f.caption.value.replace(/\r\n|\r/g, '\n');
caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
return a.replace(/[\r\n\t]+/, ' ');
});
caption = caption.replace(/\s*\n\s*/g, '<br />');
}
<?php } ?>
cls = caption ? '' : ' class="'+t.align+'"';
html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';
if ( f.url.value ) {
url = f.url.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
html = '<a href="'+url+'">'+html+'</a>';
}
if ( caption )
html = '[caption id="" align="'+t.align+'" width="'+t.width+'"]'+html+caption+'[/caption]';
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor(html);
return false;
},
resetImageData : function() {
var t = addExtImage;
t.width = t.height = '';
document.getElementById('go_button').style.color = '#bbb';
if ( ! document.forms[0].src.value )
document.getElementById('status_img').innerHTML = '*';
else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';
},
updateImageData : function() {
var t = addExtImage;
t.width = t.preloadImg.width;
t.height = t.preloadImg.height;
document.getElementById('go_button').style.color = '#333';
document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';
},
getImageData : function() {
if ( jQuery('table.describe').hasClass('not-image') )
return;
var t = addExtImage, src = document.forms[0].src.value;
if ( ! src ) {
t.resetImageData();
return false;
}
document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />';
t.preloadImg = new Image();
t.preloadImg.onload = t.updateImageData;
t.preloadImg.onerror = t.resetImageData;
t.preloadImg.src = src;
}
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- media_upload_type_url_form | A HitchHackers guide through ...
Feb 12, 2011 ... Source code. function media_upload_type_url_form($type = 'file', $errors = null, $ id = null) { media_upload_header(); $post_id ...
hitchhackerguide.com - disable_captions - A HitchHackers guide through WordPress
Feb 12, 2011 ... media_upload_type_url_form in /wp-admin/includes/media.php. 2391. Read more · $, /wp-admin/includes/media.php, Documentation, Files, ...
hitchhackerguide.com - PHPXRef 0.7 : WordPress : Detail view of media.php
media_upload_type_url_form() media_upload_gallery_form() ...
phpxref.ftwr.co.uk - #15655 (Media Upload form does not pass tab name) – WordPress ...
$form_action_url = admin_url("media-upload.php?type=$type&tab=$tab&post_id =$post_id");. This change also impacts function media_upload_type_url_form ...
core.trac.wordpress.org