/** * 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.')); } }
/** * 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; }
/** * 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); }
/** * 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; } $buddydrive_params = array('action' => 'buddydrive_upload', '_wpnonce' => wp_create_nonce('buddydrive-form')); $buddydrive_params = apply_filters('buddydrive_upload_post_params', $buddydrive_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' => 'buddyfile-upload', 'multi_selection' => false, '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(array('title' => __('Allowed Files'), 'extensions' => '*', 'max_file_size' => $max_upload_size . 'b')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $buddydrive_params); $plupload_init = apply_filters('buddydrive_plupload_init', $plupload_init); ?> <script type="text/javascript"> var wpUploaderInit = <?php echo json_encode($plupload_init); ?> ; </script> <div id="buddydrive-third-step" class="buddydrive-step hide"> <label for="plupload-browse-buttons"><?php _e('Upload your file!', 'buddydrive'); ?> </label> <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 file here', 'buddydrive'); ?> </p> <p><?php _ex('or', 'Uploader: Drop your file here - or - Select your File', 'buddydrive'); ?> </p> <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select your File', 'buddydrive'); ?> " class="button" /></p> </div> </div> </div> <p><span class="max-upload-size"><?php printf(__('Maximum upload file size: %d%s.', 'buddydrive'), esc_html($upload_size_unit), esc_html($sizes[$u])); ?> </span></p> <p class="buddydrive-action"><a href="#" class="cancel-step button"><?php _e('Cancel', 'buddydrive'); ?> </a></p> </div> </form> <?php }
/** * {@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 swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available }, debug: false }; swfu = new SWFUpload(settings); }; //]]> </script> <div id="flash-upload-ui" class="hide-if-no-js"> <?php do_action('pre-flash-upload-ui'); ?> <div> <?php _e( 'Choose files to upload' ); ?> <div id="flash-browse-button"></div> <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /></span> </div> <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p> <?php do_action('post-flash-upload-ui'); ?> <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> </div> <?php endif; // $flash ?> <div id="html-upload-ui"> <?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" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <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 upgrade to lighttpd 1.5.'); ?></p> <?php endif;?> <?php do_action('post-html-upload-ui', $flash); ?> </div> <?php do_action('post-upload-ui'); ?> <?php }
/** * 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> <p class="thumb_preview"> <span class="img-placeholder"></span> <a href="#" class="themify_builder_icon small delete themify-builder-delete-thumb"></a> </p> <?php break; case 'select': ?> <select id="<?php echo esc_attr($field['id']); ?> " name="<?php echo esc_attr($field['id']); ?> " class="tfb_lb_option <?php echo esc_attr($field['class']); ?> "> <?php if (isset($field['default'])) { ?> <option value="<?php echo esc_attr($field['default']); ?> "><?php echo esc_html($field['default']); ?> </option> <?php } foreach ($field['meta'] as $option) { ?> <option value="<?php echo esc_attr($option['value']); ?> "><?php echo esc_html($option['name']); ?> </option> <?php } ?> </select> <?php if (isset($field['description'])) { echo wp_kses_post($field['description']); } ?> <?php break; case 'font_select': $fonts = array_merge(themify_get_web_safe_font_list(), themify_get_google_web_fonts_list()); ?> <select id="<?php echo esc_attr($field['id']); ?> " name="<?php echo esc_attr($field['id']); ?> " class="tfb_lb_option <?php echo esc_attr($field['class']); ?> "> <?php if (isset($field['default'])) { ?> <option value="<?php echo esc_attr($field['default']); ?> "><?php echo esc_html($field['default']); ?> </option> <?php } foreach ($fonts as $option) { ?> <option value="<?php echo esc_attr($option['value']); ?> "><?php echo esc_html($option['name']); ?> </option> <?php } ?> </select> <?php if (isset($field['description'])) { echo wp_kses_post($field['description']); } ?> <?php break; case 'color': ?> <span class="builderColorSelect"><span></span></span> <input type="text" class="<?php echo esc_attr($field['class']); ?> colordisplay"/> <input id="<?php echo esc_attr($field['id']); ?> " name="<?php echo esc_attr($field['id']); ?> " value="" class="builderColorSelectInput tfb_lb_option" type="text" /> <?php break; case 'radio': foreach ($field['meta'] as $option) { ?> <input type="radio" id="<?php echo esc_attr($field['id'] . '_' . $option['value']); ?> " name="<?php echo esc_attr($field['id']); ?> " value="<?php echo esc_attr($option['value']); ?> " class="tfb_lb_option" <?php checked(isset($option['selected']) ? $option['selected'] : false, true); ?> > <label for="<?php echo esc_attr($field['id'] . '_' . $option['value']); ?> "><?php echo esc_html($option['name']); ?> </label> <?php } break; case 'textarea': if (!array_key_exists('rows', $field) || empty($field['rows'])) { $field['rows'] = '3'; } ?> <textarea id="<?php echo esc_attr($field['id']); ?> " name="<?php echo esc_attr($field['id']); ?> " class="<?php echo esc_attr($field['class']); ?> tfb_lb_option" rows="<?php echo esc_attr($field['rows']); ?> "></textarea> <?php if (isset($field['description'])) { ?> <small> <br> <small> <?php echo wp_kses_post($field['description']); ?> </small> </small> <?php } break; } }
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);
/** * {@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'); ?> </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'); ?> </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> <?php do_action('post-html-upload-ui'); ?> </div> <span class="max-upload-size"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($sizes[$u])); ?> </span> <?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 } do_action('post-upload-ui'); }
/** * 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; }
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 } }
/** * 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'); }
/** * 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 */ do_action('pre-plupload-upload-ui'); if (10 === remove_action('post-plupload-upload-ui', 'media_upload_flash_bypass')) { /** This action is documented in wp-admin/includes/media.php */ do_action('post-plupload-upload-ui'); add_action('post-plupload-upload-ui', 'media_upload_flash_bypass'); } else { /** This action is documented in wp-admin/includes/media.php */ do_action('post-plupload-upload-ui'); } $upload_size_unit = $max_upload_size = wp_max_upload_size(); $byte_sizes = array('KB', 'MB', 'GB'); for ($u = -1; $upload_size_unit > 1024 && $u < count($byte_sizes) - 1; $u++) { $upload_size_unit /= 1024; } if ($u < 0) { $upload_size_unit = 0; $u = 0; } else { $upload_size_unit = (int) $upload_size_unit; } ?> <p class="max-upload-size"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($byte_sizes[$u])); ?> </p> <# if ( data.suggestedWidth && data.suggestedHeight ) { #> <p class="suggested-dimensions"> <?php _e('Suggested image dimensions:'); ?> {{data.suggestedWidth}} × {{data.suggestedHeight}} </p> <# } #> <?php /** This action is documented in wp-admin/includes/media.php */ do_action('post-upload-ui'); ?> </div> <?php } ?> </div> </script> <script type="text/html" id="tmpl-uploader-status"> <h3><?php _e('Uploading'); ?> </h3> <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?> </a> <div class="media-progress-bar"><div></div></div> <div class="upload-details"> <span class="upload-count"> <span class="upload-index"></span> / <span class="upload-total"></span> </span> <span class="upload-detail-separator">–</span> <span class="upload-filename"></span> </div> <div class="upload-errors"></div> </script> <script type="text/html" id="tmpl-uploader-status-error"> <span class="upload-error-label"><?php _e('Error'); ?> </span> <span class="upload-error-filename">{{{ data.filename }}}</span> <span class="upload-error-message">{{ data.message }}</span> </script> <script type="text/html" id="tmpl-attachment"> <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type ) { #> <div class="thumbnail"> <div class="centered"> <img src="{{ data.size.url }}" draggable="false" /> </div> </div> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <div class="filename"> <div>{{ data.filename }}</div> </div> <# } #> <# if ( data.buttons.close ) { #> <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?> "></a> <# } #> <# if ( data.buttons.check ) { #> <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?> "><div class="media-modal-icon"></div></a> <# } #> </div> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; if ( data.describe ) { #> <# if ( 'image' === data.type ) { #> <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption" placeholder="<?php esc_attr_e('Caption this image…'); ?> " {{ maybeReadOnly }} /> <# } else { #> <input type="text" value="{{ data.title }}" class="describe" data-setting="title" <# if ( 'video' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this video…'); ?> " <# } else if ( 'audio' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this audio file…'); ?> " <# } else { #> placeholder="<?php esc_attr_e('Describe this media file…'); ?> " <# } #> {{ maybeReadOnly }} /> <# } #> <# } #> </script> <script type="text/html" id="tmpl-attachment-details"> <h3> <?php _e('Attachment Details'); ?> <span class="settings-save-status"> <span class="spinner"></span> <span class="saved"><?php esc_html_e('Saved.'); ?> </span> </span> </h3> <div class="attachment-info"> <div class="thumbnail"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type ) { #> <img src="{{ data.size.url }}" draggable="false" /> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <# } #> </div> <div class="details"> <div class="filename">{{ data.filename }}</div> <div class="uploaded">{{ data.dateFormatted }}</div> <# if ( 'image' === data.type && ! data.uploading ) { #> <# if ( data.width && data.height ) { #> <div class="dimensions">{{ data.width }} × {{ data.height }}</div> <# } #> <# if ( data.can.save ) { #> <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e('Edit Image'); ?> </a> <a class="refresh-attachment" href="#"><?php _e('Refresh'); ?> </a> <# } #> <# } #> <# if ( data.fileLength ) { #> <div class="file-length"><?php _e('Length:'); ?> {{ data.fileLength }}</div> <# } #> <# if ( ! data.uploading && data.can.remove ) { #> <?php if (MEDIA_TRASH) { ?> <a class="trash-attachment" href="#"><?php _e('Trash'); ?> </a> <?php } else { ?> <a class="delete-attachment" href="#"><?php _e('Delete Permanently'); ?> </a> <?php } ?> <# } #> <div class="compat-meta"> <# if ( data.compat && data.compat.meta ) { #> {{{ data.compat.meta }}} <# } #> </div> </div> </div> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> <label class="setting" data-setting="title"> <span><?php _e('Title'); ?> </span> <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> </label> <label class="setting" data-setting="caption"> <span><?php _e('Caption'); ?> </span> <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea> </label> <# if ( 'image' === data.type ) { #> <label class="setting" data-setting="alt"> <span><?php _e('Alt Text'); ?> </span> <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} /> </label> <# } #> <label class="setting" data-setting="description"> <span><?php _e('Description'); ?> </span> <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> </label> </script> <script type="text/html" id="tmpl-media-selection"> <div class="selection-info"> <span class="count"></span> <# if ( data.editable ) { #> <a class="edit-selection" href="#"><?php _e('Edit'); ?> </a> <# } #> <# if ( data.clearable ) { #> <a class="clear-selection" href="#"><?php _e('Clear'); ?> </a> <# } #> </div> <div class="selection-view"></div> </script> <script type="text/html" id="tmpl-attachment-display-settings"> <h3><?php _e('Attachment Display Settings'); ?> </h3> <# if ( 'image' === data.type ) { #> <label class="setting"> <span><?php _e('Alignment'); ?> </span> <select class="alignment" data-setting="align" <# if ( data.userSettings ) { #> data-user-setting="align" <# } #>> <option value="left"> <?php esc_attr_e('Left'); ?> </option> <option value="center"> <?php esc_attr_e('Center'); ?> </option> <option value="right"> <?php esc_attr_e('Right'); ?> </option> <option value="none" selected> <?php esc_attr_e('None'); ?> </option> </select> </label> <# } #> <div class="setting"> <label> <# if ( data.model.canEmbed ) { #> <span><?php _e('Embed or Link'); ?> </span> <# } else { #> <span><?php _e('Link To'); ?> </span> <# } #> <select class="link-to" data-setting="link" <# if ( data.userSettings && ! data.model.canEmbed ) { #> data-user-setting="urlbutton" <# } #>> <# if ( data.model.canEmbed ) { #> <option value="embed" selected> <?php esc_attr_e('Embed Media Player'); ?> </option> <option value="file"> <# } else { #> <option value="file" selected> <# } #> <# if ( data.model.canEmbed ) { #> <?php esc_attr_e('Link to Media File'); ?> <# } else { #> <?php esc_attr_e('Media File'); ?> <# } #> </option> <option value="post"> <# if ( data.model.canEmbed ) { #> <?php esc_attr_e('Link to Attachment Page'); ?> <# } else { #> <?php esc_attr_e('Attachment Page'); ?> <# } #> </option> <# if ( 'image' === data.type ) { #> <option value="custom"> <?php esc_attr_e('Custom URL'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> <# } #> </select> </label> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> <# if ( 'undefined' !== typeof data.sizes ) { #> <label class="setting"> <span><?php _e('Size'); ?> </span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php /** This filter is documented in wp-admin/includes/media.php */ $sizes = apply_filters('image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'))); foreach ($sizes as $value => $name) { ?> <# var size = data.sizes['<?php echo esc_js($value); ?> ']; if ( size ) { #> <option value="<?php echo esc_attr($value); ?> " <?php selected($value, 'full'); ?> > <?php echo esc_html($name); ?> – {{ size.width }} × {{ size.height }} </option> <# } #> <?php } ?> </select> </label> <# } #> </script> <script type="text/html" id="tmpl-gallery-settings"> <h3><?php _e('Gallery Settings'); ?> </h3> <label class="setting"> <span><?php _e('Link To'); ?> </span> <select class="link-to" data-setting="link" <# if ( data.userSettings ) { #> data-user-setting="urlbutton" <# } #>> <option value="post" selected> <?php esc_attr_e('Attachment Page'); ?> </option> <option value="file"> <?php esc_attr_e('Media File'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> </select> </label> <label class="setting"> <span><?php _e('Columns'); ?> </span> <select class="columns" name="columns" data-setting="columns"> <?php for ($i = 1; $i <= 9; $i++) { ?> <option value="<?php echo esc_attr($i); ?> " <?php selected($i, 3); ?> > <?php echo esc_html($i); ?> </option> <?php } ?> </select> </label> <label class="setting"> <span><?php _e('Random Order'); ?> </span> <input type="checkbox" data-setting="_orderbyRandom" /> </label> </script> <script type="text/html" id="tmpl-playlist-settings"> <h3><?php _e('Playlist Settings'); ?> </h3> <# var emptyModel = _.isEmpty( data.model ), isVideo = 'video' === data.controller.get('library').props.get('type'); #> <label class="setting"> <input type="checkbox" data-setting="tracklist" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <# if ( isVideo ) { #> <span><?php _e('Show Video List'); ?> </span> <# } else { #> <span><?php _e('Show Tracklist'); ?> </span> <# } #> </label> <# if ( ! isVideo ) { #> <label class="setting"> <input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <span><?php _e('Show Artist Name in Tracklist'); ?> </span> </label> <# } #> <label class="setting"> <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <span><?php _e('Show Images'); ?> </span> </label> </script> <script type="text/html" id="tmpl-embed-link-settings"> <label class="setting"> <span><?php _e('Title'); ?> </span> <input type="text" class="alignment" data-setting="title" /> </label> </script> <script type="text/html" id="tmpl-embed-image-settings"> <div class="thumbnail"> <img src="{{ data.model.url }}" draggable="false" /> </div> <?php /** This filter is documented in wp-admin/includes/media.php */ if (!apply_filters('disable_captions', '')) { ?> <label class="setting caption"> <span><?php _e('Caption'); ?> </span> <textarea data-setting="caption" /> </label> <?php } ?> <label class="setting alt-text"> <span><?php _e('Alt Text'); ?> </span> <input type="text" data-setting="alt" /> </label> <div class="setting align"> <span><?php _e('Align'); ?> </span> <div class="button-group button-large" data-setting="align"> <button class="button" value="left"> <?php esc_attr_e('Left'); ?> </button> <button class="button" value="center"> <?php esc_attr_e('Center'); ?> </button> <button class="button" value="right"> <?php esc_attr_e('Right'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> </div> <div class="setting link-to"> <span><?php _e('Link To'); ?> </span> <div class="button-group button-large" data-setting="link"> <button class="button" value="file"> <?php esc_attr_e('Image URL'); ?> </button> <button class="button" value="custom"> <?php esc_attr_e('Custom URL'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> </script> <script type="text/html" id="tmpl-attachments-css"> <style type="text/css" id="{{ data.id }}-css"> #{{ data.id }} { padding: 0 {{ data.gutter }}px; } #{{ data.id }} .attachment { margin: {{ data.gutter }}px; width: {{ data.edge }}px; } #{{ data.id }} .attachment-preview, #{{ data.id }} .attachment-preview .thumbnail { width: {{ data.edge }}px; height: {{ data.edge }}px; } #{{ data.id }} .portrait .thumbnail img { max-width: {{ data.edge }}px; height: auto; } #{{ data.id }} .landscape .thumbnail img { width: auto; max-height: {{ data.edge }}px; } </style> </script> <script type="text/html" id="tmpl-image-details"> <div class="media-embed"> <div class="embed-media-settings"> <div class="column-image"> <div class="image"> <img src="{{ data.model.url }}" draggable="false" /> <# if ( data.attachment && window.imageEdit ) { #> <div class="actions"> <input type="button" class="edit-attachment button" value="<?php esc_attr_e('Edit Original'); ?> " /> <input type="button" class="replace-attachment button" value="<?php esc_attr_e('Replace'); ?> " /> </div> <# } #> </div> </div> <div class="column-settings"> <?php /** This filter is documented in wp-admin/includes/media.php */ if (!apply_filters('disable_captions', '')) { ?> <label class="setting caption"> <span><?php _e('Caption'); ?> </span> <textarea data-setting="caption">{{ data.model.caption }}</textarea> </label> <?php } ?> <label class="setting alt-text"> <span><?php _e('Alternative Text'); ?> </span> <input type="text" data-setting="alt" value="{{ data.model.alt }}" /> </label> <h3><?php _e('Display Settings'); ?> </h3> <div class="setting align"> <span><?php _e('Align'); ?> </span> <div class="button-group button-large" data-setting="align"> <button class="button" value="left"> <?php esc_attr_e('Left'); ?> </button> <button class="button" value="center"> <?php esc_attr_e('Center'); ?> </button> <button class="button" value="right"> <?php esc_attr_e('Right'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> </div> <# if ( data.attachment ) { #> <# if ( 'undefined' !== typeof data.attachment.sizes ) { #> <label class="setting size"> <span><?php _e('Size'); ?> </span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php /** This filter is documented in wp-admin/includes/media.php */ $sizes = apply_filters('image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'))); foreach ($sizes as $value => $name) { ?> <# var size = data.sizes['<?php echo esc_js($value); ?> ']; if ( size ) { #> <option value="<?php echo esc_attr($value); ?> "> <?php echo esc_html($name); ?> – {{ size.width }} × {{ size.height }} </option> <# } #> <?php } ?> <option value="<?php echo esc_attr('custom'); ?> "> <?php _e('Custom Size'); ?> </option> </select> </label> <# } #> <div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>"> <label><span><?php _e('Width'); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">×</span><label><span><?php _e('Height'); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label> </div> <# } #> <div class="setting link-to"> <span><?php _e('Link To'); ?> </span> <select data-setting="link"> <# if ( data.attachment ) { #> <option value="file"> <?php esc_attr_e('Media File'); ?> </option> <option value="post"> <?php esc_attr_e('Attachment Page'); ?> </option> <# } else { #> <option value="file"> <?php esc_attr_e('Image URL'); ?> </option> <# } #> <option value="custom"> <?php esc_attr_e('Custom URL'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> </select> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> <div class="advanced-section"> <h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?> </a></h3> <div class="advanced-settings hidden"> <div class="advanced-image"> <label class="setting title-text"> <span><?php _e('Image Title Attribute'); ?> </span> <input type="text" data-setting="title" value="{{ data.model.title }}" /> </label> <label class="setting extra-classes"> <span><?php _e('Image CSS Class'); ?> </span> <input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" /> </label> </div> <div class="advanced-link"> <div class="setting link-target"> <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e('Open link in a new window/tab'); ?> </label> </div> <label class="setting link-rel"> <span><?php _e('Link Rel'); ?> </span> <input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" /> </label> <label class="setting link-class-name"> <span><?php _e('Link CSS Class'); ?> </span> <input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" /> </label> </div> </div> </div> </div> </div> </div> </script> <script type="text/html" id="tmpl-image-editor"> <div id="media-head-{{ data.id }}"></div> <div id="image-editor-{{ data.id }}"></div> </script> <script type="text/html" id="tmpl-audio-details"> <# var ext, html5types = { mp3: wp.media.view.settings.embedMimes.mp3, ogg: wp.media.view.settings.embedMimes.ogg }; #> <?php $audio_types = wp_get_audio_extensions(); ?> <div class="media-embed media-embed-details"> <div class="embed-media-settings embed-audio-settings"> <?php wp_underscore_audio_template(); ?> <# if ( ! _.isEmpty( data.model.src ) ) { ext = data.model.src.split('.').pop(); if ( html5types[ ext ] ) { delete html5types[ ext ]; } #> <label class="setting"> <span>SRC</span> <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> <a class="remove-setting"><?php _e('Remove'); ?> </a> </label> <# } #> <?php foreach ($audio_types as $type) { ?> <# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) { if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) { delete html5types.<?php echo $type; ?> ; } #> <label class="setting"> <span><?php echo strtoupper($type); ?> </span> <input type="text" disabled="disabled" data-setting="<?php echo $type; ?> " value="{{ data.model.<?php echo $type; ?> }}" /> <a class="remove-setting"><?php _e('Remove'); ?> </a> </label> <# } #> <?php } ?> <# if ( ! _.isEmpty( html5types ) ) { #> <div class="setting"> <span><?php _e('Add alternate sources for maximum HTML5 playback:'); ?> </span> <div class="button-large"> <# _.each( html5types, function (mime, type) { #> <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> <# } ) #> </div> </div> <# } #> <div class="setting preload"> <span><?php _e('Preload'); ?> </span> <div class="button-group button-large" data-setting="preload"> <button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?> </button> <button class="button" value="metadata"><?php _e('Metadata'); ?> </button> <button class="button active" value="none"><?php _e('None'); ?> </button> </div> </div> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="autoplay" /> <span><?php _e('Autoplay'); ?> </span> </label> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="loop" /> <span><?php _e('Loop'); ?> </span> </label> </div> </div> </script> <script type="text/html" id="tmpl-video-details"> <# var ext, html5types = { mp4: wp.media.view.settings.embedMimes.mp4, ogv: wp.media.view.settings.embedMimes.ogv, webm: wp.media.view.settings.embedMimes.webm }; #> <?php $video_types = wp_get_video_extensions(); ?> <div class="media-embed media-embed-details"> <div class="embed-media-settings embed-video-settings"> <div class="wp-video-holder"> <# var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/); w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width, h = ! data.model.height ? 360 : data.model.height; if ( data.model.width && w !== data.model.width ) { h = Math.ceil( ( h * w ) / data.model.width ); } #> <?php wp_underscore_video_template(); ?> <# if ( ! _.isEmpty( data.model.src ) ) { ext = data.model.src.split('.').pop(); if ( html5types[ ext ] ) { delete html5types[ ext ]; } #> <label class="setting"> <span>SRC</span> <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> <a class="remove-setting"><?php _e('Remove'); ?> </a> </label> <# } #> <?php foreach ($video_types as $type) { ?> <# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) { if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) { delete html5types.<?php echo $type; ?> ; } #> <label class="setting"> <span><?php echo strtoupper($type); ?> </span> <input type="text" disabled="disabled" data-setting="<?php echo $type; ?> " value="{{ data.model.<?php echo $type; ?> }}" /> <a class="remove-setting"><?php _e('Remove'); ?> </a> </label> <# } #> <?php } ?> </div> <# if ( ! _.isEmpty( html5types ) ) { #> <div class="setting"> <span><?php _e('Add alternate sources for maximum HTML5 playback:'); ?> </span> <div class="button-large"> <# _.each( html5types, function (mime, type) { #> <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> <# } ) #> </div> </div> <# } #> <# if ( ! _.isEmpty( data.model.poster ) ) { #> <label class="setting"> <span><?php _e('Poster Image'); ?> </span> <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" /> <a class="remove-setting"><?php _e('Remove'); ?> </a> </label> <# } #> <div class="setting preload"> <span><?php _e('Preload'); ?> </span> <div class="button-group button-large" data-setting="preload"> <button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?> </button> <button class="button" value="metadata"><?php _e('Metadata'); ?> </button> <button class="button active" value="none"><?php _e('None'); ?> </button> </div> </div> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="autoplay" /> <span><?php _e('Autoplay'); ?> </span> </label> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="loop" /> <span><?php _e('Loop'); ?> </span> </label> <label class="setting" data-setting="content"> <span><?php _e('Tracks (subtitles, captions, descriptions, chapters, or metadata)'); ?> </span> <# var content = ''; if ( ! _.isEmpty( data.model.content ) ) { var tracks = jQuery( data.model.content ).filter( 'track' ); _.each( tracks.toArray(), function (track) { content += track.outerHTML; #> <p> <input class="content-track" type="text" value="{{ track.outerHTML }}" /> <a class="remove-setting remove-track"><?php _e('Remove'); ?> </a> </p> <# } ); #> <# } else { #> <em><?php _e('There are no associated subtitles.'); ?> </em> <# } #> <textarea class="hidden content-setting">{{ content }}</textarea> </label> </div> </div> </script> <script type="text/html" id="tmpl-editor-gallery"> <div class="toolbar"> <div class="dashicons dashicons-edit edit"></div><div class="dashicons dashicons-no-alt remove"></div> </div> <# if ( data.attachments ) { #> <div class="gallery gallery-columns-{{ data.columns }}"> <# _.each( data.attachments, function( attachment, index ) { #> <dl class="gallery-item"> <dt class="gallery-icon"> <# if ( attachment.thumbnail ) { #> <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" /> <# } else { #> <img src="{{ attachment.url }}" /> <# } #> </dt> <dd class="wp-caption-text gallery-caption"> {{ attachment.caption }} </dd> </dl> <# if ( index % data.columns === data.columns - 1 ) { #> <br style="clear: both;"> <# } #> <# } ); #> </div> <# } else { #> <div class="wpview-error"> <div class="dashicons dashicons-format-gallery"></div><p><?php _e('No items found.'); ?> </p> </div> <# } #> </script> <script type="text/html" id="tmpl-editor-audio"> <div class="toolbar"> <div class="dashicons dashicons-edit edit"></div> <div class="dashicons dashicons-no-alt remove"></div> </div> <?php wp_underscore_audio_template(); ?> <div class="wpview-overlay"></div> </script> <script type="text/html" id="tmpl-editor-video"> <div class="toolbar"> <div class="dashicons dashicons-edit edit"></div> <div class="dashicons dashicons-no-alt remove"></div> </div> <?php wp_underscore_video_template(); ?> <div class="wpview-overlay"></div> </script> <?php wp_underscore_playlist_templates(); ?> <script type="text/html" id="tmpl-editor-playlist"> <div class="toolbar"> <div class="dashicons dashicons-edit edit"></div> <div class="dashicons dashicons-no-alt remove"></div> </div> <# if ( data.tracks ) { #> <div class="wp-playlist wp-{{ data.type }}-playlist wp-playlist-{{ data.style }}"> <# if ( 'audio' === data.type ){ #> <div class="wp-playlist-current-item"></div> <# } #> <{{ data.type }} controls="controls" preload="none" <# if ( data.width ) { #> width="{{ data.width }}"<# } #><# if ( data.height ) { #> height="{{ data.height }}"<# } #>></{{ data.type }}> <div class="wp-playlist-next"></div> <div class="wp-playlist-prev"></div> </div> <div class="wpview-overlay"></div> <# } else { #> <div class="wpview-error"> <div class="dashicons dashicons-video-alt3"></div><p><?php _e('No items found.'); ?> </p> </div> <# } #> </script> <script type="text/html" id="tmpl-crop-content"> <img class="crop-image" src="{{ data.url }}"> <div class="upload-errors"></div> </script> <?php /** * Fires when the custom Backbone media templates are printed. * * @since 3.5.0 */ do_action('print_media_templates'); }
/** * {@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'); ?> </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> <?php do_action('post-html-upload-ui'); ?> </div> <p><?php printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($sizes[$u])); echo ' ' . __('After a file has been uploaded, you can add titles and descriptions.'); ?> </p> <?php do_action('post-upload-ui'); }
/** * {@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')); ?> ', filters: [ {title: '<?php echo esc_js(__('Allowed Files')); ?> ', extensions: '<?php echo esc_js(apply_filters('uploader_allowed_extensions', '*')); ?> '} ], multipart: true, urlstream_upload: true, multipart_params : { <?php echo $post_params_str; ?> } }); setResize( getUserSetting('upload_resize', false) ); $('#image_resize').bind('change', function() { var arg = $(this).prop('checked'); setResize( arg ); if ( arg ) setUserSetting('upload_resize', 1); else deleteUserSetting('upload_resize'); }); uploader.init(); uploader.bind('FilesAdded', function(up, files) { $.each(files, function(i, file) { fileQueued(file); }); up.refresh(); up.start(); }); uploader.bind('BeforeUpload', function(up, file) { uploadStart(file); }); uploader.bind('UploadProgress', function(up, file) { uploadProgress(file, file.loaded, file.size); }); uploader.bind('Error', function(up, err) { uploadError(err.file, err.code, err.message); up.refresh(); }); uploader.bind('FileUploaded', function(up, file, response) { <?php echo apply_filters('plupload_success_handler', 'uploadSuccess'); ?> (file, response.response); }); if ( uploader.runtime == 'html5' ) $('.dragdrop-info').show(); }); //]]> </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> <?php _e('Choose files to upload'); ?> <input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?> " class="button" /> <input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?> " class="button" /> </div> <p class="dragdrop-info howto"><?php _e('Or you can drop the files into this window.'); ?> </p> <?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'); ?> </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> <?php do_action('post-html-upload-ui', $plupload); ?> </div> <p class="media-upload-size"><?php printf(__('Maximum upload file size: %d%s'), esc_html($upload_size_unit), esc_html($sizes[$u])); ?> </p> <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?> </p> <?php do_action('post-upload-ui'); }
/** * Adds all templates for Backbone application */ public function add_templates() { ?> <?php /* Used by views/media-manager.js */ ?> <script type="text/html" id="tmpl-brightcove-media"> <div class="brightcove media-frame-router"></div> <div class="brightcove-message message hidden"></div> <div class="brightcove media-frame-content"></div> <div class="brightcove media-frame-menu hidden"></div> <div class="brightcove media-frame-details"></div> <div class="brightcove media-frame-toolbar"></div> <div class="brightcove media-frame-uploader"></div> <div class="brightcove-uploader"></div> </script> <?php /* Used by views/playlist-edit.js */ ?> <script type="text/html" id="tmpl-brightcove-playlist-edit-video-in-playlist"> <li class="attachment brightcove"> <div class="js--select-attachment type- subtype- "> <div class="thumbnail"> <# if ( data.images && data.images.thumbnail && data.images.thumbnail.src ) { #> <img src="{{data.images.thumbnail.src}}" width="162" height="94"> <# } else { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-processing-large.png'); ?> " width="162" height="94"> <# } #> <div class="duration"> <span>{{data.duration}}</span> </div> </div> <div class="bc-info"> <span class="bc-name">{{data.name}}</span> <span class="bc-updated">{{data.updated_at_readable}}</span> <span class="row-actions"> <span class="video-move-up"><a href="#">↑ <?php esc_html_e('Move up', 'brightcove'); ?> </a></span> | <span class="video-move-down"><a href="#">↓ <?php esc_html_e('Move Down', 'brightcove'); ?> </a></span> | <span class="trash"><a href="#"><?php esc_html_e('Remove', 'brightcove'); ?> </a></span> </span> </div> </div> </li> </script> <?php /* Used by views/playlist-edit.js */ ?> <script type="text/html" id="tmpl-brightcove-playlist-edit-video-in-library"> <li class="attachment brightcove"> <div class=" js--select-attachment type- subtype- "> <div class="thumbnail"> <# if ( data.images && data.images.thumbnail && data.images.thumbnail.src ) { #> <img src="{{data.images.thumbnail.src}}" width="162" height="94"> <# } else { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-processing-large.png'); ?> " width="162" height="94"> <# } #> <div class="duration"> <span>{{data.duration}}</span> </div> </div> <div class="bc-info"> <span class="bc-name">{{data.name}}</span> <span class="bc-updated">{{data.updated_at_readable}}</span> <span class="row-actions"><span class="add-to-playlist"><a href="#" class="button action"><?php esc_html_e('Add to playlist', 'brightcove'); ?> </a></span></span> </div> </div> </li> </script> <?php /* Used by views/playlist-edit.js */ ?> <script type="text/html" id="tmpl-brightcove-playlist-edit"> <div class="settings"> <label class="playlist-name"> <span class="name"><?php esc_html_e('Playlist Name', 'brightcove'); ?> </span> <input type="text" class="brightcove-name" value="{{data.name}}" /> <a href="#" class="button button-primary button-large media-button brightcove back"><?php esc_html_e('Back', 'brightcove'); ?> </a> <span class="spinner is-active"></span> </label> </div> <div class="playlist-videos-list"> <h2>Playlist videos</h2> <ul class="existing-videos"></ul> </div> <div class="playlist-add-videos-list"> <h2>Video search</h2> <ul class="library-videos"></ul> </div> </script> <?php /* Used by views/video-edit.js */ ?> <script type="text/html" id="tmpl-brightcove-video-edit"> <div class="settings"> <label class="setting video-name"> <span class="name"><?php esc_html_e('Name', 'brightcove'); ?> </span> <input type="text" class="brightcove-name" value="{{data.name}}" /> </label> <label class="setting short-description"> <span class="name"><?php esc_html_e('Description', 'brightcove'); ?> </span> <textarea class="brightcove-description">{{data.description}}</textarea> </label> <label class="setting long-description"> <span class="name"><?php esc_html_e('Long Description', 'brightcove'); ?> </span> <textarea class="brightcove-long-description">{{data.long_description}}</textarea> </label> <label class="setting tags"> <span class="name"><?php esc_html_e('Tags', 'brightcove'); ?> </span> <input type="text" class="brightcove-tags" value="{{data.tags}}" /> </label> </div> <div class="brightcove brightcove-buttons"> <span class="delete-action"> <a href="#" class="brightcove delete"><?php esc_html_e('Delete', 'brightcove'); ?> </a> </span> <span class="more-actions"> <span class="spinner hidden"></span> <a href="#" class="button button-secondary button-large media-button brightcove back"><?php esc_html_e('Back', 'brightcove'); ?> </a> <a href="#" class="button button-primary button-large media-button brightcove save-sync"><?php esc_html_e('Save and Sync Changes', 'brightcove'); ?> </a> </span> </div> </script> <?php /* Used by views/video-preview.js */ ?> <script type="text/html" id="tmpl-brightcove-video-preview"> <!-- Start of Brightcove Player --> <iframe src="//players.brightcove.net/{{data.account_id}}/default_default/index.html?videoId={{data.id}}" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe> <!-- End of Brightcove Player --> </script> <?php /* Used by views/modal.js */ ?> <script type="text/html" id="tmpl-brightcove-media-modal"> <div class="media-modal wp-core-ui"> <button type="button" class="button-link media-modal-close"><span class="brightcove media-modal-icon"><span class="screen-reader-text"><?php esc_html_e('Close media panel', 'brightcove'); ?> </span></span></button> <div class="media-modal-content"> <div class="media-frame mode-select wp-core-ui" id="__wp-uploader-id-0"> <div class="media-frame-title"> <h1> <img class="bc-page-icon" src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/menu-icon.svg'); ?> "> <?php esc_html_e('Brightcove', 'brightcove'); ?> </h1> </div> <div class="media-frame-router"> <div class="media-router"> <a href="#" class="brightcove upload media-menu-item"><?php esc_html_e('Upload Files', 'brightcove'); ?> </a><a href="#" class="brightcove videos media-menu-item active"><?php esc_html_e('Videos', 'brightcove'); ?> </a><a href="#" class="brightcove playlists media-menu-item"><?php esc_html_e('Playlists', 'brightcove'); ?> </a> </div> </div> <div class="media-frame-content"> </div> <div class="media-frame-toolbar"> <div class="media-toolbar"> <div class="media-toolbar-secondary"> <div class="media-selection empty"> <div class="selection-info"> <span class="count">0 selected</span> <a class="edit-selection" href="#"><?php esc_html_e('Edit Selection', 'brightcove'); ?> </a> <a class="clear-selection" href="#"><?php esc_html_e('Clear', 'brightcove'); ?> </a> </div> <div class="selection-view"> <ul tabindex="-1" class="attachments" id="__attachments-view-71"></ul> </div> </div> </div> <div class="media-toolbar-primary search-form"> <a href="#" class="button media-button button-primary button-large media-button-insert brightcove" disabled="disabled"><?php esc_html_e('Insert Into Post', 'brightcove'); ?> </a> </div> </div> </div> <div class="media-frame-uploader"> <div class="uploader-window"> <div class="uploader-window-content"> <h3> <?php esc_html_e('Drop files to upload', 'brightcove'); ?> </h3> </div> </div> </div> <div id="html5_19jecn1m2eteuqiud64df15595_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; overflow: hidden; z-index: 0;"> <input id="html5_19jecn1m2eteuqiud64df15595" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple accept=""> </div> </div> </div> </div> <div class="media-modal-backdrop"></div> </script> <?php /* Used by views/media-manager.js */ ?> <script type="text/html" id="tmpl-brightcove-uploader-container"> <div class="brightcove-uploader media-frame mode-grid"></div> </script> <?php /* Used by views/upload-video-manager.js */ ?> <script type="text/html" id="tmpl-brightcove-uploader-queued-files"> <div class="brightcove-upload-queued-files"> <div class="pending-uploads"> <table class="wp-list-table widefat"> <thead> <tr> <th><?php esc_html_e('File Name', 'brightcove'); ?> </th> <th><?php esc_html_e('Size', 'brightcove'); ?> </th> <th><?php esc_html_e('Source', 'brightcove'); ?> </th> <th><?php esc_html_e('Progress', 'brightcove'); ?> </th> </tr> </thead> <tbody class="brightcove-pending-uploads"> </tbody> </table> <br> <button class="brightcove-start-upload button action"><?php esc_html_e('Start Upload', 'brightcove'); ?> </button> </div> </div> <div class="brightcove-messages"></div> </script> <?php /* Used by views/upload.js */ ?> <script type="text/html" id="tmpl-brightcove-pending-upload"> <td>{{data.fileName}}</td> <td>{{data.size}}</td> <td>{{data.accountName}}</td> <td> <# if (data.percent > 0 || data.activeUpload) #> <progress value="{{data.percent}}" max="100">{{data.percent}} %</progress> </td> </script> <?php /* Used by views/upload-details.js */ ?> <script type="text/html" id="tmpl-brightcove-pending-upload-details"> <# if (data.uploaded) { var disabled = ' disabled'; var readOnly = ' readonly'; } #> <div class="settings"> <label class="file-name setting"> <span class="name"><?php esc_html_e('File Name', 'brightcove'); ?> </span> <span>{{data.fileName}}</span> </label> <label class="video-name setting"> <span class="name"><?php esc_html_e('Name', 'brightcove'); ?> </span> <input type="text" class="brightcove-name" value="{{data.fileName}}"{{readOnly}} /> </label> <label class="tags setting"> <span class="name"><?php esc_html_e('Tags', 'brightcove'); ?> </span> <input type="text" class="brightcove-tags" value="{{data.tags}}"{{readOnly}} /> </label> <label class="account setting"> <span class="name"><?php esc_html_e('Source', 'brightcove'); ?> </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; } ?> <p class="max-upload-size"> <?php printf(esc_html__('Maximum upload file size: ', 'brightcove') . esc_html(size_format($max_upload_size)) . '.'); ?> <br> <?php _e('Please reference the readme.txt file of this plugin for further information on upload file size limits.', 'brightcove'); ?> </p> </div> <?php } ?> </div> </script> <?php /* Used by views/media.js */ ?> <script type="text/html" id="tmpl-brightcove-media-item-grid"> <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> <div class="thumbnail"> <# if ( data.images && data.images.thumbnail && data.images.thumbnail.src ) { #> <img src="{{ data.images.thumbnail.src }}" class="icon" draggable="false" width="162" height="94" /> <# } else { #> <# if ( data.video_ids ) { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-playlist-large.png'); ?> " class="icon" draggable="false" width="162" height="94" /> <# } else { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-processing-large.png'); ?> " class="icon" draggable="false" width="162" height="94" /> <# } #> <# } #> <# if ( data.duration ) { #> <div class="duration"> <span>{{ data.duration }}</span> </div> <# } #> <# if ( data.video_ids ) { #> <div class="video-count"> <# if ( 'EXPLICIT' === data.type && data.video_ids ) { #> <# if ( 1 === data.video_ids.length ) { #> <span>1 <?php esc_html_e('Video', 'brightcove'); ?> </span> <# } else { #> <span>{{ data.video_ids.length }} <?php esc_html_e('Videos', 'brightcove'); ?> </span> <# } #> <# } else { #> <span class="brightcove-smart-playlist"><?php esc_html_e('Smart', 'brightcove'); ?> </span> <# } #> </div> <# } #> </div> <div class="bc-info"> <span class="bc-name">{{ data.name }}</span> <# if ( data.updated_at_readable ) { #> <span class="bc-updated">{{ data.updated_at_readable }}</span> <# } #> </div> <div class="media-actions"> <a href="#" class="button media-button brightcove edit"><?php esc_html_e('Edit', 'brightcove'); ?> </a> <a href="#" class="button media-button brightcove preview"><?php esc_html_e('Preview', 'brightcove'); ?> </a> </div> </div> </script> <?php /* Used by views/media.js */ ?> <script type="text/html" id="tmpl-brightcove-media-item-list"> <li class="attachment-preview js--select-attachment type-list subtype-{{ data.subtype }} {{ data.orientation }}"> {{ data.name }} <# if ( data.duration ) { #> {{ data.duration }} <# } #> <# if ( data.updated_at ) { #> <em>{{ data.updated_at }}</em> <# } #> </li> </script> <?php /* Used by views/media-details.js */ ?> <script type="text/html" id="tmpl-brightcove-media-item-details-videos"> <div class="attachment-detail js--select-attachment type-list subtype-{{ data.subtype }} {{ data.orientation }}"> <div class="thumbnail"> <# if ( data.images && data.images.poster && data.images.poster.src ) { #> <img src="{{ data.images.poster.src }}" class="detail-icon" draggable="false" width="300" height="172" /> <# } else { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-processing-large.png'); ?> " class="detail-icon" draggable="false" width="300" height="172" /> <# } #> <# if ( data.duration ) { #> <div class="detail-duration"> <span>{{ data.duration }}</span> </div> <# } #> </div> <div class="video-info"> <span class="video-name">{{ data.name }}</span> <div class="video-source"><span class="title"><?php esc_html_e('Source: ', 'brightcove'); ?> </span><span class="data">{{ data.account_name }}</span></div> <div class="video-id"><span class="title"><?php esc_html_e('Video ID: ', 'brightcove'); ?> </span><span class="data">{{ data.id }}</span></div> </div> <div class="media-actions"> <# if ('preview' === data.detailsMode) { #> <a href="#" class="button media-button brightcove back"><?php esc_html_e('Back', 'brightcove'); ?> </a> <# } else { #> <a href="#" class="button media-button brightcove edit"><?php esc_html_e('Edit', 'brightcove'); ?> </a> <a href="#" class="button media-button brightcove preview"><?php esc_html_e('Preview', 'brightcove'); ?> </a> <# } #> </div> </div> </script> <?php /* Used by views/media-details.js */ ?> <script type="text/html" id="tmpl-brightcove-media-item-details-playlists"> <div class="attachment-detail js--select-attachment type-list subtype-{{ data.subtype }} {{ data.orientation }}"> <div class="thumbnail"> <# if ( data.images && data.images.poster && data.images.poster.src ) { #> <img src="{{ data.images.poster.src }}" class="detail-icon" draggable="false" width="300" height="172" /> <# } else { #> <img src="<?php echo esc_url(BRIGHTCOVE_URL . 'images/video-playlist-large.png'); ?> " class="detail-icon" draggable="false" width="300" height="172" /> <# } #> <# if ( data.video_ids ) { #> <div class="detail-video-count"> <# if ( 'EXPLICIT' === data.type && data.video_ids ) { #> <# if ( 1 === data.video_ids.length ) { #> <span>1 <?php esc_html_e('Video', 'brightcove'); ?> </span> <# } else { #> <span>{{ data.video_ids.length }} <?php esc_html_e('Videos', 'brightcove'); ?> </span> <# } #> <# } else { #> <span class="brightcove-smart-playlist"><?php esc_html_e('Smart', 'brightcove'); ?> </span> <# } #> </div> <# } #> </div> <div class="playlist-info"> <span class="playlist-name">{{ data.name }}</span> <div class="playlist-id"><span class="title"><?php esc_html_e('Playlist ID: ', 'brightcove'); ?> </span><span class="data">{{ data.id }}</span></div> <div class="account-name"><span class="title"><?php esc_html_e('Account Name: ', 'brightcove'); ?> </span><span class="data">{{ data.account_name }}</span></div> <div class="created-date"><span class="title"><?php esc_html_e('Created At: ', 'brightcove'); ?> </span><span class="data">{{ data.created_at_readable }}</span></div> <div class="updated-date"><span class="title"><?php esc_html_e('Updated At: ', 'brightcove'); ?> </span><span class="data">{{ data.updated_at_readable }}</span></div> <div class="playlist-type"><span class="title"><?php esc_html_e('Playlist Type: ', 'brightcove'); ?> </span><span class="data">{{ data.type }}</span></div> </div> <# if ('EXPLICIT' === data.type) { #> <div class="media-actions"> <a href="#" class="button media-button brightcove edit"><?php esc_html_e('Edit', 'brightcove'); ?> </a> </div> <# } #> </div> </script> <?php /* Used by views/toolbar.js */ ?> <script type="text/html" id="tmpl-brightcove-media-toolbar"> <div class="media-toolbar-secondary"> <label for="brightcove-media-source" class="screen-reader-text">Filter by source</label> <select id="brightcove-media-source" class="brightcove-media-source attachment-filters"> <# var allValue = 1 === _.size(data.accounts) ? data.accounts[_.keys(data.accounts)[0]]['account_id'] : 'all'; #> <option value="{{ allValue }}">All sources</option> <# _.each(data.accounts, function (account) { #> <option value="{{ account.account_id }}">{{ account.account_name }}</option> <# }); #> </select> <# if (data.mediaType === 'videos') { #> <!-- <label for="media-attachment-date-filters" class="screen-reader-text">Filter by date</label> <select id="brightcove-media-dates" class="brightcove-media-dates attachment-filters"> <option value="all">All dates</option> <# _.each(data.dates, function (date) { #> <option value="{{ date.code }}">{{ date.value }}</option> <# }); #> </select> --> <label for="media-attachment-tags-filters" class="screen-reader-text">Filter by tag</label> <select id="media-attachment-tags-filters" class="brightcove-media-tags attachment-filters"> <option value="all">All tags</option> <# _.each(data.tags, function (tagName, tagId) { #> <option value="{{ tagId }}">{{ tagName }}</option> <# }); #> </select> <# }#> <# if( data.mediaType === 'playlists' ) { #> <input type="checkbox" name="brightcove-empty-playlists" id="brightcove-empty-playlists" class="brightcove-empty-playlists attachment-filters"> <label for="brightcove-empty-playlists">Hide Empty Playlists</label> <# } #> <a href="#" class="button media-button button-primary button-large delete-selected-button hidden" disabled="disabled">Delete Selected</a> </div> <# if (data.mediaType === 'videos') { #> <div class="media-toolbar-primary search-form"> <span class="spinner hidden"></span> <label for="media-search-input" class="screen-reader-text">Search Media</label> <input type="search" placeholder="Search" id="media-search-input" class="search"> </div> <# }#> </script> <?php }
/** * Flag if the site has the capacity to receive an upload. * * @since 1.0.0 * * @return bool True if it can, false otherwise. */ public function has_upload_capacity() { return !(is_multisite() && !is_upload_space_available()); }
function out_message() { global $psts; if (current_user_can('edit_pages') && !is_upload_space_available()) { $level = $psts->get_level() + 1; if ($name = $psts->get_level_setting($level, 'name')) { //only show if there is a higher level $space = $this->display_space($psts->get_level_setting($level, 'quota')); $msg = str_replace('LEVEL', $name, $psts->get_setting('quota_message')); $msg = str_replace('SPACE', $space, $msg); echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $msg . '</a></p></div>'; } } }
function test_is_upload_space_available_upload_space_negative() { update_site_option( 'upload_space_check_disabled', false ); update_site_option( 'blog_upload_space', -1 ); $this->assertFalse( is_upload_space_available() ); }
/** * 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-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.'), 'http://wordpress.org/mobile/'); ?> </h3> <?php } elseif (is_multisite() && !is_upload_space_available()) { ?> <h3 class="upload-instructions"><?php _e('Upload Limit Exceeded'); ?> </h3> <?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 do_action('pre-upload-ui'); do_action('pre-plupload-upload-ui'); if (10 === remove_action('post-plupload-upload-ui', 'media_upload_flash_bypass')) { do_action('post-plupload-upload-ui'); add_action('post-plupload-upload-ui', 'media_upload_flash_bypass'); } else { do_action('post-plupload-upload-ui'); } $upload_size_unit = $max_upload_size = wp_max_upload_size(); $byte_sizes = array('KB', 'MB', 'GB'); for ($u = -1; $upload_size_unit > 1024 && $u < count($byte_sizes) - 1; $u++) { $upload_size_unit /= 1024; } if ($u < 0) { $upload_size_unit = 0; $u = 0; } else { $upload_size_unit = (int) $upload_size_unit; } ?> <p class="max-upload-size"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($byte_sizes[$u])); ?> </p> <?php if (($GLOBALS['is_IE'] || $GLOBALS['is_opera']) && $max_upload_size > 100 * 1024 * 1024) { $browser_uploader = admin_url('media-new.php?browser-uploader&post_id=') . '{{ data.postId }}'; ?> <p class="big-file-warning"><?php printf(__('Your browser has some limitations uploading large files with the multi-file uploader. Please use the <a href="%1$s" target="%2$s">browser uploader</a> for files over 100MB.'), $browser_uploader, '_blank'); ?> </p> <?php } ?> <?php do_action('post-upload-ui'); ?> </div> <?php } ?> </div> </script> <script type="text/html" id="tmpl-uploader-status"> <h3><?php _e('Uploading'); ?> </h3> <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?> </a> <div class="media-progress-bar"><div></div></div> <div class="upload-details"> <span class="upload-count"> <span class="upload-index"></span> / <span class="upload-total"></span> </span> <span class="upload-detail-separator">–</span> <span class="upload-filename"></span> </div> <div class="upload-errors"></div> </script> <script type="text/html" id="tmpl-uploader-status-error"> <span class="upload-error-label"><?php _e('Error'); ?> </span> <span class="upload-error-filename">{{{ data.filename }}}</span> <span class="upload-error-message">{{ data.message }}</span> </script> <script type="text/html" id="tmpl-attachment"> <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type ) { #> <div class="thumbnail"> <div class="centered"> <img src="{{ data.size.url }}" draggable="false" /> </div> </div> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <div class="filename"> <div>{{ data.filename }}</div> </div> <# } #> <# if ( data.buttons.close ) { #> <a class="close media-modal-icon" href="#" title="<?php _e('Remove'); ?> "></a> <# } #> <# if ( data.buttons.check ) { #> <a class="check" href="#" title="<?php _e('Deselect'); ?> "><div class="media-modal-icon"></div></a> <# } #> </div> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; if ( data.describe ) { #> <# if ( 'image' === data.type ) { #> <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption" placeholder="<?php esc_attr_e('Caption this image…'); ?> " {{ maybeReadOnly }} /> <# } else { #> <input type="text" value="{{ data.title }}" class="describe" data-setting="title" <# if ( 'video' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this video…'); ?> " <# } else if ( 'audio' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this audio file…'); ?> " <# } else { #> placeholder="<?php esc_attr_e('Describe this media file…'); ?> " <# } #> {{ maybeReadOnly }} /> <# } #> <# } #> </script> <script type="text/html" id="tmpl-attachment-details"> <h3> <?php _e('Attachment Details'); ?> <span class="settings-save-status"> <span class="spinner"></span> <span class="saved"><?php esc_html_e('Saved.'); ?> </span> </span> </h3> <div class="attachment-info"> <div class="thumbnail"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type ) { #> <img src="{{ data.size.url }}" draggable="false" /> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <# } #> </div> <div class="details"> <div class="filename">{{ data.filename }}</div> <div class="uploaded">{{ data.dateFormatted }}</div> <# if ( 'image' === data.type && ! data.uploading ) { #> <# if ( data.width && data.height ) { #> <div class="dimensions">{{ data.width }} × {{ data.height }}</div> <# } #> <# if ( data.can.save ) { #> <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e('Edit Image'); ?> </a> <a class="refresh-attachment" href="#"><?php _e('Refresh'); ?> </a> <# } #> <# } #> <# if ( ! data.uploading && data.can.remove ) { #> <a class="delete-attachment" href="#"><?php _e('Delete Permanently'); ?> </a> <# } #> <div class="compat-meta"> <# if ( data.compat && data.compat.meta ) { #> {{{ data.compat.meta }}} <# } #> </div> </div> </div> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> <label class="setting" data-setting="title"> <span><?php _e('Title'); ?> </span> <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> </label> <label class="setting" data-setting="caption"> <span><?php _e('Caption'); ?> </span> <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea> </label> <# if ( 'image' === data.type ) { #> <label class="setting" data-setting="alt"> <span><?php _e('Alt Text'); ?> </span> <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} /> </label> <# } #> <label class="setting" data-setting="description"> <span><?php _e('Description'); ?> </span> <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> </label> </script> <script type="text/html" id="tmpl-media-selection"> <div class="selection-info"> <span class="count"></span> <# if ( data.editable ) { #> <a class="edit-selection" href="#"><?php _e('Edit'); ?> </a> <# } #> <# if ( data.clearable ) { #> <a class="clear-selection" href="#"><?php _e('Clear'); ?> </a> <# } #> </div> <div class="selection-view"></div> </script> <script type="text/html" id="tmpl-attachment-display-settings"> <h3><?php _e('Attachment Display Settings'); ?> </h3> <# if ( 'image' === data.type ) { #> <label class="setting"> <span><?php _e('Alignment'); ?> </span> <select class="alignment" data-setting="align" <# if ( data.userSettings ) { #> data-user-setting="align" <# } #>> <option value="left"> <?php esc_attr_e('Left'); ?> </option> <option value="center"> <?php esc_attr_e('Center'); ?> </option> <option value="right"> <?php esc_attr_e('Right'); ?> </option> <option value="none" selected> <?php esc_attr_e('None'); ?> </option> </select> </label> <# } #> <div class="setting"> <label> <span><?php _e('Link To'); ?> </span> <select class="link-to" data-setting="link" <# if ( data.userSettings ) { #> data-user-setting="urlbutton" <# } #>> <option value="custom"> <?php esc_attr_e('Custom URL'); ?> </option> <option value="file" selected> <?php esc_attr_e('Media File'); ?> </option> <option value="post"> <?php esc_attr_e('Attachment Page'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> </select> </label> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> <# if ( 'undefined' !== typeof data.sizes ) { #> <label class="setting"> <span><?php _e('Size'); ?> </span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php $sizes = apply_filters('image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'))); foreach ($sizes as $value => $name) { ?> <# var size = data.sizes['<?php echo esc_js($value); ?> ']; if ( size ) { #> <option value="<?php echo esc_attr($value); ?> " <?php selected($value, 'full'); ?> > <?php echo esc_html($name); ?> – {{ size.width }} × {{ size.height }} </option> <# } #> <?php } ?> </select> </label> <# } #> </script> <script type="text/html" id="tmpl-gallery-settings"> <h3><?php _e('Gallery Settings'); ?> </h3> <label class="setting"> <span><?php _e('Link To'); ?> </span> <select class="link-to" data-setting="link" <# if ( data.userSettings ) { #> data-user-setting="urlbutton" <# } #>> <option value="post" selected> <?php esc_attr_e('Attachment Page'); ?> </option> <option value="file"> <?php esc_attr_e('Media File'); ?> </option> </select> </label> <label class="setting"> <span><?php _e('Columns'); ?> </span> <select class="columns" name="columns" data-setting="columns"> <?php for ($i = 1; $i <= 9; $i++) { ?> <option value="<?php echo esc_attr($i); ?> " <?php selected($i, 3); ?> > <?php echo esc_html($i); ?> </option> <?php } ?> </select> </label> <label class="setting"> <span><?php _e('Random Order'); ?> </span> <input type="checkbox" data-setting="_orderbyRandom" /> </label> </script> <script type="text/html" id="tmpl-embed-link-settings"> <label class="setting"> <span><?php _e('Title'); ?> </span> <input type="text" class="alignment" data-setting="title" /> </label> </script> <script type="text/html" id="tmpl-embed-image-settings"> <div class="thumbnail"> <img src="{{ data.model.url }}" draggable="false" /> </div> <?php if (!apply_filters('disable_captions', '')) { ?> <label class="setting caption"> <span><?php _e('Caption'); ?> </span> <textarea data-setting="caption" /> </label> <?php } ?> <label class="setting alt-text"> <span><?php _e('Alt Text'); ?> </span> <input type="text" data-setting="alt" /> </label> <div class="setting align"> <span><?php _e('Align'); ?> </span> <div class="button-group button-large" data-setting="align"> <button class="button" value="left"> <?php esc_attr_e('Left'); ?> </button> <button class="button" value="center"> <?php esc_attr_e('Center'); ?> </button> <button class="button" value="right"> <?php esc_attr_e('Right'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> </div> <div class="setting link-to"> <span><?php _e('Link To'); ?> </span> <div class="button-group button-large" data-setting="link"> <button class="button" value="file"> <?php esc_attr_e('Image URL'); ?> </button> <button class="button" value="custom"> <?php esc_attr_e('Custom URL'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> </script> <script type="text/html" id="tmpl-attachments-css"> <style type="text/css" id="{{ data.id }}-css"> #{{ data.id }} { padding: 0 {{ data.gutter }}px; } #{{ data.id }} .attachment { margin: {{ data.gutter }}px; width: {{ data.edge }}px; } #{{ data.id }} .attachment-preview, #{{ data.id }} .attachment-preview .thumbnail { width: {{ data.edge }}px; height: {{ data.edge }}px; } #{{ data.id }} .portrait .thumbnail img { max-width: {{ data.edge }}px; height: auto; } #{{ data.id }} .landscape .thumbnail img { width: auto; max-height: {{ data.edge }}px; } </style> </script> <?php do_action('print_media_templates'); }
/** * Prints default plupload arguments. * * @since 3.4.0 */ function wp_plupload_default_settings() { global $wp_scripts; $data = $wp_scripts->get_data('wp-plupload', 'data'); if ($data && false !== strpos($data, '_wpPluploadSettings')) { return; } $max_upload_size = wp_max_upload_size(); $defaults = array('runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'async-upload', 'url' => admin_url('async-upload.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')); /** * 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); }
/** * @ticket 18119 */ function test_upload_is_user_over_quota() { $default_space_allowed = 100; $echo = false; $this->assertFalse( upload_is_user_over_quota( $echo ) ); $this->assertTrue( is_upload_space_available() ); update_site_option('upload_space_check_disabled', true); $this->assertFalse( upload_is_user_over_quota( $echo ) ); $this->assertTrue( is_upload_space_available() ); update_site_option( 'blog_upload_space', 0 ); $this->assertFalse( upload_is_user_over_quota( $echo ) ); $this->assertEquals( $default_space_allowed, get_space_allowed() ); $this->assertTrue( is_upload_space_available() ); update_site_option('upload_space_check_disabled', false); $this->assertFalse( upload_is_user_over_quota( $echo ) ); $this->assertTrue( is_upload_space_available() ); if ( defined( 'BLOGSUPLOADDIR' ) && ! file_exists( BLOGSUPLOADDIR ) ) $this->markTestSkipped( 'This test is broken when blogs.dir does not exist. '); /* This is broken when blogs.dir does not exist, as get_upload_space_available() simply returns the value of blog_upload_space (converted to bytes), which would be negative but still not false. When blogs.dir does exist, < 0 is returned as 0. */ update_site_option( 'blog_upload_space', -1 ); $this->assertTrue( upload_is_user_over_quota( $echo ) ); $this->assertEquals( -1, get_space_allowed() ); $this->assertFalse( is_upload_space_available() ); update_option( 'blog_upload_space', 0 ); $this->assertFalse( upload_is_user_over_quota( $echo ) ); $this->assertEquals( $default_space_allowed, get_space_allowed() ); $this->assertTrue( is_upload_space_available() ); update_option( 'blog_upload_space', -1 ); $this->assertTrue( upload_is_user_over_quota( $echo ) ); $this->assertEquals( -1, get_space_allowed() ); $this->assertFalse( is_upload_space_available() ); }
function test_is_upload_space_available_upload_space_negative() { update_site_option('blog_upload_space', -1); add_filter('pre_get_space_used', array($this, '_filter_space_used_small')); $available = is_upload_space_available(); remove_filter('pre_get_space_used', array($this, '_filter_space_used_small')); $this->assertFalse($available); }
/** * Prints default plupload arguments. * * @since 3.4.0 */ function wp_plupload_default_settings() { $wp_scripts = wp_scripts(); $data = $wp_scripts->get_data('wp-plupload', 'data'); if ($data && false !== strpos($data, '_wpPluploadSettings')) { return; } $max_upload_size = wp_max_upload_size(); $defaults = array('runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'async-upload', 'url' => admin_url('async-upload.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')); // Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos // when enabled. 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; } /** * 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 = ' . wp_json_encode($settings) . ';'; if ($data) { $script = "{$data}\n{$script}"; } $wp_scripts->add_data('wp-plupload', 'data', $script); }
/** * Module Styling Fields * @param array $styling * @return string */ function themify_builder_styling_field($styling) { switch ($styling['type']) { case 'text': ?> <input id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " type="text" value="" class="<?php echo esc_attr($styling['class']); ?> tfb_lb_option"> <?php if (isset($styling['description'])) { echo '<small>' . wp_kses_post($styling['description']) . '</small>'; } ?> <?php break; case 'textarea': ?> <textarea id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " class="<?php echo esc_attr($styling['class']); ?> tfb_lb_option"><?php if (isset($styling['value'])) { echo esc_textarea($styling['value']); } ?> </textarea> <?php if (isset($styling['description'])) { echo '<small>' . wp_kses_post($styling['description']) . '</small>'; } ?> <?php break; case 'separator': echo isset($styling['meta']['html']) && '' != $styling['meta']['html'] ? $styling['meta']['html'] : '<hr class="meta_fields_separator" />'; break; case 'image': ?> <input id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " placeholder="<?php if (isset($styling['value'])) { echo esc_attr($styling['value']); } ?> " class="<?php echo esc_attr($styling['class']); ?> themify-builder-uploader-input tfb_lb_option" type="text" /><br /> <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($styling['id']); ?> themify-builder-plupload-upload-ui"> <input id="<?php echo esc_attr($styling['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($styling['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> <p class="thumb_preview"> <span class="img-placeholder"></span> <a href="#" class="themify_builder_icon small delete themify-builder-delete-thumb"></a> </p> <?php break; case 'video': ?> <input id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " placeholder="<?php if (isset($styling['value'])) { echo esc_attr($styling['value']); } ?> " class="<?php echo esc_attr($styling['class']); ?> themify-builder-uploader-input tfb_lb_option" type="text" /><br /> <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($styling['id']); ?> themify-builder-plupload-upload-ui" data-extensions="<?php echo esc_attr(implode(',', wp_get_video_extensions())); ?> "> <input id="<?php echo esc_attr($styling['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($styling['id'] . 'themify-builder-plupload'); ?> "></span> </div> <?php _e('or', 'themify'); ?> <a href="#" class="themify-builder-media-uploader tf-upload-btn" data-uploader-title="<?php _e('Upload a Video', 'themify'); ?> " data-uploader-button-text="<?php esc_attr_e('Insert file URL', 'themify'); ?> " data-library-type="video"><?php _e('Browse Library', 'themify'); ?> </a> <?php } ?> </div> <?php if (isset($styling['description'])) { echo '<small>' . wp_kses_post($styling['description']) . '</small>'; } ?> <?php break; case 'select': ?> <select id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " class="tfb_lb_option <?php echo isset($styling['class']) ? esc_attr($styling['class']) : ''; ?> "> <?php if (isset($styling['default'])) { ?> <option value="<?php echo esc_attr($styling['default']); ?> "><?php echo esc_html($styling['default']); ?> </option> <?php } foreach ($styling['meta'] as $option) { ?> <option value="<?php echo esc_attr($option['value']); ?> "><?php echo esc_html($option['name']); ?> </option> <?php } ?> </select> <?php if (isset($styling['description'])) { echo wp_kses_post($styling['description']); } ?> <?php break; case 'animation_select': ?> <?php $class = isset($styling['class']) ? $styling['class'] : ''; ?> <select id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " class="tfb_lb_option <?php echo esc_attr($class); ?> "> <option value=""></option> <?php $animation = Themify_Builder_model::get_preset_animation(); foreach ($animation as $group) { ?> <optgroup label="<?php echo esc_attr($group['group_label']); ?> "> <?php foreach ($group['options'] as $opt) { ?> <option value="<?php echo esc_attr($opt['value']); ?> "><?php echo esc_html($opt['name']); ?> </option> <?php } ?> </optgroup> <?php } ?> </select> <?php if (isset($styling['description'])) { echo wp_kses_post($styling['description']); } ?> <?php break; case 'font_select': $fonts = array_merge(themify_get_web_safe_font_list(), themify_get_google_web_fonts_list()); ?> <select id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " class="tfb_lb_option <?php echo esc_attr($styling['class']); ?> "> <?php if (isset($styling['default'])) { ?> <option value="<?php echo esc_attr($styling['default']); ?> "><?php echo esc_html($styling['default']); ?> </option> <?php } foreach ($fonts as $option) { ?> <option value="<?php echo esc_attr($option['value']); ?> "><?php echo esc_html($option['name']); ?> </option> <?php } ?> </select> <?php if (isset($styling['description'])) { echo wp_kses_post($styling['description']); } ?> <?php break; case 'color': ?> <span class="builderColorSelect"><span></span></span> <input type="text" class="<?php echo esc_attr($styling['class']); ?> colordisplay"/> <input id="<?php echo esc_attr($styling['id']); ?> " name="<?php echo esc_attr($styling['id']); ?> " value="" class="builderColorSelectInput tfb_lb_option" type="hidden" /> <?php break; case 'checkbox': if (isset($styling['before'])) { echo wp_kses_post($styling['before']); } ?> <div id="<?php echo esc_attr($styling['id']); ?> " class="tfb_lb_option themify-checkbox"> <?php foreach ($styling['options'] as $opt) { ?> <?php $checkbox_checked = ''; if (isset($styling['default']) && is_array($styling['default'])) { $checkbox_checked = in_array($opt['name'], $styling['default']) ? 'checked="checked"' : ''; } elseif (isset($styling['default'])) { $checkbox_checked = checked($styling['default'], $opt['name'], false); } ?> <input id="<?php echo esc_attr($styling['id'] . '_' . $opt['name']); ?> " name="<?php echo esc_attr($styling['id']); ?> " type="checkbox" class="tfb_lb_option tf-checkbox" value="<?php echo esc_attr($opt['name']); ?> " <?php echo $checkbox_checked; ?> /> <label for="<?php echo esc_attr($styling['id'] . '_' . $opt['name']); ?> " class="pad-right"><?php echo wp_kses_post($opt['value']); ?> </label> <?php if (isset($opt['help'])) { ?> <small><?php echo wp_kses_post($opt['help']); ?> </small> <?php } ?> <?php if (!isset($styling['new_line']) || $styling['new_line'] == true) { ?> <br /> <?php } ?> <?php } ?> </div> <?php if (isset($styling['after'])) { echo wp_kses_post($styling['after']); } break; case 'radio': $option_js = isset($styling['option_js']) && $styling['option_js'] == true ? 'tf-option-checkbox-js' : ''; $option_js_wrap = isset($styling['option_js']) && $styling['option_js'] == true ? 'tf-option-checkbox-enable' : ''; ?> <div id="<?php echo esc_attr($styling['id']); ?> " class="tfb_lb_option tf-radio-input-container <?php echo esc_attr($option_js_wrap); ?> "> <?php foreach ($styling['meta'] as $option) { $checked = isset($option['selected']) && $option['selected'] == true ? 'checked="checked"' : ''; $data_el = isset($styling['option_js']) && $styling['option_js'] == true ? 'data-selected="tf-group-element-' . $option['value'] . '"' : ''; ?> <input type="radio" id="<?php echo esc_attr($styling['id'] . '_' . $option['value']); ?> " name="<?php echo esc_attr($styling['id']); ?> " value="<?php echo esc_attr($option['value']); ?> " class="tfb_lb_option <?php echo esc_attr($option_js); ?> " <?php echo $checked . ' ' . $data_el; ?> > <label for="<?php echo esc_attr($styling['id'] . '_' . $option['value']); ?> "><?php echo esc_html($option['name']); ?> </label> <?php } ?> <?php if (isset($styling['description'])) { echo '<br/><small>' . wp_kses_post($styling['description']) . '</small>'; } ?> </div> <?php break; } }
/** * Prints the templates used in the media manager. * * @since 3.5.0 * * @global bool $is_IE */ 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'; ?> <!--[if lte IE 8]> <style> .attachment:focus { outline: #1e8cbe solid; } .selected.attachment { outline: #1e8cbe solid; } </style> <![endif]--> <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="#"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></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'; #> <# if ( data.canClose ) { #> <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button> <# } #> <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://apps.wordpress.org/' ); ?></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> <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p> <button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button> </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 */ do_action( 'pre-plupload-upload-ui' ); if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) { /** This action is documented in wp-admin/includes/media.php */ do_action( 'post-plupload-upload-ui' ); add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ); } else { /** This action is documented in wp-admin/includes/media.php */ do_action( 'post-plupload-upload-ui' ); } $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } ?> <p class="max-upload-size"><?php printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) ); ?></p> <# if ( data.suggestedWidth && data.suggestedHeight ) { #> <p class="suggested-dimensions"> <?php _e( 'Suggested image dimensions:' ); ?> {{data.suggestedWidth}} × {{data.suggestedHeight}} </p> <# } #> <?php /** This action is documented in wp-admin/includes/media.php */ do_action( 'post-upload-ui' ); ?> </div> <?php endif; ?> </div> </script> <script type="text/html" id="tmpl-media-library-view-switcher"> <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list"> <span class="screen-reader-text"><?php _e( 'List View' ); ?></span> </a> <a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current"> <span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span> </a> </script> <script type="text/html" id="tmpl-uploader-status"> <h3><?php _e( 'Uploading' ); ?></h3> <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a> <div class="media-progress-bar"><div></div></div> <div class="upload-details"> <span class="upload-count"> <span class="upload-index"></span> / <span class="upload-total"></span> </span> <span class="upload-detail-separator">–</span> <span class="upload-filename"></span> </div> <div class="upload-errors"></div> </script> <script type="text/html" id="tmpl-uploader-status-error"> <span class="upload-error-filename">{{{ data.filename }}}</span> <span class="upload-error-message">{{ data.message }}</span> </script> <script type="text/html" id="tmpl-edit-attachment-frame"> <div class="edit-media-header"> <button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button> <button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button> </div> <div class="media-frame-title"></div> <div class="media-frame-content"></div> </script> <script type="text/html" id="tmpl-attachment-details-two-column"> <div class="attachment-media-view {{ data.orientation }}"> <div class="thumbnail thumbnail-{{ data.type }}"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #> <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" /> <# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #> <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" /> <# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #> <img class="details-image" src="{{ data.icon }}" class="icon" draggable="false" /> <# } #> <# if ( 'audio' === data.type ) { #> <div class="wp-media-wrapper"> <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none"> <source type="{{ data.mime }}" src="{{ data.url }}"/> </audio> </div> <# } else if ( 'video' === data.type ) { var w_rule = h_rule = ''; if ( data.width ) { w_rule = 'width: ' + data.width + 'px;'; } else if ( wp.media.view.settings.contentWidth ) { w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;'; } if ( data.height ) { h_rule = 'height: ' + data.height + 'px;'; } #> <div style="{{ w_rule }}{{ h_rule }}" class="wp-media-wrapper wp-video"> <video controls="controls" class="wp-video-shortcode" preload="metadata" <# if ( data.width ) { #>width="{{ data.width }}"<# } #> <# if ( data.height ) { #>height="{{ data.height }}"<# } #> <# if ( data.image && data.image.src !== data.icon ) { #>poster="{{ data.image.src }}"<# } #>> <source type="{{ data.mime }}" src="{{ data.url }}"/> </video> </div> <# } #> <div class="attachment-actions"> <# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #> <button type="button" class="button edit-attachment"><?php _e( 'Edit Image' ); ?></button> <# } #> </div> </div> </div> <div class="attachment-info"> <span class="settings-save-status"> <span class="spinner"></span> <span class="saved"><?php esc_html_e('Saved.'); ?></span> </span> <div class="details"> <div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div> <div class="filename"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div> <div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div> <div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div> <# if ( 'image' === data.type && ! data.uploading ) { #> <# if ( data.width && data.height ) { #> <div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} × {{ data.height }}</div> <# } #> <# } #> <# if ( data.fileLength ) { #> <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div> <# } #> <# if ( 'audio' === data.type && data.meta.bitrate ) { #> <div class="bitrate"> <strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s <# if ( data.meta.bitrate_mode ) { #> {{ ' ' + data.meta.bitrate_mode.toUpperCase() }} <# } #> </div> <# } #> <div class="compat-meta"> <# if ( data.compat && data.compat.meta ) { #> {{{ data.compat.meta }}} <# } #> </div> </div> <div class="settings"> <label class="setting" data-setting="url"> <span class="name"><?php _e('URL'); ?></span> <input type="text" value="{{ data.url }}" readonly /> </label> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?> <label class="setting" data-setting="title"> <span class="name"><?php _e('Title'); ?></span> <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> </label> <?php endif; ?> <# if ( 'audio' === data.type ) { #> <?php foreach ( array( 'artist' => __( 'Artist' ), 'album' => __( 'Album' ), ) as $key => $label ) : ?> <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>"> <span class="name"><?php echo $label ?></span> <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" /> </label> <?php endforeach; ?> <# } #> <label class="setting" data-setting="caption"> <span class="name"><?php _e( 'Caption' ); ?></span> <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea> </label> <# if ( 'image' === data.type ) { #> <label class="setting" data-setting="alt"> <span class="name"><?php _e( 'Alt Text' ); ?></span> <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} /> </label> <# } #> <label class="setting" data-setting="description"> <span class="name"><?php _e('Description'); ?></span> <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> </label> <label class="setting"> <span class="name"><?php _e( 'Uploaded By' ); ?></span> <span class="value">{{ data.authorName }}</span> </label> <# if ( data.uploadedToTitle ) { #> <label class="setting"> <span class="name"><?php _e( 'Uploaded To' ); ?></span> <# if ( data.uploadedToLink ) { #> <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span> <# } else { #> <span class="value">{{ data.uploadedToTitle }}</span> <# } #> </label> <# } #> <div class="attachment-compat"></div> </div> <div class="actions"> <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> <# if ( data.can.save ) { #> | <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a> <# } #> <# if ( ! data.uploading && data.can.remove ) { #> | <?php if ( MEDIA_TRASH ): ?> <# if ( 'trash' === data.status ) { #> <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a> <# } else { #> <a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a> <# } #> <?php else: ?> <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a> <?php endif; ?> <# } #> </div> </div> </script> <script type="text/html" id="tmpl-attachment"> <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> <div class="thumbnail"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div> <# } else if ( 'image' === data.type && data.sizes ) { #> <div class="centered"> <img src="{{ data.size.url }}" draggable="false" alt="" /> </div> <# } else { #> <div class="centered"> <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #> <img src="{{ data.image.src }}" class="thumbnail" draggable="false" /> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <# } #> </div> <div class="filename"> <div>{{ data.filename }}</div> </div> <# } #> </div> <# if ( data.buttons.close ) { #> <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a> <# } #> </div> <# if ( data.buttons.check ) { #> <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a> <# } #> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; if ( data.describe ) { if ( 'image' === data.type ) { #> <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption" placeholder="<?php esc_attr_e('Caption this image…'); ?>" {{ maybeReadOnly }} /> <# } else { #> <input type="text" value="{{ data.title }}" class="describe" data-setting="title" <# if ( 'video' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this video…'); ?>" <# } else if ( 'audio' === data.type ) { #> placeholder="<?php esc_attr_e('Describe this audio file…'); ?>" <# } else { #> placeholder="<?php esc_attr_e('Describe this media file…'); ?>" <# } #> {{ maybeReadOnly }} /> <# } } #> </script> <script type="text/html" id="tmpl-attachment-details"> <h3> <?php _e('Attachment Details'); ?> <span class="settings-save-status"> <span class="spinner"></span> <span class="saved"><?php esc_html_e('Saved.'); ?></span> </span> </h3> <div class="attachment-info"> <div class="thumbnail thumbnail-{{ data.type }}"> <# if ( data.uploading ) { #> <div class="media-progress-bar"><div></div></div> <# } else if ( 'image' === data.type && data.sizes ) { #> <img src="{{ data.size.url }}" draggable="false" /> <# } else { #> <img src="{{ data.icon }}" class="icon" draggable="false" /> <# } #> </div> <div class="details"> <div class="filename">{{ data.filename }}</div> <div class="uploaded">{{ data.dateFormatted }}</div> <div class="file-size">{{ data.filesizeHumanReadable }}</div> <# if ( 'image' === data.type && ! data.uploading ) { #> <# if ( data.width && data.height ) { #> <div class="dimensions">{{ data.width }} × {{ data.height }}</div> <# } #> <# if ( data.can.save && data.sizes ) { #> <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a> <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a> <# } #> <# } #> <# if ( data.fileLength ) { #> <div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div> <# } #> <# if ( ! data.uploading && data.can.remove ) { #> <?php if ( MEDIA_TRASH ): ?> <# if ( 'trash' === data.status ) { #> <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a> <# } else { #> <a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a> <# } #> <?php else: ?> <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a> <?php endif; ?> <# } #> <div class="compat-meta"> <# if ( data.compat && data.compat.meta ) { #> {{{ data.compat.meta }}} <# } #> </div> </div> </div> <label class="setting" data-setting="url"> <span class="name"><?php _e('URL'); ?></span> <input type="text" value="{{ data.url }}" readonly /> </label> <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?> <label class="setting" data-setting="title"> <span class="name"><?php _e('Title'); ?></span> <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> </label> <?php endif; ?> <# if ( 'audio' === data.type ) { #> <?php foreach ( array( 'artist' => __( 'Artist' ), 'album' => __( 'Album' ), ) as $key => $label ) : ?> <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>"> <span class="name"><?php echo $label ?></span> <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" /> </label> <?php endforeach; ?> <# } #> <label class="setting" data-setting="caption"> <span class="name"><?php _e('Caption'); ?></span> <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea> </label> <# if ( 'image' === data.type ) { #> <label class="setting" data-setting="alt"> <span class="name"><?php _e('Alt Text'); ?></span> <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} /> </label> <# } #> <label class="setting" data-setting="description"> <span class="name"><?php _e('Description'); ?></span> <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> </label> </script> <script type="text/html" id="tmpl-media-selection"> <div class="selection-info"> <span class="count"></span> <# if ( data.editable ) { #> <a class="edit-selection" href="#"><?php _e( 'Edit Selection' ); ?></a> <# } #> <# if ( data.clearable ) { #> <a class="clear-selection" href="#"><?php _e('Clear'); ?></a> <# } #> </div> <div class="selection-view"></div> </script> <script type="text/html" id="tmpl-attachment-display-settings"> <h3><?php _e('Attachment Display Settings'); ?></h3> <# if ( 'image' === data.type ) { #> <label class="setting"> <span><?php _e('Alignment'); ?></span> <select class="alignment" data-setting="align" <# if ( data.userSettings ) { #> data-user-setting="align" <# } #>> <option value="left"> <?php esc_attr_e('Left'); ?> </option> <option value="center"> <?php esc_attr_e('Center'); ?> </option> <option value="right"> <?php esc_attr_e('Right'); ?> </option> <option value="none" selected> <?php esc_attr_e('None'); ?> </option> </select> </label> <# } #> <div class="setting"> <label> <# if ( data.model.canEmbed ) { #> <span><?php _e('Embed or Link'); ?></span> <# } else { #> <span><?php _e('Link To'); ?></span> <# } #> <select class="link-to" data-setting="link" <# if ( data.userSettings && ! data.model.canEmbed ) { #> data-user-setting="urlbutton" <# } #>> <# if ( data.model.canEmbed ) { #> <option value="embed" selected> <?php esc_attr_e('Embed Media Player'); ?> </option> <option value="file"> <# } else { #> <option value="file" selected> <# } #> <# if ( data.model.canEmbed ) { #> <?php esc_attr_e('Link to Media File'); ?> <# } else { #> <?php esc_attr_e('Media File'); ?> <# } #> </option> <option value="post"> <# if ( data.model.canEmbed ) { #> <?php esc_attr_e('Link to Attachment Page'); ?> <# } else { #> <?php esc_attr_e('Attachment Page'); ?> <# } #> </option> <# if ( 'image' === data.type ) { #> <option value="custom"> <?php esc_attr_e('Custom URL'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> <# } #> </select> </label> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> <# if ( 'undefined' !== typeof data.sizes ) { #> <label class="setting"> <span><?php _e('Size'); ?></span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php /** This filter is documented in wp-admin/includes/media.php */ $sizes = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'), ) ); foreach ( $sizes as $value => $name ) : ?> <# var size = data.sizes['<?php echo esc_js( $value ); ?>']; if ( size ) { #> <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>> <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }} </option> <# } #> <?php endforeach; ?> </select> </label> <# } #> </script> <script type="text/html" id="tmpl-gallery-settings"> <h3><?php _e('Gallery Settings'); ?></h3> <label class="setting"> <span><?php _e('Link To'); ?></span> <select class="link-to" data-setting="link" <# if ( data.userSettings ) { #> data-user-setting="urlbutton" <# } #>> <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>> <?php esc_attr_e('Attachment Page'); ?> </option> <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>> <?php esc_attr_e('Media File'); ?> </option> <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>> <?php esc_attr_e('None'); ?> </option> </select> </label> <label class="setting"> <span><?php _e('Columns'); ?></span> <select class="columns" name="columns" data-setting="columns"> <?php for ( $i = 1; $i <= 9; $i++ ) : ?> <option value="<?php echo esc_attr( $i ); ?>" <# if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# } #>> <?php echo esc_html( $i ); ?> </option> <?php endfor; ?> </select> </label> <label class="setting"> <span><?php _e( 'Random Order' ); ?></span> <input type="checkbox" data-setting="_orderbyRandom" /> </label> <label class="setting size"> <span><?php _e( 'Size' ); ?></span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #> > <?php // This filter is documented in wp-admin/includes/media.php $size_names = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); foreach ( $size_names as $size => $label ) : ?> <option value="<?php echo esc_attr( $size ); ?>"> <?php echo esc_html( $label ); ?> </option> <?php endforeach; ?> </select> </label> </script> <script type="text/html" id="tmpl-playlist-settings"> <h3><?php _e( 'Playlist Settings' ); ?></h3> <# var emptyModel = _.isEmpty( data.model ), isVideo = 'video' === data.controller.get('library').props.get('type'); #> <label class="setting"> <input type="checkbox" data-setting="tracklist" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <# if ( isVideo ) { #> <span><?php _e( 'Show Video List' ); ?></span> <# } else { #> <span><?php _e( 'Show Tracklist' ); ?></span> <# } #> </label> <# if ( ! isVideo ) { #> <label class="setting"> <input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <span><?php _e( 'Show Artist Name in Tracklist' ); ?></span> </label> <# } #> <label class="setting"> <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #> checked="checked" <# } #> /> <span><?php _e( 'Show Images' ); ?></span> </label> </script> <script type="text/html" id="tmpl-embed-link-settings"> <label class="setting link-text"> <span><?php _e( 'Link Text' ); ?></span> <input type="text" class="alignment" data-setting="linkText" /> </label> <div class="embed-container" style="display: none;"> <div class="embed-preview"></div> </div> </script> <script type="text/html" id="tmpl-embed-image-settings"> <div class="thumbnail"> <img src="{{ data.model.url }}" draggable="false" /> </div> <?php /** This filter is documented in wp-admin/includes/media.php */ if ( ! apply_filters( 'disable_captions', '' ) ) : ?> <label class="setting caption"> <span><?php _e('Caption'); ?></span> <textarea data-setting="caption" /> </label> <?php endif; ?> <label class="setting alt-text"> <span><?php _e('Alt Text'); ?></span> <input type="text" data-setting="alt" /> </label> <div class="setting align"> <span><?php _e('Align'); ?></span> <div class="button-group button-large" data-setting="align"> <button class="button" value="left"> <?php esc_attr_e('Left'); ?> </button> <button class="button" value="center"> <?php esc_attr_e('Center'); ?> </button> <button class="button" value="right"> <?php esc_attr_e('Right'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> </div> <div class="setting link-to"> <span><?php _e('Link To'); ?></span> <div class="button-group button-large" data-setting="link"> <button class="button" value="file"> <?php esc_attr_e('Image URL'); ?> </button> <button class="button" value="custom"> <?php esc_attr_e('Custom URL'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> </script> <script type="text/html" id="tmpl-image-details"> <div class="media-embed"> <div class="embed-media-settings"> <div class="column-image"> <div class="image"> <img src="{{ data.model.url }}" draggable="false" /> <# if ( data.attachment && window.imageEdit ) { #> <div class="actions"> <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" /> <input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" /> </div> <# } #> </div> </div> <div class="column-settings"> <?php /** This filter is documented in wp-admin/includes/media.php */ if ( ! apply_filters( 'disable_captions', '' ) ) : ?> <label class="setting caption"> <span><?php _e('Caption'); ?></span> <textarea data-setting="caption">{{ data.model.caption }}</textarea> </label> <?php endif; ?> <label class="setting alt-text"> <span><?php _e('Alternative Text'); ?></span> <input type="text" data-setting="alt" value="{{ data.model.alt }}" /> </label> <h3><?php _e( 'Display Settings' ); ?></h3> <div class="setting align"> <span><?php _e('Align'); ?></span> <div class="button-group button-large" data-setting="align"> <button class="button" value="left"> <?php esc_attr_e('Left'); ?> </button> <button class="button" value="center"> <?php esc_attr_e('Center'); ?> </button> <button class="button" value="right"> <?php esc_attr_e('Right'); ?> </button> <button class="button active" value="none"> <?php esc_attr_e('None'); ?> </button> </div> </div> <# if ( data.attachment ) { #> <# if ( 'undefined' !== typeof data.attachment.sizes ) { #> <label class="setting size"> <span><?php _e('Size'); ?></span> <select class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php /** This filter is documented in wp-admin/includes/media.php */ $sizes = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'), ) ); foreach ( $sizes as $value => $name ) : ?> <# var size = data.sizes['<?php echo esc_js( $value ); ?>']; if ( size ) { #> <option value="<?php echo esc_attr( $value ); ?>"> <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }} </option> <# } #> <?php endforeach; ?> <option value="<?php echo esc_attr( 'custom' ); ?>"> <?php _e( 'Custom Size' ); ?> </option> </select> </label> <# } #> <div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>"> <label><span><?php _e( 'Width' ); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">×</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label> </div> <# } #> <div class="setting link-to"> <span><?php _e('Link To'); ?></span> <select data-setting="link"> <# if ( data.attachment ) { #> <option value="file"> <?php esc_attr_e('Media File'); ?> </option> <option value="post"> <?php esc_attr_e('Attachment Page'); ?> </option> <# } else { #> <option value="file"> <?php esc_attr_e('Image URL'); ?> </option> <# } #> <option value="custom"> <?php esc_attr_e('Custom URL'); ?> </option> <option value="none"> <?php esc_attr_e('None'); ?> </option> </select> <input type="text" class="link-to-custom" data-setting="linkUrl" /> </div> <div class="advanced-section"> <h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?></a></h3> <div class="advanced-settings hidden"> <div class="advanced-image"> <label class="setting title-text"> <span><?php _e('Image Title Attribute'); ?></span> <input type="text" data-setting="title" value="{{ data.model.title }}" /> </label> <label class="setting extra-classes"> <span><?php _e('Image CSS Class'); ?></span> <input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" /> </label> </div> <div class="advanced-link"> <div class="setting link-target"> <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new window/tab' ); ?></label> </div> <label class="setting link-rel"> <span><?php _e('Link Rel'); ?></span> <input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" /> </label> <label class="setting link-class-name"> <span><?php _e('Link CSS Class'); ?></span> <input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" /> </label> </div> </div> </div> </div> </div> </div> </script> <script type="text/html" id="tmpl-image-editor"> <div id="media-head-{{ data.id }}"></div> <div id="image-editor-{{ data.id }}"></div> </script> <script type="text/html" id="tmpl-audio-details"> <# var ext, html5types = { mp3: wp.media.view.settings.embedMimes.mp3, ogg: wp.media.view.settings.embedMimes.ogg }; #> <?php $audio_types = wp_get_audio_extensions(); ?> <div class="media-embed media-embed-details"> <div class="embed-media-settings embed-audio-settings"> <?php wp_underscore_audio_template() ?> <# if ( ! _.isEmpty( data.model.src ) ) { ext = data.model.src.split('.').pop(); if ( html5types[ ext ] ) { delete html5types[ ext ]; } #> <label class="setting"> <span>SRC</span> <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> <a class="remove-setting"><?php _e( 'Remove' ); ?></a> </label> <# } #> <?php foreach ( $audio_types as $type ): ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) { delete html5types.<?php echo $type ?>; } #> <label class="setting"> <span><?php echo strtoupper( $type ) ?></span> <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> <a class="remove-setting"><?php _e( 'Remove' ); ?></a> </label> <# } #> <?php endforeach ?> <# if ( ! _.isEmpty( html5types ) ) { #> <div class="setting"> <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span> <div class="button-large"> <# _.each( html5types, function (mime, type) { #> <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> <# } ) #> </div> </div> <# } #> <div class="setting preload"> <span><?php _e( 'Preload' ); ?></span> <div class="button-group button-large" data-setting="preload"> <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button> <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button> <button class="button active" value="none"><?php _e( 'None' ); ?></button> </div> </div> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="autoplay" /> <span><?php _e( 'Autoplay' ); ?></span> </label> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="loop" /> <span><?php _e( 'Loop' ); ?></span> </label> </div> </div> </script> <script type="text/html" id="tmpl-video-details"> <# var ext, html5types = { mp4: wp.media.view.settings.embedMimes.mp4, ogv: wp.media.view.settings.embedMimes.ogv, webm: wp.media.view.settings.embedMimes.webm }; #> <?php $video_types = wp_get_video_extensions(); ?> <div class="media-embed media-embed-details"> <div class="embed-media-settings embed-video-settings"> <div class="wp-video-holder"> <# var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width, h = ! data.model.height ? 360 : data.model.height; if ( data.model.width && w !== data.model.width ) { h = Math.ceil( ( h * w ) / data.model.width ); } #> <?php wp_underscore_video_template() ?> <# if ( ! _.isEmpty( data.model.src ) ) { ext = data.model.src.split('.').pop(); if ( html5types[ ext ] ) { delete html5types[ ext ]; } #> <label class="setting"> <span>SRC</span> <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> <a class="remove-setting"><?php _e( 'Remove' ); ?></a> </label> <# } #> <?php foreach ( $video_types as $type ): ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) { delete html5types.<?php echo $type ?>; } #> <label class="setting"> <span><?php echo strtoupper( $type ) ?></span> <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> <a class="remove-setting"><?php _e( 'Remove' ); ?></a> </label> <# } #> <?php endforeach ?> </div> <# if ( ! _.isEmpty( html5types ) ) { #> <div class="setting"> <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span> <div class="button-large"> <# _.each( html5types, function (mime, type) { #> <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> <# } ) #> </div> </div> <# } #> <# if ( ! _.isEmpty( data.model.poster ) ) { #> <label class="setting"> <span><?php _e( 'Poster Image' ); ?></span> <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" /> <a class="remove-setting"><?php _e( 'Remove' ); ?></a> </label> <# } #> <div class="setting preload"> <span><?php _e( 'Preload' ); ?></span> <div class="button-group button-large" data-setting="preload"> <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button> <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button> <button class="button active" value="none"><?php _e( 'None' ); ?></button> </div> </div> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="autoplay" /> <span><?php _e( 'Autoplay' ); ?></span> </label> <label class="setting checkbox-setting"> <input type="checkbox" data-setting="loop" /> <span><?php _e( 'Loop' ); ?></span> </label> <label class="setting" data-setting="content"> <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span> <# var content = ''; if ( ! _.isEmpty( data.model.content ) ) { var tracks = jQuery( data.model.content ).filter( 'track' ); _.each( tracks.toArray(), function (track) { content += track.outerHTML; #> <p> <input class="content-track" type="text" value="{{ track.outerHTML }}" /> <a class="remove-setting remove-track"><?php _e( 'Remove' ); ?></a> </p> <# } ); #> <# } else { #> <em><?php _e( 'There are no associated subtitles.' ); ?></em> <# } #> <textarea class="hidden content-setting">{{ content }}</textarea> </label> </div> </div> </script> <script type="text/html" id="tmpl-editor-gallery"> <# if ( data.attachments.length ) { #> <div class="gallery gallery-columns-{{ data.columns }}"> <# _.each( data.attachments, function( attachment, index ) { #> <dl class="gallery-item"> <dt class="gallery-icon"> <# if ( attachment.thumbnail ) { #> <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" /> <# } else { #> <img src="{{ attachment.url }}" /> <# } #> </dt> <# if ( attachment.caption ) { #> <dd class="wp-caption-text gallery-caption"> {{ attachment.caption }} </dd> <# } #> </dl> <# if ( index % data.columns === data.columns - 1 ) { #> <br style="clear: both;"> <# } #> <# } ); #> </div> <# } else { #> <div class="wpview-error"> <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p> </div> <# } #> </script> <script type="text/html" id="tmpl-crop-content"> <img class="crop-image" src="{{ data.url }}"> <div class="upload-errors"></div> </script> <?php /** * Fires when the custom Backbone media templates are printed. * * @since 3.5.0 */ do_action( 'print_media_templates' ); }
function anno_media_upload_form() { if (!anno_current_user_can_edit()) { echo '<div style="text-align:center;">' . _x('You do not have proper permissions to upload a new image', 'Permissions warning for image uplaod', 'anno') . '</div>'; return; } global $type, $tab, $pagenow; $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(_x('Sorry, you have filled your storage quota (%s MB).', 'Media upload error text', 'anno'), get_space_allowed()) . '</p>'; return; } do_action('pre-upload-ui'); if ($flash) { // Set the post params, which SWFUpload will post back with the file, and pass // them through a filter. $post_params = array('post_id' => anno_get_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', 'action' => 'tinymce_upload'); $post_params = apply_filters('swfupload_post_params', $post_params); $p = array(); foreach ($post_params as $param => $val) { $p[] = "\t\t'{$param}' : '{$val}'"; } $post_params_str = implode(", \n", $p); // #8545. wmode=transparent cannot be used with SWFUpload if ('media-new.php' == $pagenow) { $upload_image_path = get_user_option('admin_color'); if ('classic' != $upload_image_path) { $upload_image_path = 'fresh'; } $upload_image_path = admin_url('images/upload-' . $upload_image_path . '.png?ver=20101205'); } else { $upload_image_path = includes_url('images/upload.png?ver=20100531'); } ?> <script type="text/javascript"> //<![CDATA[ var swfu; SWFUpload.onload = function() { var settings = { button_text: '<span class="button"><?php _ex('Select Files', 'Media upload text', 'anno'); ?> <\/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 $upload_image_path; ?> ', 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", post_params : { <?php echo $post_params_str; ?> }, file_size_limit : "<?php echo $max_upload_size; ?> b", file_dialog_start_handler : fileDialogStart, file_queued_handler : annoFileQueued, upload_start_handler : uploadStart, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : <?php echo apply_filters('swfupload_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 swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available }, file_types : "*.jpg;*.gif;*.png;*.jpeg;*.bmp;", debug: false }; swfu = new SWFUpload(settings); }; //]]> </script> <div id="flash-upload-ui" class="tinymce-uploader hide-if-no-js"> <?php do_action('pre-flash-upload-ui'); ?> <div> <?php _ex('Choose files to upload', 'Media upload dialog', 'anno'); ?> <div id="flash-browse-button"></div> <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php _ex('Cancel Upload', 'Media cancel button text', 'anno'); ?> " class="button" /></span> </div> <?php do_action('post-plupload-upload-ui'); ?> </div> <?php } // $flash ?> <div id="html-upload-ui" class="tinymce-uploader<?php if ($flash) { echo ' hide-if-js'; } ?> "> <?php do_action('pre-html-upload-ui'); ?> <p id="async-upload-wrap"> <label class="screen-reader-text" for="async-upload"><?php _ex('Upload', 'Media upload text', 'anno'); ?> </label> <input type="file" name="async-upload" id="async-upload" accept="image/gif, image/jpeg, image/jpg, image/png" /> <?php submit_button(_x('Upload', 'Media upload text', 'anno'), 'button', 'html-upload', false); ?> </p> <div class="clear"></div> <?php if (is_lighttpd_before_150()) { ?> <p><?php _ex('If you want to use all capabilities of the uploader, like uploading multiple files at once, please update to lighttpd 1.5.', 'Media upload error text', 'anno'); ?> </p> <?php } ?> <?php do_action('post-html-upload-ui', $flash); ?> </div> <?php do_action('post-upload-ui'); ?> <?php }
* @since 2.3.0 * * @package BuddyPress * @subpackage bp-attachments */ ?> <script type="text/html" id="tmpl-upload-window"> <?php if (!_device_can_upload()) { ?> <h3 class="upload-instructions"><?php esc_html_e('The web browser on your device cannot be used to upload files.', 'buddypress'); ?> </h3> <?php } elseif (is_multisite() && !is_upload_space_available()) { ?> <h3 class="upload-instructions"><?php esc_html_e('Upload Limit Exceeded', 'buddypress'); ?> </h3> <?php } else { ?> <div id="{{data.container}}"> <div id="{{data.drop_element}}"> <div class="drag-drop-inside"> <p class="drag-drop-info"><?php esc_html_e('Drop your file here', 'buddypress'); ?> </p>
/** * Prints default plupload arguments. * * @since 3.4.0 */ function wp_plupload_default_settings() { global $wp_scripts; $data = $wp_scripts->get_data('wp-plupload', 'data'); if ($data && false !== strpos($data, '_wpPluploadSettings')) { return; } $max_upload_size = wp_max_upload_size(); $defaults = array('runtimes' => 'html5,silverlight,flash,html4', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => $max_upload_size . 'b', 'url' => admin_url('async-upload.php', 'relative'), '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); // 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()) { $defaults['multi_selection'] = false; } $defaults = apply_filters('plupload_default_settings', $defaults); $params = array('action' => 'upload-attachment'); $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); }
/** * {@internal Missing Short Description}} * * @since 2.5.0 * * @param unknown_type $errors */ function media_upload_form($errors = null) { global $type, $tab, $is_IE, $is_opera; if (!_device_can_upload()) { echo '<p>' . sprintf(__('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://apps.wordpress.org/') . '</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 : ''; $max_upload_size = wp_max_upload_size(); if (!$max_upload_size) { $max_upload_size = 0; } ?> <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()) { /** * Fires when an upload will exceed the defined upload space quota for a network site. * * @since 3.5.0 */ do_action('upload_ui_over_quota'); return; } /** * Fires just before the legacy (pre-3.5.0) upload interface is loaded. * * @since 2.6.0 */ do_action('pre-upload-ui'); $post_params = array("post_id" => $post_id, "_wpnonce" => wp_create_nonce('media-form'), "type" => $_type, "tab" => $_tab, "short" => "1"); /** * Filter the media upload post parameters. * * @since 3.1.0 As 'swfupload_post_params' * @since 3.3.0 * * @param array $post_params An array of media upload parameters used by Plupload. */ $post_params = apply_filters('upload_post_params', $post_params); $plupload_init = array('runtimes' => 'html5,flash,silverlight,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', '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('max_file_size' => $max_upload_size . 'b'), 'multipart_params' => $post_params); // Currently only iOS Safari supports multiple files uploading but has a bug that prevents uploading of videos // when enabled. See #29602. if (wp_is_mobile()) { $plupload_init['multi_selection'] = false; } /** * Filter the default Plupload settings. * * @since 3.3.0 * * @param array $plupload_init An array of default settings used by Plupload. */ $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 /** * Fires before the upload interface loads. * * @since 2.6.0 As 'pre-flash-upload-ui' * @since 3.3.0 */ do_action('pre-plupload-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 /** * Fires after the upload interface loads. * * @since 2.6.0 As 'post-flash-upload-ui' * @since 3.3.0 */ do_action('post-plupload-upload-ui'); ?> </div> <div id="html-upload-ui" class="hide-if-js"> <?php /** * Fires before the upload button in the media upload interface. * * @since 2.6.0 */ 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(__('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> <?php /** * Fires after the upload button in the media upload interface. * * @since 2.6.0 */ do_action('post-html-upload-ui'); ?> </div> <p class="max-upload-size"><?php printf(__('Maximum upload file size: %s.'), esc_html(size_format($max_upload_size))); ?> </p> <?php /** * Fires on the post upload UI screen. * * Legacy (pre-3.5.0) media workflow hook. * * @since 2.6.0 */ do_action('post-upload-ui'); }
/** * Print the field based on field type. * * @since 1.0.0 * @access public * @param string $field_name Fieldname. * @param array $field Field Properties. * @param array $exist_data Exist field values. * @return string */ public static function print_field($field_name, $field, $exist_data = array()) { global $wp_registered_sidebars, $wp_widget_factory; $field = wp_parse_args($field, array('class' => '', 'default' => '')); $field_id = 'tf_field_' . $field_name; // prefix field id to avoid identic tag ID from another elements $output = ''; $exist_value = isset($exist_data[$field_name]) ? $exist_data[$field_name] : ''; switch ($field['type']) { case 'text': case 'number': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<input type="%s" name="%s" id="%s" class="%s" value="%s">', esc_attr($field['type']), esc_attr($field_name), esc_attr($field_id), esc_attr($field['class']), esc_attr($exist_value)); break; case 'hidden': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<input type="hidden" name="%s" id="%s" class="%s" value="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class']), esc_attr($exist_value)); break; case 'textarea': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<textarea id="%s" name="%s" class="%s" rows="4" cols="3">%s</textarea>', esc_attr($field_id), esc_attr($field_name), esc_attr($field['class']), esc_textarea($exist_value)); break; case 'select': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $size = isset($field['size']) && intval($field['size']) > 0 ? $field['size'] : 10; $multi = isset($field['multiple']) ? 'multiple="multiple" size="' . $size . '"' : ''; if ($multi) { $field_name = $field_name . '[]'; if ($exist_value && !is_array($exist_value)) { $exist_value = maybe_unserialize(stripslashes($exist_value)); } else { if (!is_array($exist_value)) { $exist_value = array(); } } } $output .= sprintf('<select name="%s" id="%s" class="%s" ' . $multi . '>', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class'])); foreach ($field['options'] as $option) { if ($multi) { $selected = in_array($option['value'], $exist_value) ? 'selected="selected"' : ''; } else { $selected = selected($exist_value, $option['value'], false); } $output .= sprintf('<option value="%s"%s>%s</option>', esc_attr($option['value']), $selected, esc_html($option['name'])); } $output .= '</select>'; break; case 'select_group': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<select name="%s" id="%s" class="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class'])); if (isset($field['show_empty'])) { $output .= '<option value=""> </option>'; } foreach ($field['options'] as $key => $group) { $output .= sprintf('<optgroup label="%s">', $group['label']); foreach ($group['options'] as $option) { $output .= sprintf('<option value="%s"%s>%s</option>', esc_attr($option['value']), selected($exist_value, $option['value'], false), esc_html($option['name'])); } $output .= '</optgroup>'; } $output .= '</select>'; break; case 'wp_editor': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $rows = isset($field['rows']) ? $field['rows'] : 6; ob_start(); wp_editor($exist_value, $field_id, array('textarea_name' => $field_name, 'textarea_rows' => $rows, 'editor_class' => 'tf_wp_editor ' . $field['class'])); $output .= ob_get_contents(); ob_end_clean(); break; case 'separator': $output .= isset($field['meta']['html']) && '' != $field['meta']['html'] ? $field['meta']['html'] : '<hr class="meta_fields_separator" />'; break; case 'image': case 'video': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $input_type = 'image' == $field['type'] ? 'hidden' : 'text'; $output .= sprintf('<input type="%s" name="%s" id="%s" class="tf_upload_value tf_type-%s %s" value="%s">', esc_attr($input_type), esc_attr($field_name), esc_attr($field_id), $field['type'], esc_attr($field['class']), esc_attr($exist_value)); $output .= '<div class="tf_small">'; 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-flow'), get_space_allowed()); } else { $output .= sprintf('<a href="#" class="tf_upload_media_library" data-uploader-title="%s" data-uploader-button-text="%s" data-library-type="%s">%s</a>', 'image' == $field['type'] ? esc_attr__('Upload an Image', 'themify-flow') : esc_attr__('Upload a Video', 'themify-flow'), esc_attr__('Insert file URL', 'themify-flow'), esc_attr($field['type']), 'image' == $field['type'] ? esc_attr__('+ Add Image', 'themify-flow') : esc_attr__('+ Add Video', 'themify-flow')); $max_upload_size = (int) wp_max_upload_size() / (1024 * 1024); $output .= sprintf(__('<p class="tf_max_upload_size">Maximum upload file size: %d MB.</p>', 'themify-flow'), $max_upload_size); } $output .= '</div>'; if ('image' == $field['type']) { $img_el = TF_Model::get_attachment_image($exist_value, array(50, 50)); $output .= sprintf('<p class="tf_thumb_preview"> <span class="tf_thumb_preview_placeholder">%s</span> <a href="#" class="tf_thumb_preview_delete"><span class="ti-close"></span></a> </p>', $img_el); } break; case 'color': $color = '' != $exist_value ? explode('_', $exist_value) : array(); $color_val = isset($color[0]) ? $color[0] : ''; $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= '<div class="tf_custom_color_wrap">'; $output .= sprintf('<input type="text" class="tf_color_picker %s" value="%s">', esc_attr($field['class']), esc_attr($color_val)); $output .= sprintf('<input type="hidden" name="%s" id="%s" class="tf_color_pick_value" value="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($exist_value)); $output .= '<a class="remove-color ti-close" href="#"></a></div>'; break; case 'radio': $meta_attr = ''; foreach ($field['options'] as $option) { $checked = isset($option['selected']) && $option['selected'] == true ? 'checked="checked"' : ''; $checked = '' != $exist_value && $option['value'] == $exist_value ? 'checked="checked"' : $checked; $meta_attr = isset($field['toggleable']) ? ' data-toggleable="' . $field['toggleable']['target_class'] . '-' . $option['value'] . '"' : ''; $output .= sprintf('<input type="radio" id="%s" class="%s" name="%s" value="%s" %s%s>', esc_attr($field_name . '_' . $option['value']), esc_attr($field['class']), esc_attr($field_name), esc_attr($option['value']), $checked, $meta_attr); $output .= sprintf('<label for="%s">%s</label>', esc_attr($field_name . '_' . $option['value']), esc_html($option['name'])); } break; case 'checkbox': $checked = $exist_value || isset($field['checked']) && true == $field['checked'] ? 'checked="checked"' : ''; $output .= sprintf('<label><input type="checkbox" name="%s" id="%s" class="%s" value="1" %s> %s</label>', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class']), $checked, $field['text']); break; case 'checkbox_group': $output .= sprintf('<div class="tf_checkbox_group" data-field-name="%s">', $field_name); foreach ($field['options'] as $key => $value) { $output .= sprintf('<label><input type="checkbox" name="%s[%s]" id="%s" class="%s" value="1" data-key="%s"> %s</label>', esc_attr($field_name), $key, esc_attr($field_id), esc_attr($field['class']), $key, $value); } $output .= '</div>'; break; case 'layout': $output .= sprintf('<p id="%s" class="tf_option_icons tf-layout-icon">', esc_attr($field_name)); $value = ''; foreach ($field['options'] as $option) { $selected = isset($option['selected']) && true == $option['selected'] ? ' selected' : ''; $value = isset($option['selected']) && true == $option['selected'] && '' == $value ? $option['value'] : $value; // Check exist value if ('' != $exist_value) { $selected = $option['value'] == $exist_value ? ' selected' : ''; $value = $exist_value; } $output .= sprintf('<a href="#" data-value="%s" title="%s" class="tf-layout-option%s"><img src="%s" alt="%s" /></a>', esc_attr($option['value']), esc_attr($option['label']), $selected, esc_url($option['img']), esc_attr($option['label'])); } $output .= sprintf('<input type="hidden" name="%s" value="%s" class="val">', esc_attr($field_name), esc_attr($value)); $output .= '</p>'; break; case 'template_assign': $selected = '' != $exist_value ? $exist_value : array(); $output .= self::print_archive_tabs($field_name, $selected); $output .= self::print_single_tabs($field_name, $selected); $output .= self::print_page_tabs($field_name, $selected); break; case 'template_part_select': $output .= sprintf('<select name="%s" id="%s" class="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class'])); $output .= '<option></option>'; $posts = TF_Model::get_posts('tf_template_part'); foreach ($posts as $part) { $selected = selected($exist_value, $part->post_name, false); $output .= sprintf('<option value="%s" %s>%s</option>', esc_attr($part->post_name), $selected, esc_html($part->post_title)); } $output .= '</select><br/>'; if (isset($field['show_extra_link']) && true == $field['show_extra_link'] || !isset($field['show_extra_link'])) { $output .= sprintf('<a href="%s" target="_blank" class="manage_template_part_link"><span class="tf_icon ti-folder"></span> %s</a>', admin_url('edit.php?post_type=tf_template_part'), __('Manage Template Part', 'themify-flow')); } break; case 'builder': ob_start(); global $TF; $TF->in_builder_lightbox = true; $exist_value = '' == $exist_value ? $field['default'] : wp_kses_stripslashes($exist_value); $output .= '<div class="tf_back_builder tf_lightbox_builder_field-init" data-builder-field="' . $field_id . '">'; TF_Interface::builder_element_panel($field['options']['category']); TF_Interface::builder_row_panel($exist_value); $output .= ob_get_contents(); $output .= '</div>'; $TF->in_builder_lightbox = false; ob_end_clean(); // Hold the builder value $output .= sprintf('<input type="hidden" name="_has_builder[]" value="%s">', esc_attr($field_name)); $output .= sprintf('<input type="hidden" name="%s" id="%s" class="tf_field_builder" value="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($exist_value)); break; case 'icon': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<input type="text" name="%s" id="%s" class="%s" value="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class']), esc_attr($exist_value)); $output .= '<a class="button button-secondary hide-if-no-js tf_fa_toggle" href="#">' . __('Insert Icon', 'themify-flow') . '</a>'; break; case 'gallery': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<input type="hidden" id="%s" name="%s" class="tf_gallery_value %s" value="%s">', esc_attr($field_id), esc_attr($field_name), esc_attr($field['class']), esc_textarea($exist_value)); $output .= sprintf('<a href="#" class="tf_browse_gallery_btn">%s</a>', __('+ Insert Gallery', 'themify-flow')); $output .= '<div class="tf_gallery_preview">'; // place outside images loop for js placeholder if ($slider_images = tf_get_images_from_gallery_shortcode($exist_value)) { foreach ($slider_images as $image) { $output .= sprintf('<p class="tf_thumb_preview"> <span class="tf_thumb_preview_placeholder">%s</span> </p>', wp_get_attachment_image($image->ID, array(50, 50))); } } $output .= '</div>'; break; case 'widget_area': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<select name="%s" id="%s" class="%s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class'])); $output .= '<option value=""></option>'; foreach ($wp_registered_sidebars as $k => $v) { $output .= sprintf('<option value="%s"%s>%s</option>', esc_attr($v['id']), selected($exist_value, $v['id'], false), esc_html($v['name'])); } $output .= '</select>'; break; case 'widget': $exist_value = '' == $exist_value ? $field['default'] : $exist_value; $output .= sprintf('<select name="%s" id="%s" class="tf-field-widget-select %s">', esc_attr($field_name), esc_attr($field_id), esc_attr($field['class'])); $output .= '<option value=""></option>'; foreach ($wp_widget_factory->widgets as $class => $widget) { $output .= sprintf('<option data-idbase="%s" value="%s"%s>%s</option>', esc_attr($widget->id_base), esc_attr($class), selected($exist_value, $class, false), esc_html($widget->name)); } $output .= '</select>'; $output .= '<div class="tf-widget-form"></div>'; break; case 'html': $output .= $field['html']; break; default: /** * Hook your own field type. * * @since 1.0.0 */ $output .= apply_filters('tf_form_fields', $field_id, $field_name, $exist_value); break; } $output .= isset($field['description']) ? sprintf('<small>%s</small>', $field['description']) : ''; return $output; }