Ticket #27506: 27506.3.diff
File 27506.3.diff, 43.6 KB (added by , 11 years ago) |
---|
-
src/wp-includes/class-wp-xmlrpc-server.php
127 127 ); 128 128 129 129 $this->initialise_blog_option_info(); 130 $this->methods = apply_filters('xmlrpc_methods', $this->methods); 130 131 /** 132 * Filter the methods exposed by the XML-RPC server. 133 * 134 * This filter can be used to add new methods, and remove built-in methods. 135 * 136 * @since 1.5.0 137 * 138 * @param array $methods An array of XML-RPC methods. 139 */ 140 $this->methods = apply_filters( 'xmlrpc_methods', $this->methods ); 131 141 } 132 142 133 143 function serve_request() { … … 171 181 */ 172 182 function login( $username, $password ) { 173 183 // Respect any old filters against get_option() for 'enable_xmlrpc'. 174 $enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated 184 185 /** 186 * Filter whether XML-RPC is enabled. 187 * 188 * @since 3.5.0 189 * @deprecated 3.5.0 Use 'xmlrpc_enabled' instead. 190 * 191 * @param bool $enable Whether to enable XML-RPC. Default false. 192 */ 193 $enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); 175 194 if ( false === $enabled ) 176 $enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated177 195 178 // Proper filter for turning off XML-RPC. It is on by default. 196 /** 197 * Filter whether XML-RPC is enabled. 198 * 199 * @since 3.5.0 200 * @deprecated 3.5.0 Use xmlrpc_enabled instead. 201 * 202 * @param bool $enable Whether to enable XML-RPC. Default true. 203 */ 204 $enabled = apply_filters( 'option_enable_xmlrpc', true ); 205 206 /** 207 * Filter whether XML-RPC is enabled. 208 * 209 * This is the proper filter for turning off XML-RPC. 210 * 211 * @since 3.5.0 212 * 213 * @param bool $enabled Whether XML-RPC is enabled. Default true. 214 */ 179 215 $enabled = apply_filters( 'xmlrpc_enabled', $enabled ); 180 216 181 217 if ( ! $enabled ) { … … 187 223 188 224 if (is_wp_error($user)) { 189 225 $this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) ); 226 227 /** 228 * Filter the XML-RPC user login error message. 229 * 230 * @since 3.5.0 231 * 232 * @param string $error The XML-RPC error message. 233 * @param WP_User $user WP_User object. 234 */ 190 235 $this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user ); 191 236 return false; 192 237 } … … 441 486 ) 442 487 ); 443 488 489 /** 490 * Filter the XML-RPC blog options property. 491 * 492 * @since 2.6.0 493 * 494 * @param array $blog_options An array of XML-RPC blog options. 495 */ 444 496 $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options ); 445 497 } 446 498 … … 474 526 if ( !$user = $this->login($username, $password) ) 475 527 return $this->error; 476 528 529 /** 530 * Fires after the XML-RPC user has been authenticated but before the rest of 531 * the method logic begins. 532 * 533 * All built-in XML-RPC methods use the action xmlrpc_call, with a parameter 534 * equal to the method's name, e.g., wp.getUsersBlogs, wp.newPost, etc. 535 * 536 * @since 2.5.0 537 * 538 * @param method $name The method name. 539 */ 477 540 do_action( 'xmlrpc_call', 'wp.getUsersBlogs' ); 478 541 479 542 $blogs = (array) get_blogs_of_user( $user->ID ); … … 553 616 if ( in_array( 'object_type', $fields ) ) 554 617 $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type ); 555 618 619 /** 620 * Filter XML-RPC-prepared data for the given taxonomy. 621 * 622 * @since 3.4.0 623 * 624 * @param array $_taxonomy An array of taxonomy data. 625 * @param object $taxonomy Taxonomy object. 626 * @param array $fields The subset of taxonomy fields to return. 627 */ 556 628 return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); 557 629 } 558 630 … … 578 650 // Count we are happy to return as an integer because people really shouldn't use terms that much. 579 651 $_term['count'] = intval( $_term['count'] ); 580 652 653 /** 654 * Filter XML-RPC-prepared data for the given term. 655 * 656 * @since 3.4.0 657 * 658 * @param array $_term An array of term data. 659 * @param array|object $term Term object or array. 660 */ 581 661 return apply_filters( 'xmlrpc_prepare_term', $_term, $term ); 582 662 } 583 663 … … 699 779 } 700 780 } 701 781 782 /** 783 * Filter XML-RPC-prepared date for the given post. 784 * 785 * @since 3.4.0 786 * 787 * @param array $_post An array of modified post data. 788 * @param array $post An array of post data. 789 * @param array $fields An array of post fields. 790 */ 702 791 return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields ); 703 792 } 704 793 … … 741 830 if ( in_array( 'taxonomies', $fields ) ) 742 831 $_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' ); 743 832 833 /** 834 * Filter XML-RPC-prepared date for the given post type. 835 * 836 * @since 3.4.0 837 * 838 * @param array $_post_type An array of post type data. 839 * @param object $post_type Post type object. 840 */ 744 841 return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type ); 745 842 } 746 843 … … 771 868 else 772 869 $_media_item['thumbnail'] = $_media_item['link']; 773 870 871 /** 872 * Filter XML-RPC-prepared data for the given media item. 873 * 874 * @since 3.4.0 875 * 876 * @param array $_media_item An array of media item data. 877 * @param object $media_item Media item object. 878 * @param string $thumbnail_size Image size. 879 */ 774 880 return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size ); 775 881 } 776 882 … … 842 948 'wp_page_template' => $page_template 843 949 ); 844 950 951 /** 952 * Filter XML-RPC-prepared data for the given page. 953 * 954 * @since 3.4.0 955 * 956 * @param array $_page An array of page data. 957 * @param WP_Post $page Page object. 958 */ 845 959 return apply_filters( 'xmlrpc_prepare_page', $_page, $page ); 846 960 } 847 961 … … 884 998 'type' => $comment->comment_type, 885 999 ); 886 1000 1001 /** 1002 * Filter XML-RPC-prepared data for the given comment. 1003 * 1004 * @since 3.4.0 1005 * 1006 * @param array $_comment An array of prepared comment data. 1007 * @param object $comment Comment object. 1008 */ 887 1009 return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment ); 888 1010 } 889 1011 … … 924 1046 $_user = array_merge( $_user, $requested_fields ); 925 1047 } 926 1048 1049 /** 1050 * Filter XML-RPC-prepared data for the given user. 1051 * 1052 * @since 3.5.0 1053 * 1054 * @param array $_user An array of user data. 1055 * @param WP_User $user User object. 1056 * @param array $fields An array of user fields. 1057 */ 927 1058 return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields ); 928 1059 } 929 1060 … … 972 1103 if ( ! $user = $this->login( $username, $password ) ) 973 1104 return $this->error; 974 1105 1106 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 975 1107 do_action( 'xmlrpc_call', 'wp.newPost' ); 976 1108 977 1109 unset( $content_struct['ID'] ); … … 1215 1347 1216 1348 $this->attach_uploads( $post_ID, $post_data['post_content'] ); 1217 1349 1350 /** 1351 * Filter post data array to be inserted via XML-RPC. 1352 * 1353 * @since 3.4.0 1354 * 1355 * @param array $post_data Parsed array of post data. 1356 * @param array $content_struct Post data array. 1357 */ 1218 1358 $post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct ); 1219 1359 1220 1360 $post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true ); … … 1258 1398 if ( ! $user = $this->login( $username, $password ) ) 1259 1399 return $this->error; 1260 1400 1401 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1261 1402 do_action( 'xmlrpc_call', 'wp.editPost' ); 1262 1403 1263 1404 $post = get_post( $post_id, ARRAY_A ); … … 1319 1460 if ( ! $user = $this->login( $username, $password ) ) 1320 1461 return $this->error; 1321 1462 1463 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1322 1464 do_action( 'xmlrpc_call', 'wp.deletePost' ); 1323 1465 1324 1466 $post = get_post( $post_id, ARRAY_A ); … … 1394 1536 if ( isset( $args[4] ) ) 1395 1537 $fields = $args[4]; 1396 1538 else 1539 1540 /** 1541 * Filter the conceptual XML-RPC groups used to retrieve a post. 1542 * 1543 * @since 3.4.0 1544 * 1545 * @param array $fields An array of conceptual groups. Default 'post', 1546 * 'terms', 'custom_fields'. 1547 * @param string $method The method used to retrieve the post fields. 1548 * Default 'wp.getPost'. 1549 */ 1397 1550 $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' ); 1398 1551 1399 1552 if ( ! $user = $this->login( $username, $password ) ) 1400 1553 return $this->error; 1401 1554 1555 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1402 1556 do_action( 'xmlrpc_call', 'wp.getPost' ); 1403 1557 1404 1558 $post = get_post( $post_id, ARRAY_A ); … … 1447 1601 $password = $args[2]; 1448 1602 $filter = isset( $args[3] ) ? $args[3] : array(); 1449 1603 1450 if ( isset( $args[4] ) ) 1604 if ( isset( $args[4] ) ) { 1451 1605 $fields = $args[4]; 1452 else 1606 } else { 1607 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1453 1608 $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' ); 1609 } 1454 1610 1455 1611 if ( ! $user = $this->login( $username, $password ) ) 1456 1612 return $this->error; 1457 1613 1614 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1458 1615 do_action( 'xmlrpc_call', 'wp.getPosts' ); 1459 1616 1460 1617 $query = array(); … … 1544 1701 if ( ! $user = $this->login( $username, $password ) ) 1545 1702 return $this->error; 1546 1703 1704 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1547 1705 do_action( 'xmlrpc_call', 'wp.newTerm' ); 1548 1706 1549 1707 if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) … … 1632 1790 if ( ! $user = $this->login( $username, $password ) ) 1633 1791 return $this->error; 1634 1792 1793 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1635 1794 do_action( 'xmlrpc_call', 'wp.editTerm' ); 1636 1795 1637 1796 if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) … … 1724 1883 if ( ! $user = $this->login( $username, $password ) ) 1725 1884 return $this->error; 1726 1885 1886 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1727 1887 do_action( 'xmlrpc_call', 'wp.deleteTerm' ); 1728 1888 1729 1889 if ( ! taxonomy_exists( $taxonomy ) ) … … 1791 1951 if ( ! $user = $this->login( $username, $password ) ) 1792 1952 return $this->error; 1793 1953 1954 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1794 1955 do_action( 'xmlrpc_call', 'wp.getTerm' ); 1795 1956 1796 1957 if ( ! taxonomy_exists( $taxonomy ) ) … … 1844 2005 if ( ! $user = $this->login( $username, $password ) ) 1845 2006 return $this->error; 1846 2007 2008 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1847 2009 do_action( 'xmlrpc_call', 'wp.getTerms' ); 1848 2010 1849 2011 if ( ! taxonomy_exists( $taxonomy ) ) … … 1915 2077 $password = $args[2]; 1916 2078 $taxonomy = $args[3]; 1917 2079 1918 if ( isset( $args[4] ) ) 2080 if ( isset( $args[4] ) ) { 1919 2081 $fields = $args[4]; 1920 else 2082 } else { 2083 /** 2084 * Filter the taxonomy fields to query for the given XML-RPC method. 2085 * 2086 * @since 3.4.0 2087 * 2088 * @param array $fields An array of taxonomy fields to retrieve. 2089 * @param string $method The method name. 2090 */ 1921 2091 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' ); 2092 } 1922 2093 1923 2094 if ( ! $user = $this->login( $username, $password ) ) 1924 2095 return $this->error; 1925 2096 2097 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1926 2098 do_action( 'xmlrpc_call', 'wp.getTaxonomy' ); 1927 2099 1928 2100 if ( ! taxonomy_exists( $taxonomy ) ) … … 1959 2131 $password = $args[2]; 1960 2132 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 1961 2133 1962 if ( isset( $args[4] ) ) 2134 if ( isset( $args[4] ) ) { 1963 2135 $fields = $args[4]; 1964 else 2136 } else { 2137 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1965 2138 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); 2139 } 1966 2140 1967 2141 if ( ! $user = $this->login( $username, $password ) ) 1968 2142 return $this->error; 1969 2143 2144 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1970 2145 do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); 1971 2146 1972 2147 $taxonomies = get_taxonomies( $filter, 'objects' ); … … 2028 2203 $password = $args[2]; 2029 2204 $user_id = (int) $args[3]; 2030 2205 2031 if ( isset( $args[4] ) ) 2206 if ( isset( $args[4] ) ) { 2032 2207 $fields = $args[4]; 2033 else 2208 } else { 2209 /** 2210 * Filter the default user fields to query for the given XML-RPC method. 2211 * 2212 * @since 3.5.0 2213 * 2214 * @param array $fields User fields to query for given method. Default 'all'. 2215 * @param string $method The method name. 2216 */ 2034 2217 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' ); 2218 } 2035 2219 2036 2220 if ( ! $user = $this->login( $username, $password ) ) 2037 2221 return $this->error; 2038 2222 2223 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2039 2224 do_action( 'xmlrpc_call', 'wp.getUser' ); 2040 2225 2041 2226 if ( ! current_user_can( 'edit_user', $user_id ) ) … … 2081 2266 $password = $args[2]; 2082 2267 $filter = isset( $args[3] ) ? $args[3] : array(); 2083 2268 2084 if ( isset( $args[4] ) ) 2269 if ( isset( $args[4] ) ) { 2085 2270 $fields = $args[4]; 2086 else 2271 } else { 2272 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2087 2273 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' ); 2274 } 2088 2275 2089 2276 if ( ! $user = $this->login( $username, $password ) ) 2090 2277 return $this->error; 2091 2278 2279 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2092 2280 do_action( 'xmlrpc_call', 'wp.getUsers' ); 2093 2281 2094 2282 if ( ! current_user_can( 'list_users' ) ) … … 2148 2336 $username = $args[1]; 2149 2337 $password = $args[2]; 2150 2338 2151 if ( isset( $args[3] ) ) 2339 if ( isset( $args[3] ) ) { 2152 2340 $fields = $args[3]; 2153 else 2341 } else { 2342 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2154 2343 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' ); 2344 } 2155 2345 2156 2346 if ( ! $user = $this->login( $username, $password ) ) 2157 2347 return $this->error; 2158 2348 2349 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2159 2350 do_action( 'xmlrpc_call', 'wp.getProfile' ); 2160 2351 2161 2352 if ( ! current_user_can( 'edit_user', $user->ID ) ) … … 2199 2390 if ( ! $user = $this->login( $username, $password ) ) 2200 2391 return $this->error; 2201 2392 2393 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2202 2394 do_action( 'xmlrpc_call', 'wp.editProfile' ); 2203 2395 2204 2396 if ( ! current_user_can( 'edit_user', $user->ID ) ) … … 2272 2464 if ( !current_user_can( 'edit_page', $page_id ) ) 2273 2465 return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) ); 2274 2466 2275 do_action('xmlrpc_call', 'wp.getPage'); 2467 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2468 do_action( 'xmlrpc_call', 'wp.getPage' ); 2276 2469 2277 2470 // If we found the page then format the data. 2278 2471 if ( $page->ID && ($page->post_type == 'page') ) { … … 2310 2503 if ( !current_user_can( 'edit_pages' ) ) 2311 2504 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); 2312 2505 2313 do_action('xmlrpc_call', 'wp.getPages'); 2506 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2507 do_action( 'xmlrpc_call', 'wp.getPages' ); 2314 2508 2315 2509 $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) ); 2316 2510 $num_pages = count($pages); … … 2350 2544 if ( !$user = $this->login($username, $password) ) 2351 2545 return $this->error; 2352 2546 2353 do_action('xmlrpc_call', 'wp.newPage'); 2547 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2548 do_action( 'xmlrpc_call', 'wp.newPage' ); 2354 2549 2355 2550 // Mark this as content for a page. 2356 2551 $args[3]["post_type"] = 'page'; … … 2378 2573 if ( !$user = $this->login($username, $password) ) 2379 2574 return $this->error; 2380 2575 2381 do_action('xmlrpc_call', 'wp.deletePage'); 2576 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2577 do_action( 'xmlrpc_call', 'wp.deletePage' ); 2382 2578 2383 2579 // Get the current page based on the page_id and 2384 2580 // make sure it is a page and not a post. … … 2395 2591 if ( !$result ) 2396 2592 return(new IXR_Error(500, __('Failed to delete the page.'))); 2397 2593 2594 /** 2595 * Fires after a page has been successfully deleted via XML-RPC. 2596 * 2597 * @since 3.4.0 2598 * 2599 * @param int $page_id ID of the deleted page. 2600 * @param array $args An array of arguments to delete the page. 2601 */ 2398 2602 do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args ); 2399 2603 2400 2604 return(true); … … 2420 2624 if ( !$user = $this->login($username, $password) ) 2421 2625 return $this->error; 2422 2626 2423 do_action('xmlrpc_call', 'wp.editPage'); 2627 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2628 do_action( 'xmlrpc_call', 'wp.editPage' ); 2424 2629 2425 2630 // Get the page data and make sure it is a page. 2426 2631 $actual_page = get_post($page_id, ARRAY_A); … … 2470 2675 if ( !current_user_can( 'edit_pages' ) ) 2471 2676 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); 2472 2677 2473 do_action('xmlrpc_call', 'wp.getPageList'); 2678 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2679 do_action( 'xmlrpc_call', 'wp.getPageList' ); 2474 2680 2475 2681 // Get list of pages ids and titles 2476 2682 $page_list = $wpdb->get_results(" … … 2521 2727 if ( !current_user_can('edit_posts') ) 2522 2728 return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'))); 2523 2729 2524 do_action('xmlrpc_call', 'wp.getAuthors'); 2730 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2731 do_action( 'xmlrpc_call', 'wp.getAuthors' ); 2525 2732 2526 2733 $authors = array(); 2527 2734 foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) { … … 2556 2763 if ( !current_user_can( 'edit_posts' ) ) 2557 2764 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); 2558 2765 2766 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2559 2767 do_action( 'xmlrpc_call', 'wp.getKeywords' ); 2560 2768 2561 2769 $tags = array(); … … 2595 2803 if ( !$user = $this->login($username, $password) ) 2596 2804 return $this->error; 2597 2805 2598 do_action('xmlrpc_call', 'wp.newCategory'); 2806 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2807 do_action( 'xmlrpc_call', 'wp.newCategory' ); 2599 2808 2600 2809 // Make sure the user is allowed to add a category. 2601 2810 if ( !current_user_can('manage_categories') ) … … 2632 2841 return(new IXR_Error(500, __('Sorry, the new category failed.'))); 2633 2842 } 2634 2843 2844 /** 2845 * Fires after a new category has been successfully created via XML-RPC. 2846 * 2847 * @since 3.4.0 2848 * 2849 * @param int $cat_id ID of the new category. 2850 * @param array $args An array of new category arguments. 2851 */ 2635 2852 do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args ); 2636 2853 2637 2854 return $cat_id; … … 2656 2873 if ( !$user = $this->login($username, $password) ) 2657 2874 return $this->error; 2658 2875 2659 do_action('xmlrpc_call', 'wp.deleteCategory'); 2876 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2877 do_action( 'xmlrpc_call', 'wp.deleteCategory' ); 2660 2878 2661 2879 if ( !current_user_can('manage_categories') ) 2662 2880 return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) ); … … 2663 2881 2664 2882 $status = wp_delete_term( $category_id, 'category' ); 2665 2883 2666 if( true == $status ) 2884 if ( true == $status ) { 2885 /** 2886 * Fires after a category has been successfully deleted via XML-RPC. 2887 * 2888 * @since 3.4.0 2889 * 2890 * @param int $category_id ID of the deleted category. 2891 * @param array $args An array of arguments to delete the category. 2892 */ 2667 2893 do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); 2894 } 2668 2895 2669 2896 return $status; 2670 2897 } … … 2692 2919 if ( !current_user_can( 'edit_posts' ) ) 2693 2920 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) ); 2694 2921 2695 do_action('xmlrpc_call', 'wp.suggestCategories'); 2922 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2923 do_action( 'xmlrpc_call', 'wp.suggestCategories' ); 2696 2924 2697 2925 $category_suggestions = array(); 2698 2926 $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category); … … 2728 2956 if ( !current_user_can( 'moderate_comments' ) ) 2729 2957 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2730 2958 2731 do_action('xmlrpc_call', 'wp.getComment'); 2959 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2960 do_action( 'xmlrpc_call', 'wp.getComment' ); 2732 2961 2733 2962 if ( ! $comment = get_comment($comment_id) ) 2734 2963 return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); … … 2769 2998 if ( !current_user_can( 'moderate_comments' ) ) 2770 2999 return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) ); 2771 3000 2772 do_action('xmlrpc_call', 'wp.getComments'); 3001 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3002 do_action( 'xmlrpc_call', 'wp.getComments' ); 2773 3003 2774 3004 if ( isset($struct['status']) ) 2775 3005 $status = $struct['status']; … … 2835 3065 if ( !current_user_can( 'edit_comment', $comment_ID ) ) 2836 3066 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2837 3067 2838 do_action('xmlrpc_call', 'wp.deleteComment'); 3068 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3069 do_action( 'xmlrpc_call', 'wp.deleteComment' ); 2839 3070 2840 3071 $status = wp_delete_comment( $comment_ID ); 2841 3072 2842 if( true == $status ) 3073 if ( true == $status ) { 3074 /** 3075 * Fires after a comment has been successfully deleted via XML-RPC. 3076 * 3077 * @since 3.4.0 3078 * 3079 * @param int $comment_ID ID of the deleted comment. 3080 * @param array $args An array of arguments to delete the comment. 3081 */ 2843 3082 do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); 3083 } 2844 3084 2845 3085 return $status; 2846 3086 } … … 2890 3130 if ( !current_user_can( 'edit_comment', $comment_ID ) ) 2891 3131 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2892 3132 2893 do_action('xmlrpc_call', 'wp.editComment'); 3133 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3134 do_action( 'xmlrpc_call', 'wp.editComment' ); 2894 3135 2895 3136 if ( isset($content_struct['status']) ) { 2896 3137 $statuses = get_comment_statuses(); … … 2931 3172 if ( !$result ) 2932 3173 return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.')); 2933 3174 3175 /** 3176 * Fires after a comment has been successfully updated via XML-RPC. 3177 * 3178 * @since 3.4.0 3179 * 3180 * @param int $comment_ID ID of the updated comment. 3181 * @param array $args An array of arguments to update the comment. 3182 */ 2934 3183 do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); 2935 3184 2936 3185 return true; … … 2955 3204 $post = $args[3]; 2956 3205 $content_struct = $args[4]; 2957 3206 2958 $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false); 3207 /** 3208 * Filter whether to allow anonymous comments over XML-RPC. 3209 * 3210 * @since 2.7.0 3211 * 3212 * @param bool $allow Whether to allow anonymous commenting via XML-RPC. 3213 * Default false. 3214 */ 3215 $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false ); 2959 3216 2960 3217 $user = $this->login($username, $password); 2961 3218 … … 3014 3271 3015 3272 $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null; 3016 3273 3017 do_action('xmlrpc_call', 'wp.newComment'); 3274 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3275 do_action( 'xmlrpc_call', 'wp.newComment' ); 3018 3276 3019 3277 $comment_ID = wp_new_comment( $comment ); 3020 3278 3279 /** 3280 * Fires after a new comment has been successfully created via XML-RPC. 3281 * 3282 * @since 3.4.0 3283 * 3284 * @param int $comment_ID ID of the new comment. 3285 * @param array $args An array of new comment arguments. 3286 */ 3021 3287 do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); 3022 3288 3023 3289 return $comment_ID; … … 3044 3310 if ( !current_user_can( 'moderate_comments' ) ) 3045 3311 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3046 3312 3047 do_action('xmlrpc_call', 'wp.getCommentStatusList'); 3313 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3314 do_action( 'xmlrpc_call', 'wp.getCommentStatusList' ); 3048 3315 3049 3316 return get_comment_statuses(); 3050 3317 } … … 3071 3338 if ( !current_user_can( 'edit_posts' ) ) 3072 3339 return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) ); 3073 3340 3074 do_action('xmlrpc_call', 'wp.getCommentCount'); 3341 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3342 do_action( 'xmlrpc_call', 'wp.getCommentCount' ); 3075 3343 3076 3344 $count = wp_count_comments( $post_id ); 3077 3345 return array( … … 3103 3371 if ( !current_user_can( 'edit_posts' ) ) 3104 3372 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3105 3373 3106 do_action('xmlrpc_call', 'wp.getPostStatusList'); 3374 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3375 do_action( 'xmlrpc_call', 'wp.getPostStatusList' ); 3107 3376 3108 3377 return get_post_statuses(); 3109 3378 } … … 3129 3398 if ( !current_user_can( 'edit_pages' ) ) 3130 3399 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3131 3400 3132 do_action('xmlrpc_call', 'wp.getPageStatusList'); 3401 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3402 do_action( 'xmlrpc_call', 'wp.getPageStatusList' ); 3133 3403 3134 3404 return get_page_statuses(); 3135 3405 } … … 3286 3556 if ( !current_user_can( 'upload_files' ) ) 3287 3557 return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) ); 3288 3558 3289 do_action('xmlrpc_call', 'wp.getMediaItem'); 3559 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3560 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 3290 3561 3291 3562 if ( ! $attachment = get_post($attachment_id) ) 3292 3563 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); … … 3331 3602 if ( !current_user_can( 'upload_files' ) ) 3332 3603 return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) ); 3333 3604 3334 do_action('xmlrpc_call', 'wp.getMediaLibrary'); 3605 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3606 do_action( 'xmlrpc_call', 'wp.getMediaLibrary' ); 3335 3607 3336 3608 $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; 3337 3609 $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; … … 3372 3644 if ( !current_user_can( 'edit_posts' ) ) 3373 3645 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3374 3646 3647 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3375 3648 do_action( 'xmlrpc_call', 'wp.getPostFormats' ); 3376 3649 3377 3650 $formats = get_post_format_strings(); … … 3427 3700 $password = $args[2]; 3428 3701 $post_type_name = $args[3]; 3429 3702 3430 if ( isset( $args[4] ) ) 3703 if ( isset( $args[4] ) ) { 3431 3704 $fields = $args[4]; 3432 else 3705 } else { 3706 /** 3707 * Filter the default fields to query for the given XML-RPC method. 3708 * 3709 * @since 3.4.0 3710 * 3711 * @param array $fields An array of post type fields to query for the given method. 3712 * @param string $method The method name. 3713 */ 3433 3714 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' ); 3715 } 3434 3716 3435 3717 if ( !$user = $this->login( $username, $password ) ) 3436 3718 return $this->error; 3437 3719 3720 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3438 3721 do_action( 'xmlrpc_call', 'wp.getPostType' ); 3439 3722 3440 3723 if( ! post_type_exists( $post_type_name ) ) … … 3473 3756 $password = $args[2]; 3474 3757 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3475 3758 3476 if ( isset( $args[4] ) ) 3759 if ( isset( $args[4] ) ) { 3477 3760 $fields = $args[4]; 3478 else 3761 } else { 3762 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3479 3763 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); 3764 } 3480 3765 3481 3766 if ( ! $user = $this->login( $username, $password ) ) 3482 3767 return $this->error; 3483 3768 3769 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3484 3770 do_action( 'xmlrpc_call', 'wp.getPostTypes' ); 3485 3771 3486 3772 $post_types = get_post_types( $filter, 'objects' ); … … 3527 3813 $password = $args[2]; 3528 3814 $post_id = (int) $args[3]; 3529 3815 3530 if ( isset( $args[4] ) ) 3816 if ( isset( $args[4] ) ) { 3531 3817 $fields = $args[4]; 3532 else 3818 } else { 3819 /** 3820 * Filter the default revision fields to query for the given XML-RPC method. 3821 * 3822 * @since 3.5.0 3823 * 3824 * @param array $field An array of revision fields to query for the given method. 3825 * @param string $method The method name. 3826 */ 3533 3827 $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' ); 3828 } 3534 3829 3535 3830 if ( ! $user = $this->login( $username, $password ) ) 3536 3831 return $this->error; 3537 3832 3833 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3538 3834 do_action( 'xmlrpc_call', 'wp.getRevisions' ); 3539 3835 3540 3836 if ( ! $post = get_post( $post_id ) ) … … 3596 3892 if ( ! $user = $this->login( $username, $password ) ) 3597 3893 return $this->error; 3598 3894 3895 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3599 3896 do_action( 'xmlrpc_call', 'wp.restoreRevision' ); 3600 3897 3601 3898 if ( ! $revision = wp_get_post_revision( $revision_id ) ) … … 3645 3942 if ( !$user = $this->login($username, $password) ) 3646 3943 return $this->error; 3647 3944 3648 do_action('xmlrpc_call', 'blogger.getUsersBlogs'); 3945 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3946 do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' ); 3649 3947 3650 3948 $is_admin = current_user_can('manage_options'); 3651 3949 … … 3712 4010 if ( !current_user_can( 'edit_posts' ) ) 3713 4011 return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); 3714 4012 3715 do_action('xmlrpc_call', 'blogger.getUserInfo'); 4013 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4014 do_action( 'xmlrpc_call', 'blogger.getUserInfo' ); 3716 4015 3717 4016 $struct = array( 3718 4017 'nickname' => $user->nickname, … … 3751 4050 if ( !current_user_can( 'edit_post', $post_ID ) ) 3752 4051 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 3753 4052 3754 do_action('xmlrpc_call', 'blogger.getPost'); 4053 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4054 do_action( 'xmlrpc_call', 'blogger.getPost' ); 3755 4055 3756 4056 $categories = implode(',', wp_get_post_categories($post_ID)); 3757 4057 … … 3796 4096 if ( ! current_user_can( 'edit_posts' ) ) 3797 4097 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 3798 4098 3799 do_action('xmlrpc_call', 'blogger.getRecentPosts'); 4099 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4100 do_action( 'xmlrpc_call', 'blogger.getRecentPosts' ); 3800 4101 3801 4102 $posts_list = wp_get_recent_posts( $query ); 3802 4103 … … 3874 4175 if ( !$user = $this->login($username, $password) ) 3875 4176 return $this->error; 3876 4177 3877 do_action('xmlrpc_call', 'blogger.newPost'); 4178 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4179 do_action( 'xmlrpc_call', 'blogger.newPost' ); 3878 4180 3879 4181 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 3880 4182 if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) ) … … 3902 4204 3903 4205 $this->attach_uploads( $post_ID, $post_content ); 3904 4206 4207 /** 4208 * Fires after a new post has been successfully created via the XML-RPC Blogger API. 4209 * 4210 * @since 3.4.0 4211 * 4212 * @param int $post_ID ID of the new post. 4213 * @param array $args An array of new post arguments. 4214 */ 3905 4215 do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args ); 3906 4216 3907 4217 return $post_ID; … … 3928 4238 if ( !$user = $this->login($username, $password) ) 3929 4239 return $this->error; 3930 4240 3931 do_action('xmlrpc_call', 'blogger.editPost'); 4241 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4242 do_action( 'xmlrpc_call', 'blogger.editPost' ); 3932 4243 3933 4244 $actual_post = get_post($post_ID,ARRAY_A); 3934 4245 … … 3958 4269 3959 4270 $this->attach_uploads( $ID, $post_content ); 3960 4271 4272 /** 4273 * Fires after a post has been successfully updated via the XML-RPC Blogger API. 4274 * 4275 * @since 3.4.0 4276 * 4277 * @param int $post_ID ID of the updated post. 4278 * @param array $args An array of arguments for the post to edit. 4279 */ 3961 4280 do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args ); 3962 4281 3963 4282 return true; … … 3982 4301 if ( !$user = $this->login($username, $password) ) 3983 4302 return $this->error; 3984 4303 3985 do_action('xmlrpc_call', 'blogger.deletePost'); 4304 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4305 do_action( 'xmlrpc_call', 'blogger.deletePost' ); 3986 4306 3987 4307 $actual_post = get_post($post_ID,ARRAY_A); 3988 4308 … … 3997 4317 if ( !$result ) 3998 4318 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 3999 4319 4320 /** 4321 * Fires after a post has been successfully deleted via the XML-RPC Blogger API. 4322 * 4323 * @since 3.4.0 4324 * 4325 * @param int $post_ID ID of the deleted post. 4326 * @param array $args An array of arguments to delete the post. 4327 */ 4000 4328 do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args ); 4001 4329 4002 4330 return true; … … 4053 4381 if ( !$user = $this->login($username, $password) ) 4054 4382 return $this->error; 4055 4383 4056 do_action('xmlrpc_call', 'metaWeblog.newPost'); 4384 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4385 do_action( 'xmlrpc_call', 'metaWeblog.newPost' ); 4057 4386 4058 4387 $page_template = ''; 4059 4388 if ( !empty( $content_struct['post_type'] ) ) { … … 4307 4636 if ( !$post_ID ) 4308 4637 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 4309 4638 4639 /** 4640 * Fires after a new post has been successfully created via the XML-RPC MovableType API. 4641 * 4642 * @since 3.4.0 4643 * 4644 * @param int $post_ID ID of the new post. 4645 * @param array $args An array of arguments to create the new post. 4646 */ 4310 4647 do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); 4311 4648 4312 4649 return strval($post_ID); … … 4372 4709 if ( ! $user = $this->login($username, $password) ) 4373 4710 return $this->error; 4374 4711 4375 do_action('xmlrpc_call', 'metaWeblog.editPost'); 4712 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4713 do_action( 'xmlrpc_call', 'metaWeblog.editPost' ); 4376 4714 4377 4715 $postdata = get_post( $post_ID, ARRAY_A ); 4378 4716 … … 4615 4953 if ( isset( $content_struct['wp_post_format'] ) ) 4616 4954 set_post_format( $post_ID, $content_struct['wp_post_format'] ); 4617 4955 4956 /** 4957 * Fires after a post has been successfully updated via the XML-RPC MovableType API. 4958 * 4959 * @since 3.4.0 4960 * 4961 * @param int $post_ID ID of the updated post. 4962 * @param array $args An array of arguments to update the post. 4963 */ 4618 4964 do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args ); 4619 4965 4620 4966 return true; … … 4646 4992 if ( !current_user_can( 'edit_post', $post_ID ) ) 4647 4993 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 4648 4994 4649 do_action('xmlrpc_call', 'metaWeblog.getPost'); 4995 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4996 do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); 4650 4997 4651 4998 if ($postdata['post_date'] != '') { 4652 4999 $post_date = $this->_convert_date( $postdata['post_date'] ); … … 4770 5117 if ( ! current_user_can( 'edit_posts' ) ) 4771 5118 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 4772 5119 4773 do_action('xmlrpc_call', 'metaWeblog.getRecentPosts'); 5120 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5121 do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' ); 4774 5122 4775 5123 $posts_list = wp_get_recent_posts( $query ); 4776 5124 … … 4885 5233 if ( !current_user_can( 'edit_posts' ) ) 4886 5234 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 4887 5235 4888 do_action('xmlrpc_call', 'metaWeblog.getCategories'); 5236 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5237 do_action( 'xmlrpc_call', 'metaWeblog.getCategories' ); 4889 5238 4890 5239 $categories_struct = array(); 4891 5240 … … 4933 5282 if ( !$user = $this->login($username, $password) ) 4934 5283 return $this->error; 4935 5284 4936 do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); 5285 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5286 do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' ); 4937 5287 4938 5288 if ( !current_user_can('upload_files') ) { 4939 5289 $this->error = new IXR_Error( 401, __( 'You do not have permission to upload files.' ) ); … … 4940 5290 return $this->error; 4941 5291 } 4942 5292 4943 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) 4944 return new IXR_Error(500, $upload_err); 5293 /** 5294 * Filter whether to pre-empt the XML-RPC media upload. 5295 * 5296 * Passing a truthy value will effectively short-circuit the media upload, 5297 * returning that value as a 500 error instead. 5298 * 5299 * @since 2.1.0 5300 * 5301 * @param bool $error Whether to pre-empt the media upload. Default false. 5302 */ 5303 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) { 5304 return new IXR_Error( 500, $upload_err ); 5305 } 4945 5306 4946 5307 if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) { 4947 5308 // Get postmeta info on the object. … … 4987 5348 $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 4988 5349 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 4989 5350 5351 /** 5352 * Fires after a new attachment has been added via the XML-RPC MovableType API. 5353 * 5354 * @since 3.4.0 5355 * 5356 * @param int $id ID of the new attachment. 5357 * @param array $args An array of arguments to add the attachment. 5358 */ 4990 5359 do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); 4991 5360 4992 5361 $struct = array( … … 5027 5396 if ( !$user = $this->login($username, $password) ) 5028 5397 return $this->error; 5029 5398 5030 do_action('xmlrpc_call', 'mt.getRecentPostTitles'); 5399 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5400 do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' ); 5031 5401 5032 5402 $posts_list = wp_get_recent_posts( $query ); 5033 5403 … … 5086 5456 if ( !current_user_can( 'edit_posts' ) ) 5087 5457 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 5088 5458 5089 do_action('xmlrpc_call', 'mt.getCategoryList'); 5459 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5460 do_action( 'xmlrpc_call', 'mt.getCategoryList' ); 5090 5461 5091 5462 $categories_struct = array(); 5092 5463 … … 5127 5498 if ( !current_user_can( 'edit_post', $post_ID ) ) 5128 5499 return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); 5129 5500 5130 do_action('xmlrpc_call', 'mt.getPostCategories'); 5501 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5502 do_action( 'xmlrpc_call', 'mt.getPostCategories' ); 5131 5503 5132 5504 $categories = array(); 5133 5505 $catids = wp_get_post_categories(intval($post_ID)); … … 5165 5537 if ( !$user = $this->login($username, $password) ) 5166 5538 return $this->error; 5167 5539 5168 do_action('xmlrpc_call', 'mt.setPostCategories'); 5540 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5541 do_action( 'xmlrpc_call', 'mt.setPostCategories' ); 5169 5542 5170 5543 if ( ! get_post( $post_ID ) ) 5171 5544 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 5193 5566 */ 5194 5567 function mt_supportedMethods($args) { 5195 5568 5196 do_action('xmlrpc_call', 'mt.supportedMethods'); 5569 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5570 do_action( 'xmlrpc_call', 'mt.supportedMethods' ); 5197 5571 5198 5572 $supported_methods = array(); 5199 5573 foreach ( $this->methods as $key => $value ) { … … 5211 5585 * @param array $args Method parameters. 5212 5586 */ 5213 5587 function mt_supportedTextFilters($args) { 5214 do_action('xmlrpc_call', 'mt.supportedTextFilters'); 5215 return apply_filters('xmlrpc_text_filters', array()); 5588 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5589 do_action( 'xmlrpc_call', 'mt.supportedTextFilters' ); 5590 5591 /** 5592 * Filter the MoveableType text filters list for XML-RPC. 5593 * 5594 * @since 2.2.0 5595 * 5596 * @param array $filters An array of text filters. 5597 */ 5598 return apply_filters( 'xmlrpc_text_filters', array() ); 5216 5599 } 5217 5600 5218 5601 /** … … 5229 5612 5230 5613 $post_ID = intval($args); 5231 5614 5232 do_action('xmlrpc_call', 'mt.getTrackbackPings'); 5615 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5616 do_action( 'xmlrpc_call', 'mt.getTrackbackPings' ); 5233 5617 5234 5618 $actual_post = get_post($post_ID, ARRAY_A); 5235 5619 … … 5276 5660 if ( !$user = $this->login($username, $password) ) 5277 5661 return $this->error; 5278 5662 5279 do_action('xmlrpc_call', 'mt.publishPost'); 5663 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5664 do_action( 'xmlrpc_call', 'mt.publishPost' ); 5280 5665 5281 5666 $postdata = get_post($post_ID, ARRAY_A); 5282 5667 if ( ! $postdata ) … … 5312 5697 function pingback_ping($args) { 5313 5698 global $wpdb; 5314 5699 5315 do_action('xmlrpc_call', 'pingback.ping'); 5700 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5701 do_action( 'xmlrpc_call', 'pingback.ping' ); 5316 5702 5317 5703 $this->escape($args); 5318 5704 … … 5325 5711 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 5326 5712 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 5327 5713 5714 /** 5715 * Filter the pingback source URI. 5716 * 5717 * @since 3.6.0 5718 * 5719 * @param string $pagelinkedfrom URI of the page linked from. 5720 * @param string $pagelinkedto URI of the page linked to. 5721 */ 5328 5722 $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto ); 5723 5329 5724 if ( ! $pagelinkedfrom ) 5330 5725 return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) ); 5331 5726 … … 5404 5799 $linea = wp_remote_retrieve_body( wp_safe_remote_get( $pagelinkedfrom, $http_api_args ) ); 5405 5800 5406 5801 if ( !$linea ) 5407 5802 return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); 5408 5803 5409 $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto); 5804 /** 5805 * Filter the pingback remote source. 5806 * 5807 * @since 2.5.0 5808 * 5809 * @param string $linea Response object for the page linked from. 5810 * @param string $pagelinkedto URL of the page linked to. 5811 */ 5812 $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto ); 5410 5813 5411 5814 // Work around bug in strip_tags(): 5412 5815 $linea = str_replace('<!DOC', '<DOC', $linea); … … 5471 5874 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type'); 5472 5875 5473 5876 $comment_ID = wp_new_comment($commentdata); 5474 do_action('pingback_post', $comment_ID);5475 5877 5878 /** 5879 * Fires after a post pingback has been sent. 5880 * 5881 * @since 0.71 5882 * 5883 * @param int $comment_ID Comment ID. 5884 */ 5885 do_action( 'pingback_post', $comment_ID ); 5886 5476 5887 return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); 5477 5888 } 5478 5889 … … 5490 5901 5491 5902 global $wpdb; 5492 5903 5493 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); 5904 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5905 do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' ); 5494 5906 5495 5907 $this->escape($args); 5496 5908 … … 5524 5936 } 5525 5937 5526 5938 protected function pingback_error( $code, $message ) { 5939 /** 5940 * Filter the XML-RPC pingback error return. 5941 * 5942 * @since 3.5.1 5943 * 5944 * @param IXR_Error $error An IXR_Error object containing the error code and message. 5945 */ 5527 5946 return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) ); 5528 5947 } 5529 5948 }