Edit File by line
/home/barbar84/www/wp-admin/includes
File: media.php
* Filters the insert media from URL form HTML.
[2500] Fix | Delete
*
[2501] Fix | Delete
* @since 3.3.0
[2502] Fix | Delete
*
[2503] Fix | Delete
* @param string $form_html The insert from URL form HTML.
[2504] Fix | Delete
*/
[2505] Fix | Delete
echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
[2506] Fix | Delete
[2507] Fix | Delete
?>
[2508] Fix | Delete
</div>
[2509] Fix | Delete
</div>
[2510] Fix | Delete
</form>
[2511] Fix | Delete
<?php
[2512] Fix | Delete
}
[2513] Fix | Delete
[2514] Fix | Delete
/**
[2515] Fix | Delete
* Adds gallery form to upload iframe
[2516] Fix | Delete
*
[2517] Fix | Delete
* @since 2.5.0
[2518] Fix | Delete
*
[2519] Fix | Delete
* @global string $redir_tab
[2520] Fix | Delete
* @global string $type
[2521] Fix | Delete
* @global string $tab
[2522] Fix | Delete
*
[2523] Fix | Delete
* @param array $errors
[2524] Fix | Delete
*/
[2525] Fix | Delete
function media_upload_gallery_form( $errors ) {
[2526] Fix | Delete
global $redir_tab, $type;
[2527] Fix | Delete
[2528] Fix | Delete
$redir_tab = 'gallery';
[2529] Fix | Delete
media_upload_header();
[2530] Fix | Delete
[2531] Fix | Delete
$post_id = (int) $_REQUEST['post_id'];
[2532] Fix | Delete
$form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
[2533] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[2534] Fix | Delete
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
[2535] Fix | Delete
$form_class = 'media-upload-form validate';
[2536] Fix | Delete
[2537] Fix | Delete
if ( get_user_setting( 'uploader' ) ) {
[2538] Fix | Delete
$form_class .= ' html-uploader';
[2539] Fix | Delete
}
[2540] Fix | Delete
[2541] Fix | Delete
?>
[2542] Fix | Delete
<script type="text/javascript">
[2543] Fix | Delete
jQuery(function($){
[2544] Fix | Delete
var preloaded = $(".media-item.preloaded");
[2545] Fix | Delete
if ( preloaded.length > 0 ) {
[2546] Fix | Delete
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
[2547] Fix | Delete
updateMediaForm();
[2548] Fix | Delete
}
[2549] Fix | Delete
});
[2550] Fix | Delete
</script>
[2551] Fix | Delete
<div id="sort-buttons" class="hide-if-no-js">
[2552] Fix | Delete
<span>
[2553] Fix | Delete
<?php _e( 'All Tabs:' ); ?>
[2554] Fix | Delete
<a href="#" id="showall"><?php _e( 'Show' ); ?></a>
[2555] Fix | Delete
<a href="#" id="hideall" style="display:none;"><?php _e( 'Hide' ); ?></a>
[2556] Fix | Delete
</span>
[2557] Fix | Delete
<?php _e( 'Sort Order:' ); ?>
[2558] Fix | Delete
<a href="#" id="asc"><?php _e( 'Ascending' ); ?></a> |
[2559] Fix | Delete
<a href="#" id="desc"><?php _e( 'Descending' ); ?></a> |
[2560] Fix | Delete
<a href="#" id="clear"><?php _ex( 'Clear', 'verb' ); ?></a>
[2561] Fix | Delete
</div>
[2562] Fix | Delete
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
[2563] Fix | Delete
<?php wp_nonce_field( 'media-form' ); ?>
[2564] Fix | Delete
<?php // media_upload_form( $errors ); ?>
[2565] Fix | Delete
<table class="widefat">
[2566] Fix | Delete
<thead><tr>
[2567] Fix | Delete
<th><?php _e( 'Media' ); ?></th>
[2568] Fix | Delete
<th class="order-head"><?php _e( 'Order' ); ?></th>
[2569] Fix | Delete
<th class="actions-head"><?php _e( 'Actions' ); ?></th>
[2570] Fix | Delete
</tr></thead>
[2571] Fix | Delete
</table>
[2572] Fix | Delete
<div id="media-items">
[2573] Fix | Delete
<?php add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 ); ?>
[2574] Fix | Delete
<?php echo get_media_items( $post_id, $errors ); ?>
[2575] Fix | Delete
</div>
[2576] Fix | Delete
[2577] Fix | Delete
<p class="ml-submit">
[2578] Fix | Delete
<?php
[2579] Fix | Delete
submit_button(
[2580] Fix | Delete
__( 'Save all changes' ),
[2581] Fix | Delete
'savebutton',
[2582] Fix | Delete
'save',
[2583] Fix | Delete
false,
[2584] Fix | Delete
array(
[2585] Fix | Delete
'id' => 'save-all',
[2586] Fix | Delete
'style' => 'display: none;',
[2587] Fix | Delete
)
[2588] Fix | Delete
);
[2589] Fix | Delete
?>
[2590] Fix | Delete
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
[2591] Fix | Delete
<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
[2592] Fix | Delete
<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
[2593] Fix | Delete
</p>
[2594] Fix | Delete
[2595] Fix | Delete
<div id="gallery-settings" style="display:none;">
[2596] Fix | Delete
<div class="title"><?php _e( 'Gallery Settings' ); ?></div>
[2597] Fix | Delete
<table id="basic" class="describe"><tbody>
[2598] Fix | Delete
<tr>
[2599] Fix | Delete
<th scope="row" class="label">
[2600] Fix | Delete
<label>
[2601] Fix | Delete
<span class="alignleft"><?php _e( 'Link thumbnails to:' ); ?></span>
[2602] Fix | Delete
</label>
[2603] Fix | Delete
</th>
[2604] Fix | Delete
<td class="field">
[2605] Fix | Delete
<input type="radio" name="linkto" id="linkto-file" value="file" />
[2606] Fix | Delete
<label for="linkto-file" class="radio"><?php _e( 'Image File' ); ?></label>
[2607] Fix | Delete
[2608] Fix | Delete
<input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
[2609] Fix | Delete
<label for="linkto-post" class="radio"><?php _e( 'Attachment Page' ); ?></label>
[2610] Fix | Delete
</td>
[2611] Fix | Delete
</tr>
[2612] Fix | Delete
[2613] Fix | Delete
<tr>
[2614] Fix | Delete
<th scope="row" class="label">
[2615] Fix | Delete
<label>
[2616] Fix | Delete
<span class="alignleft"><?php _e( 'Order images by:' ); ?></span>
[2617] Fix | Delete
</label>
[2618] Fix | Delete
</th>
[2619] Fix | Delete
<td class="field">
[2620] Fix | Delete
<select id="orderby" name="orderby">
[2621] Fix | Delete
<option value="menu_order" selected="selected"><?php _e( 'Menu order' ); ?></option>
[2622] Fix | Delete
<option value="title"><?php _e( 'Title' ); ?></option>
[2623] Fix | Delete
<option value="post_date"><?php _e( 'Date/Time' ); ?></option>
[2624] Fix | Delete
<option value="rand"><?php _e( 'Random' ); ?></option>
[2625] Fix | Delete
</select>
[2626] Fix | Delete
</td>
[2627] Fix | Delete
</tr>
[2628] Fix | Delete
[2629] Fix | Delete
<tr>
[2630] Fix | Delete
<th scope="row" class="label">
[2631] Fix | Delete
<label>
[2632] Fix | Delete
<span class="alignleft"><?php _e( 'Order:' ); ?></span>
[2633] Fix | Delete
</label>
[2634] Fix | Delete
</th>
[2635] Fix | Delete
<td class="field">
[2636] Fix | Delete
<input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
[2637] Fix | Delete
<label for="order-asc" class="radio"><?php _e( 'Ascending' ); ?></label>
[2638] Fix | Delete
[2639] Fix | Delete
<input type="radio" name="order" id="order-desc" value="desc" />
[2640] Fix | Delete
<label for="order-desc" class="radio"><?php _e( 'Descending' ); ?></label>
[2641] Fix | Delete
</td>
[2642] Fix | Delete
</tr>
[2643] Fix | Delete
[2644] Fix | Delete
<tr>
[2645] Fix | Delete
<th scope="row" class="label">
[2646] Fix | Delete
<label>
[2647] Fix | Delete
<span class="alignleft"><?php _e( 'Gallery columns:' ); ?></span>
[2648] Fix | Delete
</label>
[2649] Fix | Delete
</th>
[2650] Fix | Delete
<td class="field">
[2651] Fix | Delete
<select id="columns" name="columns">
[2652] Fix | Delete
<option value="1">1</option>
[2653] Fix | Delete
<option value="2">2</option>
[2654] Fix | Delete
<option value="3" selected="selected">3</option>
[2655] Fix | Delete
<option value="4">4</option>
[2656] Fix | Delete
<option value="5">5</option>
[2657] Fix | Delete
<option value="6">6</option>
[2658] Fix | Delete
<option value="7">7</option>
[2659] Fix | Delete
<option value="8">8</option>
[2660] Fix | Delete
<option value="9">9</option>
[2661] Fix | Delete
</select>
[2662] Fix | Delete
</td>
[2663] Fix | Delete
</tr>
[2664] Fix | Delete
</tbody></table>
[2665] Fix | Delete
[2666] Fix | Delete
<p class="ml-submit">
[2667] Fix | Delete
<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
[2668] Fix | Delete
<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
[2669] Fix | Delete
</p>
[2670] Fix | Delete
</div>
[2671] Fix | Delete
</form>
[2672] Fix | Delete
<?php
[2673] Fix | Delete
}
[2674] Fix | Delete
[2675] Fix | Delete
/**
[2676] Fix | Delete
* Outputs the legacy media upload form for the media library.
[2677] Fix | Delete
*
[2678] Fix | Delete
* @since 2.5.0
[2679] Fix | Delete
*
[2680] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[2681] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[2682] Fix | Delete
* @global WP_Locale $wp_locale WordPress date and time locale object.
[2683] Fix | Delete
* @global string $type
[2684] Fix | Delete
* @global string $tab
[2685] Fix | Delete
* @global array $post_mime_types
[2686] Fix | Delete
*
[2687] Fix | Delete
* @param array $errors
[2688] Fix | Delete
*/
[2689] Fix | Delete
function media_upload_library_form( $errors ) {
[2690] Fix | Delete
global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
[2691] Fix | Delete
[2692] Fix | Delete
media_upload_header();
[2693] Fix | Delete
[2694] Fix | Delete
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
[2695] Fix | Delete
[2696] Fix | Delete
$form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
[2697] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[2698] Fix | Delete
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
[2699] Fix | Delete
$form_class = 'media-upload-form validate';
[2700] Fix | Delete
[2701] Fix | Delete
if ( get_user_setting( 'uploader' ) ) {
[2702] Fix | Delete
$form_class .= ' html-uploader';
[2703] Fix | Delete
}
[2704] Fix | Delete
[2705] Fix | Delete
$q = $_GET;
[2706] Fix | Delete
$q['posts_per_page'] = 10;
[2707] Fix | Delete
$q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0;
[2708] Fix | Delete
if ( $q['paged'] < 1 ) {
[2709] Fix | Delete
$q['paged'] = 1;
[2710] Fix | Delete
}
[2711] Fix | Delete
$q['offset'] = ( $q['paged'] - 1 ) * 10;
[2712] Fix | Delete
if ( $q['offset'] < 1 ) {
[2713] Fix | Delete
$q['offset'] = 0;
[2714] Fix | Delete
}
[2715] Fix | Delete
[2716] Fix | Delete
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
[2717] Fix | Delete
[2718] Fix | Delete
?>
[2719] Fix | Delete
<form id="filter" method="get">
[2720] Fix | Delete
<input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
[2721] Fix | Delete
<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
[2722] Fix | Delete
<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
[2723] Fix | Delete
<input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
[2724] Fix | Delete
<input type="hidden" name="context" value="<?php echo isset( $_GET['context'] ) ? esc_attr( $_GET['context'] ) : ''; ?>" />
[2725] Fix | Delete
[2726] Fix | Delete
<p id="media-search" class="search-box">
[2727] Fix | Delete
<label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
[2728] Fix | Delete
<input type="search" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
[2729] Fix | Delete
<?php submit_button( __( 'Search Media' ), '', '', false ); ?>
[2730] Fix | Delete
</p>
[2731] Fix | Delete
[2732] Fix | Delete
<ul class="subsubsub">
[2733] Fix | Delete
<?php
[2734] Fix | Delete
$type_links = array();
[2735] Fix | Delete
$_num_posts = (array) wp_count_attachments();
[2736] Fix | Delete
$matches = wp_match_mime_types( array_keys( $post_mime_types ), array_keys( $_num_posts ) );
[2737] Fix | Delete
foreach ( $matches as $_type => $reals ) {
[2738] Fix | Delete
foreach ( $reals as $real ) {
[2739] Fix | Delete
if ( isset( $num_posts[ $_type ] ) ) {
[2740] Fix | Delete
$num_posts[ $_type ] += $_num_posts[ $real ];
[2741] Fix | Delete
} else {
[2742] Fix | Delete
$num_posts[ $_type ] = $_num_posts[ $real ];
[2743] Fix | Delete
}
[2744] Fix | Delete
}
[2745] Fix | Delete
}
[2746] Fix | Delete
// If available type specified by media button clicked, filter by that type.
[2747] Fix | Delete
if ( empty( $_GET['post_mime_type'] ) && ! empty( $num_posts[ $type ] ) ) {
[2748] Fix | Delete
$_GET['post_mime_type'] = $type;
[2749] Fix | Delete
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
[2750] Fix | Delete
}
[2751] Fix | Delete
if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) {
[2752] Fix | Delete
$class = ' class="current"';
[2753] Fix | Delete
} else {
[2754] Fix | Delete
$class = '';
[2755] Fix | Delete
}
[2756] Fix | Delete
$type_links[] = '<li><a href="' . esc_url(
[2757] Fix | Delete
add_query_arg(
[2758] Fix | Delete
array(
[2759] Fix | Delete
'post_mime_type' => 'all',
[2760] Fix | Delete
'paged' => false,
[2761] Fix | Delete
'm' => false,
[2762] Fix | Delete
)
[2763] Fix | Delete
)
[2764] Fix | Delete
) . '"' . $class . '>' . __( 'All Types' ) . '</a>';
[2765] Fix | Delete
foreach ( $post_mime_types as $mime_type => $label ) {
[2766] Fix | Delete
$class = '';
[2767] Fix | Delete
[2768] Fix | Delete
if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) {
[2769] Fix | Delete
continue;
[2770] Fix | Delete
}
[2771] Fix | Delete
[2772] Fix | Delete
if ( isset( $_GET['post_mime_type'] ) && wp_match_mime_types( $mime_type, $_GET['post_mime_type'] ) ) {
[2773] Fix | Delete
$class = ' class="current"';
[2774] Fix | Delete
}
[2775] Fix | Delete
[2776] Fix | Delete
$type_links[] = '<li><a href="' . esc_url(
[2777] Fix | Delete
add_query_arg(
[2778] Fix | Delete
array(
[2779] Fix | Delete
'post_mime_type' => $mime_type,
[2780] Fix | Delete
'paged' => false,
[2781] Fix | Delete
)
[2782] Fix | Delete
)
[2783] Fix | Delete
) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[ $mime_type ] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[ $mime_type ] ) . '</span>' ) . '</a>';
[2784] Fix | Delete
}
[2785] Fix | Delete
/**
[2786] Fix | Delete
* Filters the media upload mime type list items.
[2787] Fix | Delete
*
[2788] Fix | Delete
* Returned values should begin with an `<li>` tag.
[2789] Fix | Delete
*
[2790] Fix | Delete
* @since 3.1.0
[2791] Fix | Delete
*
[2792] Fix | Delete
* @param string[] $type_links An array of list items containing mime type link HTML.
[2793] Fix | Delete
*/
[2794] Fix | Delete
echo implode( ' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
[2795] Fix | Delete
unset( $type_links );
[2796] Fix | Delete
?>
[2797] Fix | Delete
</ul>
[2798] Fix | Delete
[2799] Fix | Delete
<div class="tablenav">
[2800] Fix | Delete
[2801] Fix | Delete
<?php
[2802] Fix | Delete
$page_links = paginate_links(
[2803] Fix | Delete
array(
[2804] Fix | Delete
'base' => add_query_arg( 'paged', '%#%' ),
[2805] Fix | Delete
'format' => '',
[2806] Fix | Delete
'prev_text' => __( '&laquo;' ),
[2807] Fix | Delete
'next_text' => __( '&raquo;' ),
[2808] Fix | Delete
'total' => ceil( $wp_query->found_posts / 10 ),
[2809] Fix | Delete
'current' => $q['paged'],
[2810] Fix | Delete
)
[2811] Fix | Delete
);
[2812] Fix | Delete
[2813] Fix | Delete
if ( $page_links ) {
[2814] Fix | Delete
echo "<div class='tablenav-pages'>$page_links</div>";
[2815] Fix | Delete
}
[2816] Fix | Delete
?>
[2817] Fix | Delete
[2818] Fix | Delete
<div class="alignleft actions">
[2819] Fix | Delete
<?php
[2820] Fix | Delete
[2821] Fix | Delete
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
[2822] Fix | Delete
[2823] Fix | Delete
$arc_result = $wpdb->get_results( $arc_query );
[2824] Fix | Delete
[2825] Fix | Delete
$month_count = count( $arc_result );
[2826] Fix | Delete
$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;
[2827] Fix | Delete
[2828] Fix | Delete
if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
[2829] Fix | Delete
?>
[2830] Fix | Delete
<select name='m'>
[2831] Fix | Delete
<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
[2832] Fix | Delete
<?php
[2833] Fix | Delete
[2834] Fix | Delete
foreach ( $arc_result as $arc_row ) {
[2835] Fix | Delete
if ( 0 == $arc_row->yyear ) {
[2836] Fix | Delete
continue;
[2837] Fix | Delete
}
[2838] Fix | Delete
[2839] Fix | Delete
$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
[2840] Fix | Delete
[2841] Fix | Delete
if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) {
[2842] Fix | Delete
$default = ' selected="selected"';
[2843] Fix | Delete
} else {
[2844] Fix | Delete
$default = '';
[2845] Fix | Delete
}
[2846] Fix | Delete
[2847] Fix | Delete
echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
[2848] Fix | Delete
echo esc_html( $wp_locale->get_month( $arc_row->mmonth ) . " $arc_row->yyear" );
[2849] Fix | Delete
echo "</option>\n";
[2850] Fix | Delete
}
[2851] Fix | Delete
[2852] Fix | Delete
?>
[2853] Fix | Delete
</select>
[2854] Fix | Delete
<?php } ?>
[2855] Fix | Delete
[2856] Fix | Delete
<?php submit_button( __( 'Filter &#187;' ), '', 'post-query-submit', false ); ?>
[2857] Fix | Delete
[2858] Fix | Delete
</div>
[2859] Fix | Delete
[2860] Fix | Delete
<br class="clear" />
[2861] Fix | Delete
</div>
[2862] Fix | Delete
</form>
[2863] Fix | Delete
[2864] Fix | Delete
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form">
[2865] Fix | Delete
<?php wp_nonce_field( 'media-form' ); ?>
[2866] Fix | Delete
<?php // media_upload_form( $errors ); ?>
[2867] Fix | Delete
[2868] Fix | Delete
<script type="text/javascript">
[2869] Fix | Delete
jQuery(function($){
[2870] Fix | Delete
var preloaded = $(".media-item.preloaded");
[2871] Fix | Delete
if ( preloaded.length > 0 ) {
[2872] Fix | Delete
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
[2873] Fix | Delete
updateMediaForm();
[2874] Fix | Delete
}
[2875] Fix | Delete
});
[2876] Fix | Delete
</script>
[2877] Fix | Delete
[2878] Fix | Delete
<div id="media-items">
[2879] Fix | Delete
<?php add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 ); ?>
[2880] Fix | Delete
<?php echo get_media_items( null, $errors ); ?>
[2881] Fix | Delete
</div>
[2882] Fix | Delete
<p class="ml-submit">
[2883] Fix | Delete
<?php submit_button( __( 'Save all changes' ), 'savebutton', 'save', false ); ?>
[2884] Fix | Delete
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
[2885] Fix | Delete
</p>
[2886] Fix | Delete
</form>
[2887] Fix | Delete
<?php
[2888] Fix | Delete
}
[2889] Fix | Delete
[2890] Fix | Delete
/**
[2891] Fix | Delete
* Creates the form for external url
[2892] Fix | Delete
*
[2893] Fix | Delete
* @since 2.7.0
[2894] Fix | Delete
*
[2895] Fix | Delete
* @param string $default_view
[2896] Fix | Delete
* @return string the form html
[2897] Fix | Delete
*/
[2898] Fix | Delete
function wp_media_insert_url_form( $default_view = 'image' ) {
[2899] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[2900] Fix | Delete
if ( ! apply_filters( 'disable_captions', '' ) ) {
[2901] Fix | Delete
$caption = '
[2902] Fix | Delete
<tr class="image-only">
[2903] Fix | Delete
<th scope="row" class="label">
[2904] Fix | Delete
<label for="caption"><span class="alignleft">' . __( 'Image Caption' ) . '</span></label>
[2905] Fix | Delete
</th>
[2906] Fix | Delete
<td class="field"><textarea id="caption" name="caption"></textarea></td>
[2907] Fix | Delete
</tr>';
[2908] Fix | Delete
} else {
[2909] Fix | Delete
$caption = '';
[2910] Fix | Delete
}
[2911] Fix | Delete
[2912] Fix | Delete
$default_align = get_option( 'image_default_align' );
[2913] Fix | Delete
[2914] Fix | Delete
if ( empty( $default_align ) ) {
[2915] Fix | Delete
$default_align = 'none';
[2916] Fix | Delete
}
[2917] Fix | Delete
[2918] Fix | Delete
if ( 'image' === $default_view ) {
[2919] Fix | Delete
$view = 'image-only';
[2920] Fix | Delete
$table_class = '';
[2921] Fix | Delete
} else {
[2922] Fix | Delete
$view = 'not-image';
[2923] Fix | Delete
$table_class = $view;
[2924] Fix | Delete
}
[2925] Fix | Delete
[2926] Fix | Delete
return '
[2927] Fix | Delete
<p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p>
[2928] Fix | Delete
<p class="media-types media-types-required-info">' .
[2929] Fix | Delete
/* translators: %s: Asterisk symbol (*). */
[2930] Fix | Delete
sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) .
[2931] Fix | Delete
'</p>
[2932] Fix | Delete
<table class="describe ' . $table_class . '"><tbody>
[2933] Fix | Delete
<tr>
[2934] Fix | Delete
<th scope="row" class="label" style="width:130px;">
[2935] Fix | Delete
<label for="src"><span class="alignleft">' . __( 'URL' ) . '</span> <span class="required">*</span></label>
[2936] Fix | Delete
<span class="alignright" id="status_img"></span>
[2937] Fix | Delete
</th>
[2938] Fix | Delete
<td class="field"><input id="src" name="src" value="" type="text" required onblur="addExtImage.getImageData()" /></td>
[2939] Fix | Delete
</tr>
[2940] Fix | Delete
[2941] Fix | Delete
<tr>
[2942] Fix | Delete
<th scope="row" class="label">
[2943] Fix | Delete
<label for="title"><span class="alignleft">' . __( 'Title' ) . '</span> <span class="required">*</span></label>
[2944] Fix | Delete
</th>
[2945] Fix | Delete
<td class="field"><input id="title" name="title" value="" type="text" required /></td>
[2946] Fix | Delete
</tr>
[2947] Fix | Delete
[2948] Fix | Delete
<tr class="not-image"><td></td><td><p class="help">' . __( 'Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;' ) . '</p></td></tr>
[2949] Fix | Delete
[2950] Fix | Delete
<tr class="image-only">
[2951] Fix | Delete
<th scope="row" class="label">
[2952] Fix | Delete
<label for="alt"><span class="alignleft">' . __( 'Alternative Text' ) . '</span></label>
[2953] Fix | Delete
</th>
[2954] Fix | Delete
<td class="field"><input id="alt" name="alt" value="" type="text" required />
[2955] Fix | Delete
<p class="help">' . __( 'Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;' ) . '</p></td>
[2956] Fix | Delete
</tr>
[2957] Fix | Delete
' . $caption . '
[2958] Fix | Delete
<tr class="align image-only">
[2959] Fix | Delete
<th scope="row" class="label"><p><label for="align">' . __( 'Alignment' ) . '</label></p></th>
[2960] Fix | Delete
<td class="field">
[2961] Fix | Delete
<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'none' === $default_align ? ' checked="checked"' : '' ) . ' />
[2962] Fix | Delete
<label for="align-none" class="align image-align-none-label">' . __( 'None' ) . '</label>
[2963] Fix | Delete
<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'left' === $default_align ? ' checked="checked"' : '' ) . ' />
[2964] Fix | Delete
<label for="align-left" class="align image-align-left-label">' . __( 'Left' ) . '</label>
[2965] Fix | Delete
<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'center' === $default_align ? ' checked="checked"' : '' ) . ' />
[2966] Fix | Delete
<label for="align-center" class="align image-align-center-label">' . __( 'Center' ) . '</label>
[2967] Fix | Delete
<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'right' === $default_align ? ' checked="checked"' : '' ) . ' />
[2968] Fix | Delete
<label for="align-right" class="align image-align-right-label">' . __( 'Right' ) . '</label>
[2969] Fix | Delete
</td>
[2970] Fix | Delete
</tr>
[2971] Fix | Delete
[2972] Fix | Delete
<tr class="image-only">
[2973] Fix | Delete
<th scope="row" class="label">
[2974] Fix | Delete
<label for="url"><span class="alignleft">' . __( 'Link Image To:' ) . '</span></label>
[2975] Fix | Delete
</th>
[2976] Fix | Delete
<td class="field"><input id="url" name="url" value="" type="text" /><br />
[2977] Fix | Delete
[2978] Fix | Delete
<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __( 'None' ) . '</button>
[2979] Fix | Delete
<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __( 'Link to image' ) . '</button>
[2980] Fix | Delete
<p class="help">' . __( 'Enter a link URL or click above for presets.' ) . '</p></td>
[2981] Fix | Delete
</tr>
[2982] Fix | Delete
<tr class="image-only">
[2983] Fix | Delete
<td></td>
[2984] Fix | Delete
<td>
[2985] Fix | Delete
<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( 'Insert into Post' ) . '" />
[2986] Fix | Delete
</td>
[2987] Fix | Delete
</tr>
[2988] Fix | Delete
<tr class="not-image">
[2989] Fix | Delete
<td></td>
[2990] Fix | Delete
<td>
[2991] Fix | Delete
' . get_submit_button( __( 'Insert into Post' ), '', 'insertonlybutton', false ) . '
[2992] Fix | Delete
</td>
[2993] Fix | Delete
</tr>
[2994] Fix | Delete
</tbody></table>';
[2995] Fix | Delete
}
[2996] Fix | Delete
[2997] Fix | Delete
/**
[2998] Fix | Delete
* Displays the multi-file uploader message.
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function