Ticket #17578: 17578.2.diff
| File 17578.2.diff, 18.5 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/media.php
374 374 * @since 2.5.0 375 375 */ 376 376 function media_buttons($editor_id = 'content') { 377 $out = '';377 $out = _media_button(__('Add Media'), 'images/media-button-video.gif?ver=20100531', 'media', $editor_id); 378 378 379 if ( is_multisite() )380 $_buttons = get_site_option('mu_media_buttons');381 else382 $_buttons = array( 'image' => true, 'video' => true, 'audio' => true );383 384 if ( !empty($_buttons['image']) )385 $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image', $editor_id);386 if ( !empty($_buttons['video']) )387 $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video', $editor_id);388 if ( !empty($_buttons['audio']) )389 $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio', $editor_id);390 391 $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media', $editor_id);392 393 379 $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); 394 380 395 381 printf($context, $out); … … 617 603 * 618 604 * @return unknown 619 605 */ 620 function media_upload_audio() {621 $errors = array();622 $id = 0;623 624 if ( isset($_POST['html-upload']) && !empty($_FILES) ) {625 check_admin_referer('media-form');626 // Upload File button was clicked627 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);628 unset($_FILES);629 if ( is_wp_error($id) ) {630 $errors['upload_error'] = $id;631 $id = false;632 }633 }634 635 if ( !empty($_POST['insertonlybutton']) ) {636 $href = $_POST['insertonly']['href'];637 if ( !empty($href) && !strpos($href, '://') )638 $href = "http://$href";639 640 $title = esc_attr($_POST['insertonly']['title']);641 if ( empty($title) )642 $title = esc_attr( basename($href) );643 644 if ( !empty($title) && !empty($href) )645 $html = "<a href='" . esc_url($href) . "' >$title</a>";646 647 $html = apply_filters('audio_send_to_editor_url', $html, $href, $title);648 649 return media_send_to_editor($html);650 }651 652 if ( !empty($_POST) ) {653 $return = media_upload_form_handler();654 655 if ( is_string($return) )656 return $return;657 if ( is_array($return) )658 $errors = $return;659 }660 661 if ( isset($_POST['save']) ) {662 $errors['upload_notice'] = __('Saved.');663 return media_upload_gallery();664 }665 666 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )667 return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id );668 669 return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );670 }671 672 /**673 * {@internal Missing Short Description}}674 *675 * @since 2.5.0676 *677 * @return unknown678 */679 function media_upload_video() {680 $errors = array();681 $id = 0;682 683 if ( isset($_POST['html-upload']) && !empty($_FILES) ) {684 check_admin_referer('media-form');685 // Upload File button was clicked686 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);687 unset($_FILES);688 if ( is_wp_error($id) ) {689 $errors['upload_error'] = $id;690 $id = false;691 }692 }693 694 if ( !empty($_POST['insertonlybutton']) ) {695 $href = $_POST['insertonly']['href'];696 if ( !empty($href) && !strpos($href, '://') )697 $href = "http://$href";698 699 $title = esc_attr($_POST['insertonly']['title']);700 if ( empty($title) )701 $title = esc_attr( basename($href) );702 703 if ( !empty($title) && !empty($href) )704 $html = "<a href='" . esc_url($href) . "' >$title</a>";705 706 $html = apply_filters('video_send_to_editor_url', $html, $href, $title);707 708 return media_send_to_editor($html);709 }710 711 if ( !empty($_POST) ) {712 $return = media_upload_form_handler();713 714 if ( is_string($return) )715 return $return;716 if ( is_array($return) )717 $errors = $return;718 }719 720 if ( isset($_POST['save']) ) {721 $errors['upload_notice'] = __('Saved.');722 return media_upload_gallery();723 }724 725 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )726 return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );727 728 return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );729 }730 731 /**732 * {@internal Missing Short Description}}733 *734 * @since 2.5.0735 *736 * @return unknown737 */738 function media_upload_file() {739 $errors = array();740 $id = 0;741 742 if ( isset($_POST['html-upload']) && !empty($_FILES) ) {743 check_admin_referer('media-form');744 // Upload File button was clicked745 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);746 unset($_FILES);747 if ( is_wp_error($id) ) {748 $errors['upload_error'] = $id;749 $id = false;750 }751 }752 753 if ( !empty($_POST['insertonlybutton']) ) {754 $href = $_POST['insertonly']['href'];755 if ( !empty($href) && !strpos($href, '://') )756 $href = "http://$href";757 758 $title = esc_attr($_POST['insertonly']['title']);759 if ( empty($title) )760 $title = basename($href);761 if ( !empty($title) && !empty($href) )762 $html = "<a href='" . esc_url($href) . "' >$title</a>";763 $html = apply_filters('file_send_to_editor_url', $html, esc_url_raw($href), $title);764 return media_send_to_editor($html);765 }766 767 if ( !empty($_POST) ) {768 $return = media_upload_form_handler();769 770 if ( is_string($return) )771 return $return;772 if ( is_array($return) )773 $errors = $return;774 }775 776 if ( isset($_POST['save']) ) {777 $errors['upload_notice'] = __('Saved.');778 return media_upload_gallery();779 }780 781 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )782 return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id );783 784 return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );785 }786 787 /**788 * {@internal Missing Short Description}}789 *790 * @since 2.5.0791 *792 * @return unknown793 */794 606 function media_upload_gallery() { 795 607 $errors = array(); 796 608 … … 1605 1417 * @param unknown_type $errors 1606 1418 * @param unknown_type $id 1607 1419 */ 1608 function media_upload_type_url_form($type = 'file', $errors = null, $id = null) { 1420 function media_upload_type_url_form($deprecated = null, $errors = null, $id = null) { 1421 $type = 'image'; 1609 1422 media_upload_header(); 1610 1423 1611 1424 $post_id = intval($_REQUEST['post_id']); … … 1699 1512 t.preloadImg.src = src; 1700 1513 } 1701 1514 } 1515 1516 jQuery(document).ready( function($) { 1517 $('.media-types input').click( function() { 1518 $('tr.image-only, tr.not-image').hide(); 1519 $('tr.'+$(this).attr('id')).show(); 1520 }); 1521 }); 1522 1702 1523 //]]> 1703 1524 </script> 1704 1525 … … 2028 1849 function type_url_form_image() { 2029 1850 if ( !apply_filters( 'disable_captions', '' ) ) { 2030 1851 $caption = ' 2031 <tr >1852 <tr class="image-only"> 2032 1853 <th valign="top" scope="row" class="label"> 2033 1854 <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span> 2034 1855 </th> … … 2044 1865 $default_align = 'none'; 2045 1866 2046 1867 return ' 2047 <h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4> 1868 <h4 class="media-sub-title">' . __('Insert media from another web site') . '</h4> 1869 <p class="media-types"><label><input type="radio" name="media_type" id="image-only" checked="checked" /> ' . __( 'Images' ) . '</label> <label><input type="radio" name="media_type" id="not-image" /> ' . __( 'Audio, Video, or Files' ) . '</label></p> 2048 1870 <table class="describe"><tbody> 2049 1871 <tr> 2050 1872 <th valign="top" scope="row" class="label" style="width:130px;"> 2051 <span class="alignleft"><label for="src">' . __(' ImageURL') . '</label></span>1873 <span class="alignleft"><label for="src">' . __('URL') . '</label></span> 2052 1874 <span class="alignright"><abbr id="status_img" title="required" class="required">*</abbr></span> 2053 1875 </th> 2054 1876 <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td> … … 2056 1878 2057 1879 <tr> 2058 1880 <th valign="top" scope="row" class="label"> 2059 <span class="alignleft"><label for="title">' . __(' ImageTitle') . '</label></span>1881 <span class="alignleft"><label for="title">' . __('Title') . '</label></span> 2060 1882 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 2061 1883 </th> 2062 1884 <td class="field"><input id="title" name="title" value="" type="text" aria-required="true" /></td> 2063 1885 </tr> 2064 1886 2065 <tr> 1887 <tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. “Ransom Demands (PDF)”') . '</p></td></tr> 1888 1889 <tr class="image-only"> 2066 1890 <th valign="top" scope="row" class="label"> 2067 1891 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span> 2068 1892 </th> … … 2070 1894 <p class="help">' . __('Alt text for the image, e.g. “The Mona Lisa”') . '</p></td> 2071 1895 </tr> 2072 1896 ' . $caption . ' 2073 <tr class="align ">1897 <tr class="align image-only"> 2074 1898 <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th> 2075 1899 <td class="field"> 2076 1900 <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' /> … … 2084 1908 </td> 2085 1909 </tr> 2086 1910 2087 <tr >1911 <tr class="image-only"> 2088 1912 <th valign="top" scope="row" class="label"> 2089 1913 <span class="alignleft"><label for="url">' . __('Link Image To:') . '</label></span> 2090 1914 </th> … … 2094 1918 <button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button> 2095 1919 <p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td> 2096 1920 </tr> 2097 ' . _insert_into_post_button('image') . ' 2098 </tbody></table> 2099 '; 2100 2101 } 2102 2103 /** 2104 * {@internal Missing Short Description}} 2105 * 2106 * @since 2.7.0 2107 * 2108 * @return unknown 2109 */ 2110 function type_url_form_audio() { 2111 return ' 2112 <table class="describe"><tbody> 2113 <tr> 2114 <th valign="top" scope="row" class="label"> 2115 <span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span> 2116 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 2117 </th> 2118 <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 1921 <tr class="image-only"> 1922 <td></td> 1923 <td> 1924 <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" /> 1925 </td> 2119 1926 </tr> 2120 <tr> 2121 <th valign="top" scope="row" class="label"> 2122 <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 2123 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 2124 </th> 2125 <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 1927 <tr class="not-image"> 1928 <td></td> 1929 <td> 1930 ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . ' 1931 </td> 2126 1932 </tr> 2127 <tr><td></td><td class="help">' . __('Link text, e.g. “Still Alive by Jonathan Coulton”') . '</td></tr>2128 ' . _insert_into_post_button('audio') . '2129 1933 </tbody></table> 2130 1934 '; 2131 }2132 1935 2133 /**2134 * {@internal Missing Short Description}}2135 *2136 * @since 2.7.02137 *2138 * @return unknown2139 */2140 function type_url_form_video() {2141 return '2142 <table class="describe"><tbody>2143 <tr>2144 <th valign="top" scope="row" class="label">2145 <span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>2146 <span class="alignright"><abbr title="required" class="required">*</abbr></span>2147 </th>2148 <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>2149 </tr>2150 <tr>2151 <th valign="top" scope="row" class="label">2152 <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>2153 <span class="alignright"><abbr title="required" class="required">*</abbr></span>2154 </th>2155 <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>2156 </tr>2157 <tr><td></td><td class="help">' . __('Link text, e.g. “Lucy on YouTube”') . '</td></tr>2158 ' . _insert_into_post_button('video') . '2159 </tbody></table>2160 ';2161 1936 } 2162 1937 2163 /**2164 * {@internal Missing Short Description}}2165 *2166 * @since 2.7.02167 *2168 * @return unknown2169 */2170 function type_url_form_file() {2171 return '2172 <table class="describe"><tbody>2173 <tr>2174 <th valign="top" scope="row" class="label">2175 <span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>2176 <span class="alignright"><abbr title="required" class="required">*</abbr></span>2177 </th>2178 <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>2179 </tr>2180 <tr>2181 <th valign="top" scope="row" class="label">2182 <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>2183 <span class="alignright"><abbr title="required" class="required">*</abbr></span>2184 </th>2185 <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>2186 </tr>2187 <tr><td></td><td class="help">' . __('Link text, e.g. “Ransom Demands (PDF)”') . '</td></tr>2188 ' . _insert_into_post_button('file') . '2189 </tbody></table>2190 ';2191 }2192 2193 2194 1938 function _insert_into_post_button($type) { 2195 1939 if ( !post_type_supports(get_post_type($_GET['post_id']), 'editor') ) 2196 1940 return ''; … … 2232 1976 2233 1977 add_action('post-upload-ui', 'media_upload_max_image_resize'); 2234 1978 2235 add_filter('async_upload_image', 'get_media_item', 10, 2);2236 add_filter('async_upload_audio', 'get_media_item', 10, 2);2237 add_filter('async_upload_video', 'get_media_item', 10, 2);2238 add_filter('async_upload_file', 'get_media_item', 10, 2);2239 2240 1979 add_action('media_upload_image', 'media_upload_image'); 2241 add_action('media_upload_audio', 'media_upload_ audio');2242 add_action('media_upload_video', 'media_upload_ video');2243 add_action('media_upload_file', 'media_upload_ file');1980 add_action('media_upload_audio', 'media_upload_image'); 1981 add_action('media_upload_video', 'media_upload_image'); 1982 add_action('media_upload_file', 'media_upload_image'); 2244 1983 2245 1984 add_filter('media_upload_gallery', 'media_upload_gallery'); 2246 1985 -
wp-admin/edit-form-advanced.php
122 122 if ( post_type_supports($post_type, 'page-attributes') ) 123 123 add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core'); 124 124 125 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) 126 && ( ! is_multisite() || ( ( $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ) ) && ! empty( $mu_media_buttons['image'] ) ) ) ) 127 add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); 125 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) ) 126 add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); 128 127 129 128 if ( post_type_supports($post_type, 'excerpt') ) 130 129 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); -
wp-admin/network/settings.php
80 80 update_site_option( 'banned_email_domains', '' ); 81 81 } 82 82 83 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', ' mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' );84 $checked_options = array( 'm u_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );83 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' ); 84 $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); 85 85 foreach ( $checked_options as $option_name => $option_unchecked_value ) { 86 86 if ( ! isset( $_POST[$option_name] ) ) 87 87 $_POST[$option_name] = $option_unchecked_value; … … 270 270 <h3><?php _e( 'Upload Settings' ); ?></h3> 271 271 <table class="form-table"> 272 272 <tr valign="top"> 273 <th scope="row"><?php _e( 'Media upload buttons' ) ?></th>274 <?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?>275 <td><label><input type="checkbox" id="mu_media_buttons_image" name="mu_media_buttons[image]" value="1"<?php checked( ! empty( $mu_media_buttons['image'] ) ) ?>/> <?php _e( 'Images' ); ?></label><br />276 <label><input type="checkbox" id="mu_media_buttons_video" name="mu_media_buttons[video]" value="1"<?php checked( ! empty( $mu_media_buttons['video'] ) ) ?>/> <?php _e( 'Videos' ); ?></label><br />277 <label><input type="checkbox" id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value="1"<?php checked( ! empty( $mu_media_buttons['audio'] ) ) ?>/> <?php _e( 'Music' ); ?></label><br />278 <?php _e( 'The media upload buttons to display on the “Write Post” page. Make sure you update the allowed upload file types below as well.' ); ?></td>279 </tr>280 281 <tr valign="top">282 273 <th scope="row"><?php _e( 'Site upload space' ) ?></th> 283 274 <td> 284 275 <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br /> -
wp-admin/css/media.dev.css
362 362 margin-right: 25px; 363 363 } 364 364 365 p.media-types { 366 margin: 1em; 367 } 368 369 tr.not-image { 370 display: none; 371 } 372 No newline at end of file