本文整理汇总了PHP中is_upload_space_available函数的典型用法代码示例。如果您正苦于以下问题:PHP is_upload_space_available函数的具体用法?PHP is_upload_space_available怎么用?PHP is_upload_space_available使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_upload_space_available函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpmu_checkAvailableSpace
/**
* Determines if the available space defined by the admin has been exceeded by the user.
*
* @deprecated 3.0.0
* @see is_upload_space_available()
*/
function wpmu_checkAvailableSpace()
{
_deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()');
if (!is_upload_space_available()) {
wp_die(__('Sorry, you must delete files before you can upload any more.'));
}
}
示例2: builder_import_file_ajaxify
/**
* Builder Import Lightbox
* @return html
*/
function builder_import_file_ajaxify()
{
check_ajax_referer('tfb_load_nonce', 'nonce');
$output = '<div class="lightbox_inner themify-builder-import-file-inner">';
$output .= sprintf('<h3>%s</h3>', __('Select a file to import', 'themify'));
if (is_multisite() && !is_upload_space_available()) {
$output .= sprintf(__('<p>Sorry, you have filled your %s MB storage quota so uploading has been disabled.</p>', 'themify'), get_space_allowed());
} else {
$output .= sprintf('<p><div class="themify-builder-plupload-upload-uic hide-if-no-js tf-upload-btn" id="%sthemify-builder-plupload-upload-ui">
<input id="%sthemify-builder-plupload-browse-button" type="button" value="%s" class="builder_button" />
<span class="ajaxnonceplu" id="ajaxnonceplu%s"></span>
</div></p>', 'themify_builder_import_file', 'themify_builder_import_file', __('Upload', 'themify'), wp_create_nonce('themify_builder_import_filethemify-builder-plupload'));
$max_upload_size = (int) wp_max_upload_size() / (1024 * 1024);
$output .= sprintf(__('<p>Maximum upload file size: %d MB.</p>', 'themify'), $max_upload_size);
}
$output .= '</div>';
echo $output;
die;
}
示例3: bp_attachments_get_plupload_default_settings
/**
* Get the BuddyPress Plupload settings.
*
* @since 2.3.0
*
* @return array list of BuddyPress Plupload settings.
*/
function bp_attachments_get_plupload_default_settings()
{
$max_upload_size = wp_max_upload_size();
if (!$max_upload_size) {
$max_upload_size = 0;
}
$defaults = array('runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'file', 'multipart_params' => array('action' => 'bp_upload_attachment', '_wpnonce' => wp_create_nonce('bp-uploader')), 'url' => admin_url('admin-ajax.php', 'relative'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array('max_file_size' => $max_upload_size . 'b'), 'multipart' => true, 'urlstream_upload' => true);
// WordPress is not allowing multi selection for iOs 7 device.. See #29602.
if (wp_is_mobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'OS 7_') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'like Mac OS X') !== false) {
$defaults['multi_selection'] = false;
}
$settings = array('defaults' => $defaults, 'browser' => array('mobile' => wp_is_mobile(), 'supported' => _device_can_upload()), 'limitExceeded' => is_multisite() && !is_upload_space_available());
/**
* Filter the BuddyPress Plupload default settings.
*
* @since 2.3.0
*
* @param array $params Default Plupload parameters array.
*/
return apply_filters('bp_attachments_get_plupload_default_settings', $settings);
}
示例4: display
/**
* Finally output the uploader
*
* @global $type, $tab, $pagenow, $is_IE, $is_opera
* @return string the output
*/
public function display()
{
global $type, $tab, $pagenow, $is_IE, $is_opera;
?>
<form enctype="multipart/form-data" method="post" action="" class="media-upload-form type-form validate standard-form" id="file-form">
<?php
if (!_device_can_upload()) {
echo '<p>' . __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.', 'buddydrive') . '</p>';
return;
}
$upload_size_unit = $max_upload_size = buddydrive_max_upload_size(true);
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<div id="media-upload-notice"><?php
if (isset($errors['upload_notice'])) {
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error"><?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<div id="buddydrive-first-step" class="buddydrive-step">
<label for="buddyfile-desc"><?php
_e('Describe your file', 'buddydrive');
?>
</label>
<textarea placeholder="<?php
_e('140 characters to do so', 'buddydrive');
?>
" maxlength="140" id="buddyfile-desc"></textarea>
<p class="buddydrive-action"><a href="#" class="next-step button"><?php
_e('Next Step', 'buddydrive');
?>
</a></p>
</div>
<?php
if (has_action('buddydrive_uploader_custom_fields')) {
?>
<div id="buddydrive-custom-step-new" class="buddydrive-step hide">
<?php
do_action('buddydrive_uploader_custom_fields');
?>
<p class="buddydrive-action"><a href="#" class="next-step button"><?php
_e('Next Step', 'buddydrive');
?>
</a></p>
</div>
<?php
}
?>
<div id="buddydrive-second-step" class="buddydrive-step hide">
<label for="buddydrive-sharing-options"><?php
_e('Define your sharing options', 'buddydrive');
?>
</label>
<?php
buddydrive_select_sharing_options();
?>
<div id="buddydrive-sharing-details"></div>
<input type="hidden" id="buddydrive-sharing-settings" value="private">
<p class="buddydrive-action"><a href="#" class="next-step button"><?php
_e('Next Step', 'buddydrive');
?>
</a></p>
</div>
<?php
if (is_multisite() && !is_upload_space_available()) {
do_action('upload_ui_over_quota');
return;
//.........这里部分代码省略.........
示例5: media_upload_form
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
global $type, $tab;
$flash_action_url = admin_url('async-upload.php');
// If Mac and mod_security, no Flash. :(
$flash = true;
if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') )
$flash = false;
$flash = apply_filters('flash_uploader', $flash);
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array( 'KB', 'MB', 'GB' );
for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ )
$upload_size_unit /= 1024;
if ( $u < 0 ) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<script type="text/javascript">
//<![CDATA[
var uploaderMode = 0;
jQuery(document).ready(function($){
uploaderMode = getUserSetting('uploader');
$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
});
//]]>
</script>
<div id="media-upload-notice">
<?php if (isset($errors['upload_notice']) ) { ?>
<?php echo $errors['upload_notice']; ?>
<?php } ?>
</div>
<div id="media-upload-error">
<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
<?php echo $errors['upload_error']->get_error_message(); ?>
<?php } ?>
</div>
<?php
// Check quota for this blog if multisite
if ( is_multisite() && !is_upload_space_available() ) {
echo '<p>' . sprintf( __( 'Sorry, you have filled your storage quota (%s MB).' ), get_space_allowed() ) . '</p>';
return;
}
do_action('pre-upload-ui');
if ( $flash ) : ?>
<script type="text/javascript">
//<![CDATA[
var swfu;
SWFUpload.onload = function() {
var settings = {
button_text: '<span class="button"><?php _e('Select Files'); ?><\/span>',
button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }',
button_height: "23",
button_width: "132",
button_text_top_padding: 3,
button_image_url: '<?php echo includes_url('images/upload.png?ver=20100531'); ?>',
button_placeholder_id: "flash-browse-button",
upload_url : "<?php echo esc_attr( $flash_action_url ); ?>",
flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
file_post_name: "async-upload",
file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
post_params : {
"post_id" : "<?php echo $post_id; ?>",
"auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
"logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
"_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
"type" : "<?php echo $type; ?>",
"tab" : "<?php echo $tab; ?>",
"short" : "1"
},
file_size_limit : "<?php echo $max_upload_size; ?>b",
file_dialog_start_handler : fileDialogStart,
file_queued_handler : fileQueued,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
swfupload_pre_load_handler: swfuploadPreLoad,
swfupload_load_failed_handler: swfuploadLoadFailed,
custom_settings : {
degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
//.........这里部分代码省略.........
示例6: print_field
/**
* Print the field based on field type
* @param array $field
*/
public static function print_field($field)
{
$field = wp_parse_args($field, array('id' => '', 'name' => '', 'class' => ''));
switch ($field['type']) {
case 'text':
?>
<input id="<?php
echo esc_attr($field['id']);
?>
" name="<?php
echo esc_attr($field['id']);
?>
" type="text" value="" class="<?php
echo esc_attr($field['class']);
?>
tfb_lb_option">
<?php
if (isset($field['description'])) {
echo wp_kses_post($field['description']);
}
break;
case 'separator':
if (isset($field['meta']['html']) && '' != $field['meta']['html']) {
echo wp_kses_post($field['meta']['html']);
} else {
?>
<hr class="meta_fields_separator" />
<?php
}
break;
case 'image':
?>
<input id="<?php
echo esc_attr($field['id']);
?>
" name="<?php
echo esc_attr($field['id']);
?>
" placeholder="<?php
if (isset($field['value'])) {
echo esc_attr($field['value']);
}
?>
" class="<?php
echo esc_attr($field['class']);
?>
themify-builder-uploader-input tfb_lb_option" type="text" /><br />
<input type="hidden" name="<?php
echo esc_attr($field['id'] . '_attach_id');
?>
" class="themify-builder-uploader-input-attach-id" value="">
<div class="small">
<?php
if (is_multisite() && !is_upload_space_available()) {
?>
<?php
echo sprintf(__('Sorry, you have filled your %s MB storage quota so uploading has been disabled.', 'themify'), get_space_allowed());
?>
<?php
} else {
?>
<div class="themify-builder-plupload-upload-uic hide-if-no-js tf-upload-btn" id="<?php
echo esc_attr($field['id']);
?>
themify-builder-plupload-upload-ui">
<input id="<?php
echo esc_attr($field['id']);
?>
themify-builder-plupload-browse-button" type="button" value="<?php
esc_attr_e(__('Upload', 'themify'));
?>
" class="builder_button" />
<span class="ajaxnonceplu" id="ajaxnonceplu<?php
echo wp_create_nonce($field['id'] . 'themify-builder-plupload');
?>
"></span>
</div> <?php
_e('or', 'themify');
?>
<a href="#" class="themify-builder-media-uploader tf-upload-btn" data-uploader-title="<?php
esc_attr_e('Upload an Image', 'themify');
?>
" data-uploader-button-text="<?php
esc_attr_e('Insert file URL', 'themify');
?>
"><?php
_e('Browse Library', 'themify');
?>
</a>
<?php
}
?>
</div>
//.........这里部分代码省略.........
示例7: admin_url
break;
default:
$up_url = admin_url('async-upload.php', 'relative');
break;
}
$defaults = array('runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'async-upload', 'url' => $up_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array('max_file_size' => $max_upload_size . 'b'));
/**
* Filter the Plupload default settings.
*
* @since 3.4.0
*
* @param array $defaults Default Plupload settings array.
*/
$defaults = apply_filters('plupload_default_settings', $defaults);
$params = array('action' => 'upload-attachment');
/**
* Filter the Plupload default parameters.
*
* @since 3.4.0
*
* @param array $params Default Plupload parameters array.
*/
$params = apply_filters('plupload_default_params', $params);
$params['_wpnonce'] = wp_create_nonce('media-form');
$defaults['multipart_params'] = $params;
$settings = array('defaults' => $defaults, 'browser' => array('mobile' => wp_is_mobile(), 'supported' => _device_can_upload()), 'limitExceeded' => is_multisite() && !is_upload_space_available());
$script = 'var _wpPluploadSettings = ' . json_encode($settings) . ';';
if ($data) {
$script = "{$data}\n{$script}";
}
$wp_scripts->add_data('wp-plupload', 'data', $script);
示例8: media_upload_form
/**
* {@internal Missing Short Description}}
*
* @since 2.5.0
*
* @param unknown_type $errors
*/
function media_upload_form($errors = null)
{
global $type, $tab, $pagenow, $is_IE, $is_opera;
if (!_device_can_upload()) {
echo '<p>' . __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.') . '</p>';
return;
}
$upload_action_url = admin_url('async-upload.php');
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$_type = isset($type) ? $type : '';
$_tab = isset($tab) ? $tab : '';
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<div id="media-upload-notice"><?php
if (isset($errors['upload_notice'])) {
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error"><?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
if (is_multisite() && !is_upload_space_available()) {
do_action('upload_ui_over_quota');
return;
}
do_action('pre-upload-ui');
$post_params = array("post_id" => $post_id, "_wpnonce" => wp_create_nonce('media-form'), "type" => $_type, "tab" => $_tab, "short" => "1");
$post_params = apply_filters('upload_post_params', $post_params);
// hook change! old name: 'swfupload_post_params'
$plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => $max_upload_size . 'b', 'url' => $upload_action_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $post_params);
// Multi-file uploading doesn't currently work in iOS Safari,
// single-file allows the built-in camera to be used as source for images
if (wp_is_mobile()) {
$plupload_init['multi_selection'] = false;
}
$plupload_init = apply_filters('plupload_init', $plupload_init);
?>
<script type="text/javascript">
<?php
// Verify size is an int. If not return default value.
$large_size_h = absint(get_option('large_size_h'));
if (!$large_size_h) {
$large_size_h = 1024;
}
$large_size_w = absint(get_option('large_size_w'));
if (!$large_size_w) {
$large_size_w = 1024;
}
?>
var resize_height = <?php
echo $large_size_h;
?>
, resize_width = <?php
echo $large_size_w;
?>
,
wpUploaderInit = <?php
echo json_encode($plupload_init);
?>
;
</script>
<div id="plupload-upload-ui" class="hide-if-no-js">
<?php
do_action('pre-plupload-upload-ui');
// hook change, old name: 'pre-flash-upload-ui'
?>
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info"><?php
_e('Drop files here');
?>
</p>
<p><?php
_ex('or', 'Uploader: Drop files here - or - Select Files');
?>
//.........这里部分代码省略.........
示例9: themify_has_quota
/**
* Check if user has available space in multisite installations
* @param String $allowed Content to show if there is space available
* @param Boolean $echo Flag establishing if content must be echoed or returned
* @return String
* @since 1.1.5
*/
function themify_has_quota($allowed, $echo = false, $custom = '')
{
if (is_multisite() && !is_upload_space_available()) {
if ('' != $custom) {
$message = $custom;
} else {
$message = '<small>' . sprintf(__('Sorry, you have filled your %s MB storage quota so uploading has been disabled.', 'themify'), get_space_allowed()) . '</small>';
}
} else {
$message = $allowed;
}
if ($echo) {
echo wp_kses_post($message);
}
return $message;
}
示例10: media_upload_form
public function media_upload_form($errors = null)
{
global $type, $tab, $pagenow, $is_IE, $is_opera;
if (function_exists('_device_can_upload') && !_device_can_upload()) {
echo '<p>' . __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.') . '</p>';
return;
}
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<div id="media-upload-notice"><?php
if (isset($errors['upload_notice'])) {
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error"><?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
if (is_multisite() && !is_upload_space_available()) {
return;
}
$post_params = array("action" => "mymail_import_subscribers_upload_handler", "_wpnonce" => wp_create_nonce('mymail_nonce'));
$upload_action_url = admin_url('admin-ajax.php');
$plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => $max_upload_size . 'b', 'url' => $upload_action_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Comma-separated values (CSV)', 'mymail'), 'extensions' => 'csv')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $post_params, 'multi_selection' => false);
?>
<script type="text/javascript">
var wpUploaderInit = <?php
echo json_encode($plupload_init);
?>
;
</script>
<div id="plupload-upload-ui" class="hide-if-no-js">
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info"><?php
_e('Drop your list here', 'mymail');
?>
</p>
<p><?php
_ex('or', 'Uploader: Drop files here - or - Select Files');
?>
</p>
<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php
esc_attr_e('Select File', 'mymail');
?>
" class="button" /></p>
</div>
</div>
</div>
<div id="html-upload-ui" class="hide-if-js">
<p id="async-upload-wrap">
<label class="screen-reader-text" for="async-upload"><?php
_e('Upload');
?>
</label>
<input type="file" name="async-upload" id="async-upload" />
<?php
submit_button(__('Upload'), 'button', 'html-upload', false);
?>
<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php
_e('Cancel');
?>
</a>
</p>
<div class="clear"></div>
</div>
<p class="max-upload-size"><?php
printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($sizes[$u]));
?>
<?php
_e('Split your lists into max 50.000 subscribers each', 'mymail');
?>
</p>
<?php
if (($is_IE || $is_opera) && $max_upload_size > 100 * 1024 * 1024) {
?>
<span class="big-file-warning"><?php
_e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.');
?>
</span>
<?php
//.........这里部分代码省略.........
示例11: s2sfu_media_upload_form
/**
* Modified From media_upload_form in WordPress 3.2.1 Core
*
* {@internal Missing Short Description}}
*
* @since 2.5.0
*
* @return unknown
*/
function s2sfu_media_upload_form($errors)
{
global $type, $tab, $pagenow;
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<div id="media-upload-notice">
<?php
if (isset($errors['upload_notice'])) {
?>
<?php
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error">
<?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
?>
<?php
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
// Check quota for this blog if multisite
if (is_multisite() && !is_upload_space_available()) {
echo '<p>' . sprintf(__('Sorry, you have filled your storage quota (%s MB).'), get_space_allowed()) . '</p>';
return;
}
do_action('pre-upload-ui');
?>
<div id="html-upload-ui" <?php
if ($flash) {
echo 'class="hide-if-js"';
}
?>
>
<?php
do_action('pre-html-upload-ui');
?>
<p id="async-upload-wrap">
<label class="screen-reader-text" for="async-upload"><?php
_e('Upload');
?>
</label>
<input type="file" name="async-upload" id="async-upload" />
<?php
submit_button(__('Insert into Post'), 'button', 'html-upload', false);
?>
<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php
_e('Cancel');
?>
</a>
</p>
<div class="clear"></div>
<p class="media-upload-size"><?php
printf(__('Maximum upload file size: %d%s'), $upload_size_unit, $sizes[$u]);
?>
</p>
<?php
if (is_lighttpd_before_150()) {
?>
<p><?php
_e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please update to lighttpd 1.5.');
?>
</p>
<?php
}
do_action('post-html-upload-ui', $flash);
?>
</div>
<?php
do_action('post-upload-ui');
}
示例12: wp_print_media_templates
/**
* Prints the templates used in the media manager.
*
* @since 3.5.0
*/
function wp_print_media_templates()
{
global $is_IE;
$class = 'media-modal wp-core-ui';
if ($is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false) {
$class .= ' ie7';
}
?>
<script type="text/html" id="tmpl-media-frame">
<div class="media-frame-menu"></div>
<div class="media-frame-title"></div>
<div class="media-frame-router"></div>
<div class="media-frame-content"></div>
<div class="media-frame-toolbar"></div>
<div class="media-frame-uploader"></div>
</script>
<script type="text/html" id="tmpl-media-modal">
<div class="<?php
echo $class;
?>
">
<a class="media-modal-close" href="#" title="<?php
esc_attr_e('Close');
?>
"><span class="media-modal-icon"></span></a>
<div class="media-modal-content"></div>
</div>
<div class="media-modal-backdrop"></div>
</script>
<script type="text/html" id="tmpl-uploader-window">
<div class="uploader-window-content">
<h3><?php
_e('Drop files to upload');
?>
</h3>
</div>
</script>
<script type="text/html" id="tmpl-uploader-editor">
<div class="uploader-editor-content">
<div class="uploader-editor-title"><?php
_e('Drop files to upload');
?>
</div>
</div>
</script>
<script type="text/html" id="tmpl-uploader-inline">
<# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
<div class="uploader-inline-content {{ messageClass }}">
<# if ( data.message ) { #>
<h3 class="upload-message">{{ data.message }}</h3>
<# } #>
<?php
if (!_device_can_upload()) {
?>
<h3 class="upload-instructions"><?php
printf(__('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://wordpress.org/mobile/');
?>
</h3>
<?php
} elseif (is_multisite() && !is_upload_space_available()) {
?>
<h3 class="upload-instructions"><?php
_e('Upload Limit Exceeded');
?>
</h3>
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action('upload_ui_over_quota');
?>
<?php
} else {
?>
<div class="upload-ui">
<h3 class="upload-instructions drop-instructions"><?php
_e('Drop files anywhere to upload');
?>
</h3>
<a href="#" class="browser button button-hero"><?php
_e('Select Files');
?>
</a>
</div>
<div class="upload-inline-status"></div>
<div class="post-upload-ui">
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action('pre-upload-ui');
/** This action is documented in wp-admin/includes/media.php */
//.........这里部分代码省略.........
示例13: media_upload_form
/**
* {@internal Missing Short Description}}
*
* @since 2.5.0
*
* @param unknown_type $errors
*/
function media_upload_form($errors = null)
{
global $type, $tab, $pagenow;
$upload_action_url = admin_url('async-upload.php');
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
<div id="media-upload-notice"><?php
if (isset($errors['upload_notice'])) {
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error"><?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
// Check quota for this blog if multisite
if (is_multisite() && !is_upload_space_available()) {
echo '<p>' . sprintf(__('Sorry, you have filled your storage quota (%s MB).'), get_space_allowed()) . '</p>';
return;
}
do_action('pre-upload-ui');
$post_params = array("post_id" => $post_id, "_wpnonce" => wp_create_nonce('media-form'), "type" => $type, "tab" => $tab, "short" => "1");
$post_params = apply_filters('upload_post_params', $post_params);
// hook change! old name: 'swfupload_post_params'
$plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => round((int) $max_upload_size / 1024) . 'kb', 'url' => $upload_action_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $post_params);
$plupload_init = apply_filters('plupload_init', $plupload_init);
?>
<script type="text/javascript">
var resize_height = <?php
echo get_option('large_size_h', 1024);
?>
,
resize_width = <?php
echo get_option('large_size_w', 1024);
?>
,
wpUploaderInit = <?php
echo json_encode($plupload_init);
?>
;
</script>
<div id="plupload-upload-ui" class="hide-if-no-js">
<?php
do_action('pre-plupload-upload-ui');
// hook change, old name: 'pre-flash-upload-ui'
?>
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info"><?php
_e('Drop files here');
?>
</p>
<p><?php
_ex('or', 'Uploader: Drop files here - or - Select Files');
?>
</p>
<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php
esc_attr_e('Select Files');
?>
" class="button" /></p>
</div>
</div>
<?php
do_action('post-plupload-upload-ui');
// hook change, old name: 'post-flash-upload-ui'
?>
</div>
<div id="html-upload-ui" class="hide-if-js">
<?php
do_action('pre-html-upload-ui');
?>
<p id="async-upload-wrap">
<label class="screen-reader-text" for="async-upload"><?php
_e('Upload');
//.........这里部分代码省略.........
示例14: media_upload_form
/**
* {@internal Missing Short Description}}
*
* @since 2.5.0
*
* @param unknown_type $errors
*/
function media_upload_form($errors = null)
{
global $type, $tab, $pagenow;
$upload_action_url = admin_url('async-upload.php');
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
?>
</script>
<div id="media-upload-notice">
<?php
if (isset($errors['upload_notice'])) {
?>
<?php
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error">
<?php
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
?>
<?php
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
// Check quota for this blog if multisite
if (is_multisite() && !is_upload_space_available()) {
echo '<p>' . sprintf(__('Sorry, you have filled your storage quota (%s MB).'), get_space_allowed()) . '</p>';
return;
}
do_action('pre-upload-ui');
// Set the post params, which plupload will post back with the file, and pass
// them through a filter.
$post_params = array("post_id" => $post_id, "auth_cookie" => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE], "_wpnonce" => wp_create_nonce('media-form'), "type" => $type, "tab" => $tab, "short" => "1");
$post_params = apply_filters('upload_post_params', $post_params);
// hook change! old name: 'swfupload_post_params'
$p = array();
foreach ($post_params as $param => $val) {
$val = esc_js($val);
$p[] = "'{$param}' : '{$val}'";
}
$post_params_str = implode(',', $p) . "\n";
?>
<script type="text/javascript">
//<![CDATA[
var resize_height = <?php
echo get_option('large_size_h', 1024);
?>
,
resize_width = <?php
echo get_option('large_size_w', 1024);
?>
;
jQuery(document).ready(function($) {
window.uploader = new plupload.Uploader({
runtimes: '<?php
echo apply_filters('plupload_runtimes', 'html5,silverlight,flash,html4');
?>
',
browse_button: 'plupload-browse-button',
container: 'plupload-upload-ui',
drop_element: 'media-upload',
file_data_name: 'async-upload',
max_file_size: '<?php
echo round((int) $max_upload_size / 1024);
?>
kb',
url: '<?php
echo esc_js($upload_action_url);
?>
',
flash_swf_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.flash.swf'));
?>
',
silverlight_xap_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.silverlight.xap'));
?>
//.........这里部分代码省略.........
示例15: add_templates
//.........这里部分代码省略.........
</span>
<select id="brightcove-media-source" class="brightcove-media-source"{{disabled}}>
<# _.each(data.accounts, function (account, hash) {
if (account.client_id === data.accounts[data.account].client_id) {
var selected = ' selected';
} #>
<option value="{{ hash }}"{{selected}}>{{ account.account_name }}</option>
<# }); #>
</select>
</label>
</div>
</script>
<?php
/* Used by views/upload-window.js */
?>
<script type="text/html" id="tmpl-brightcove-uploader-window">
<div id="drop-target" class="uploader-window-content">
<h3><?php
esc_html_e('Drop files to upload', 'brightcove');
?>
</h3>
</div>
</script>
<?php
/* Used by views/upload-video-manager.js */
?>
<script type="text/html" id="tmpl-brightcove-uploader-inline">
<div class="uploader-inline-content">
<?php
if (is_multisite() && !is_upload_space_available()) {
?>
<h3 class="upload-instructions"><?php
esc_html_e('Upload Limit Exceeded', 'brightcove');
?>
</h3>
<?php
} else {
?>
<div class="upload-ui">
<h3 class="upload-instructions drop-instructions"><?php
esc_html_e('Drop files anywhere to upload', 'brightcove');
?>
</h3>
<p class="upload-instructions drop-instructions"><?php
_ex('or', 'Uploader: Drop files here - or - Select Files');
?>
</p>
<a href="#" id="brightcove-select-files-button" class="browser button button-hero"><?php
esc_html_e('Select Files', 'brightcove');
?>
</a>
</div>
<div class="upload-inline-status"></div>
<div class="post-upload-ui">
<?php
$max_upload_size = wp_max_upload_size();
if (!$max_upload_size) {
$max_upload_size = 0;
}
?>