Ticket #27506: 27506.2.diff
File 27506.2.diff, 42.7 KB (added by , 7 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 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 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 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 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 Array of modified post data. 788 * @param array $post Array of post data. 789 * @param array $fields 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 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 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 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 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 Array of user data. 1055 * @param WP_User $user User object. 1056 * @param array $fields List 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 Array of taxonomy fields to retrieve. 2089 * @param string $method 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 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. … … 2420 2616 if ( !$user = $this->login($username, $password) ) 2421 2617 return $this->error; 2422 2618 2423 do_action('xmlrpc_call', 'wp.editPage'); 2619 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2620 do_action( 'xmlrpc_call', 'wp.editPage' ); 2424 2621 2425 2622 // Get the page data and make sure it is a page. 2426 2623 $actual_page = get_post($page_id, ARRAY_A); … … 2470 2667 if ( !current_user_can( 'edit_pages' ) ) 2471 2668 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); 2472 2669 2473 do_action('xmlrpc_call', 'wp.getPageList'); 2670 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2671 do_action( 'xmlrpc_call', 'wp.getPageList' ); 2474 2672 2475 2673 // Get list of pages ids and titles 2476 2674 $page_list = $wpdb->get_results(" … … 2521 2719 if ( !current_user_can('edit_posts') ) 2522 2720 return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'))); 2523 2721 2524 do_action('xmlrpc_call', 'wp.getAuthors'); 2722 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2723 do_action( 'xmlrpc_call', 'wp.getAuthors' ); 2525 2724 2526 2725 $authors = array(); 2527 2726 foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) { … … 2556 2755 if ( !current_user_can( 'edit_posts' ) ) 2557 2756 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); 2558 2757 2758 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2559 2759 do_action( 'xmlrpc_call', 'wp.getKeywords' ); 2560 2760 2561 2761 $tags = array(); … … 2595 2795 if ( !$user = $this->login($username, $password) ) 2596 2796 return $this->error; 2597 2797 2598 do_action('xmlrpc_call', 'wp.newCategory'); 2798 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2799 do_action( 'xmlrpc_call', 'wp.newCategory' ); 2599 2800 2600 2801 // Make sure the user is allowed to add a category. 2601 2802 if ( !current_user_can('manage_categories') ) … … 2632 2833 return(new IXR_Error(500, __('Sorry, the new category failed.'))); 2633 2834 } 2634 2835 2836 /** 2837 * Fires after a new category has successfully been created via XML-RPC. 2838 * 2839 * @since 3.4.0 2840 * 2841 * @param int $cat_id Category ID. 2842 * @param array $args New category arguments. 2843 */ 2635 2844 do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args ); 2636 2845 2637 2846 return $cat_id; … … 2656 2865 if ( !$user = $this->login($username, $password) ) 2657 2866 return $this->error; 2658 2867 2659 do_action('xmlrpc_call', 'wp.deleteCategory'); 2868 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2869 do_action( 'xmlrpc_call', 'wp.deleteCategory' ); 2660 2870 2661 2871 if ( !current_user_can('manage_categories') ) 2662 2872 return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) ); 2663 2873 2664 2874 $status = wp_delete_term( $category_id, 'category' ); 2665 2875 2666 if( true == $status ) 2876 if ( true == $status ) { 2877 /** 2878 * Fires after a category is successfully deleted via XML-RPC. 2879 * 2880 * @since 3.4.0 2881 * 2882 * @param int $category_id ID of the deleted category. 2883 * @param array $args Array of arguments to delete the category. 2884 */ 2667 2885 do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); 2886 } 2668 2887 2669 2888 return $status; 2670 2889 } … … 2692 2911 if ( !current_user_can( 'edit_posts' ) ) 2693 2912 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) ); 2694 2913 2695 do_action('xmlrpc_call', 'wp.suggestCategories'); 2914 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2915 do_action( 'xmlrpc_call', 'wp.suggestCategories' ); 2696 2916 2697 2917 $category_suggestions = array(); 2698 2918 $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category); … … 2728 2948 if ( !current_user_can( 'moderate_comments' ) ) 2729 2949 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2730 2950 2731 do_action('xmlrpc_call', 'wp.getComment'); 2951 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2952 do_action( 'xmlrpc_call', 'wp.getComment' ); 2732 2953 2733 2954 if ( ! $comment = get_comment($comment_id) ) 2734 2955 return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); … … 2769 2990 if ( !current_user_can( 'moderate_comments' ) ) 2770 2991 return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) ); 2771 2992 2772 do_action('xmlrpc_call', 'wp.getComments'); 2993 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2994 do_action( 'xmlrpc_call', 'wp.getComments' ); 2773 2995 2774 2996 if ( isset($struct['status']) ) 2775 2997 $status = $struct['status']; … … 2835 3057 if ( !current_user_can( 'edit_comment', $comment_ID ) ) 2836 3058 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2837 3059 2838 do_action('xmlrpc_call', 'wp.deleteComment'); 3060 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3061 do_action( 'xmlrpc_call', 'wp.deleteComment' ); 2839 3062 2840 3063 $status = wp_delete_comment( $comment_ID ); 2841 3064 2842 if( true == $status ) 3065 if ( true == $status ) { 3066 /** 3067 * Fires after a comment has successfully been deleted via XML-RPC. 3068 * 3069 * @since 3.4.0 3070 * 3071 * @param int $comment_ID ID of the deleted comment. 3072 * @param array $args Array of arguments to delete the comment. 3073 */ 2843 3074 do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); 3075 } 2844 3076 2845 3077 return $status; 2846 3078 } … … 2890 3122 if ( !current_user_can( 'edit_comment', $comment_ID ) ) 2891 3123 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2892 3124 2893 do_action('xmlrpc_call', 'wp.editComment'); 3125 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3126 do_action( 'xmlrpc_call', 'wp.editComment' ); 2894 3127 2895 3128 if ( isset($content_struct['status']) ) { 2896 3129 $statuses = get_comment_statuses(); … … 2931 3164 if ( !$result ) 2932 3165 return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.')); 2933 3166 3167 /** 3168 * Fires after a comment has been successfully updated via XML-RPC. 3169 * 3170 * @since 3.4.0 3171 * 3172 * @param int $comment_ID ID of the updated comment. 3173 * @param array $args Array of arguments to update the comment. 3174 */ 2934 3175 do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); 2935 3176 2936 3177 return true; … … 2955 3196 $post = $args[3]; 2956 3197 $content_struct = $args[4]; 2957 3198 2958 $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false); 3199 /** 3200 * Filter whether to allow anonymous comments over XML-RPC. 3201 * 3202 * @since 2.7.0 3203 * 3204 * @param bool $allow Whether to allow anonymous commenting via XML-RPC. 3205 * Default false. 3206 */ 3207 $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false ); 2959 3208 2960 3209 $user = $this->login($username, $password); 2961 3210 … … 3014 3263 3015 3264 $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null; 3016 3265 3017 do_action('xmlrpc_call', 'wp.newComment'); 3266 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3267 do_action( 'xmlrpc_call', 'wp.newComment' ); 3018 3268 3019 3269 $comment_ID = wp_new_comment( $comment ); 3020 3270 3271 /** 3272 * Fires after a new comment is created via XML-RPC. 3273 * 3274 * @since 3.4.0 3275 * 3276 * @param int $comment_ID Comment ID. 3277 * @param array $args Array of new comment arguments. 3278 */ 3021 3279 do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); 3022 3280 3023 3281 return $comment_ID; … … 3044 3302 if ( !current_user_can( 'moderate_comments' ) ) 3045 3303 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3046 3304 3047 do_action('xmlrpc_call', 'wp.getCommentStatusList'); 3305 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3306 do_action( 'xmlrpc_call', 'wp.getCommentStatusList' ); 3048 3307 3049 3308 return get_comment_statuses(); 3050 3309 } … … 3071 3330 if ( !current_user_can( 'edit_posts' ) ) 3072 3331 return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) ); 3073 3332 3074 do_action('xmlrpc_call', 'wp.getCommentCount'); 3333 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3334 do_action( 'xmlrpc_call', 'wp.getCommentCount' ); 3075 3335 3076 3336 $count = wp_count_comments( $post_id ); 3077 3337 return array( … … 3103 3363 if ( !current_user_can( 'edit_posts' ) ) 3104 3364 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3105 3365 3106 do_action('xmlrpc_call', 'wp.getPostStatusList'); 3366 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3367 do_action( 'xmlrpc_call', 'wp.getPostStatusList' ); 3107 3368 3108 3369 return get_post_statuses(); 3109 3370 } … … 3129 3390 if ( !current_user_can( 'edit_pages' ) ) 3130 3391 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3131 3392 3132 do_action('xmlrpc_call', 'wp.getPageStatusList'); 3393 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3394 do_action( 'xmlrpc_call', 'wp.getPageStatusList' ); 3133 3395 3134 3396 return get_page_statuses(); 3135 3397 } … … 3286 3548 if ( !current_user_can( 'upload_files' ) ) 3287 3549 return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) ); 3288 3550 3289 do_action('xmlrpc_call', 'wp.getMediaItem'); 3551 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3552 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 3290 3553 3291 3554 if ( ! $attachment = get_post($attachment_id) ) 3292 3555 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); … … 3331 3594 if ( !current_user_can( 'upload_files' ) ) 3332 3595 return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) ); 3333 3596 3334 do_action('xmlrpc_call', 'wp.getMediaLibrary'); 3597 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3598 do_action( 'xmlrpc_call', 'wp.getMediaLibrary' ); 3335 3599 3336 3600 $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; 3337 3601 $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; … … 3372 3636 if ( !current_user_can( 'edit_posts' ) ) 3373 3637 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3374 3638 3639 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3375 3640 do_action( 'xmlrpc_call', 'wp.getPostFormats' ); 3376 3641 3377 3642 $formats = get_post_format_strings(); … … 3427 3692 $password = $args[2]; 3428 3693 $post_type_name = $args[3]; 3429 3694 3430 if ( isset( $args[4] ) ) 3695 if ( isset( $args[4] ) ) { 3431 3696 $fields = $args[4]; 3432 else 3697 } else { 3698 /** 3699 * Filter the default fields to query for the given XML-RPC method. 3700 * 3701 * @since 3.4.0 3702 * 3703 * @param array $fields Array of post type fields to query for the given method. 3704 * @param string $method Method name. 3705 */ 3433 3706 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' ); 3707 } 3434 3708 3435 3709 if ( !$user = $this->login( $username, $password ) ) 3436 3710 return $this->error; 3437 3711 3712 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3438 3713 do_action( 'xmlrpc_call', 'wp.getPostType' ); 3439 3714 3440 3715 if( ! post_type_exists( $post_type_name ) ) … … 3473 3748 $password = $args[2]; 3474 3749 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3475 3750 3476 if ( isset( $args[4] ) ) 3751 if ( isset( $args[4] ) ) { 3477 3752 $fields = $args[4]; 3478 else 3753 } else { 3754 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3479 3755 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); 3756 } 3480 3757 3481 3758 if ( ! $user = $this->login( $username, $password ) ) 3482 3759 return $this->error; 3483 3760 3761 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3484 3762 do_action( 'xmlrpc_call', 'wp.getPostTypes' ); 3485 3763 3486 3764 $post_types = get_post_types( $filter, 'objects' ); … … 3527 3805 $password = $args[2]; 3528 3806 $post_id = (int) $args[3]; 3529 3807 3530 if ( isset( $args[4] ) ) 3808 if ( isset( $args[4] ) ) { 3531 3809 $fields = $args[4]; 3532 else 3810 } else { 3811 /** 3812 * Filter the default revision fields to query for the given XML-RPC method. 3813 * 3814 * @since 3.5.0 3815 * 3816 * @param array $field Array of revision fields to query for the given method. 3817 * @param string $method Method name. 3818 */ 3533 3819 $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' ); 3820 } 3534 3821 3535 3822 if ( ! $user = $this->login( $username, $password ) ) 3536 3823 return $this->error; 3537 3824 3825 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3538 3826 do_action( 'xmlrpc_call', 'wp.getRevisions' ); 3539 3827 3540 3828 if ( ! $post = get_post( $post_id ) ) … … 3596 3884 if ( ! $user = $this->login( $username, $password ) ) 3597 3885 return $this->error; 3598 3886 3887 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3599 3888 do_action( 'xmlrpc_call', 'wp.restoreRevision' ); 3600 3889 3601 3890 if ( ! $revision = wp_get_post_revision( $revision_id ) ) … … 3645 3934 if ( !$user = $this->login($username, $password) ) 3646 3935 return $this->error; 3647 3936 3648 do_action('xmlrpc_call', 'blogger.getUsersBlogs'); 3937 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3938 do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' ); 3649 3939 3650 3940 $is_admin = current_user_can('manage_options'); 3651 3941 … … 3712 4002 if ( !current_user_can( 'edit_posts' ) ) 3713 4003 return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); 3714 4004 3715 do_action('xmlrpc_call', 'blogger.getUserInfo'); 4005 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4006 do_action( 'xmlrpc_call', 'blogger.getUserInfo' ); 3716 4007 3717 4008 $struct = array( 3718 4009 'nickname' => $user->nickname, … … 3751 4042 if ( !current_user_can( 'edit_post', $post_ID ) ) 3752 4043 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 3753 4044 3754 do_action('xmlrpc_call', 'blogger.getPost'); 4045 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4046 do_action( 'xmlrpc_call', 'blogger.getPost' ); 3755 4047 3756 4048 $categories = implode(',', wp_get_post_categories($post_ID)); 3757 4049 … … 3796 4088 if ( ! current_user_can( 'edit_posts' ) ) 3797 4089 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 3798 4090 3799 do_action('xmlrpc_call', 'blogger.getRecentPosts'); 4091 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4092 do_action( 'xmlrpc_call', 'blogger.getRecentPosts' ); 3800 4093 3801 4094 $posts_list = wp_get_recent_posts( $query ); 3802 4095 … … 3874 4167 if ( !$user = $this->login($username, $password) ) 3875 4168 return $this->error; 3876 4169 3877 do_action('xmlrpc_call', 'blogger.newPost'); 4170 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4171 do_action( 'xmlrpc_call', 'blogger.newPost' ); 3878 4172 3879 4173 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 3880 4174 if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) ) … … 3902 4196 3903 4197 $this->attach_uploads( $post_ID, $post_content ); 3904 4198 4199 /** 4200 * Fires after a post is successfully created via the XML-RPC Blogger API. 4201 * 4202 * @since 3.4.0 4203 * 4204 * @param int $post_ID New post ID. 4205 * @param array $args Array of new post arguments. 4206 */ 3905 4207 do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args ); 3906 4208 3907 4209 return $post_ID; … … 3928 4230 if ( !$user = $this->login($username, $password) ) 3929 4231 return $this->error; 3930 4232 3931 do_action('xmlrpc_call', 'blogger.editPost'); 4233 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4234 do_action( 'xmlrpc_call', 'blogger.editPost' ); 3932 4235 3933 4236 $actual_post = get_post($post_ID,ARRAY_A); 3934 4237 … … 3958 4261 3959 4262 $this->attach_uploads( $ID, $post_content ); 3960 4263 4264 /** 4265 * Fires after a post has been successfully updated via the XML-RPC Blogger API. 4266 * 4267 * @since 3.4.0 4268 * 4269 * @param int $post_ID Post ID. 4270 * @param array $args Array of arguments for the post to edit. 4271 */ 3961 4272 do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args ); 3962 4273 3963 4274 return true; … … 3982 4293 if ( !$user = $this->login($username, $password) ) 3983 4294 return $this->error; 3984 4295 3985 do_action('xmlrpc_call', 'blogger.deletePost'); 4296 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4297 do_action( 'xmlrpc_call', 'blogger.deletePost' ); 3986 4298 3987 4299 $actual_post = get_post($post_ID,ARRAY_A); 3988 4300 … … 3997 4309 if ( !$result ) 3998 4310 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 3999 4311 4312 /** 4313 * Fires after a post has been successfully deleted via the XML-RPC Blogger API. 4314 * 4315 * @since 3.4.0 4316 * 4317 * @param int $post_ID ID of the deleted post. 4318 * @param array $args Array of arguments to delete the post. 4319 */ 4000 4320 do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args ); 4001 4321 4002 4322 return true; … … 4053 4373 if ( !$user = $this->login($username, $password) ) 4054 4374 return $this->error; 4055 4375 4056 do_action('xmlrpc_call', 'metaWeblog.newPost'); 4376 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4377 do_action( 'xmlrpc_call', 'metaWeblog.newPost' ); 4057 4378 4058 4379 $page_template = ''; 4059 4380 if ( !empty( $content_struct['post_type'] ) ) { … … 4307 4628 if ( !$post_ID ) 4308 4629 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 4309 4630 4631 /** 4632 * Fires after a new post has successfully been created via the XML-RPC MovableType API. 4633 * 4634 * @since 3.4.0 4635 * 4636 * @param int $post_ID ID of the new post. 4637 * @param array $args Arguments to create the new post. 4638 */ 4310 4639 do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); 4311 4640 4312 4641 return strval($post_ID); … … 4372 4701 if ( ! $user = $this->login($username, $password) ) 4373 4702 return $this->error; 4374 4703 4375 do_action('xmlrpc_call', 'metaWeblog.editPost'); 4704 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4705 do_action( 'xmlrpc_call', 'metaWeblog.editPost' ); 4376 4706 4377 4707 $postdata = get_post( $post_ID, ARRAY_A ); 4378 4708 … … 4615 4945 if ( isset( $content_struct['wp_post_format'] ) ) 4616 4946 set_post_format( $post_ID, $content_struct['wp_post_format'] ); 4617 4947 4948 /** 4949 * Fires after a post has been successfully updated via the XML-RPC MovableType API. 4950 * 4951 * @since 3.4.0 4952 * 4953 * @param int $post_ID ID of the updated post. 4954 * @param array $args Array of arguments to update the post. 4955 */ 4618 4956 do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args ); 4619 4957 4620 4958 return true; … … 4646 4984 if ( !current_user_can( 'edit_post', $post_ID ) ) 4647 4985 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 4648 4986 4649 do_action('xmlrpc_call', 'metaWeblog.getPost'); 4987 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4988 do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); 4650 4989 4651 4990 if ($postdata['post_date'] != '') { 4652 4991 $post_date = $this->_convert_date( $postdata['post_date'] ); … … 4770 5109 if ( ! current_user_can( 'edit_posts' ) ) 4771 5110 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 4772 5111 4773 do_action('xmlrpc_call', 'metaWeblog.getRecentPosts'); 5112 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5113 do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' ); 4774 5114 4775 5115 $posts_list = wp_get_recent_posts( $query ); 4776 5116 … … 4885 5225 if ( !current_user_can( 'edit_posts' ) ) 4886 5226 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 4887 5227 4888 do_action('xmlrpc_call', 'metaWeblog.getCategories'); 5228 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5229 do_action( 'xmlrpc_call', 'metaWeblog.getCategories' ); 4889 5230 4890 5231 $categories_struct = array(); 4891 5232 … … 4933 5274 if ( !$user = $this->login($username, $password) ) 4934 5275 return $this->error; 4935 5276 4936 do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); 5277 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5278 do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' ); 4937 5279 4938 5280 if ( !current_user_can('upload_files') ) { 4939 5281 $this->error = new IXR_Error( 401, __( 'You do not have permission to upload files.' ) ); 4940 5282 return $this->error; 4941 5283 } 4942 5284 4943 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) 4944 return new IXR_Error(500, $upload_err); 5285 /** 5286 * Filter whether to pre-empt the XML-RPC media upload. 5287 * 5288 * Passing a truthy value will effectively short-circuit the media upload, 5289 * returning that value as a 500 error instead. 5290 * 5291 * @since 2.1.0 5292 * 5293 * @param bool $error Whether to pre-empt the media upload. Default false. 5294 */ 5295 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) { 5296 return new IXR_Error( 500, $upload_err ); 5297 } 4945 5298 4946 5299 if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) { 4947 5300 // Get postmeta info on the object. … … 4987 5340 $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 4988 5341 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 4989 5342 5343 /** 5344 * Fires after a new attachment has been added via the XML-RPC MovableType API. 5345 * 5346 * @since 3.4.0 5347 * 5348 * @param int $id ID of the new attachment. 5349 * @param array $args Array of arguments to add the attachment. 5350 */ 4990 5351 do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); 4991 5352 4992 5353 $struct = array( … … 5027 5388 if ( !$user = $this->login($username, $password) ) 5028 5389 return $this->error; 5029 5390 5030 do_action('xmlrpc_call', 'mt.getRecentPostTitles'); 5391 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5392 do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' ); 5031 5393 5032 5394 $posts_list = wp_get_recent_posts( $query ); 5033 5395 … … 5086 5448 if ( !current_user_can( 'edit_posts' ) ) 5087 5449 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 5088 5450 5089 do_action('xmlrpc_call', 'mt.getCategoryList'); 5451 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5452 do_action( 'xmlrpc_call', 'mt.getCategoryList' ); 5090 5453 5091 5454 $categories_struct = array(); 5092 5455 … … 5127 5490 if ( !current_user_can( 'edit_post', $post_ID ) ) 5128 5491 return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); 5129 5492 5130 do_action('xmlrpc_call', 'mt.getPostCategories'); 5493 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5494 do_action( 'xmlrpc_call', 'mt.getPostCategories' ); 5131 5495 5132 5496 $categories = array(); 5133 5497 $catids = wp_get_post_categories(intval($post_ID)); … … 5165 5529 if ( !$user = $this->login($username, $password) ) 5166 5530 return $this->error; 5167 5531 5168 do_action('xmlrpc_call', 'mt.setPostCategories'); 5532 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5533 do_action( 'xmlrpc_call', 'mt.setPostCategories' ); 5169 5534 5170 5535 if ( ! get_post( $post_ID ) ) 5171 5536 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); … … 5193 5558 */ 5194 5559 function mt_supportedMethods($args) { 5195 5560 5196 do_action('xmlrpc_call', 'mt.supportedMethods'); 5561 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5562 do_action( 'xmlrpc_call', 'mt.supportedMethods' ); 5197 5563 5198 5564 $supported_methods = array(); 5199 5565 foreach ( $this->methods as $key => $value ) { … … 5211 5577 * @param array $args Method parameters. 5212 5578 */ 5213 5579 function mt_supportedTextFilters($args) { 5214 do_action('xmlrpc_call', 'mt.supportedTextFilters'); 5215 return apply_filters('xmlrpc_text_filters', array()); 5580 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5581 do_action( 'xmlrpc_call', 'mt.supportedTextFilters' ); 5582 5583 /** 5584 * Filter the MoveableType text filters list for XML-RPC. 5585 * 5586 * @since 2.2.0 5587 * 5588 * @param array $filters List of text filters. 5589 */ 5590 return apply_filters( 'xmlrpc_text_filters', array() ); 5216 5591 } 5217 5592 5218 5593 /** … … 5229 5604 5230 5605 $post_ID = intval($args); 5231 5606 5232 do_action('xmlrpc_call', 'mt.getTrackbackPings'); 5607 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5608 do_action( 'xmlrpc_call', 'mt.getTrackbackPings' ); 5233 5609 5234 5610 $actual_post = get_post($post_ID, ARRAY_A); 5235 5611 … … 5276 5652 if ( !$user = $this->login($username, $password) ) 5277 5653 return $this->error; 5278 5654 5279 do_action('xmlrpc_call', 'mt.publishPost'); 5655 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5656 do_action( 'xmlrpc_call', 'mt.publishPost' ); 5280 5657 5281 5658 $postdata = get_post($post_ID, ARRAY_A); 5282 5659 if ( ! $postdata ) … … 5312 5689 function pingback_ping($args) { 5313 5690 global $wpdb; 5314 5691 5315 do_action('xmlrpc_call', 'pingback.ping'); 5692 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5693 do_action( 'xmlrpc_call', 'pingback.ping' ); 5316 5694 5317 5695 $this->escape($args); 5318 5696 … … 5325 5703 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 5326 5704 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 5327 5705 5706 /** 5707 * Filter the pingback source URI. 5708 * 5709 * @since 3.6.0 5710 * 5711 * @param string $pagelinkedfrom URI of the page linked from. 5712 * @param string $pagelinkedto URI of the page linked to. 5713 */ 5328 5714 $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto ); 5715 5329 5716 if ( ! $pagelinkedfrom ) 5330 5717 return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) ); 5331 5718 … … 5406 5793 if ( !$linea ) 5407 5794 return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); 5408 5795 5409 $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto); 5796 /** 5797 * Filter the pingback remote source. 5798 * 5799 * @since 2.5.0 5800 * 5801 * @param string $linea Response object for the page linked from. 5802 * @param string $pagelinkedto URL of the page linked to. 5803 */ 5804 $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto ); 5410 5805 5411 5806 // Work around bug in strip_tags(): 5412 5807 $linea = str_replace('<!DOC', '<DOC', $linea); … … 5471 5866 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type'); 5472 5867 5473 5868 $comment_ID = wp_new_comment($commentdata); 5474 do_action('pingback_post', $comment_ID);5475 5869 5870 /** 5871 * Fires after a post pingback has been sent. 5872 * 5873 * @since 0.71 5874 * 5875 * @param int $comment_ID Comment ID. 5876 */ 5877 do_action( 'pingback_post', $comment_ID ); 5878 5476 5879 return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); 5477 5880 } 5478 5881 … … 5490 5893 5491 5894 global $wpdb; 5492 5895 5493 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); 5896 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5897 do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' ); 5494 5898 5495 5899 $this->escape($args); 5496 5900 … … 5524 5928 } 5525 5929 5526 5930 protected function pingback_error( $code, $message ) { 5931 /** 5932 * Filter the XML-RPC pingback error return. 5933 * 5934 * @since 3.5.1 5935 * 5936 * @param IXR_Error $error An IXR_Error object containing the error code and message. 5937 */ 5527 5938 return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) ); 5528 5939 } 5529 5940 }