Changeset 21681
- Timestamp:
- 08/31/2012 02:58:51 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r21071 r21681 51 51 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 52 52 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 53 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 53 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'query-attachments', 54 54 ); 55 55 -
trunk/wp-admin/includes/ajax-actions.php
r21597 r21681 1426 1426 $parent_tag = get_term( $parent, $taxonomy ); 1427 1427 $parent = $parent_tag->parent; 1428 $level++; 1428 $level++; 1429 1429 } 1430 1430 echo $wp_list_table->single_row( $tag, $level ); … … 1802 1802 wp_die( 1 ); 1803 1803 } 1804 1805 /** 1806 * Get an attachment. 1807 * 1808 * @since 3.5.0 1809 */ 1810 function wp_ajax_get_attachment() { 1811 if ( ! isset( $_REQUEST['id'] ) ) 1812 wp_send_json_error(); 1813 1814 if ( ! $id = absint( $_REQUEST['id'] ) ) 1815 wp_send_json_error(); 1816 1817 if ( ! current_user_can( 'read_post', $id ) ) 1818 wp_send_json_error(); 1819 1820 if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) 1821 wp_send_json_error(); 1822 1823 wp_send_json_success( $attachment ); 1824 } 1825 1826 /** 1827 * Query for attachments. 1828 * 1829 * @since 3.5.0 1830 */ 1831 function wp_ajax_query_attachments() { 1832 $qvs = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); 1833 $qvs = array_intersect_key( $qvs, array_flip( array( 's', 'order', 'orderby', 'posts_per_page', 'paged' ) ) ); 1834 1835 $query['post_type'] = 'attachment'; 1836 $query['post_status'] = 'inherit'; 1837 if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) ) 1838 $query['post_status'] .= ',private'; 1839 1840 $query = new WP_Query( $query ); 1841 1842 $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts ); 1843 $posts = array_filter( $posts ); 1844 1845 wp_send_json_success( $posts ); 1846 } -
trunk/wp-includes/functions.php
r21679 r21681 2152 2152 function wp_send_json( $response ) { 2153 2153 @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); 2154 echo json_encode( $ json);2154 echo json_encode( $response ); 2155 2155 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) 2156 2156 wp_die();
Note: See TracChangeset
for help on using the changeset viewer.