Changeset 28355
- Timestamp:
- 05/10/2014 04:59:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r28292 r28355 12 12 13 13 /** 14 * Heartbeat API (experimental) 14 * Ajax handler for the (experimental) Heartbeat API in 15 * the no-privilege context. 15 16 * 16 17 * Runs when the user is not logged in. 18 * 19 * @since 3.6.0 17 20 */ 18 21 function wp_ajax_nopriv_heartbeat() { … … 68 71 } 69 72 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 72 81 */ 73 82 function wp_ajax_fetch_list() { … … 88 97 wp_die( 0 ); 89 98 } 99 100 /** 101 * Ajax handler for tag search. 102 * 103 * @since 3.1.0 104 */ 90 105 function wp_ajax_ajax_tag_search() { 91 106 global $wpdb; … … 121 136 } 122 137 138 /** 139 * Ajax handler for compression testing. 140 * 141 * @since 3.1.0 142 */ 123 143 function wp_ajax_wp_compression_test() { 124 144 if ( !current_user_can( 'manage_options' ) ) … … 166 186 } 167 187 188 /** 189 * Ajax handler for image editor previews. 190 * 191 * @since 3.1.0 192 */ 168 193 function wp_ajax_imgedit_preview() { 169 194 $post_id = intval($_GET['postid']); … … 180 205 } 181 206 207 /** 208 * Ajax handler for oEmbed caching. 209 * 210 * @since 3.1.0 211 */ 182 212 function wp_ajax_oembed_cache() { 183 213 global $wp_embed; … … 187 217 } 188 218 219 /** 220 * Ajax handler for user autocomplete. 221 * 222 * @since 3.4.0 223 */ 189 224 function wp_ajax_autocomplete_user() { 190 225 if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) ) … … 242 277 } 243 278 279 /** 280 * Ajax handler for dashboard widgets. 281 * 282 * @since 3.4.0 283 */ 244 284 function wp_ajax_dashboard_widgets() { 245 285 require_once ABSPATH . 'wp-admin/includes/dashboard.php'; … … 258 298 } 259 299 300 /** 301 * Ajax handler for Customizer preview logged-in status. 302 * 303 * @since 3.4.0 304 */ 260 305 function wp_ajax_logged_in() { 261 306 wp_die( 1 ); 262 307 } 263 308 264 / *265 * Ajax helper.266 */309 // 310 // Ajax helpers. 311 // 267 312 268 313 /** … … 326 371 } 327 372 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 */ 332 382 function _wp_ajax_add_hierarchical_term() { 333 383 $action = $_POST['action']; … … 409 459 } 410 460 461 /** 462 * Ajax handler for deleting a comment. 463 * 464 * @since 3.1.0 465 */ 411 466 function wp_ajax_delete_comment() { 412 467 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; … … 452 507 } 453 508 509 /** 510 * Ajax handler for deleting a tag. 511 * 512 * @since 3.1.0 513 */ 454 514 function wp_ajax_delete_tag() { 455 515 $tag_id = (int) $_POST['tag_ID']; … … 472 532 } 473 533 534 /** 535 * Ajax handler for deleting a link. 536 * 537 * @since 3.1.0 538 */ 474 539 function wp_ajax_delete_link() { 475 540 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; … … 489 554 } 490 555 556 /** 557 * Ajax handler for deleting meta. 558 * 559 * @since 3.1.0 560 */ 491 561 function wp_ajax_delete_meta() { 492 562 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; … … 503 573 } 504 574 575 /** 576 * Ajax handler for deleting a post. 577 * 578 * @since 3.1.0 579 * 580 * @param string $action Action to perform. 581 */ 505 582 function wp_ajax_delete_post( $action ) { 506 583 if ( empty( $action ) ) … … 521 598 } 522 599 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 */ 523 607 function wp_ajax_trash_post( $action ) { 524 608 if ( empty( $action ) ) … … 544 628 } 545 629 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 */ 546 637 function wp_ajax_untrash_post( $action ) { 547 638 if ( empty( $action ) ) … … 568 659 } 569 660 661 /** 662 * Ajax handler to dim a comment. 663 * 664 * @since 3.1.0 665 */ 570 666 function wp_ajax_dim_comment() { 571 667 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; … … 605 701 } 606 702 703 /** 704 * Ajax handler for deleting a link category. 705 * 706 * @since 3.1.0 707 * 708 * @param string $action Action to perform. 709 */ 607 710 function wp_ajax_add_link_category( $action ) { 608 711 if ( empty( $action ) ) … … 635 738 } 636 739 740 /** 741 * Ajax handler to add a tag. 742 * 743 * @since 3.1.0 744 */ 637 745 function wp_ajax_add_tag() { 638 746 global $wp_list_table; … … 687 795 } 688 796 797 /** 798 * Ajax handler for getting a tagcloud. 799 * 800 * @since 3.1.0 801 */ 689 802 function wp_ajax_get_tagcloud() { 690 803 if ( isset( $_POST['tax'] ) ) { … … 723 836 } 724 837 838 /** 839 * Ajax handler for getting comments. 840 * 841 * @since 3.1.0 842 * 843 * @param string $action Action to perform. 844 */ 725 845 function wp_ajax_get_comments( $action ) { 726 846 global $wp_list_table, $post_id; … … 767 887 } 768 888 889 /** 890 * Ajax handler for replying to a comment. 891 * 892 * @since 3.1.0 893 * 894 * @param string $action Action to perform. 895 */ 769 896 function wp_ajax_replyto_comment( $action ) { 770 897 global $wp_list_table, $wpdb; … … 861 988 } 862 989 990 /** 991 * Ajax handler for editing a comment. 992 * 993 * @since 3.1.0 994 */ 863 995 function wp_ajax_edit_comment() { 864 996 global $wp_list_table; … … 901 1033 } 902 1034 1035 /** 1036 * Ajax handler for adding a menu item. 1037 * 1038 * @since 3.1.0 1039 */ 903 1040 function wp_ajax_add_menu_item() { 904 1041 check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); … … 973 1110 } 974 1111 1112 /** 1113 * Ajax handler for adding meta. 1114 * 1115 * @since 3.1.0 1116 */ 975 1117 function wp_ajax_add_meta() { 976 1118 check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' ); … … 1056 1198 } 1057 1199 1200 /** 1201 * Ajax handler for adding a user. 1202 * 1203 * @since 3.1.0 1204 * 1205 * @param string $action Action to perform. 1206 */ 1058 1207 function wp_ajax_add_user( $action ) { 1059 1208 global $wp_list_table; … … 1091 1240 } 1092 1241 1242 /** 1243 * Ajax handler for closed post boxes. 1244 * 1245 * @since 3.1.0 1246 */ 1093 1247 function wp_ajax_closed_postboxes() { 1094 1248 check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); … … 1118 1272 } 1119 1273 1274 /** 1275 * Ajax handler for hidden columns. 1276 * 1277 * @since 3.1.0 1278 */ 1120 1279 function wp_ajax_hidden_columns() { 1121 1280 check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); … … 1135 1294 } 1136 1295 1296 /** 1297 * Ajax handler for updating whether to display the welcome panel. 1298 * 1299 * @since 3.1.0 1300 */ 1137 1301 function wp_ajax_update_welcome_panel() { 1138 1302 check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' ); … … 1146 1310 } 1147 1311 1312 /** 1313 * Ajax handler for retrieving menu meta boxes. 1314 * 1315 * @since 3.1.0 1316 */ 1148 1317 function wp_ajax_menu_get_metabox() { 1149 1318 if ( ! current_user_can( 'edit_theme_options' ) ) … … 1189 1358 } 1190 1359 1360 /** 1361 * Ajax handler for internal linking. 1362 * 1363 * @since 3.1.0 1364 */ 1191 1365 function wp_ajax_wp_link_ajax() { 1192 1366 check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' ); … … 1210 1384 } 1211 1385 1386 /** 1387 * Ajax handler for menu locations save. 1388 * 1389 * @since 3.1.0 1390 */ 1212 1391 function wp_ajax_menu_locations_save() { 1213 1392 if ( ! current_user_can( 'edit_theme_options' ) ) … … 1220 1399 } 1221 1400 1401 /** 1402 * Ajax handler for saving the meta box order. 1403 * 1404 * @since 3.1.0 1405 */ 1222 1406 function wp_ajax_meta_box_order() { 1223 1407 check_ajax_referer( 'meta-box-order' ); … … 1245 1429 } 1246 1430 1431 /** 1432 * Ajax handler for menu quick searching. 1433 * 1434 * @since 3.1.0 1435 */ 1247 1436 function wp_ajax_menu_quick_search() { 1248 1437 if ( ! current_user_can( 'edit_theme_options' ) ) … … 1256 1445 } 1257 1446 1447 /** 1448 * Ajax handler to retrieve a permalink. 1449 * 1450 * @since 3.1.0 1451 */ 1258 1452 function wp_ajax_get_permalink() { 1259 1453 check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); … … 1262 1456 } 1263 1457 1458 /** 1459 * Ajax handler to retrieve a sample permalink. 1460 * 1461 * @since 3.1.0 1462 */ 1264 1463 function wp_ajax_sample_permalink() { 1265 1464 check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); … … 1270 1469 } 1271 1470 1471 /** 1472 * Ajax handler for quick edit saving for a post. 1473 * 1474 * @since 3.1.0 1475 */ 1272 1476 function wp_ajax_inline_save() { 1273 1477 global $wp_list_table; … … 1344 1548 } 1345 1549 1550 /** 1551 * Ajax handler for quick edit saving for a term. 1552 * 1553 * @since 3.1.0 1554 */ 1346 1555 function wp_ajax_inline_save_tax() { 1347 1556 global $wp_list_table; … … 1389 1598 } 1390 1599 1600 /** 1601 * Ajax handler for finding posts. 1602 * 1603 * @since 3.1.0 1604 */ 1391 1605 function wp_ajax_find_posts() { 1392 1606 check_ajax_referer( 'find-posts' ); … … 1447 1661 } 1448 1662 1663 /** 1664 * Ajax handler for saving the widgets order. 1665 * 1666 * @since 3.1.0 1667 */ 1449 1668 function wp_ajax_widgets_order() { 1450 1669 check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); … … 1478 1697 } 1479 1698 1699 /** 1700 * Ajax handler for saving a widget. 1701 * 1702 * @since 3.1.0 1703 */ 1480 1704 function wp_ajax_save_widget() { 1481 1705 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; … … 1562 1786 } 1563 1787 1788 /** 1789 * Ajax handler for saving a widget. 1790 * 1791 * @since 3.9.0 1792 */ 1564 1793 function wp_ajax_update_widget() { 1565 1794 global $wp_customize; … … 1567 1796 } 1568 1797 1798 /** 1799 * Ajax handler for uploading attachments 1800 * 1801 * @since 3.3.0 1802 */ 1569 1803 function wp_ajax_upload_attachment() { 1570 1804 check_ajax_referer( 'media-form' ); … … 1632 1866 } 1633 1867 1868 /** 1869 * Ajax handler for image editing. 1870 * 1871 * @since 3.1.0 1872 */ 1634 1873 function wp_ajax_image_editor() { 1635 1874 $attachment_id = intval($_POST['postid']); … … 1659 1898 } 1660 1899 1900 /** 1901 * Ajax handler for setting the featured image. 1902 * 1903 * @since 3.1.0 1904 */ 1661 1905 function wp_ajax_set_post_thumbnail() { 1662 1906 $json = ! empty( $_REQUEST['json'] ); // New-style request … … 1690 1934 } 1691 1935 1936 /** 1937 * Ajax handler for date formatting. 1938 * 1939 * @since 3.1.0 1940 */ 1692 1941 function wp_ajax_date_format() { 1693 1942 wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) ); 1694 1943 } 1695 1944 1945 /** 1946 * Ajax handler for time formatting. 1947 * 1948 * @since 3.1.0 1949 */ 1696 1950 function wp_ajax_time_format() { 1697 1951 wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) ); 1698 1952 } 1699 1953 1954 /** 1955 * Ajax handler for saving posts from the fullscreen editor. 1956 * 1957 * @since 3.1.0 1958 */ 1700 1959 function wp_ajax_wp_fullscreen_save_post() { 1701 1960 $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; … … 1732 1991 } 1733 1992 1993 /** 1994 * Ajax handler for removing a post lock. 1995 * 1996 * @since 3.1.0 1997 */ 1734 1998 function wp_ajax_wp_remove_post_lock() { 1735 1999 if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) ) … … 1761 2025 } 1762 2026 2027 /** 2028 * Ajax handler for dismissing a WordPress pointer. 2029 * 2030 * @since 3.1.0 2031 */ 1763 2032 function wp_ajax_dismiss_wp_pointer() { 1764 2033 $pointer = $_POST['pointer']; … … 1781 2050 1782 2051 /** 1783 * Getan attachment.2052 * Ajax handler for getting an attachment. 1784 2053 * 1785 2054 * @since 3.5.0 … … 1808 2077 1809 2078 /** 1810 * Queryfor attachments.2079 * Ajax handler for querying for attachments. 1811 2080 * 1812 2081 * @since 3.5.0 … … 1847 2116 1848 2117 /** 1849 * Saveattachment attributes.2118 * Ajax handler for saving attachment attributes. 1850 2119 * 1851 2120 * @since 3.5.0 … … 1891 2160 1892 2161 /** 1893 * Savebackwards compatible attachment attributes.2162 * Ajax handler for saving backwards compatible attachment attributes. 1894 2163 * 1895 2164 * @since 3.5.0 … … 1937 2206 } 1938 2207 2208 /** 2209 * Ajax handler for saving the attachment order. 2210 * 2211 * @since 3.5.0 2212 */ 1939 2213 function wp_ajax_save_attachment_order() { 1940 2214 if ( ! isset( $_REQUEST['post_id'] ) ) … … 1969 2243 1970 2244 /** 2245 * Ajax handler for sending an attachment to the editor. 2246 * 1971 2247 * Generates the HTML to send an attachment to the editor. 1972 * Backwards compatible with the media_send_to_editor filter and the chain1973 * of filters that follow.2248 * Backwards compatible with the media_send_to_editor filter 2249 * and the chain of filters that follow. 1974 2250 * 1975 2251 * @since 3.5.0 … … 2024 2300 2025 2301 /** 2302 * Ajax handler for sending a link to the editor. 2303 * 2026 2304 * Generates the HTML to send a non-image embed link to the editor. 2027 2305 * … … 2065 2343 2066 2344 /** 2067 * Heartbeat API (experimental)2345 * Ajax handler for the (experimental) Heartbeat API. 2068 2346 * 2069 2347 * Runs when the user is logged in. 2348 * 2349 * @since 3.6.0 2070 2350 */ 2071 2351 function wp_ajax_heartbeat() { … … 2130 2410 } 2131 2411 2412 /** 2413 * Ajax handler for getting revision diffs. 2414 * 2415 * @since 3.6.0 2416 */ 2132 2417 function wp_ajax_get_revision_diffs() { 2133 2418 require ABSPATH . 'wp-admin/includes/revision.php'; … … 2158 2443 2159 2444 /** 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 2163 2449 */ 2164 2450 function wp_ajax_save_user_color_scheme() { … … 2178 2464 2179 2465 /** 2180 * Getthemes from themes_api().2466 * Ajax handler for getting themes from themes_api(). 2181 2467 * 2182 2468 * @since 3.9.0
Note: See TracChangeset
for help on using the changeset viewer.