Changeset 27730
- Timestamp:
- 03/26/2014 05:43:05 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r27672 r27730 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 … … 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 ); // Deprecated 177 178 // Proper filter for turning off XML-RPC. It is on by default. 195 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 … … 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; … … 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 } … … 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 … … 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 } … … 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 } … … 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 } … … 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 } … … 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 } … … 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 } … … 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 } … … 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 } … … 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 … … 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 … … 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 … … 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 … … 1395 1537 $fields = $args[4]; 1396 1538 else 1539 1540 /** 1541 * Filter the list of post query fields used by the given XML-RPC method. 1542 * 1543 * @since 3.4.0 1544 * 1545 * @param array $fields Array of post fields. 1546 * @param string $method Method name. 1547 */ 1397 1548 $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' ); 1398 1549 … … 1400 1551 return $this->error; 1401 1552 1553 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1402 1554 do_action( 'xmlrpc_call', 'wp.getPost' ); 1403 1555 … … 1448 1600 $filter = isset( $args[3] ) ? $args[3] : array(); 1449 1601 1450 if ( isset( $args[4] ) ) 1602 if ( isset( $args[4] ) ) { 1451 1603 $fields = $args[4]; 1452 else 1604 } else { 1605 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1453 1606 $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' ); 1607 } 1454 1608 1455 1609 if ( ! $user = $this->login( $username, $password ) ) 1456 1610 return $this->error; 1457 1611 1612 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1458 1613 do_action( 'xmlrpc_call', 'wp.getPosts' ); 1459 1614 … … 1545 1700 return $this->error; 1546 1701 1702 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1547 1703 do_action( 'xmlrpc_call', 'wp.newTerm' ); 1548 1704 … … 1633 1789 return $this->error; 1634 1790 1791 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1635 1792 do_action( 'xmlrpc_call', 'wp.editTerm' ); 1636 1793 … … 1725 1882 return $this->error; 1726 1883 1884 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1727 1885 do_action( 'xmlrpc_call', 'wp.deleteTerm' ); 1728 1886 … … 1792 1950 return $this->error; 1793 1951 1952 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1794 1953 do_action( 'xmlrpc_call', 'wp.getTerm' ); 1795 1954 … … 1845 2004 return $this->error; 1846 2005 2006 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1847 2007 do_action( 'xmlrpc_call', 'wp.getTerms' ); 1848 2008 … … 1916 2076 $taxonomy = $args[3]; 1917 2077 1918 if ( isset( $args[4] ) ) 2078 if ( isset( $args[4] ) ) { 1919 2079 $fields = $args[4]; 1920 else 2080 } else { 2081 /** 2082 * Filter the taxonomy query fields used by the given XML-RPC method. 2083 * 2084 * @since 3.4.0 2085 * 2086 * @param array $fields An array of taxonomy fields to retrieve. 2087 * @param string $method The method name. 2088 */ 1921 2089 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' ); 2090 } 1922 2091 1923 2092 if ( ! $user = $this->login( $username, $password ) ) 1924 2093 return $this->error; 1925 2094 2095 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1926 2096 do_action( 'xmlrpc_call', 'wp.getTaxonomy' ); 1927 2097 … … 1960 2130 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 1961 2131 1962 if ( isset( $args[4] ) ) 2132 if ( isset( $args[4] ) ) { 1963 2133 $fields = $args[4]; 1964 else 2134 } else { 2135 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1965 2136 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); 2137 } 1966 2138 1967 2139 if ( ! $user = $this->login( $username, $password ) ) 1968 2140 return $this->error; 1969 2141 2142 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1970 2143 do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); 1971 2144 … … 2029 2202 $user_id = (int) $args[3]; 2030 2203 2031 if ( isset( $args[4] ) ) 2204 if ( isset( $args[4] ) ) { 2032 2205 $fields = $args[4]; 2033 else 2206 } else { 2207 /** 2208 * Filter the default user query fields used by the given XML-RPC method. 2209 * 2210 * @since 3.5.0 2211 * 2212 * @param array $fields User query fields for given method. Default 'all'. 2213 * @param string $method The method name. 2214 */ 2034 2215 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' ); 2216 } 2035 2217 2036 2218 if ( ! $user = $this->login( $username, $password ) ) 2037 2219 return $this->error; 2038 2220 2221 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2039 2222 do_action( 'xmlrpc_call', 'wp.getUser' ); 2040 2223 … … 2082 2265 $filter = isset( $args[3] ) ? $args[3] : array(); 2083 2266 2084 if ( isset( $args[4] ) ) 2267 if ( isset( $args[4] ) ) { 2085 2268 $fields = $args[4]; 2086 else 2269 } else { 2270 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2087 2271 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' ); 2272 } 2088 2273 2089 2274 if ( ! $user = $this->login( $username, $password ) ) 2090 2275 return $this->error; 2091 2276 2277 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2092 2278 do_action( 'xmlrpc_call', 'wp.getUsers' ); 2093 2279 … … 2149 2335 $password = $args[2]; 2150 2336 2151 if ( isset( $args[3] ) ) 2337 if ( isset( $args[3] ) ) { 2152 2338 $fields = $args[3]; 2153 else 2339 } else { 2340 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2154 2341 $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' ); 2342 } 2155 2343 2156 2344 if ( ! $user = $this->login( $username, $password ) ) 2157 2345 return $this->error; 2158 2346 2347 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2159 2348 do_action( 'xmlrpc_call', 'wp.getProfile' ); 2160 2349 … … 2200 2389 return $this->error; 2201 2390 2391 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2202 2392 do_action( 'xmlrpc_call', 'wp.editProfile' ); 2203 2393 … … 2273 2463 return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) ); 2274 2464 2275 do_action('xmlrpc_call', 'wp.getPage'); 2465 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2466 do_action( 'xmlrpc_call', 'wp.getPage' ); 2276 2467 2277 2468 // If we found the page then format the data. … … 2311 2502 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); 2312 2503 2313 do_action('xmlrpc_call', 'wp.getPages'); 2504 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2505 do_action( 'xmlrpc_call', 'wp.getPages' ); 2314 2506 2315 2507 $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) ); … … 2351 2543 return $this->error; 2352 2544 2353 do_action('xmlrpc_call', 'wp.newPage'); 2545 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2546 do_action( 'xmlrpc_call', 'wp.newPage' ); 2354 2547 2355 2548 // Mark this as content for a page. … … 2379 2572 return $this->error; 2380 2573 2381 do_action('xmlrpc_call', 'wp.deletePage'); 2574 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2575 do_action( 'xmlrpc_call', 'wp.deletePage' ); 2382 2576 2383 2577 // Get the current page based on the page_id and … … 2396 2590 return(new IXR_Error(500, __('Failed to delete the page.'))); 2397 2591 2592 /** 2593 * Fires after a page has been successfully deleted via XML-RPC. 2594 * 2595 * @since 3.4.0 2596 * 2597 * @param int $page_id ID of the deleted page. 2598 * @param array $args An array of arguments to delete the page. 2599 */ 2398 2600 do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args ); 2399 2601 … … 2421 2623 return $this->error; 2422 2624 2423 do_action('xmlrpc_call', 'wp.editPage'); 2625 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2626 do_action( 'xmlrpc_call', 'wp.editPage' ); 2424 2627 2425 2628 // Get the page data and make sure it is a page. … … 2471 2674 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); 2472 2675 2473 do_action('xmlrpc_call', 'wp.getPageList'); 2676 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2677 do_action( 'xmlrpc_call', 'wp.getPageList' ); 2474 2678 2475 2679 // Get list of pages ids and titles … … 2522 2726 return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'))); 2523 2727 2524 do_action('xmlrpc_call', 'wp.getAuthors'); 2728 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2729 do_action( 'xmlrpc_call', 'wp.getAuthors' ); 2525 2730 2526 2731 $authors = array(); … … 2557 2762 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); 2558 2763 2764 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2559 2765 do_action( 'xmlrpc_call', 'wp.getKeywords' ); 2560 2766 … … 2596 2802 return $this->error; 2597 2803 2598 do_action('xmlrpc_call', 'wp.newCategory'); 2804 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2805 do_action( 'xmlrpc_call', 'wp.newCategory' ); 2599 2806 2600 2807 // Make sure the user is allowed to add a category. … … 2633 2840 } 2634 2841 2842 /** 2843 * Fires after a new category has been successfully created via XML-RPC. 2844 * 2845 * @since 3.4.0 2846 * 2847 * @param int $cat_id ID of the new category. 2848 * @param array $args An array of new category arguments. 2849 */ 2635 2850 do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args ); 2636 2851 … … 2657 2872 return $this->error; 2658 2873 2659 do_action('xmlrpc_call', 'wp.deleteCategory'); 2874 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2875 do_action( 'xmlrpc_call', 'wp.deleteCategory' ); 2660 2876 2661 2877 if ( !current_user_can('manage_categories') ) … … 2664 2880 $status = wp_delete_term( $category_id, 'category' ); 2665 2881 2666 if( true == $status ) 2882 if ( true == $status ) { 2883 /** 2884 * Fires after a category has been successfully deleted via XML-RPC. 2885 * 2886 * @since 3.4.0 2887 * 2888 * @param int $category_id ID of the deleted category. 2889 * @param array $args An array of arguments to delete the category. 2890 */ 2667 2891 do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); 2892 } 2668 2893 2669 2894 return $status; … … 2693 2918 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) ); 2694 2919 2695 do_action('xmlrpc_call', 'wp.suggestCategories'); 2920 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2921 do_action( 'xmlrpc_call', 'wp.suggestCategories' ); 2696 2922 2697 2923 $category_suggestions = array(); … … 2729 2955 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2730 2956 2731 do_action('xmlrpc_call', 'wp.getComment'); 2957 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2958 do_action( 'xmlrpc_call', 'wp.getComment' ); 2732 2959 2733 2960 if ( ! $comment = get_comment($comment_id) ) … … 2770 2997 return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) ); 2771 2998 2772 do_action('xmlrpc_call', 'wp.getComments'); 2999 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3000 do_action( 'xmlrpc_call', 'wp.getComments' ); 2773 3001 2774 3002 if ( isset($struct['status']) ) … … 2836 3064 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2837 3065 2838 do_action('xmlrpc_call', 'wp.deleteComment'); 3066 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3067 do_action( 'xmlrpc_call', 'wp.deleteComment' ); 2839 3068 2840 3069 $status = wp_delete_comment( $comment_ID ); 2841 3070 2842 if( true == $status ) 3071 if ( true == $status ) { 3072 /** 3073 * Fires after a comment has been successfully deleted via XML-RPC. 3074 * 3075 * @since 3.4.0 3076 * 3077 * @param int $comment_ID ID of the deleted comment. 3078 * @param array $args An array of arguments to delete the comment. 3079 */ 2843 3080 do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); 3081 } 2844 3082 2845 3083 return $status; … … 2891 3129 return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); 2892 3130 2893 do_action('xmlrpc_call', 'wp.editComment'); 3131 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3132 do_action( 'xmlrpc_call', 'wp.editComment' ); 2894 3133 2895 3134 if ( isset($content_struct['status']) ) { … … 2932 3171 return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.')); 2933 3172 3173 /** 3174 * Fires after a comment has been successfully updated via XML-RPC. 3175 * 3176 * @since 3.4.0 3177 * 3178 * @param int $comment_ID ID of the updated comment. 3179 * @param array $args An array of arguments to update the comment. 3180 */ 2934 3181 do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); 2935 3182 … … 2956 3203 $content_struct = $args[4]; 2957 3204 2958 $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false); 3205 /** 3206 * Filter whether to allow anonymous comments over XML-RPC. 3207 * 3208 * @since 2.7.0 3209 * 3210 * @param bool $allow Whether to allow anonymous commenting via XML-RPC. 3211 * Default false. 3212 */ 3213 $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false ); 2959 3214 2960 3215 $user = $this->login($username, $password); … … 3015 3270 $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null; 3016 3271 3017 do_action('xmlrpc_call', 'wp.newComment'); 3272 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3273 do_action( 'xmlrpc_call', 'wp.newComment' ); 3018 3274 3019 3275 $comment_ID = wp_new_comment( $comment ); 3020 3276 3277 /** 3278 * Fires after a new comment has been successfully created via XML-RPC. 3279 * 3280 * @since 3.4.0 3281 * 3282 * @param int $comment_ID ID of the new comment. 3283 * @param array $args An array of new comment arguments. 3284 */ 3021 3285 do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); 3022 3286 … … 3045 3309 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3046 3310 3047 do_action('xmlrpc_call', 'wp.getCommentStatusList'); 3311 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3312 do_action( 'xmlrpc_call', 'wp.getCommentStatusList' ); 3048 3313 3049 3314 return get_comment_statuses(); … … 3072 3337 return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) ); 3073 3338 3074 do_action('xmlrpc_call', 'wp.getCommentCount'); 3339 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3340 do_action( 'xmlrpc_call', 'wp.getCommentCount' ); 3075 3341 3076 3342 $count = wp_count_comments( $post_id ); … … 3104 3370 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3105 3371 3106 do_action('xmlrpc_call', 'wp.getPostStatusList'); 3372 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3373 do_action( 'xmlrpc_call', 'wp.getPostStatusList' ); 3107 3374 3108 3375 return get_post_statuses(); … … 3130 3397 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3131 3398 3132 do_action('xmlrpc_call', 'wp.getPageStatusList'); 3399 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3400 do_action( 'xmlrpc_call', 'wp.getPageStatusList' ); 3133 3401 3134 3402 return get_page_statuses(); … … 3287 3555 return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) ); 3288 3556 3289 do_action('xmlrpc_call', 'wp.getMediaItem'); 3557 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3558 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 3290 3559 3291 3560 if ( ! $attachment = get_post($attachment_id) ) … … 3332 3601 return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) ); 3333 3602 3334 do_action('xmlrpc_call', 'wp.getMediaLibrary'); 3603 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3604 do_action( 'xmlrpc_call', 'wp.getMediaLibrary' ); 3335 3605 3336 3606 $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; … … 3373 3643 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 3374 3644 3645 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3375 3646 do_action( 'xmlrpc_call', 'wp.getPostFormats' ); 3376 3647 … … 3428 3699 $post_type_name = $args[3]; 3429 3700 3430 if ( isset( $args[4] ) ) 3701 if ( isset( $args[4] ) ) { 3431 3702 $fields = $args[4]; 3432 else 3703 } else { 3704 /** 3705 * Filter the default query fields used by the given XML-RPC method. 3706 * 3707 * @since 3.4.0 3708 * 3709 * @param array $fields An array of post type query fields for the given method. 3710 * @param string $method The method name. 3711 */ 3433 3712 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' ); 3713 } 3434 3714 3435 3715 if ( !$user = $this->login( $username, $password ) ) 3436 3716 return $this->error; 3437 3717 3718 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3438 3719 do_action( 'xmlrpc_call', 'wp.getPostType' ); 3439 3720 … … 3474 3755 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3475 3756 3476 if ( isset( $args[4] ) ) 3757 if ( isset( $args[4] ) ) { 3477 3758 $fields = $args[4]; 3478 else 3759 } else { 3760 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3479 3761 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); 3762 } 3480 3763 3481 3764 if ( ! $user = $this->login( $username, $password ) ) 3482 3765 return $this->error; 3483 3766 3767 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3484 3768 do_action( 'xmlrpc_call', 'wp.getPostTypes' ); 3485 3769 … … 3528 3812 $post_id = (int) $args[3]; 3529 3813 3530 if ( isset( $args[4] ) ) 3814 if ( isset( $args[4] ) ) { 3531 3815 $fields = $args[4]; 3532 else 3816 } else { 3817 /** 3818 * Filter the default revision query fields used by the given XML-RPC method. 3819 * 3820 * @since 3.5.0 3821 * 3822 * @param array $field An array of revision query fields. 3823 * @param string $method The method name. 3824 */ 3533 3825 $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' ); 3826 } 3534 3827 3535 3828 if ( ! $user = $this->login( $username, $password ) ) 3536 3829 return $this->error; 3537 3830 3831 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3538 3832 do_action( 'xmlrpc_call', 'wp.getRevisions' ); 3539 3833 … … 3597 3891 return $this->error; 3598 3892 3893 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3599 3894 do_action( 'xmlrpc_call', 'wp.restoreRevision' ); 3600 3895 … … 3646 3941 return $this->error; 3647 3942 3648 do_action('xmlrpc_call', 'blogger.getUsersBlogs'); 3943 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3944 do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' ); 3649 3945 3650 3946 $is_admin = current_user_can('manage_options'); … … 3713 4009 return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); 3714 4010 3715 do_action('xmlrpc_call', 'blogger.getUserInfo'); 4011 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4012 do_action( 'xmlrpc_call', 'blogger.getUserInfo' ); 3716 4013 3717 4014 $struct = array( … … 3752 4049 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 3753 4050 3754 do_action('xmlrpc_call', 'blogger.getPost'); 4051 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4052 do_action( 'xmlrpc_call', 'blogger.getPost' ); 3755 4053 3756 4054 $categories = implode(',', wp_get_post_categories($post_ID)); … … 3797 4095 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 3798 4096 3799 do_action('xmlrpc_call', 'blogger.getRecentPosts'); 4097 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4098 do_action( 'xmlrpc_call', 'blogger.getRecentPosts' ); 3800 4099 3801 4100 $posts_list = wp_get_recent_posts( $query ); … … 3875 4174 return $this->error; 3876 4175 3877 do_action('xmlrpc_call', 'blogger.newPost'); 4176 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4177 do_action( 'xmlrpc_call', 'blogger.newPost' ); 3878 4178 3879 4179 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; … … 3903 4203 $this->attach_uploads( $post_ID, $post_content ); 3904 4204 4205 /** 4206 * Fires after a new post has been successfully created via the XML-RPC Blogger API. 4207 * 4208 * @since 3.4.0 4209 * 4210 * @param int $post_ID ID of the new post. 4211 * @param array $args An array of new post arguments. 4212 */ 3905 4213 do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args ); 3906 4214 … … 3929 4237 return $this->error; 3930 4238 3931 do_action('xmlrpc_call', 'blogger.editPost'); 4239 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4240 do_action( 'xmlrpc_call', 'blogger.editPost' ); 3932 4241 3933 4242 $actual_post = get_post($post_ID,ARRAY_A); … … 3959 4268 $this->attach_uploads( $ID, $post_content ); 3960 4269 4270 /** 4271 * Fires after a post has been successfully updated via the XML-RPC Blogger API. 4272 * 4273 * @since 3.4.0 4274 * 4275 * @param int $post_ID ID of the updated post. 4276 * @param array $args An array of arguments for the post to edit. 4277 */ 3961 4278 do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args ); 3962 4279 … … 3983 4300 return $this->error; 3984 4301 3985 do_action('xmlrpc_call', 'blogger.deletePost'); 4302 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4303 do_action( 'xmlrpc_call', 'blogger.deletePost' ); 3986 4304 3987 4305 $actual_post = get_post($post_ID,ARRAY_A); … … 3998 4316 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 3999 4317 4318 /** 4319 * Fires after a post has been successfully deleted via the XML-RPC Blogger API. 4320 * 4321 * @since 3.4.0 4322 * 4323 * @param int $post_ID ID of the deleted post. 4324 * @param array $args An array of arguments to delete the post. 4325 */ 4000 4326 do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args ); 4001 4327 … … 4054 4380 return $this->error; 4055 4381 4056 do_action('xmlrpc_call', 'metaWeblog.newPost'); 4382 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4383 do_action( 'xmlrpc_call', 'metaWeblog.newPost' ); 4057 4384 4058 4385 $page_template = ''; … … 4308 4635 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 4309 4636 4637 /** 4638 * Fires after a new post has been successfully created via the XML-RPC MovableType API. 4639 * 4640 * @since 3.4.0 4641 * 4642 * @param int $post_ID ID of the new post. 4643 * @param array $args An array of arguments to create the new post. 4644 */ 4310 4645 do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); 4311 4646 … … 4373 4708 return $this->error; 4374 4709 4375 do_action('xmlrpc_call', 'metaWeblog.editPost'); 4710 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4711 do_action( 'xmlrpc_call', 'metaWeblog.editPost' ); 4376 4712 4377 4713 $postdata = get_post( $post_ID, ARRAY_A ); … … 4616 4952 set_post_format( $post_ID, $content_struct['wp_post_format'] ); 4617 4953 4954 /** 4955 * Fires after a post has been successfully updated via the XML-RPC MovableType API. 4956 * 4957 * @since 3.4.0 4958 * 4959 * @param int $post_ID ID of the updated post. 4960 * @param array $args An array of arguments to update the post. 4961 */ 4618 4962 do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args ); 4619 4963 … … 4647 4991 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 4648 4992 4649 do_action('xmlrpc_call', 'metaWeblog.getPost'); 4993 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4994 do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); 4650 4995 4651 4996 if ($postdata['post_date'] != '') { … … 4771 5116 return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) ); 4772 5117 4773 do_action('xmlrpc_call', 'metaWeblog.getRecentPosts'); 5118 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5119 do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' ); 4774 5120 4775 5121 $posts_list = wp_get_recent_posts( $query ); … … 4886 5232 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 4887 5233 4888 do_action('xmlrpc_call', 'metaWeblog.getCategories'); 5234 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5235 do_action( 'xmlrpc_call', 'metaWeblog.getCategories' ); 4889 5236 4890 5237 $categories_struct = array(); … … 4934 5281 return $this->error; 4935 5282 4936 do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); 5283 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5284 do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' ); 4937 5285 4938 5286 if ( !current_user_can('upload_files') ) { … … 4941 5289 } 4942 5290 4943 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) 4944 return new IXR_Error(500, $upload_err); 5291 /** 5292 * Filter whether to preempt the XML-RPC media upload. 5293 * 5294 * Passing a truthy value will effectively short-circuit the media upload, 5295 * returning that value as a 500 error instead. 5296 * 5297 * @since 2.1.0 5298 * 5299 * @param bool $error Whether to pre-empt the media upload. Default false. 5300 */ 5301 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) { 5302 return new IXR_Error( 500, $upload_err ); 5303 } 4945 5304 4946 5305 if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) { … … 4988 5347 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 4989 5348 5349 /** 5350 * Fires after a new attachment has been added via the XML-RPC MovableType API. 5351 * 5352 * @since 3.4.0 5353 * 5354 * @param int $id ID of the new attachment. 5355 * @param array $args An array of arguments to add the attachment. 5356 */ 4990 5357 do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); 4991 5358 … … 5028 5395 return $this->error; 5029 5396 5030 do_action('xmlrpc_call', 'mt.getRecentPostTitles'); 5397 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5398 do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' ); 5031 5399 5032 5400 $posts_list = wp_get_recent_posts( $query ); … … 5087 5455 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); 5088 5456 5089 do_action('xmlrpc_call', 'mt.getCategoryList'); 5457 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5458 do_action( 'xmlrpc_call', 'mt.getCategoryList' ); 5090 5459 5091 5460 $categories_struct = array(); … … 5128 5497 return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); 5129 5498 5130 do_action('xmlrpc_call', 'mt.getPostCategories'); 5499 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5500 do_action( 'xmlrpc_call', 'mt.getPostCategories' ); 5131 5501 5132 5502 $categories = array(); … … 5166 5536 return $this->error; 5167 5537 5168 do_action('xmlrpc_call', 'mt.setPostCategories'); 5538 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5539 do_action( 'xmlrpc_call', 'mt.setPostCategories' ); 5169 5540 5170 5541 if ( ! get_post( $post_ID ) ) … … 5194 5565 function mt_supportedMethods($args) { 5195 5566 5196 do_action('xmlrpc_call', 'mt.supportedMethods'); 5567 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5568 do_action( 'xmlrpc_call', 'mt.supportedMethods' ); 5197 5569 5198 5570 $supported_methods = array(); … … 5212 5584 */ 5213 5585 function mt_supportedTextFilters($args) { 5214 do_action('xmlrpc_call', 'mt.supportedTextFilters'); 5215 return apply_filters('xmlrpc_text_filters', array()); 5586 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5587 do_action( 'xmlrpc_call', 'mt.supportedTextFilters' ); 5588 5589 /** 5590 * Filter the MoveableType text filters list for XML-RPC. 5591 * 5592 * @since 2.2.0 5593 * 5594 * @param array $filters An array of text filters. 5595 */ 5596 return apply_filters( 'xmlrpc_text_filters', array() ); 5216 5597 } 5217 5598 … … 5230 5611 $post_ID = intval($args); 5231 5612 5232 do_action('xmlrpc_call', 'mt.getTrackbackPings'); 5613 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5614 do_action( 'xmlrpc_call', 'mt.getTrackbackPings' ); 5233 5615 5234 5616 $actual_post = get_post($post_ID, ARRAY_A); … … 5277 5659 return $this->error; 5278 5660 5279 do_action('xmlrpc_call', 'mt.publishPost'); 5661 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5662 do_action( 'xmlrpc_call', 'mt.publishPost' ); 5280 5663 5281 5664 $postdata = get_post($post_ID, ARRAY_A); … … 5313 5696 global $wpdb; 5314 5697 5315 do_action('xmlrpc_call', 'pingback.ping'); 5698 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5699 do_action( 'xmlrpc_call', 'pingback.ping' ); 5316 5700 5317 5701 $this->escape($args); … … 5326 5710 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 5327 5711 5712 /** 5713 * Filter the pingback source URI. 5714 * 5715 * @since 3.6.0 5716 * 5717 * @param string $pagelinkedfrom URI of the page linked from. 5718 * @param string $pagelinkedto URI of the page linked to. 5719 */ 5328 5720 $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto ); 5721 5329 5722 if ( ! $pagelinkedfrom ) 5330 5723 return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) ); … … 5405 5798 5406 5799 if ( !$linea ) 5407 return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); 5408 5409 $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto); 5800 return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); 5801 5802 /** 5803 * Filter the pingback remote source. 5804 * 5805 * @since 2.5.0 5806 * 5807 * @param string $linea Response object for the page linked from. 5808 * @param string $pagelinkedto URL of the page linked to. 5809 */ 5810 $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto ); 5410 5811 5411 5812 // Work around bug in strip_tags(): … … 5472 5873 5473 5874 $comment_ID = wp_new_comment($commentdata); 5474 do_action('pingback_post', $comment_ID); 5875 5876 /** 5877 * Fires after a post pingback has been sent. 5878 * 5879 * @since 0.71 5880 * 5881 * @param int $comment_ID Comment ID. 5882 */ 5883 do_action( 'pingback_post', $comment_ID ); 5475 5884 5476 5885 return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); … … 5491 5900 global $wpdb; 5492 5901 5493 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); 5902 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5903 do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' ); 5494 5904 5495 5905 $this->escape($args); … … 5525 5935 5526 5936 protected function pingback_error( $code, $message ) { 5937 /** 5938 * Filter the XML-RPC pingback error return. 5939 * 5940 * @since 3.5.1 5941 * 5942 * @param IXR_Error $error An IXR_Error object containing the error code and message. 5943 */ 5527 5944 return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) ); 5528 5945 }
Note: See TracChangeset
for help on using the changeset viewer.