Changes in trunk/wp-admin/includes/media.php [12190:12308]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r12190 r12308 483 483 if ( !empty($_POST['insertonlybutton']) ) { 484 484 $alt = $align = ''; 485 if ( !empty($_POST['insertonly']['embed-src']) ) { 486 $src = $_POST['insertonly']['embed-src']; 487 if ( !strpos($src, '://') ) 488 $src = "http://$src"; 489 $html = '[embed]' . $src . '[/embed]'; 490 } else { 491 $src = $_POST['insertonly']['src']; 492 if ( !empty($src) && !strpos($src, '://') ) 493 $src = "http://$src"; 494 $alt = esc_attr($_POST['insertonly']['alt']); 495 if ( isset($_POST['insertonly']['align']) ) { 496 $align = esc_attr($_POST['insertonly']['align']); 497 $class = " class='align$align'"; 498 } 499 if ( !empty($src) ) 500 $html = "<img src='$src' alt='$alt'$class />"; 485 486 $src = $_POST['insertonly']['src']; 487 if ( !empty($src) && !strpos($src, '://') ) 488 $src = "http://$src"; 489 $alt = esc_attr($_POST['insertonly']['alt']); 490 if ( isset($_POST['insertonly']['align']) ) { 491 $align = esc_attr($_POST['insertonly']['align']); 492 $class = " class='align$align'"; 501 493 } 502 503 $html = apply_filters('image_send_to_editor_url', $html, $src, $alt, $align); 494 if ( !empty($src) ) 495 $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />"; 496 497 $html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align); 504 498 return media_send_to_editor($html); 505 499 } … … 597 591 $href = "http://$href"; 598 592 599 $html = '[embed]' . $href . '[/embed]'; 600 $html = apply_filters('audio_send_to_editor_url', $html, $href); 593 $title = esc_attr($_POST['insertonly']['title']); 594 if ( empty($title) ) 595 $title = esc_attr( basename($href) ); 596 597 if ( !empty($title) && !empty($href) ) 598 $html = "<a href='" . esc_url($href) . "' >$title</a>"; 599 600 $html = apply_filters('audio_send_to_editor_url', $html, $href, $title); 601 601 602 return media_send_to_editor($html); 602 603 } … … 648 649 $href = "http://$href"; 649 650 650 $html = '[embed]' . $href . '[/embed]'; 651 $html = apply_filters('video_send_to_editor_url', $html, $href); 651 $title = esc_attr($_POST['insertonly']['title']); 652 if ( empty($title) ) 653 $title = esc_attr( basename($href) ); 654 655 if ( !empty($title) && !empty($href) ) 656 $html = "<a href='" . esc_url($href) . "' >$title</a>"; 657 658 $html = apply_filters('video_send_to_editor_url', $html, $href, $title); 659 652 660 return media_send_to_editor($html); 653 661 } … … 703 711 $title = basename($href); 704 712 if ( !empty($title) && !empty($href) ) 705 $html = "<a href=' $href' >$title</a>";706 $html = apply_filters('file_send_to_editor_url', $html, $href, $title);713 $html = "<a href='" . esc_url($href) . "' >$title</a>"; 714 $html = apply_filters('file_send_to_editor_url', $html, esc_url_raw($href), $title); 707 715 return media_send_to_editor($html); 708 716 } … … 1041 1049 'input' => 'html', 1042 1050 'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />", 1043 'value' => isset($edit_post->post_url) ? $edit_post->post_url :wp_get_attachment_url($post->ID),1051 'value' => wp_get_attachment_url($post->ID), 1044 1052 'helps' => __('Location of the uploaded file.') 1045 1053 ) … … 1165 1173 1166 1174 $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case 1167 $display_title = $show_title ? "<div class='filename new'> " . wp_html_excerpt($display_title, 60) . "</div>" : '';1175 $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt($display_title, 60) . "</span></div>" : ''; 1168 1176 1169 1177 $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false; … … 1202 1210 <tr> 1203 1211 <td class='A1B1' id='thumbnail-head-$post->ID' rowspan='5'><img class='thumbnail' src='$thumb_url' alt='' /></td> 1204 <td> $filename</td>1212 <td><strong>" . __('File name:') . "</strong> $filename</td> 1205 1213 </tr> 1206 <tr><td> $post->post_mime_type</td></tr>1207 <tr><td> " . mysql2date(get_option('time_format'), $post->post_date) . "</td></tr>1208 <tr><td> " . apply_filters('media_meta', $media_dims, $post) . "</td></tr>1214 <tr><td><strong>" . __('File type:') . "</strong> $post->post_mime_type</td></tr> 1215 <tr><td><strong>" . __('Upload date:') . "</strong> " . mysql2date( get_option('date_format'), $post->post_date ) . "</td></tr> 1216 <tr><td><strong>" . __('Dimensions:') . "</strong> " . apply_filters('media_meta', $media_dims, $post) . "</td></tr> 1209 1217 <tr><td class='A1B1'>$image_edit_button</td></tr> 1210 1218 </thead> … … 1226 1234 $delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>"; 1227 1235 else 1228 $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo ?') . "</a>";1236 $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo') . "</a>"; 1229 1237 } else { 1230 1238 $delete = ''; 1231 1239 } 1232 1240 1241 $thumbnail = ''; 1233 1242 if ( 'image' == $type && current_theme_supports( 'post-thumbnails' ) && get_post_image_id($_GET['post_id']) != $attachment_id ) 1234 1243 $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>"; … … 1431 1440 <p id="async-upload-wrap"> 1432 1441 <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label> 1433 <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=" return top.tb_remove();"><?php _e('Cancel'); ?></a>1442 <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> 1434 1443 </p> 1435 1444 <div class="clear"></div> … … 1462 1471 1463 1472 <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form"> 1473 <input type="submit" class="hidden" name="save" value="" /> 1464 1474 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1465 1475 <?php wp_nonce_field('media-form'); ?> … … 1538 1548 var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = ''; 1539 1549 1540 if ( '' != document.getElementById('embed-src').value )1541 return true;1542 1543 1550 if ( '' == f.src.value || '' == t.width ) 1544 1551 return false; … … 1658 1665 <a href="#" id="asc"><?php _e('Ascending'); ?></a> | 1659 1666 <a href="#" id="desc"><?php _e('Descending'); ?></a> | 1660 <a href="#" id="clear"><?php _e('Clear'); ?></a>1667 <a href="#" id="clear"><?php echo _x('Clear', 'verb'); ?></a> 1661 1668 </div> 1662 1669 <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> … … 1873 1880 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 ); 1874 1881 1875 if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'])1882 if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) ) 1876 1883 $default = ' selected="selected"'; 1877 1884 else … … 1950 1957 1951 1958 return ' 1952 <h4 class="media-sub-title">' . __('Embed a picture from a web site that supports oEmbed') . '</h4>1953 <table class="describe"><tbody>1954 <tr>1955 <th valign="top" scope="row" class="label" style="width:130px;">1956 <span class="alignleft"><label for="embed-src">' . __('Embed image') . '</label></span>1957 <span class="alignright"><abbr title="required" class="required">*</abbr></span>1958 </th>1959 <td class="field"><input id="embed-src" name="insertonly[embed-src]" value="" type="text" /></td>1960 </tr>1961 1962 <tr>1963 <td></td>1964 <td>1965 <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Embed') . '" />1966 </td>1967 </tr>1968 </tbody></table>1969 1970 1959 <h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4> 1971 1960 <table class="describe"><tbody> … … 2047 2036 <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 2048 2037 </tr> 2049 2038 <tr> 2039 <th valign="top" scope="row" class="label"> 2040 <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 2041 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 2042 </th> 2043 <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 2044 </tr> 2045 <tr><td></td><td class="help">' . __('Link text, e.g. “Still Alive by Jonathan Coulton”') . '</td></tr> 2050 2046 <tr> 2051 2047 <td></td> … … 2075 2071 <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 2076 2072 </tr> 2077 2073 <tr> 2074 <th valign="top" scope="row" class="label"> 2075 <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 2076 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 2077 </th> 2078 <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 2079 </tr> 2080 <tr><td></td><td class="help">' . __('Link text, e.g. “Lucy on YouTube“') . '</td></tr> 2078 2081 <tr> 2079 2082 <td></td>
Note: See TracChangeset
for help on using the changeset viewer.