Changeset 14248 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 04/27/2010 01:05:58 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r14235 r14248 127 127 128 128 include_once( ABSPATH . 'wp-admin/includes/image-edit.php' ); 129 if ( ! stream_preview_image($post_id) )129 if ( ! stream_preview_image($post_id) ) 130 130 die('-1'); 131 131 132 132 die(); 133 break; 134 case 'menu-quick-search': 135 if ( ! current_user_can( 'switch_themes' ) ) 136 die('-1'); 137 138 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 139 140 _wp_ajax_menu_quick_search( $_REQUEST ); 141 142 exit; 133 143 break; 134 144 case 'oembed-cache' : … … 387 397 die('0'); 388 398 break; 399 case 'delete-menu-item' : 400 $menu_item_id = (int) $_POST['menu-item']; 401 check_admin_referer( 'delete-menu_item_' . $menu_item_id ); 402 if ( ! current_user_can( 'switch_themes' ) ) 403 die('-1'); 404 405 if ( 'nav_menu_item' == get_post_type( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) 406 die('1'); 407 else 408 die('0'); 409 break; 389 410 case 'delete-meta' : 390 411 check_ajax_referer( "delete-meta_$id" ); … … 795 816 796 817 $x->send(); 818 break; 819 case 'add-menu-item' : 820 if ( ! current_user_can( 'switch_themes' ) ) 821 die('-1'); 822 823 check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' ); 824 825 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 826 827 $menu_id = (int) $_POST['menu']; 828 if ( isset( $_POST['menu-item'] ) ) { 829 $item_ids = wp_save_nav_menu_item( $menu_id, $_POST['menu-item'] ); 830 } else { 831 $item_ids = array(); 832 } 833 834 foreach ( (array) $item_ids as $menu_item_id ) { 835 $menu_obj = get_post( $menu_item_id ); 836 if ( ! empty( $menu_obj->ID ) ) { 837 $menu_items[] = wp_setup_nav_menu_item( $menu_obj ); 838 } 839 } 840 841 if ( ! empty( $menu_items ) ) { 842 $args = array( 843 'after' => '', 844 'before' => '', 845 'context' => 'backend', 846 'link_after' => '', 847 'link_before' => '', 848 'walker' => new Walker_Nav_Menu_Edit, 849 ); 850 echo walk_nav_menu_tree( $menu_items, 0, (object) $args ); 851 } 797 852 break; 798 853 case 'add-meta' : … … 1034 1089 die('1'); 1035 1090 break; 1091 case 'menu-quick-search': 1092 if ( ! current_user_can( 'switch_themes' ) ) 1093 die('-1'); 1094 1095 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 1096 1097 _wp_ajax_menu_quick_search( $_REQUEST ); 1098 1099 exit; 1100 break; 1036 1101 case 'meta-box-order': 1037 1102 check_ajax_referer( 'meta-box-order' );
Note: See TracChangeset
for help on using the changeset viewer.