WordPress.org

Make WordPress Core

Changeset 28355


Ignore:
Timestamp:
05/10/2014 04:59:34 AM (8 years ago)
Author:
DrewAPicture
Message:

Add baseline doc blocks for all ajax handlers in ajax-actions.php.

Fixes #28200.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r28292 r28355  
    1212
    1313/**
    14  * Heartbeat API (experimental)
     14 * Ajax handler for the (experimental) Heartbeat API in
     15 * the no-privilege context.
    1516 *
    1617 * Runs when the user is not logged in.
     18 *
     19 * @since 3.6.0
    1720 */
    1821function wp_ajax_nopriv_heartbeat() {
     
    6871}
    6972
    70 /*
    71  * GET-based Ajax handlers.
     73//
     74// GET-based Ajax handlers.
     75//
     76
     77/**
     78 * Ajax handler for fetching a list table.
     79 *
     80 * @since 3.1.0
    7281 */
    7382function wp_ajax_fetch_list() {
     
    8897    wp_die( 0 );
    8998}
     99
     100/**
     101 * Ajax handler for tag search.
     102 *
     103 * @since 3.1.0
     104 */
    90105function wp_ajax_ajax_tag_search() {
    91106    global $wpdb;
     
    121136}
    122137
     138/**
     139 * Ajax handler for compression testing.
     140 *
     141 * @since 3.1.0
     142 */
    123143function wp_ajax_wp_compression_test() {
    124144    if ( !current_user_can( 'manage_options' ) )
     
    166186}
    167187
     188/**
     189 * Ajax handler for image editor previews.
     190 *
     191 * @since 3.1.0
     192 */
    168193function wp_ajax_imgedit_preview() {
    169194    $post_id = intval($_GET['postid']);
     
    180205}
    181206
     207/**
     208 * Ajax handler for oEmbed caching.
     209 *
     210 * @since 3.1.0
     211 */
    182212function wp_ajax_oembed_cache() {
    183213    global $wp_embed;
     
    187217}
    188218
     219/**
     220 * Ajax handler for user autocomplete.
     221 *
     222 * @since 3.4.0
     223 */
    189224function wp_ajax_autocomplete_user() {
    190225    if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
     
    242277}
    243278
     279/**
     280 * Ajax handler for dashboard widgets.
     281 *
     282 * @since 3.4.0
     283 */
    244284function wp_ajax_dashboard_widgets() {
    245285    require_once ABSPATH . 'wp-admin/includes/dashboard.php';
     
    258298}
    259299
     300/**
     301 * Ajax handler for Customizer preview logged-in status.
     302 *
     303 * @since 3.4.0
     304 */
    260305function wp_ajax_logged_in() {
    261306    wp_die( 1 );
    262307}
    263308
    264 /*
    265  * Ajax helper.
    266  */
     309//
     310// Ajax helpers.
     311//
    267312
    268313/**
     
    326371}
    327372
    328 /*
    329  * POST-based Ajax handlers.
    330  */
    331 
     373//
     374// POST-based Ajax handlers.
     375//
     376
     377/**
     378 * Ajax handler for adding a hierarchical term.
     379 *
     380 * @since 3.1.0
     381 */
    332382function _wp_ajax_add_hierarchical_term() {
    333383    $action = $_POST['action'];
     
    409459}
    410460
     461/**
     462 * Ajax handler for deleting a comment.
     463 *
     464 * @since 3.1.0
     465 */
    411466function wp_ajax_delete_comment() {
    412467    $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
     
    452507}
    453508
     509/**
     510 * Ajax handler for deleting a tag.
     511 *
     512 * @since 3.1.0
     513 */
    454514function wp_ajax_delete_tag() {
    455515    $tag_id = (int) $_POST['tag_ID'];
     
    472532}
    473533
     534/**
     535 * Ajax handler for deleting a link.
     536 *
     537 * @since 3.1.0
     538 */
    474539function wp_ajax_delete_link() {
    475540    $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
     
    489554}
    490555
     556/**
     557 * Ajax handler for deleting meta.
     558 *
     559 * @since 3.1.0
     560 */
    491561function wp_ajax_delete_meta() {
    492562    $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
     
    503573}
    504574
     575/**
     576 * Ajax handler for deleting a post.
     577 *
     578 * @since 3.1.0
     579 *
     580 * @param string $action Action to perform.
     581 */
    505582function wp_ajax_delete_post( $action ) {
    506583    if ( empty( $action ) )
     
    521598}
    522599
     600/**
     601 * Ajax handler for sending a post to the trash.
     602 *
     603 * @since 3.1.0
     604 *
     605 * @param string $action Action to perform.
     606 */
    523607function wp_ajax_trash_post( $action ) {
    524608    if ( empty( $action ) )
     
    544628}
    545629
     630/**
     631 * Ajax handler to restore a post from the trash.
     632 *
     633 * @since 3.1.0
     634 *
     635 * @param string $action Action to perform.
     636 */
    546637function wp_ajax_untrash_post( $action ) {
    547638    if ( empty( $action ) )
     
    568659}
    569660
     661/**
     662 * Ajax handler to dim a comment.
     663 *
     664 * @since 3.1.0
     665 */
    570666function wp_ajax_dim_comment() {
    571667    $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
     
    605701}
    606702
     703/**
     704 * Ajax handler for deleting a link category.
     705 *
     706 * @since 3.1.0
     707 *
     708 * @param string $action Action to perform.
     709 */
    607710function wp_ajax_add_link_category( $action ) {
    608711    if ( empty( $action ) )
     
    635738}
    636739
     740/**
     741 * Ajax handler to add a tag.
     742 *
     743 * @since 3.1.0
     744 */
    637745function wp_ajax_add_tag() {
    638746    global $wp_list_table;
     
    687795}
    688796
     797/**
     798 * Ajax handler for getting a tagcloud.
     799 *
     800 * @since 3.1.0
     801 */
    689802function wp_ajax_get_tagcloud() {
    690803    if ( isset( $_POST['tax'] ) ) {
     
    723836}
    724837
     838/**
     839 * Ajax handler for getting comments.
     840 *
     841 * @since 3.1.0
     842 *
     843 * @param string $action Action to perform.
     844 */
    725845function wp_ajax_get_comments( $action ) {
    726846    global $wp_list_table, $post_id;
     
    767887}
    768888
     889/**
     890 * Ajax handler for replying to a comment.
     891 *
     892 * @since 3.1.0
     893 *
     894 * @param string $action Action to perform.
     895 */
    769896function wp_ajax_replyto_comment( $action ) {
    770897    global $wp_list_table, $wpdb;
     
    861988}
    862989
     990/**
     991 * Ajax handler for editing a comment.
     992 *
     993 * @since 3.1.0
     994 */
    863995function wp_ajax_edit_comment() {
    864996    global $wp_list_table;
     
    9011033}
    9021034
     1035/**
     1036 * Ajax handler for adding a menu item.
     1037 *
     1038 * @since 3.1.0
     1039 */
    9031040function wp_ajax_add_menu_item() {
    9041041    check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
     
    9731110}
    9741111
     1112/**
     1113 * Ajax handler for adding meta.
     1114 *
     1115 * @since 3.1.0
     1116 */
    9751117function wp_ajax_add_meta() {
    9761118    check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
     
    10561198}
    10571199
     1200/**
     1201 * Ajax handler for adding a user.
     1202 *
     1203 * @since 3.1.0
     1204 *
     1205 * @param string $action Action to perform.
     1206 */
    10581207function wp_ajax_add_user( $action ) {
    10591208    global $wp_list_table;
     
    10911240}
    10921241
     1242/**
     1243 * Ajax handler for closed post boxes.
     1244 *
     1245 * @since 3.1.0
     1246 */
    10931247function wp_ajax_closed_postboxes() {
    10941248    check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
     
    11181272}
    11191273
     1274/**
     1275 * Ajax handler for hidden columns.
     1276 *
     1277 * @since 3.1.0
     1278 */
    11201279function wp_ajax_hidden_columns() {
    11211280    check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
     
    11351294}
    11361295
     1296/**
     1297 * Ajax handler for updating whether to display the welcome panel.
     1298 *
     1299 * @since 3.1.0
     1300 */
    11371301function wp_ajax_update_welcome_panel() {
    11381302    check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' );
     
    11461310}
    11471311
     1312/**
     1313 * Ajax handler for retrieving menu meta boxes.
     1314 *
     1315 * @since 3.1.0
     1316 */
    11481317function wp_ajax_menu_get_metabox() {
    11491318    if ( ! current_user_can( 'edit_theme_options' ) )
     
    11891358}
    11901359
     1360/**
     1361 * Ajax handler for internal linking.
     1362 *
     1363 * @since 3.1.0
     1364 */
    11911365function wp_ajax_wp_link_ajax() {
    11921366    check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
     
    12101384}
    12111385
     1386/**
     1387 * Ajax handler for menu locations save.
     1388 *
     1389 * @since 3.1.0
     1390 */
    12121391function wp_ajax_menu_locations_save() {
    12131392    if ( ! current_user_can( 'edit_theme_options' ) )
     
    12201399}
    12211400
     1401/**
     1402 * Ajax handler for saving the meta box order.
     1403 *
     1404 * @since 3.1.0
     1405 */
    12221406function wp_ajax_meta_box_order() {
    12231407    check_ajax_referer( 'meta-box-order' );
     
    12451429}
    12461430
     1431/**
     1432 * Ajax handler for menu quick searching.
     1433 *
     1434 * @since 3.1.0
     1435 */
    12471436function wp_ajax_menu_quick_search() {
    12481437    if ( ! current_user_can( 'edit_theme_options' ) )
     
    12561445}
    12571446
     1447/**
     1448 * Ajax handler to retrieve a permalink.
     1449 *
     1450 * @since 3.1.0
     1451 */
    12581452function wp_ajax_get_permalink() {
    12591453    check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
     
    12621456}
    12631457
     1458/**
     1459 * Ajax handler to retrieve a sample permalink.
     1460 *
     1461 * @since 3.1.0
     1462 */
    12641463function wp_ajax_sample_permalink() {
    12651464    check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
     
    12701469}
    12711470
     1471/**
     1472 * Ajax handler for quick edit saving for a post.
     1473 *
     1474 * @since 3.1.0
     1475 */
    12721476function wp_ajax_inline_save() {
    12731477    global $wp_list_table;
     
    13441548}
    13451549
     1550/**
     1551 * Ajax handler for quick edit saving for a term.
     1552 *
     1553 * @since 3.1.0
     1554 */
    13461555function wp_ajax_inline_save_tax() {
    13471556    global $wp_list_table;
     
    13891598}
    13901599
     1600/**
     1601 * Ajax handler for finding posts.
     1602 *
     1603 * @since 3.1.0
     1604 */
    13911605function wp_ajax_find_posts() {
    13921606    check_ajax_referer( 'find-posts' );
     
    14471661}
    14481662
     1663/**
     1664 * Ajax handler for saving the widgets order.
     1665 *
     1666 * @since 3.1.0
     1667 */
    14491668function wp_ajax_widgets_order() {
    14501669    check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
     
    14781697}
    14791698
     1699/**
     1700 * Ajax handler for saving a widget.
     1701 *
     1702 * @since 3.1.0
     1703 */
    14801704function wp_ajax_save_widget() {
    14811705    global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
     
    15621786}
    15631787
     1788/**
     1789 * Ajax handler for saving a widget.
     1790 *
     1791 * @since 3.9.0
     1792 */
    15641793function wp_ajax_update_widget() {
    15651794    global $wp_customize;
     
    15671796}
    15681797
     1798/**
     1799 * Ajax handler for uploading attachments
     1800 *
     1801 * @since 3.3.0
     1802 */
    15691803function wp_ajax_upload_attachment() {
    15701804    check_ajax_referer( 'media-form' );
     
    16321866}
    16331867
     1868/**
     1869 * Ajax handler for image editing.
     1870 *
     1871 * @since 3.1.0
     1872 */
    16341873function wp_ajax_image_editor() {
    16351874    $attachment_id = intval($_POST['postid']);
     
    16591898}
    16601899
     1900/**
     1901 * Ajax handler for setting the featured image.
     1902 *
     1903 * @since 3.1.0
     1904 */
    16611905function wp_ajax_set_post_thumbnail() {
    16621906    $json = ! empty( $_REQUEST['json'] ); // New-style request
     
    16901934}
    16911935
     1936/**
     1937 * Ajax handler for date formatting.
     1938 *
     1939 * @since 3.1.0
     1940 */
    16921941function wp_ajax_date_format() {
    16931942    wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) );
    16941943}
    16951944
     1945/**
     1946 * Ajax handler for time formatting.
     1947 *
     1948 * @since 3.1.0
     1949 */
    16961950function wp_ajax_time_format() {
    16971951    wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
    16981952}
    16991953
     1954/**
     1955 * Ajax handler for saving posts from the fullscreen editor.
     1956 *
     1957 * @since 3.1.0
     1958 */
    17001959function wp_ajax_wp_fullscreen_save_post() {
    17011960    $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
     
    17321991}
    17331992
     1993/**
     1994 * Ajax handler for removing a post lock.
     1995 *
     1996 * @since 3.1.0
     1997 */
    17341998function wp_ajax_wp_remove_post_lock() {
    17351999    if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) )
     
    17612025}
    17622026
     2027/**
     2028 * Ajax handler for dismissing a WordPress pointer.
     2029 *
     2030 * @since 3.1.0
     2031 */
    17632032function wp_ajax_dismiss_wp_pointer() {
    17642033    $pointer = $_POST['pointer'];
     
    17812050
    17822051/**
    1783  * Get an attachment.
     2052 * Ajax handler for getting an attachment.
    17842053 *
    17852054 * @since 3.5.0
     
    18082077
    18092078/**
    1810  * Query for attachments.
     2079 * Ajax handler for querying for attachments.
    18112080 *
    18122081 * @since 3.5.0
     
    18472116
    18482117/**
    1849  * Save attachment attributes.
     2118 * Ajax handler for saving attachment attributes.
    18502119 *
    18512120 * @since 3.5.0
     
    18912160
    18922161/**
    1893  * Save backwards compatible attachment attributes.
     2162 * Ajax handler for saving backwards compatible attachment attributes.
    18942163 *
    18952164 * @since 3.5.0
     
    19372206}
    19382207
     2208/**
     2209 * Ajax handler for saving the attachment order.
     2210 *
     2211 * @since 3.5.0
     2212 */
    19392213function wp_ajax_save_attachment_order() {
    19402214    if ( ! isset( $_REQUEST['post_id'] ) )
     
    19692243
    19702244/**
     2245 * Ajax handler for sending an attachment to the editor.
     2246 *
    19712247 * Generates the HTML to send an attachment to the editor.
    1972  * Backwards compatible with the media_send_to_editor filter and the chain
    1973  * of filters that follow.
     2248 * Backwards compatible with the media_send_to_editor filter
     2249 * and the chain of filters that follow.
    19742250 *
    19752251 * @since 3.5.0
     
    20242300
    20252301/**
     2302 * Ajax handler for sending a link to the editor.
     2303 *
    20262304 * Generates the HTML to send a non-image embed link to the editor.
    20272305 *
     
    20652343
    20662344/**
    2067  * Heartbeat API (experimental)
     2345 * Ajax handler for the (experimental) Heartbeat API.
    20682346 *
    20692347 * Runs when the user is logged in.
     2348 *
     2349 * @since 3.6.0
    20702350 */
    20712351function wp_ajax_heartbeat() {
     
    21302410}
    21312411
     2412/**
     2413 * Ajax handler for getting revision diffs.
     2414 *
     2415 * @since 3.6.0
     2416 */
    21322417function wp_ajax_get_revision_diffs() {
    21332418    require ABSPATH . 'wp-admin/includes/revision.php';
     
    21582443
    21592444/**
    2160  * Auto-save the selected color scheme for a user's own profile.
    2161  *
    2162  * @since  3.8.0
     2445 * Ajax handler for auto-saving the selected color scheme for
     2446 * a user's own profile.
     2447 *
     2448 * @since 3.8.0
    21632449 */
    21642450function wp_ajax_save_user_color_scheme() {
     
    21782464
    21792465/**
    2180  * Get themes from themes_api().
     2466 * Ajax handler for getting themes from themes_api().
    21812467 *
    21822468 * @since 3.9.0
Note: See TracChangeset for help on using the changeset viewer.