Edit File by line
/home/barbar84/www/wp-admin/includes
File: media.php
if ( ! empty( $field['helps'] ) ) {
[2000] Fix | Delete
$item .= "<p class='help'>" . implode( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
[2001] Fix | Delete
}
[2002] Fix | Delete
[2003] Fix | Delete
$item .= "</td>\n\t\t</tr>\n";
[2004] Fix | Delete
[2005] Fix | Delete
$extra_rows = array();
[2006] Fix | Delete
[2007] Fix | Delete
if ( ! empty( $field['errors'] ) ) {
[2008] Fix | Delete
foreach ( array_unique( (array) $field['errors'] ) as $error ) {
[2009] Fix | Delete
$extra_rows['error'][] = $error;
[2010] Fix | Delete
}
[2011] Fix | Delete
}
[2012] Fix | Delete
[2013] Fix | Delete
if ( ! empty( $field['extra_rows'] ) ) {
[2014] Fix | Delete
foreach ( $field['extra_rows'] as $class => $rows ) {
[2015] Fix | Delete
foreach ( (array) $rows as $html ) {
[2016] Fix | Delete
$extra_rows[ $class ][] = $html;
[2017] Fix | Delete
}
[2018] Fix | Delete
}
[2019] Fix | Delete
}
[2020] Fix | Delete
[2021] Fix | Delete
foreach ( $extra_rows as $class => $rows ) {
[2022] Fix | Delete
foreach ( $rows as $html ) {
[2023] Fix | Delete
$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
[2024] Fix | Delete
}
[2025] Fix | Delete
}
[2026] Fix | Delete
}
[2027] Fix | Delete
[2028] Fix | Delete
if ( ! empty( $form_fields['_final'] ) ) {
[2029] Fix | Delete
$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
[2030] Fix | Delete
}
[2031] Fix | Delete
[2032] Fix | Delete
if ( $item ) {
[2033] Fix | Delete
$item = '<p class="media-types media-types-required-info">' .
[2034] Fix | Delete
/* translators: %s: Asterisk symbol (*). */
[2035] Fix | Delete
sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) .
[2036] Fix | Delete
'</p>' .
[2037] Fix | Delete
'<table class="compat-attachment-fields">' . $item . '</table>';
[2038] Fix | Delete
}
[2039] Fix | Delete
[2040] Fix | Delete
foreach ( $hidden_fields as $hidden_field => $value ) {
[2041] Fix | Delete
$item .= '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
[2042] Fix | Delete
}
[2043] Fix | Delete
[2044] Fix | Delete
if ( $item ) {
[2045] Fix | Delete
$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
[2046] Fix | Delete
}
[2047] Fix | Delete
[2048] Fix | Delete
return array(
[2049] Fix | Delete
'item' => $item,
[2050] Fix | Delete
'meta' => $media_meta,
[2051] Fix | Delete
);
[2052] Fix | Delete
}
[2053] Fix | Delete
[2054] Fix | Delete
/**
[2055] Fix | Delete
* Outputs the legacy media upload header.
[2056] Fix | Delete
*
[2057] Fix | Delete
* @since 2.5.0
[2058] Fix | Delete
*/
[2059] Fix | Delete
function media_upload_header() {
[2060] Fix | Delete
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
[2061] Fix | Delete
[2062] Fix | Delete
echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>';
[2063] Fix | Delete
[2064] Fix | Delete
if ( empty( $_GET['chromeless'] ) ) {
[2065] Fix | Delete
echo '<div id="media-upload-header">';
[2066] Fix | Delete
the_media_upload_tabs();
[2067] Fix | Delete
echo '</div>';
[2068] Fix | Delete
}
[2069] Fix | Delete
}
[2070] Fix | Delete
[2071] Fix | Delete
/**
[2072] Fix | Delete
* Outputs the legacy media upload form.
[2073] Fix | Delete
*
[2074] Fix | Delete
* @since 2.5.0
[2075] Fix | Delete
*
[2076] Fix | Delete
* @global string $type
[2077] Fix | Delete
* @global string $tab
[2078] Fix | Delete
* @global bool $is_IE
[2079] Fix | Delete
* @global bool $is_opera
[2080] Fix | Delete
*
[2081] Fix | Delete
* @param array $errors
[2082] Fix | Delete
*/
[2083] Fix | Delete
function media_upload_form( $errors = null ) {
[2084] Fix | Delete
global $type, $tab, $is_IE, $is_opera;
[2085] Fix | Delete
[2086] Fix | Delete
if ( ! _device_can_upload() ) {
[2087] Fix | Delete
echo '<p>' . sprintf(
[2088] Fix | Delete
/* translators: %s: https://apps.wordpress.org/ */
[2089] Fix | Delete
__( '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.' ),
[2090] Fix | Delete
'https://apps.wordpress.org/'
[2091] Fix | Delete
) . '</p>';
[2092] Fix | Delete
return;
[2093] Fix | Delete
}
[2094] Fix | Delete
[2095] Fix | Delete
$upload_action_url = admin_url( 'async-upload.php' );
[2096] Fix | Delete
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
[2097] Fix | Delete
$_type = isset( $type ) ? $type : '';
[2098] Fix | Delete
$_tab = isset( $tab ) ? $tab : '';
[2099] Fix | Delete
[2100] Fix | Delete
$max_upload_size = wp_max_upload_size();
[2101] Fix | Delete
if ( ! $max_upload_size ) {
[2102] Fix | Delete
$max_upload_size = 0;
[2103] Fix | Delete
}
[2104] Fix | Delete
[2105] Fix | Delete
?>
[2106] Fix | Delete
<div id="media-upload-notice">
[2107] Fix | Delete
<?php
[2108] Fix | Delete
[2109] Fix | Delete
if ( isset( $errors['upload_notice'] ) ) {
[2110] Fix | Delete
echo $errors['upload_notice'];
[2111] Fix | Delete
}
[2112] Fix | Delete
[2113] Fix | Delete
?>
[2114] Fix | Delete
</div>
[2115] Fix | Delete
<div id="media-upload-error">
[2116] Fix | Delete
<?php
[2117] Fix | Delete
[2118] Fix | Delete
if ( isset( $errors['upload_error'] ) && is_wp_error( $errors['upload_error'] ) ) {
[2119] Fix | Delete
echo $errors['upload_error']->get_error_message();
[2120] Fix | Delete
}
[2121] Fix | Delete
[2122] Fix | Delete
?>
[2123] Fix | Delete
</div>
[2124] Fix | Delete
<?php
[2125] Fix | Delete
[2126] Fix | Delete
if ( is_multisite() && ! is_upload_space_available() ) {
[2127] Fix | Delete
/**
[2128] Fix | Delete
* Fires when an upload will exceed the defined upload space quota for a network site.
[2129] Fix | Delete
*
[2130] Fix | Delete
* @since 3.5.0
[2131] Fix | Delete
*/
[2132] Fix | Delete
do_action( 'upload_ui_over_quota' );
[2133] Fix | Delete
return;
[2134] Fix | Delete
}
[2135] Fix | Delete
[2136] Fix | Delete
/**
[2137] Fix | Delete
* Fires just before the legacy (pre-3.5.0) upload interface is loaded.
[2138] Fix | Delete
*
[2139] Fix | Delete
* @since 2.6.0
[2140] Fix | Delete
*/
[2141] Fix | Delete
do_action( 'pre-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2142] Fix | Delete
[2143] Fix | Delete
$post_params = array(
[2144] Fix | Delete
'post_id' => $post_id,
[2145] Fix | Delete
'_wpnonce' => wp_create_nonce( 'media-form' ),
[2146] Fix | Delete
'type' => $_type,
[2147] Fix | Delete
'tab' => $_tab,
[2148] Fix | Delete
'short' => '1',
[2149] Fix | Delete
);
[2150] Fix | Delete
[2151] Fix | Delete
/**
[2152] Fix | Delete
* Filters the media upload post parameters.
[2153] Fix | Delete
*
[2154] Fix | Delete
* @since 3.1.0 As 'swfupload_post_params'
[2155] Fix | Delete
* @since 3.3.0
[2156] Fix | Delete
*
[2157] Fix | Delete
* @param array $post_params An array of media upload parameters used by Plupload.
[2158] Fix | Delete
*/
[2159] Fix | Delete
$post_params = apply_filters( 'upload_post_params', $post_params );
[2160] Fix | Delete
[2161] Fix | Delete
/*
[2162] Fix | Delete
* Since 4.9 the `runtimes` setting is hardcoded in our version of Plupload to `html5,html4`,
[2163] Fix | Delete
* and the `flash_swf_url` and `silverlight_xap_url` are not used.
[2164] Fix | Delete
*/
[2165] Fix | Delete
$plupload_init = array(
[2166] Fix | Delete
'browse_button' => 'plupload-browse-button',
[2167] Fix | Delete
'container' => 'plupload-upload-ui',
[2168] Fix | Delete
'drop_element' => 'drag-drop-area',
[2169] Fix | Delete
'file_data_name' => 'async-upload',
[2170] Fix | Delete
'url' => $upload_action_url,
[2171] Fix | Delete
'filters' => array( 'max_file_size' => $max_upload_size . 'b' ),
[2172] Fix | Delete
'multipart_params' => $post_params,
[2173] Fix | Delete
);
[2174] Fix | Delete
[2175] Fix | Delete
/*
[2176] Fix | Delete
* Currently only iOS Safari supports multiple files uploading,
[2177] Fix | Delete
* but iOS 7.x has a bug that prevents uploading of videos when enabled.
[2178] Fix | Delete
* See #29602.
[2179] Fix | Delete
*/
[2180] Fix | Delete
if (
[2181] Fix | Delete
wp_is_mobile() &&
[2182] Fix | Delete
strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
[2183] Fix | Delete
strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false
[2184] Fix | Delete
) {
[2185] Fix | Delete
$plupload_init['multi_selection'] = false;
[2186] Fix | Delete
}
[2187] Fix | Delete
[2188] Fix | Delete
/**
[2189] Fix | Delete
* Filters the default Plupload settings.
[2190] Fix | Delete
*
[2191] Fix | Delete
* @since 3.3.0
[2192] Fix | Delete
*
[2193] Fix | Delete
* @param array $plupload_init An array of default settings used by Plupload.
[2194] Fix | Delete
*/
[2195] Fix | Delete
$plupload_init = apply_filters( 'plupload_init', $plupload_init );
[2196] Fix | Delete
[2197] Fix | Delete
?>
[2198] Fix | Delete
<script type="text/javascript">
[2199] Fix | Delete
<?php
[2200] Fix | Delete
// Verify size is an int. If not return default value.
[2201] Fix | Delete
$large_size_h = absint( get_option( 'large_size_h' ) );
[2202] Fix | Delete
[2203] Fix | Delete
if ( ! $large_size_h ) {
[2204] Fix | Delete
$large_size_h = 1024;
[2205] Fix | Delete
}
[2206] Fix | Delete
[2207] Fix | Delete
$large_size_w = absint( get_option( 'large_size_w' ) );
[2208] Fix | Delete
[2209] Fix | Delete
if ( ! $large_size_w ) {
[2210] Fix | Delete
$large_size_w = 1024;
[2211] Fix | Delete
}
[2212] Fix | Delete
[2213] Fix | Delete
?>
[2214] Fix | Delete
var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>,
[2215] Fix | Delete
wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>;
[2216] Fix | Delete
</script>
[2217] Fix | Delete
[2218] Fix | Delete
<div id="plupload-upload-ui" class="hide-if-no-js">
[2219] Fix | Delete
<?php
[2220] Fix | Delete
/**
[2221] Fix | Delete
* Fires before the upload interface loads.
[2222] Fix | Delete
*
[2223] Fix | Delete
* @since 2.6.0 As 'pre-flash-upload-ui'
[2224] Fix | Delete
* @since 3.3.0
[2225] Fix | Delete
*/
[2226] Fix | Delete
do_action( 'pre-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2227] Fix | Delete
[2228] Fix | Delete
?>
[2229] Fix | Delete
<div id="drag-drop-area">
[2230] Fix | Delete
<div class="drag-drop-inside">
[2231] Fix | Delete
<p class="drag-drop-info"><?php _e( 'Drop files to upload' ); ?></p>
[2232] Fix | Delete
<p><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
[2233] Fix | Delete
<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e( 'Select Files' ); ?>" class="button" /></p>
[2234] Fix | Delete
</div>
[2235] Fix | Delete
</div>
[2236] Fix | Delete
<?php
[2237] Fix | Delete
/**
[2238] Fix | Delete
* Fires after the upload interface loads.
[2239] Fix | Delete
*
[2240] Fix | Delete
* @since 2.6.0 As 'post-flash-upload-ui'
[2241] Fix | Delete
* @since 3.3.0
[2242] Fix | Delete
*/
[2243] Fix | Delete
do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2244] Fix | Delete
?>
[2245] Fix | Delete
</div>
[2246] Fix | Delete
[2247] Fix | Delete
<div id="html-upload-ui" class="hide-if-js">
[2248] Fix | Delete
<?php
[2249] Fix | Delete
/**
[2250] Fix | Delete
* Fires before the upload button in the media upload interface.
[2251] Fix | Delete
*
[2252] Fix | Delete
* @since 2.6.0
[2253] Fix | Delete
*/
[2254] Fix | Delete
do_action( 'pre-html-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2255] Fix | Delete
[2256] Fix | Delete
?>
[2257] Fix | Delete
<p id="async-upload-wrap">
[2258] Fix | Delete
<label class="screen-reader-text" for="async-upload"><?php _e( 'Upload' ); ?></label>
[2259] Fix | Delete
<input type="file" name="async-upload" id="async-upload" />
[2260] Fix | Delete
<?php submit_button( __( 'Upload' ), 'primary', 'html-upload', false ); ?>
[2261] Fix | Delete
<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e( 'Cancel' ); ?></a>
[2262] Fix | Delete
</p>
[2263] Fix | Delete
<div class="clear"></div>
[2264] Fix | Delete
<?php
[2265] Fix | Delete
/**
[2266] Fix | Delete
* Fires after the upload button in the media upload interface.
[2267] Fix | Delete
*
[2268] Fix | Delete
* @since 2.6.0
[2269] Fix | Delete
*/
[2270] Fix | Delete
do_action( 'post-html-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2271] Fix | Delete
[2272] Fix | Delete
?>
[2273] Fix | Delete
</div>
[2274] Fix | Delete
[2275] Fix | Delete
<p class="max-upload-size">
[2276] Fix | Delete
<?php
[2277] Fix | Delete
/* translators: %s: Maximum allowed file size. */
[2278] Fix | Delete
printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
[2279] Fix | Delete
?>
[2280] Fix | Delete
</p>
[2281] Fix | Delete
<?php
[2282] Fix | Delete
[2283] Fix | Delete
/**
[2284] Fix | Delete
* Fires on the post upload UI screen.
[2285] Fix | Delete
*
[2286] Fix | Delete
* Legacy (pre-3.5.0) media workflow hook.
[2287] Fix | Delete
*
[2288] Fix | Delete
* @since 2.6.0
[2289] Fix | Delete
*/
[2290] Fix | Delete
do_action( 'post-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[2291] Fix | Delete
}
[2292] Fix | Delete
[2293] Fix | Delete
/**
[2294] Fix | Delete
* Outputs the legacy media upload form for a given media type.
[2295] Fix | Delete
*
[2296] Fix | Delete
* @since 2.5.0
[2297] Fix | Delete
*
[2298] Fix | Delete
* @param string $type
[2299] Fix | Delete
* @param array $errors
[2300] Fix | Delete
* @param int|WP_Error $id
[2301] Fix | Delete
*/
[2302] Fix | Delete
function media_upload_type_form( $type = 'file', $errors = null, $id = null ) {
[2303] Fix | Delete
[2304] Fix | Delete
media_upload_header();
[2305] Fix | Delete
[2306] Fix | Delete
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
[2307] Fix | Delete
[2308] Fix | Delete
$form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
[2309] Fix | Delete
[2310] Fix | Delete
/**
[2311] Fix | Delete
* Filters the media upload form action URL.
[2312] Fix | Delete
*
[2313] Fix | Delete
* @since 2.6.0
[2314] Fix | Delete
*
[2315] Fix | Delete
* @param string $form_action_url The media upload form action URL.
[2316] Fix | Delete
* @param string $type The type of media. Default 'file'.
[2317] Fix | Delete
*/
[2318] Fix | Delete
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
[2319] Fix | Delete
$form_class = 'media-upload-form type-form validate';
[2320] Fix | Delete
[2321] Fix | Delete
if ( get_user_setting( 'uploader' ) ) {
[2322] Fix | Delete
$form_class .= ' html-uploader';
[2323] Fix | Delete
}
[2324] Fix | Delete
[2325] Fix | Delete
?>
[2326] Fix | Delete
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
[2327] Fix | Delete
<?php submit_button( '', 'hidden', 'save', false ); ?>
[2328] Fix | Delete
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
[2329] Fix | Delete
<?php wp_nonce_field( 'media-form' ); ?>
[2330] Fix | Delete
[2331] Fix | Delete
<h3 class="media-title"><?php _e( 'Add media files from your computer' ); ?></h3>
[2332] Fix | Delete
[2333] Fix | Delete
<?php media_upload_form( $errors ); ?>
[2334] Fix | Delete
[2335] Fix | Delete
<script type="text/javascript">
[2336] Fix | Delete
jQuery(function($){
[2337] Fix | Delete
var preloaded = $(".media-item.preloaded");
[2338] Fix | Delete
if ( preloaded.length > 0 ) {
[2339] Fix | Delete
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
[2340] Fix | Delete
}
[2341] Fix | Delete
updateMediaForm();
[2342] Fix | Delete
});
[2343] Fix | Delete
</script>
[2344] Fix | Delete
<div id="media-items">
[2345] Fix | Delete
<?php
[2346] Fix | Delete
[2347] Fix | Delete
if ( $id ) {
[2348] Fix | Delete
if ( ! is_wp_error( $id ) ) {
[2349] Fix | Delete
add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 );
[2350] Fix | Delete
echo get_media_items( $id, $errors );
[2351] Fix | Delete
} else {
[2352] Fix | Delete
echo '<div id="media-upload-error">' . esc_html( $id->get_error_message() ) . '</div></div>';
[2353] Fix | Delete
exit;
[2354] Fix | Delete
}
[2355] Fix | Delete
}
[2356] Fix | Delete
[2357] Fix | Delete
?>
[2358] Fix | Delete
</div>
[2359] Fix | Delete
[2360] Fix | Delete
<p class="savebutton ml-submit">
[2361] Fix | Delete
<?php submit_button( __( 'Save all changes' ), '', 'save', false ); ?>
[2362] Fix | Delete
</p>
[2363] Fix | Delete
</form>
[2364] Fix | Delete
<?php
[2365] Fix | Delete
}
[2366] Fix | Delete
[2367] Fix | Delete
/**
[2368] Fix | Delete
* Outputs the legacy media upload form for external media.
[2369] Fix | Delete
*
[2370] Fix | Delete
* @since 2.7.0
[2371] Fix | Delete
*
[2372] Fix | Delete
* @param string $type
[2373] Fix | Delete
* @param object $errors
[2374] Fix | Delete
* @param int $id
[2375] Fix | Delete
*/
[2376] Fix | Delete
function media_upload_type_url_form( $type = null, $errors = null, $id = null ) {
[2377] Fix | Delete
if ( null === $type ) {
[2378] Fix | Delete
$type = 'image';
[2379] Fix | Delete
}
[2380] Fix | Delete
[2381] Fix | Delete
media_upload_header();
[2382] Fix | Delete
[2383] Fix | Delete
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
[2384] Fix | Delete
[2385] Fix | Delete
$form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
[2386] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[2387] Fix | Delete
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
[2388] Fix | Delete
$form_class = 'media-upload-form type-form validate';
[2389] Fix | Delete
[2390] Fix | Delete
if ( get_user_setting( 'uploader' ) ) {
[2391] Fix | Delete
$form_class .= ' html-uploader';
[2392] Fix | Delete
}
[2393] Fix | Delete
[2394] Fix | Delete
?>
[2395] Fix | Delete
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
[2396] Fix | Delete
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
[2397] Fix | Delete
<?php wp_nonce_field( 'media-form' ); ?>
[2398] Fix | Delete
[2399] Fix | Delete
<h3 class="media-title"><?php _e( 'Insert media from another website' ); ?></h3>
[2400] Fix | Delete
[2401] Fix | Delete
<script type="text/javascript">
[2402] Fix | Delete
var addExtImage = {
[2403] Fix | Delete
[2404] Fix | Delete
width : '',
[2405] Fix | Delete
height : '',
[2406] Fix | Delete
align : 'alignnone',
[2407] Fix | Delete
[2408] Fix | Delete
insert : function() {
[2409] Fix | Delete
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
[2410] Fix | Delete
[2411] Fix | Delete
if ( '' === f.src.value || '' === t.width )
[2412] Fix | Delete
return false;
[2413] Fix | Delete
[2414] Fix | Delete
if ( f.alt.value )
[2415] Fix | Delete
alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
[2416] Fix | Delete
[2417] Fix | Delete
<?php
[2418] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[2419] Fix | Delete
if ( ! apply_filters( 'disable_captions', '' ) ) {
[2420] Fix | Delete
?>
[2421] Fix | Delete
if ( f.caption.value ) {
[2422] Fix | Delete
caption = f.caption.value.replace(/\r\n|\r/g, '\n');
[2423] Fix | Delete
caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
[2424] Fix | Delete
return a.replace(/[\r\n\t]+/, ' ');
[2425] Fix | Delete
});
[2426] Fix | Delete
[2427] Fix | Delete
caption = caption.replace(/\s*\n\s*/g, '<br />');
[2428] Fix | Delete
}
[2429] Fix | Delete
<?php
[2430] Fix | Delete
}
[2431] Fix | Delete
[2432] Fix | Delete
?>
[2433] Fix | Delete
cls = caption ? '' : ' class="'+t.align+'"';
[2434] Fix | Delete
[2435] Fix | Delete
html = '<img alt="'+alt+'" src="'+f.src.value+'"'+cls+' width="'+t.width+'" height="'+t.height+'" />';
[2436] Fix | Delete
[2437] Fix | Delete
if ( f.url.value ) {
[2438] Fix | Delete
url = f.url.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
[2439] Fix | Delete
html = '<a href="'+url+'">'+html+'</a>';
[2440] Fix | Delete
}
[2441] Fix | Delete
[2442] Fix | Delete
if ( caption )
[2443] Fix | Delete
html = '[caption id="" align="'+t.align+'" width="'+t.width+'"]'+html+caption+'[/caption]';
[2444] Fix | Delete
[2445] Fix | Delete
var win = window.dialogArguments || opener || parent || top;
[2446] Fix | Delete
win.send_to_editor(html);
[2447] Fix | Delete
return false;
[2448] Fix | Delete
},
[2449] Fix | Delete
[2450] Fix | Delete
resetImageData : function() {
[2451] Fix | Delete
var t = addExtImage;
[2452] Fix | Delete
[2453] Fix | Delete
t.width = t.height = '';
[2454] Fix | Delete
document.getElementById('go_button').style.color = '#bbb';
[2455] Fix | Delete
if ( ! document.forms[0].src.value )
[2456] Fix | Delete
document.getElementById('status_img').innerHTML = '';
[2457] Fix | Delete
else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';
[2458] Fix | Delete
},
[2459] Fix | Delete
[2460] Fix | Delete
updateImageData : function() {
[2461] Fix | Delete
var t = addExtImage;
[2462] Fix | Delete
[2463] Fix | Delete
t.width = t.preloadImg.width;
[2464] Fix | Delete
t.height = t.preloadImg.height;
[2465] Fix | Delete
document.getElementById('go_button').style.color = '#333';
[2466] Fix | Delete
document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';
[2467] Fix | Delete
},
[2468] Fix | Delete
[2469] Fix | Delete
getImageData : function() {
[2470] Fix | Delete
if ( jQuery('table.describe').hasClass('not-image') )
[2471] Fix | Delete
return;
[2472] Fix | Delete
[2473] Fix | Delete
var t = addExtImage, src = document.forms[0].src.value;
[2474] Fix | Delete
[2475] Fix | Delete
if ( ! src ) {
[2476] Fix | Delete
t.resetImageData();
[2477] Fix | Delete
return false;
[2478] Fix | Delete
}
[2479] Fix | Delete
[2480] Fix | Delete
document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" alt="" width="16" height="16" />';
[2481] Fix | Delete
t.preloadImg = new Image();
[2482] Fix | Delete
t.preloadImg.onload = t.updateImageData;
[2483] Fix | Delete
t.preloadImg.onerror = t.resetImageData;
[2484] Fix | Delete
t.preloadImg.src = src;
[2485] Fix | Delete
}
[2486] Fix | Delete
};
[2487] Fix | Delete
[2488] Fix | Delete
jQuery(document).ready( function($) {
[2489] Fix | Delete
$('.media-types input').click( function() {
[2490] Fix | Delete
$('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );
[2491] Fix | Delete
});
[2492] Fix | Delete
});
[2493] Fix | Delete
</script>
[2494] Fix | Delete
[2495] Fix | Delete
<div id="media-items">
[2496] Fix | Delete
<div class="media-item media-blank">
[2497] Fix | Delete
<?php
[2498] Fix | Delete
/**
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function