| [ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * WordPress AJAX Process Execution. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 * 8 * @link http://codex.wordpress.org/AJAX_in_Plugins 9 */ 10 11 /** 12 * Executing AJAX process. 13 * 14 * @since 2.1.0 15 */ 16 define( 'DOING_AJAX', true ); 17 define( 'WP_ADMIN', true ); 18 19 // Require an action parameter 20 if ( empty( $_REQUEST['action'] ) ) 21 die( '0' ); 22 23 /** Load WordPress Bootstrap */ 24 require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); 25 26 /** Load WordPress Administration APIs */ 27 require_once ( ABSPATH . 'wp-admin/includes/admin.php' ); 28 29 /** Load Ajax Handlers for WordPress Core */ 30 require_once ( ABSPATH . 'wp-admin/includes/ajax-actions.php' ); 31 32 @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); 33 @header( 'X-Robots-Tag: noindex' ); 34 35 send_nosniff_header(); 36 37 do_action( 'admin_init' ); 38 39 $core_actions_get = array( 40 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache', 41 'autocomplete-user', 'autocomplete-site', 'dashboard-widgets', 42 ); 43 44 $core_actions_post = array( 45 'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link', 46 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment', 47 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment', 48 'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'autosave', 'closed-postboxes', 49 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 50 'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink', 51 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 52 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 53 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 54 ); 55 56 // Register core Ajax calls. 57 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) 58 add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); 59 60 if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) 61 add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); 62 63 add_action( 'wp_ajax_nopriv_autosave', 'wp_ajax_nopriv_autosave', 1 ); 64 65 if ( is_user_logged_in() ) 66 do_action( 'wp_ajax_' . $_REQUEST['action'] ); // Authenticated actions 67 else 68 do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); // Non-admin actions 69 70 // Default status 71 die( '0' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri May 25 03:56:23 2012 | Hosted by follow the white rabbit. |