Ticket #21092: 21092.diff
File 21092.diff, 2.5 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/media.php
1152 1152 'extra_rows' => array(), 1153 1153 ); 1154 1154 1155 if ( $send ) 1156 $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false ); 1155 if ( $send ) { 1156 if ( isset( $_POST ) && isset( $_POST['attachment_id'] ) ) { 1157 $attachment_parent_id = wp_get_post_parent_id( $_POST['attachment_id'] ); 1158 $parent_type = get_post_type_object( get_post_type( $attachment_parent_id ) ); 1159 } 1160 elseif( isset( $_GET ) && isset( $_GET['post_id'] ) ) { 1161 $parent_type = get_post_type_object( get_post_type( $_GET['post_id'] ) ); 1162 } 1163 1164 if( isset( $parent_type ) ) 1165 $parent_type_singular = $parent_type->labels->singular_name; 1166 else 1167 $parent_type_singular = 'Post'; 1168 1169 $send = get_submit_button( sprintf( __( 'Insert into %1$s' ), $parent_type_singular ), 'button', "send[$attachment_id]", false ); 1170 } 1157 1171 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1158 1172 if ( !EMPTY_TRASH_DAYS ) { 1159 1173 $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Delete Permanently' ) . '</a>'; … … 1929 1943 * @return unknown 1930 1944 */ 1931 1945 function wp_media_insert_url_form( $default_view = 'image' ) { 1946 if( isset( $_GET ) && isset( $_GET['post_id'] ) ) 1947 $parent_type = get_post_type_object( get_post_type( $_GET['post_id'] ) ); 1948 1949 if( isset( $parent_type ) ) 1950 $parent_type_singular = $parent_type->labels->singular_name; 1951 else 1952 $parent_type_singular = 'Post'; 1953 1932 1954 if ( !apply_filters( 'disable_captions', '' ) ) { 1933 1955 $caption = ' 1934 1956 <tr class="image-only"> … … 2009 2031 <tr class="image-only"> 2010 2032 <td></td> 2011 2033 <td> 2012 <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( 'Insert into Post') . '" />2034 <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( sprintf( 'Insert into %1$s', $parent_type_singular ) ) . '" /> 2013 2035 </td> 2014 2036 </tr> 2015 2037 <tr class="not-image"> 2016 2038 <td></td> 2017 2039 <td> 2018 ' . get_submit_button( __( 'Insert into Post'), 'button', 'insertonlybutton', false ) . '2040 ' . get_submit_button( sprintf( __( 'Insert into %1$s' ), $parent_type_singular ), 'button', 'insertonlybutton', false ) . ' 2019 2041 </td> 2020 2042 </tr> 2021 2043 </tbody></table>