Make WordPress Core

Ticket #12400: 12400.4.diff

File 12400.4.diff, 17.7 KB (added by sivel, 14 years ago)

Refreshed patch

  • wp-ajax.php

     
     1<?php
     2/**
     3 * WordPress Primary AJAX Process Execution.
     4 *
     5 * @package WordPress
     6 */
     7
     8/**
     9 * Executing AJAX process.
     10 *
     11 * @since 2.1.0
     12 */
     13define( 'DOING_AJAX', true );
     14
     15if ( ! isset( $_REQUEST['action'] ) )
     16        die( '-1' );
     17
     18if ( ! defined( 'ABSPATH' ) )
     19        require_once( dirname( __FILE__ ) . '/wp-load.php' );
     20
     21if ( defined( 'WP_ADMIN' ) && WP_ADMIN )
     22        require_once( ABSPATH . 'wp-admin/includes/admin.php' );
     23
     24@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     25send_nosniff_header();
     26
     27if ( defined( 'WP_ADMIN' ) && WP_ADMIN )
     28        do_action( 'admin_init' );
     29
     30if ( ! is_user_logged_in() ) {
     31        if ( !empty( $_REQUEST['action'] ) )
     32                do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
     33        die('-1');
     34}
     35
     36if ( isset( $_REQUEST['action'] ) ) {
     37        do_action( 'wp_ajax_' . $_REQUEST['action'] );
     38        die( '0' );
     39} else {
     40        die( '1' );
     41}
     42?>
  • wp-admin/admin-ajax.php

     
    11<?php
    22/**
    3  * WordPress AJAX Process Execution.
     3 * WordPress AJAX Process Execution for admin.
    44 *
    55 * @package WordPress
    66 * @subpackage Administration
    77 */
    8 
    9 /**
    10  * Executing AJAX process.
    11  *
    12  * @since 2.1.0
    13  */
    14 define('DOING_AJAX', true);
    158define('WP_ADMIN', true);
    169
    17 if ( ! isset( $_REQUEST['action'] ) )
    18         die('-1');
     10if ( ! defined( 'ABSPATH' ) )
     11        require_once( '../wp-load.php' );
    1912
    20 require_once('../wp-load.php');
    21 
    22 require_once('./includes/admin.php');
    23 @header('Content-Type: text/html; charset=' . get_option('blog_charset'));
    24 send_nosniff_header();
    25 
    26 do_action('admin_init');
    27 
    2813if ( ! is_user_logged_in() ) {
     14        if ( isset( $_POST['action'] ) )
     15                add_action( 'wp_ajax_nopriv_autosave', 'ajax_logged_out_autosave' );
     16} else {
     17        if ( isset( $_GET['action'] ) ) {
     18                add_action( 'wp_ajax_fetch-list', 'ajax_fetch_list' );
     19                add_action( 'wp_ajax_ajax-tag-search', 'ajax_tag_search' );
     20                add_action( 'wp_ajax_wp-compression-test', 'ajax_wp_compression_test' );
     21                add_action( 'wp_ajax_imgedit-preview', 'ajax_imgedit_preview' );
     22                add_action( 'wp_ajax_menu-quick-search', 'ajax_menu_quick_search' );
     23                add_action( 'wp_ajax_oembed-cache', 'ajax_oembed_cache' );
     24        } else if ( isset( $_POST['action'] ) ) {
     25                add_action( 'wp_ajax_delete-comment', 'ajax_delete_comment' );
     26                add_action( 'wp_ajax_delete-tag', 'ajax_delete_tag' );
     27                add_action( 'wp_ajax_delete-link', 'ajax_delete_link' );
     28                add_action( 'wp_ajax_delete-meta', 'ajax_delete_meta' );
     29                add_action( 'wp_ajax_delete-post', 'ajax_delete_post' );
     30                add_action( 'wp_ajax_trash-post', 'ajax_trash_untrash_post' );
     31                add_action( 'wp_ajax_untrash-post', 'ajax_trash_untrash_post' );
     32                add_action( 'wp_ajax_delete-page', 'ajax_delete_page' );
     33                add_action( 'wp_ajax_dim-comment', 'ajax_dim_comment' );
     34                add_action( 'wp_ajax_add-link-category', 'ajax_add_link_category' );
     35                add_action( 'wp_ajax_add-tag', 'ajax_add_tag' );
     36                add_action( 'wp_ajax_get-tagcloud', 'ajax_get_tagcloud' );
     37                add_action( 'wp_ajax_get-comments', 'ajax_get_comments' );
     38                add_action( 'wp_ajax_replyto-comment', 'ajax_replyto_comment' );
     39                add_action( 'wp_ajax_edit-comment', 'ajax_edit_comment' );
     40                add_action( 'wp_ajax_add-menu-item', 'ajax_add_menu_item' );
     41                add_action( 'wp_ajax_add-meta', 'ajax_add_meta' );
     42                add_action( 'wp_ajax_add-user', 'ajax_add_user' );
     43                add_action( 'wp_ajax_autosave', 'ajax_autosave' );
     44                add_action( 'wp_ajax_closed-postboxes', 'ajax_closed_postboxes' );
     45                add_action( 'wp_ajax_hidden-columns', 'ajax_hidden_columns' );
     46                add_action( 'wp_ajax_menu-get-metabox', 'ajax_menu_get_metabox' );
     47                add_action( 'wp_ajax_menu-quick-search', 'ajax_menu_quick_search' );
     48                add_action( 'wp_ajax_wp-link-ajax', 'ajax_wp_link_ajax' );
     49                add_action( 'wp_ajax_menu-locations-save', 'ajax_menu_locations_save' );
     50                add_action( 'wp_ajax_meta-box-order', 'ajax_meta_box_order' );
     51                add_action( 'wp_ajax_get-permalink', 'ajax_get_permalink' );
     52                add_action( 'wp_ajax_sample-permalink', 'ajax_sample_permalink' );
     53                add_action( 'wp_ajax_inline-save', 'ajax_inline_save' );
     54                add_action( 'wp_ajax_inline-save-tax', 'ajax_inline_save_tax' );
     55                add_action( 'wp_ajax_find_posts', 'ajax_find_posts' );
     56                add_action( 'wp_ajax_widgets-order', 'ajax_widgets_order' );
     57                add_action( 'wp_ajax_save-widget', 'ajax_save_widget' );
     58                add_action( 'wp_ajax_image-editor', 'ajax_image_editor' );
     59                add_action( 'wp_ajax_set-post-thumbnail', 'ajax_set_post_thumbnail' );
     60                add_action( 'wp_ajax_date_format', 'ajax_date_format' );
     61                add_action( 'wp_ajax_time_format', 'ajax_time_format' );
     62                add_action( 'wp_ajax_wp-fullscreen-save-post', 'ajax_wp_fullscreen_save_post' );
     63        }
     64}
    2965
    30         if ( isset( $_POST['action'] ) && $_POST['action'] == 'autosave' ) {
    31                 $id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0;
     66function ajax_logged_out_autosave() {
     67        $id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0;
    3268
    33                 if ( ! $id )
    34                         die('-1');
     69        if ( ! $id )
     70                die('-1');
    3571
    36                 $message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="_blank">Please log in again.</a>'), wp_login_url() );
    37                 $x = new WP_Ajax_Response( array(
    38                         'what' => 'autosave',
    39                         'id' => $id,
    40                         'data' => $message
    41                 ) );
    42                 $x->send();
    43         }
    44 
    45         if ( !empty( $_REQUEST['action'] ) )
    46                 do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
    47 
    48         die('-1');
     72        $message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="_blank">Please log in again.</a>'), wp_login_url() );
     73        $x = new WP_Ajax_Response( array(
     74                'what' => 'autosave',
     75                'id' => $id,
     76                'data' => $message
     77        ) );
     78        $x->send();
    4979}
    5080
    51 if ( isset( $_GET['action'] ) ) :
    52 switch ( $action = $_GET['action'] ) :
    53 case 'fetch-list' :
    54 
     81function ajax_fetch_list() {
    5582        $list_class = $_GET['list_args']['class'];
    5683        check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
    5784
     
    73100        $wp_list_table->ajax_response();
    74101
    75102        die( '0' );
    76         break;
    77 case 'ajax-tag-search' :
     103}
     104
     105function ajax_tag_search() {
    78106        if ( isset( $_GET['tax'] ) ) {
    79107                $taxonomy = sanitize_key( $_GET['tax'] );
    80108                $tax = get_taxonomy( $taxonomy );
     
    100128
    101129        echo join( $results, "\n" );
    102130        die;
    103         break;
    104 case 'wp-compression-test' :
     131}
     132
     133function wp_compression_test() {
    105134        if ( !current_user_can( 'manage_options' ) )
    106135                die('-1');
    107136
     
    144173        }
    145174
    146175        die('0');
    147         break;
    148 case 'imgedit-preview' :
     176}
     177
     178function ajax_imgedit_preview() {
    149179        $post_id = intval($_GET['postid']);
    150180        if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
    151181                die('-1');
     
    157187                die('-1');
    158188
    159189        die();
    160         break;
    161 case 'menu-quick-search':
     190}
     191
     192function admin_menu_quick_search() {
    162193        if ( ! current_user_can( 'edit_theme_options' ) )
    163194                die('-1');
    164195
     
    167198        _wp_ajax_menu_quick_search( $_REQUEST );
    168199
    169200        exit;
    170         break;
    171 case 'oembed-cache' :
     201}
     202
     203function oembed_cache() {
    172204        $return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0';
    173205        die( $return );
    174         break;
    175 default :
    176         do_action( 'wp_ajax_' . $_GET['action'] );
    177         die('0');
    178         break;
    179 endswitch;
    180 endif;
     206}
    181207
     208
    182209/**
    183210 * Sends back current comment total and new page links if they need to be updated.
    184211 *
     
    316343        $x->send();
    317344}
    318345
    319 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    320 switch ( $action = $_POST['action'] ) :
    321 case 'delete-comment' : // On success, die with time() instead of 1
     346function ajax_delete_comment() { // On success, die with time() instead of 1
     347        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    322348        if ( !$comment = get_comment( $id ) )
    323349                die( (string) time() );
    324350        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
     
    357383        if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
    358384                _wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
    359385        die( '0' );
    360         break;
    361 case 'delete-tag' :
     386}
     387
     388function ajax_delete_tag() {
    362389        $tag_id = (int) $_POST['tag_ID'];
    363390        check_ajax_referer( "delete-tag_$tag_id" );
    364391
     
    376403                die('1');
    377404        else
    378405                die('0');
    379         break;
    380 case 'delete-link' :
     406}
     407
     408function ajax_delete_link() {
     409        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    381410        check_ajax_referer( "delete-bookmark_$id" );
    382411        if ( !current_user_can( 'manage_links' ) )
    383412                die('-1');
     
    390419                die('1');
    391420        else
    392421                die('0');
    393         break;
    394 case 'delete-meta' :
     422}
     423
     424function ajax_delete_meta() {
     425        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    395426        check_ajax_referer( "delete-meta_$id" );
    396427        if ( !$meta = get_post_meta_by_id( $id ) )
    397428                die('1');
     
    401432        if ( delete_meta( $meta->meta_id ) )
    402433                die('1');
    403434        die('0');
    404         break;
    405 case 'delete-post' :
     435}
     436
     437function ajax_delete_post() {
     438        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    406439        check_ajax_referer( "{$action}_$id" );
    407440        if ( !current_user_can( 'delete_post', $id ) )
    408441                die('-1');
     
    414447                die('1');
    415448        else
    416449                die('0');
    417         break;
    418 case 'trash-post' :
    419 case 'untrash-post' :
     450}
     451
     452function ajax_trash_untrash_post() {
     453        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    420454        check_ajax_referer( "{$action}_$id" );
    421455        if ( !current_user_can( 'delete_post', $id ) )
    422456                die('-1');
     
    433467                die('1');
    434468
    435469        die('0');
    436         break;
    437 case 'delete-page' :
     470}
     471
     472function ajax_delete_page() {
     473        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    438474        check_ajax_referer( "{$action}_$id" );
    439475        if ( !current_user_can( 'delete_page', $id ) )
    440476                die('-1');
     
    446482                die('1');
    447483        else
    448484                die('0');
    449         break;
    450 case 'dim-comment' : // On success, die with time() instead of 1
     485}
    451486
     487function ajax_dim_comment() { // On success, die with time() instead of 1
     488        $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
    452489        if ( !$comment = get_comment( $id ) ) {
    453490                $x = new WP_Ajax_Response( array(
    454491                        'what' => 'comment',
     
    481518        // Decide if we need to send back '1' or a more complicated response including page links and comment counts
    482519        _wp_ajax_delete_comment_response( $comment->comment_ID );
    483520        die( '0' );
    484         break;
    485 case 'add-link-category' : // On the Fly
     521}
     522
     523function ajax_add_link_category() { // On the Fly
    486524        check_ajax_referer( $action );
    487525        if ( !current_user_can( 'manage_categories' ) )
    488526                die('-1');
     
    506544                ) );
    507545        }
    508546        $x->send();
    509         break;
    510 case 'add-tag' :
     547}
     548
     549function ajax_add_tag() {
    511550        check_ajax_referer( 'add-tag' );
    512551        $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
    513552        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
     
    558597                'supplemental' => (array) $tag
    559598                ) );
    560599        $x->send();
    561         break;
    562 case 'get-tagcloud' :
     600}
     601
     602function ajax_get_tagcloud() {
    563603        if ( isset( $_POST['tax'] ) ) {
    564604                $taxonomy = sanitize_key( $_POST['tax'] );
    565605                $tax = get_taxonomy( $taxonomy );
     
    593633        echo $return;
    594634
    595635        exit;
    596         break;
    597 case 'get-comments' :
     636}
     637
     638function ajax_get_comments() {
    598639        check_ajax_referer( $action );
    599640
    600641        set_current_screen( 'edit-comments' );
     
    623664                'data' => $comment_list_item
    624665        ) );
    625666        $x->send();
    626         break;
    627 case 'replyto-comment' :
     667}
     668
     669function ajax_replyto_comment() {
    628670        check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
    629671
    630672        set_current_screen( 'edit-comments' );
     
    693735        ));
    694736
    695737        $x->send();
    696         break;
    697 case 'edit-comment' :
     738}
     739
     740function ajax_edit_comment() {
    698741        check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
    699742
    700743        set_current_screen( 'edit-comments' );
     
    731774        ));
    732775
    733776        $x->send();
    734         break;
    735 case 'add-menu-item' :
     777}
     778
     779function ajax_add_menu_item() {
    736780        if ( ! current_user_can( 'edit_theme_options' ) )
    737781                die('-1');
    738782
     
    793837                );
    794838                echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
    795839        }
    796         break;
    797 case 'add-meta' :
     840}
     841
     842function ajax_add_meta() {
    798843        check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
    799844        $c = 0;
    800845        $pid = (int) $_POST['post_id'];
     
    875920                ) );
    876921        }
    877922        $x->send();
    878         break;
    879 case 'add-user' :
     923}
     924
     925function ajax_add_user() {
    880926        check_ajax_referer( $action );
    881927        if ( !current_user_can('create_users') )
    882928                die('-1');
     
    903949                )
    904950        ) );
    905951        $x->send();
    906         break;
    907 case 'autosave' : // The name of this action is hardcoded in edit_post()
     952}
     953
     954function ajax_autosave() { // The name of this action is hardcoded in edit_post()
    908955        define( 'DOING_AUTOSAVE', true );
    909956
    910957        $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
     
    9981045                'supplemental' => $supplemental
    9991046        ) );
    10001047        $x->send();
    1001         break;
    1002 case 'closed-postboxes' :
     1048}
     1049
     1050function ajax_closed_postboxes() {
    10031051        check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
    10041052        $closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed']) : array();
    10051053        $closed = array_filter($closed);
     
    10241072        }
    10251073
    10261074        die('1');
    1027         break;
    1028 case 'hidden-columns' :
     1075}
     1076
     1077function ajax_hidden_columns() {
    10291078        check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
    10301079        $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
    10311080        $hidden = explode( ',', $_POST['hidden'] );
     
    10411090                update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
    10421091
    10431092        die('1');
    1044         break;
    1045 case 'menu-get-metabox' :
     1093}
     1094
     1095function ajax_menu_get_metabox() {
    10461096        if ( ! current_user_can( 'edit_theme_options' ) )
    10471097                die('-1');
    10481098
     
    10801130        }
    10811131
    10821132        exit;
    1083         break;
    1084 case 'menu-quick-search':
     1133}
     1134
     1135function ajax_menu_quick_search() {
    10851136        if ( ! current_user_can( 'edit_theme_options' ) )
    10861137                die('-1');
    10871138
     
    10901141        _wp_ajax_menu_quick_search( $_REQUEST );
    10911142
    10921143        exit;
    1093         break;
    1094 case 'wp-link-ajax':
     1144}
     1145
     1146function ajax_wp_link_ajax() {
    10951147        require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
    10961148
    10971149        check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
     
    11111163        echo "\n";
    11121164
    11131165        exit;
    1114         break;
    1115 case 'menu-locations-save':
     1166}
     1167
     1168function ajax_menu_locations_save() {
    11161169        if ( ! current_user_can( 'edit_theme_options' ) )
    11171170                die('-1');
    11181171        check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
     
    11201173                die('0');
    11211174        set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
    11221175        die('1');
    1123         break;
    1124 case 'meta-box-order':
     1176}
     1177
     1178function ajax_meta_box_order() {
    11251179        check_ajax_referer( 'meta-box-order' );
    11261180        $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
    11271181        $page_columns = isset( $_POST['page_columns'] ) ? (int) $_POST['page_columns'] : 0;
     
    11401194                update_user_option($user->ID, "screen_layout_$page", $page_columns, true);
    11411195
    11421196        die('1');
    1143         break;
    1144 case 'get-permalink':
     1197}
     1198
     1199function ajax_get_permalink() {
    11451200        check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
    11461201        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
    11471202        die(add_query_arg(array('preview' => 'true'), get_permalink($post_id)));
    1148 break;
    1149 case 'sample-permalink':
     1203}
     1204
     1205function ajax_sample_permalink() {
    11501206        check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
    11511207        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
    11521208        $title = isset($_POST['new_title'])? $_POST['new_title'] : '';
    11531209        $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
    11541210        die(get_sample_permalink_html($post_id, $title, $slug));
    1155 break;
    1156 case 'inline-save':
     1211}
     1212
     1213function ajax_inline_save() {
    11571214        check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
    11581215
    11591216        if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
     
    12101267        $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) );
    12111268
    12121269        exit;
    1213         break;
    1214 case 'inline-save-tax':
     1270}
     1271
     1272function ajax_inline_save_tax() {
    12151273        check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
    12161274
    12171275        $taxonomy = sanitize_key( $_POST['taxonomy'] );
     
    12491307        }
    12501308
    12511309        exit;
    1252         break;
    1253 case 'find_posts':
     1310}
     1311
     1312function ajax_find_posts() {
    12541313        check_ajax_referer( 'find-posts' );
    12551314
    12561315        if ( empty($_POST['ps']) )
     
    13191378                'data' => $html
    13201379        ));
    13211380        $x->send();
     1381}
    13221382
    1323         break;
    1324 case 'widgets-order' :
     1383function ajax_widgets_order() {
    13251384        check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
    13261385
    13271386        if ( !current_user_can('edit_theme_options') )
     
    13501409        }
    13511410
    13521411        die('-1');
    1353         break;
    1354 case 'save-widget' :
     1412}
     1413
     1414function ajax_save_widget() {
    13551415        check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
    13561416
    13571417        if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) )
     
    14181478                call_user_func_array( $form['callback'], $form['params'] );
    14191479
    14201480        die();
    1421         break;
    1422 case 'image-editor':
     1481}
     1482
     1483function ajax_image_editor() {
    14231484        $attachment_id = intval($_POST['postid']);
    14241485        if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) )
    14251486                die('-1');
     
    14441505
    14451506        wp_image_editor($attachment_id, $msg);
    14461507        die();
    1447         break;
    1448 case 'set-post-thumbnail':
     1508}
     1509
     1510function ajax_set_post_thumbnail() {
    14491511        $post_ID = intval( $_POST['post_id'] );
    14501512        if ( !current_user_can( 'edit_post', $post_ID ) )
    14511513                die( '-1' );
     
    14611523        if ( set_post_thumbnail( $post_ID, $thumbnail_id ) )
    14621524                die( _wp_post_thumbnail_html( $thumbnail_id ) );
    14631525        die( '0' );
    1464         break;
    1465 case 'date_format' :
     1526}
     1527
     1528function ajax_date_format() {
    14661529        die( date_i18n( sanitize_option( 'date_format', $_POST['date'] ) ) );
    1467         break;
    1468 case 'time_format' :
     1530}
     1531
     1532function ajax_time_format() {
    14691533        die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
    1470         break;
    1471 case 'wp-fullscreen-save-post' :
     1534}
     1535
     1536function ajax_wp_fullscreen_save_post() {
    14721537        if ( isset($_POST['post_ID']) )
    14731538                $post_id = (int) $_POST['post_ID'];
    14741539        else
     
    15291594
    15301595        echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
    15311596        die();
    1532         break;
    1533 default :
    1534         do_action( 'wp_ajax_' . $_POST['action'] );
    1535         die('0');
    1536         break;
    1537 endswitch;
     1597}
     1598
     1599include( '../wp-ajax.php' );
    15381600?>