Ticket #21092: 21092.2.diff
| File 21092.2.diff, 3.6 KB (added by , 13 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 if ( $parent_type->labels->insert_into_post ) 1166 $parent_insert_into_post = $parent_type->labels->insert_into_post; 1167 else 1168 $parent_insert_into_post = sprintf( __( 'Insert Into %1$s' ), $parent_type->labels->singular_name ); 1169 } 1170 else { 1171 $parent_insert_into_post = __( 'Insert Into Post' ); 1172 } 1173 1174 $send = get_submit_button( $parent_insert_into_post, 'button', "send[$attachment_id]", false ); 1175 } 1157 1176 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1158 1177 if ( !EMPTY_TRASH_DAYS ) { 1159 1178 $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 1948 * @return unknown 1930 1949 */ 1931 1950 function wp_media_insert_url_form( $default_view = 'image' ) { 1951 if( isset( $_GET ) && isset( $_GET['post_id'] ) ) 1952 $parent_type = get_post_type_object( get_post_type( $_GET['post_id'] ) ); 1953 1954 1955 if ( isset( $parent_type ) ) { 1956 if ( isset( $parent_type->labels->insert_into_post ) ) 1957 $parent_insert_into_post = $parent_type->labels->insert_into_post; 1958 else 1959 $parent_insert_into_post = sprintf( __( 'Insert Into %1$s' ), $parent_type->labels->singular_name ); 1960 } 1961 else { 1962 $parent_insert_into_post = __( 'Insert Into Post' ); 1963 } 1964 1965 1966 1932 1967 if ( !apply_filters( 'disable_captions', '' ) ) { 1933 1968 $caption = ' 1934 1969 <tr class="image-only"> … … 2009 2044 <tr class="image-only"> 2010 2045 <td></td> 2011 2046 <td> 2012 <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( 'Insert into Post') . '" />2047 <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( $parent_insert_into_post ) . '" /> 2013 2048 </td> 2014 2049 </tr> 2015 2050 <tr class="not-image"> 2016 2051 <td></td> 2017 2052 <td> 2018 ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '2053 ' . get_submit_button( $parent_insert_into_post, 'button', 'insertonlybutton', false ) . ' 2019 2054 </td> 2020 2055 </tr> 2021 2056 </tbody></table> -
wp-includes/post.php
1222 1222 * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page: 1223 1223 * - all_items - String for the submenu. Default is All Posts/All Pages 1224 1224 * - menu_name - Default is the same as <code>name</code> 1225 * - insert_into_post - Optional. String for the media uploader screen. Default is null, when it isn't explicitly set the media upload will use Insert Into $object->label->singular_name 1225 1226 * 1226 1227 * Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages). 1227 1228 *