Ticket #32444: 32444.3.diff
File 32444.3.diff, 51.8 KB (added by , 10 years ago) |
---|
-
src/wp-includes/class-wp-theme.php
403 403 static $keys = array( 404 404 'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description', 405 405 'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir', 406 406 'Screenshot', 'Tags', 'Theme Root', 'Theme Root URI', 'Parent Theme', 407 407 ); 408 408 409 409 return in_array( $offset, $keys ); -
src/wp-includes/class-wp-xmlrpc-server.php
158 158 * 159 159 * @param callable $name Method to call. 160 160 * @param array $arguments Arguments to pass when calling. 161 * @return mixed|boolReturn value of the callback, false otherwise.161 * @return array|IXR_Error|false Return value of the callback, false otherwise. 162 162 */ 163 163 public function __call( $name, $arguments ) { 164 164 if ( '_multisite_getUsersBlogs' === $name ) { … … 176 176 * 177 177 * @since 1.5.0 178 178 * 179 * @param array $args Method Parameters.180 179 * @return string 181 180 */ 182 public function sayHello( $args) {181 public function sayHello() { 183 182 return 'Hello!'; 184 183 } 185 184 … … 188 187 * 189 188 * @since 1.5.0 190 189 * 191 * @param array $args Method Parameters. 190 * @param array $args { 191 * Method parameters. 192 * 193 * @type int $number1 A number to add. 194 * @type int $number2 A second number to add. 195 * } 192 196 * @return int 193 197 */ 194 public function addTwoNumbers( $args) {198 public function addTwoNumbers( $args ) { 195 199 $number1 = $args[0]; 196 200 $number2 = $args[1]; 197 201 return $number1 + $number2; … … 275 279 * @since 1.5.2 276 280 * 277 281 * @param string|array $data Escape single string or array of strings. 278 * @return string|array Type matches $data and sanitized for the database. 282 * @return string|null Returns with string is passed, alters by-reference 283 * when array is passed. 279 284 */ 280 285 public function escape( &$data ) { 281 286 if ( ! is_array( $data ) ) … … 354 359 * Passes property through 'xmlrpc_blog_options' filter. 355 360 * 356 361 * @since 2.6.0 362 * 363 * @global string $wp_version 357 364 */ 358 365 public function initialise_blog_option_info() { 359 366 global $wp_version; … … 514 521 * 515 522 * @since 2.6.0 516 523 * 517 * @param array $args Method parameters. Contains: 518 * - username 519 * - password 524 * @param array $args { 525 * Method parameters, in this order: 526 * 527 * @type string $username 528 * @type string $password 529 * } 520 530 * @return array|IXR_Error Array contains: 521 531 * - 'isAdmin' 522 532 * - 'url' … … 587 597 * 588 598 * @param string|array $args Sanitize single string or array of strings. 589 599 * @param int $count Minimum number of arguments. 590 * @return bool eanif $args contains at least $count arguments.600 * @return bool if $args contains at least $count arguments. 591 601 */ 592 602 protected function minimum_args( $args, $count ) { 593 603 if ( count( $args ) < $count ) { … … 651 661 */ 652 662 protected function _prepare_term( $term ) { 653 663 $_term = $term; 654 if ( ! is_array( $_term ) )664 if ( ! is_array( $_term ) ) 655 665 $_term = get_object_vars( $_term ); 656 666 657 667 // For integers which may be larger than XML-RPC supports ensure we return strings. … … 1077 1087 * 1078 1088 * @since 3.4.0 1079 1089 * 1080 * @param array $args Method parameters. Contains: 1081 * - int $blog_id (unused) 1082 * - string $username 1083 * - string $password 1084 * - array $content_struct 1085 * $content_struct can contain: 1090 * @param array $args { 1091 * Method parameters, in this order: 1092 * 1093 * @type int $blog_id (unused) 1094 * @type string $username 1095 * @type string $password 1096 * @type array $content_struct can contain: 1086 1097 * - post_type (default: 'post') 1087 1098 * - post_status (default: 'draft') 1088 1099 * - post_title … … 1101 1112 * - terms_names - array, with taxonomy names as keys and arrays of term names as values 1102 1113 * - enclosure 1103 1114 * - any other fields supported by wp_insert_post() 1115 * } 1116 * 1104 1117 * @return string|IXR_Error post_id 1105 1118 */ 1106 1119 public function wp_newPost( $args ) { … … 1158 1171 * 1159 1172 * @param WP_User $user The post author if post_author isn't set in $content_struct. 1160 1173 * @param array|IXR_Error $content_struct Post data to insert. 1174 * @return IXR_Error|string 1161 1175 */ 1162 1176 protected function _insert_post( $user, $content_struct ) { 1163 1177 $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0, … … 1403 1417 * 1404 1418 * @since 3.4.0 1405 1419 * 1406 * @param array $args Method parameters. Contains: 1407 * - int $blog_id (unused) 1408 * - string $username 1409 * - string $password 1410 * - int $post_id 1411 * - array $content_struct 1412 * @return bool|IXR_Error true on success 1420 * @param array $args { 1421 * Method parameters, in this order: 1422 * 1423 * @type int $blog_id (unused) 1424 * @type string $username 1425 * @type string $password 1426 * @type int $post_id 1427 * @type array $content_struct 1428 * } 1429 * 1430 * @return true|IXR_Error true on success 1413 1431 */ 1414 1432 public function wp_editPost( $args ) { 1415 1433 if ( ! $this->minimum_args( $args, 5 ) ) … … 1466 1484 * @since 3.4.0 1467 1485 * 1468 1486 * @uses wp_delete_post() 1469 * @param array $args Method parameters. Contains: 1470 * - int $blog_id (unused) 1471 * - string $username 1472 * - string $password 1473 * - int $post_id 1474 * @return bool|IXR_Error true on success 1487 * 1488 * @param array $args { 1489 * Method parameters, in this order: 1490 * 1491 * @type int $blog_id (unused) 1492 * @type string $username 1493 * @type string $password 1494 * @type int $post_id 1495 * } 1496 * @return true|IXR_Error true on success 1475 1497 */ 1476 1498 public function wp_deletePost( $args ) { 1477 1499 if ( ! $this->minimum_args( $args, 4 ) ) … … 1555 1577 1556 1578 $this->escape( $args ); 1557 1579 1558 $username 1559 $password 1560 $post_id 1580 $username = $args[1]; 1581 $password = $args[2]; 1582 $post_id = (int) $args[3]; 1561 1583 1562 1584 if ( isset( $args[4] ) ) { 1563 1585 $fields = $args[4]; … … 1620 1642 1621 1643 $this->escape( $args ); 1622 1644 1623 $username 1624 $password 1625 $filter 1645 $username = $args[1]; 1646 $password = $args[2]; 1647 $filter = isset( $args[3] ) ? $args[3] : array(); 1626 1648 1627 1649 if ( isset( $args[4] ) ) { 1628 1650 $fields = $args[4]; … … 1716 1738 1717 1739 $this->escape( $args ); 1718 1740 1719 $username 1720 $password 1721 $content_struct 1741 $username = $args[1]; 1742 $password = $args[2]; 1743 $content_struct = $args[3]; 1722 1744 1723 1745 if ( ! $user = $this->login( $username, $password ) ) 1724 1746 return $this->error; … … 1795 1817 * - 'parent' 1796 1818 * - 'description' 1797 1819 * - 'slug' 1798 * @return bool|IXR_Error True, on success.1820 * @return true|IXR_Error True, on success. 1799 1821 */ 1800 1822 public function wp_editTerm( $args ) { 1801 1823 if ( ! $this->minimum_args( $args, 5 ) ) … … 1803 1825 1804 1826 $this->escape( $args ); 1805 1827 1806 $username 1807 $password 1808 $term_id 1809 $content_struct 1828 $username = $args[1]; 1829 $password = $args[2]; 1830 $term_id = (int) $args[3]; 1831 $content_struct = $args[4]; 1810 1832 1811 1833 if ( ! $user = $this->login( $username, $password ) ) 1812 1834 return $this->error; … … 1881 1903 * @since 3.4.0 1882 1904 * 1883 1905 * @uses wp_delete_term() 1884 * @param array $args Method parameters. Contains: 1885 * - int $blog_id (unused) 1886 * - string $username 1887 * - string $password 1888 * - string $taxnomy_name 1889 * - string $term_id 1890 * @return boolean|IXR_Error If it suceeded true else a reason why not 1906 * 1907 * @param array $args { 1908 * Method parameters, in this order: 1909 * 1910 * @type int $blog_id (unused) 1911 * @type string $username 1912 * @type string $password 1913 * @type string $taxnomy_name 1914 * @type string $term_id 1915 * } 1916 * @return bool|IXR_Error If it suceeded true else a reason why not 1891 1917 */ 1892 1918 public function wp_deleteTerm( $args ) { 1893 1919 if ( ! $this->minimum_args( $args, 5 ) ) … … 1939 1965 * @since 3.4.0 1940 1966 * 1941 1967 * @uses get_term() 1942 * @param array $args Method parameters. Contains: 1943 * - int $blog_id (unused) 1944 * - string $username 1945 * - string $password 1946 * - string $taxonomy 1947 * - string $term_id 1968 * 1969 * @param array $args { 1970 * Method parameters, in this order: 1971 * 1972 * @type int $blog_id (unused) 1973 * @type string $username 1974 * @type string $password 1975 * @type string $taxnomy 1976 * @type string $term_id 1977 * } 1948 1978 * @return array|IXR_Error Array contains: 1949 1979 * - 'term_id' 1950 1980 * - 'name' … … 2001 2031 * Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'. 2002 2032 * 2003 2033 * @uses get_terms() 2004 * @param array $args Method parameters. Contains: 2005 * - int $blog_id (unused) 2006 * - string $username 2007 * - string $password 2008 * - string $taxonomy 2009 * - array $filter optional 2034 * 2035 * @param array $args { 2036 * Method parameters, in this order: 2037 * 2038 * @type int $blog_id (unused) 2039 * @type string $username 2040 * @type string $password 2041 * @type string $taxnomy 2042 * @type array $filter (optional) 2043 * } 2010 2044 * @return array|IXR_Error terms 2011 2045 */ 2012 2046 public function wp_getTerms( $args ) { … … 2077 2111 * @since 3.4.0 2078 2112 * 2079 2113 * @uses get_taxonomy() 2080 * @param array $args Method parameters. Contains: 2081 * - int $blog_id (unused) 2082 * - string $username 2083 * - string $password 2084 * - string $taxonomy 2114 * 2115 * @param array $args { 2116 * Method parameters, in this order: 2117 * 2118 * @type int $blog_id (unused) 2119 * @type string $username 2120 * @type string $password 2121 * @type string $taxnomy 2122 * @type array $fields (optional) 2123 * } 2085 2124 * @return array|IXR_Error (@see get_taxonomy()) 2086 2125 */ 2087 2126 public function wp_getTaxonomy( $args ) { … … 2090 2129 2091 2130 $this->escape( $args ); 2092 2131 2093 $username 2094 $password 2095 $taxonomy 2132 $username = $args[1]; 2133 $password = $args[2]; 2134 $taxonomy = $args[3]; 2096 2135 2097 2136 if ( isset( $args[4] ) ) { 2098 2137 $fields = $args[4]; … … 2131 2170 * @since 3.4.0 2132 2171 * 2133 2172 * @uses get_taxonomies() 2134 * @param array $args Method parameters. Contains: 2135 * - int $blog_id (unused) 2136 * - string $username 2137 * - string $password 2173 * 2174 * @param array $args { 2175 * Method parameters, in this order: 2176 * 2177 * @type int $blog_id (unused) 2178 * @type string $username 2179 * @type string $password 2180 * } 2138 2181 * @return array taxonomies 2139 2182 */ 2140 2183 public function wp_getTaxonomies( $args ) { … … 2143 2186 2144 2187 $this->escape( $args ); 2145 2188 2146 $username 2147 $password 2148 $filter 2189 $username = $args[1]; 2190 $password = $args[2]; 2191 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 2149 2192 2150 2193 if ( isset( $args[4] ) ) { 2151 2194 $fields = $args[4]; … … 2188 2231 * groups are 'basic' and 'all'. 2189 2232 * 2190 2233 * @uses get_userdata() 2191 * @param array $args Method parameters. Contains: 2192 * - int $blog_id (unused) 2193 * - string $username 2194 * - string $password 2195 * - int $user_id 2196 * - array $fields optional 2234 * 2235 * @param array $args { 2236 * Method parameters, in this order: 2237 * 2238 * @type int $blog_id (unused) 2239 * @type string $username 2240 * @type string $password 2241 * @type int $user_id 2242 * @type array $fields (optional) 2243 * } 2197 2244 * @return array|IXR_Error Array contains (based on $fields parameter): 2198 2245 * - 'user_id' 2199 2246 * - 'username' … … 2214 2261 2215 2262 $this->escape( $args ); 2216 2263 2217 $username 2218 $password 2219 $user_id 2264 $username = $args[1]; 2265 $password = $args[2]; 2266 $user_id = (int) $args[3]; 2220 2267 2221 2268 if ( isset( $args[4] ) ) { 2222 2269 $fields = $args[4]; … … 2262 2309 * @uses get_users() 2263 2310 * @see wp_getUser() for more on $fields and return values 2264 2311 * 2265 * @param array $args Method parameters. Contains: 2266 * - int $blog_id (unused) 2267 * - string $username 2268 * - string $password 2269 * - array $filter optional 2270 * - array $fields optional 2312 * @param array $args { 2313 * Method parameters, in this order: 2314 * 2315 * @type int $blog_id (unused) 2316 * @type string $username 2317 * @type string $password 2318 * @type array $filter (optional) 2319 * @type array $fields (optional) 2320 * } 2271 2321 * @return array|IXR_Error users data 2272 2322 */ 2273 2323 public function wp_getUsers( $args ) { … … 2276 2326 2277 2327 $this->escape( $args ); 2278 2328 2279 $username 2280 $password 2281 $filter 2329 $username = $args[1]; 2330 $password = $args[2]; 2331 $filter = isset( $args[3] ) ? $args[3] : array(); 2282 2332 2283 2333 if ( isset( $args[4] ) ) { 2284 2334 $fields = $args[4]; … … 2333 2383 * Retrieve information about the requesting user. 2334 2384 * 2335 2385 * @uses get_userdata() 2336 * @param array $args Method parameters. Contains: 2337 * - int $blog_id (unused) 2338 * - string $username 2339 * - string $password 2340 * - array $fields optional 2386 * 2387 * @param array $args { 2388 * Method parameters, in this order: 2389 * 2390 * @type int $blog_id (unused) 2391 * @type string $username 2392 * @type string $password 2393 * @type array $fields (optional) 2394 * } 2341 2395 * @return array|IXR_Error (@see wp_getUser) 2342 2396 */ 2343 2397 public function wp_getProfile( $args ) { … … 2346 2400 2347 2401 $this->escape( $args ); 2348 2402 2349 $username 2350 $password 2403 $username = $args[1]; 2404 $password = $args[2]; 2351 2405 2352 2406 if ( isset( $args[3] ) ) { 2353 2407 $fields = $args[3]; … … 2374 2428 * Edit user's profile. 2375 2429 * 2376 2430 * @uses wp_update_user() 2377 * @param array $args Method parameters. Contains: 2378 * - int $blog_id (unused) 2379 * - string $username 2380 * - string $password 2381 * - array $content_struct 2382 * It can optionally contain: 2431 * 2432 * @param array $args { 2433 * Method parameters, in this order: 2434 * 2435 * @type int $blog_id (unused) 2436 * @type string $username 2437 * @type string $password 2438 * @type array $content_struct It can optionally contain: 2383 2439 * - 'first_name' 2384 2440 * - 'last_name' 2385 2441 * - 'website' … … 2387 2443 * - 'nickname' 2388 2444 * - 'nicename' 2389 2445 * - 'bio' 2390 * @return bool|IXR_Error True, on success. 2446 * } 2447 * 2448 * @return true|IXR_Error True, on success. 2391 2449 */ 2392 2450 public function wp_editProfile( $args ) { 2393 2451 if ( ! $this->minimum_args( $args, 4 ) ) … … 2450 2508 * 2451 2509 * @since 2.2.0 2452 2510 * 2453 * @param array $args Method parameters. Contains: 2454 * - blog_id (unused) 2455 * - page_id 2456 * - username 2457 * - password 2511 * @param array $args { 2512 * Method parameters, in this order: 2513 * 2514 * @type int $blog_id (unused) 2515 * @type int $page_id 2516 * @type string $username 2517 * @type string $password 2518 * } 2458 2519 * @return array|IXR_Error 2459 2520 */ 2460 public function wp_getPage( $args) {2461 $this->escape( $args);2521 public function wp_getPage( $args ) { 2522 $this->escape( $args ); 2462 2523 2463 $page_id 2464 $username 2465 $password 2524 $page_id = (int) $args[1]; 2525 $username = $args[2]; 2526 $password = $args[3]; 2466 2527 2467 2528 if ( !$user = $this->login($username, $password) ) { 2468 2529 return $this->error; … … 2493 2554 * 2494 2555 * @since 2.2.0 2495 2556 * 2496 * @param array $args Method parameters. Contains: 2497 * - blog_id (unused) 2498 * - username 2499 * - password 2500 * - num_pages 2557 * @param array $args { 2558 * Method parameters, in this order: 2559 * 2560 * @type int $blog_id (unused) 2561 * @type string $username 2562 * @type string $password 2563 * @type int $num_pages 2564 * } 2501 2565 * @return array|IXR_Error 2502 2566 */ 2503 public function wp_getPages( $args) {2504 $this->escape( $args);2567 public function wp_getPages( $args ) { 2568 $this->escape( $args ); 2505 2569 2506 $username 2507 $password 2508 $num_pages 2570 $username = $args[1]; 2571 $password = $args[2]; 2572 $num_pages = isset($args[3]) ? (int) $args[3] : 10; 2509 2573 2510 2574 if ( !$user = $this->login($username, $password) ) 2511 2575 return $this->error; … … 2539 2603 * 2540 2604 * @since 2.2.0 2541 2605 * 2542 * @param array $args Method parameters. See {@link wp_xmlrpc_server::mw_newPost()} 2606 * @param array $args { 2607 * See {@link wp_xmlrpc_server::mw_newPost()} 2608 * Method parameters, in this order: 2609 * 2610 * @type int $blog_id (unused) 2611 * @type string $username 2612 * @type string $password 2613 * @type array $content_struct 2614 * } 2543 2615 * @return int|IXR_Error 2544 2616 */ 2545 public function wp_newPage( $args) {2617 public function wp_newPage( $args ) { 2546 2618 // Items not escaped here will be escaped in newPost. 2547 $username = $this->escape($args[1]);2548 $password = $this->escape($args[2]);2619 $username = $this->escape( $args[1] ); 2620 $password = $this->escape( $args[2] ); 2549 2621 2550 2622 if ( !$user = $this->login($username, $password) ) 2551 2623 return $this->error; … … 2565 2637 * 2566 2638 * @since 2.2.0 2567 2639 * 2568 * @param array $args Method parameters. 2569 * @return bool|IXR_Error True, if success. 2640 * @param array $args { 2641 * Method parameters, in this order: 2642 * 2643 * @type int $blog_id (unused) 2644 * @type string $username 2645 * @type string $password 2646 * @type int $page_id 2647 * } 2648 * @return true|IXR_Error True, if success. 2570 2649 */ 2571 public function wp_deletePage( $args) {2572 $this->escape( $args);2650 public function wp_deletePage( $args ) { 2651 $this->escape( $args ); 2573 2652 2574 $username 2575 $password 2576 $page_id 2653 $username = $args[1]; 2654 $password = $args[2]; 2655 $page_id = (int) $args[3]; 2577 2656 2578 2657 if ( !$user = $this->login($username, $password) ) 2579 2658 return $this->error; … … 2614 2693 * 2615 2694 * @since 2.2.0 2616 2695 * 2617 * @param array $args Method parameters. 2696 * @param array $args { 2697 * Method parameters, in this order: 2698 * 2699 * @type int $blog_id (unused) 2700 * @type int $page_id 2701 * @type string $username 2702 * @type string $password 2703 * @type string $content 2704 * @type string $publish 2705 * } 2618 2706 * @return array|IXR_Error 2619 2707 */ 2620 public function wp_editPage( $args) {2708 public function wp_editPage( $args ) { 2621 2709 // Items not escaped here will be escaped in editPost. 2622 $page_id 2623 $username 2624 $password 2625 $content 2626 $publish 2710 $page_id = (int) $this->escape($args[1]); 2711 $username = $this->escape($args[2]); 2712 $password = $this->escape($args[3]); 2713 $content = $args[4]; 2714 $publish = $args[5]; 2627 2715 2628 2716 if ( !$user = $this->login($username, $password) ) 2629 2717 return $this->error; … … 2661 2749 * 2662 2750 * @since 2.2.0 2663 2751 * 2664 * @param array $args Method parameters. 2752 * @global wpdb $wpdb 2753 * 2754 * @param array $args { 2755 * Method parameters, in this order: 2756 * 2757 * @type int $blog_id (unused) 2758 * @type string $username 2759 * @type string $password 2760 * } 2665 2761 * @return array|IXR_Error 2666 2762 */ 2667 public function wp_getPageList( $args) {2763 public function wp_getPageList( $args ) { 2668 2764 global $wpdb; 2669 2765 2670 $this->escape( $args);2766 $this->escape( $args ); 2671 2767 2672 $username 2673 $password 2768 $username = $args[1]; 2769 $password = $args[2]; 2674 2770 2675 2771 if ( !$user = $this->login($username, $password) ) 2676 2772 return $this->error; … … 2713 2809 * 2714 2810 * @since 2.2.0 2715 2811 * 2716 * @param array $args Method parameters. 2812 * @param array $args { 2813 * Method parameters, in this order: 2814 * 2815 * @type int $blog_id (unused) 2816 * @type string $username 2817 * @type string $password 2818 * } 2717 2819 * @return array|IXR_Error 2718 2820 */ 2719 public function wp_getAuthors($args) { 2821 public function wp_getAuthors( $args ) { 2822 $this->escape( $args ); 2720 2823 2721 $this->escape($args); 2824 $username = $args[1]; 2825 $password = $args[2]; 2722 2826 2723 $username = $args[1];2724 $password = $args[2];2725 2726 2827 if ( !$user = $this->login($username, $password) ) 2727 2828 return $this->error; 2728 2829 … … 2749 2850 * 2750 2851 * @since 2.7.0 2751 2852 * 2752 * @param array $args Method parameters. 2853 * @param array $args { 2854 * Method parameters, in this order: 2855 * 2856 * @type int $blog_id (unused) 2857 * @type string $username 2858 * @type string $password 2859 * } 2753 2860 * @return array|IXR_Error 2754 2861 */ 2755 2862 public function wp_getTags( $args ) { 2756 2863 $this->escape( $args ); 2757 2864 2758 $username 2759 $password 2865 $username = $args[1]; 2866 $password = $args[2]; 2760 2867 2761 2868 if ( !$user = $this->login($username, $password) ) 2762 2869 return $this->error; … … 2791 2898 * 2792 2899 * @since 2.2.0 2793 2900 * 2794 * @param array $args Method parameters. 2901 * @param array $args { 2902 * Method parameters, in this order: 2903 * 2904 * @type int $blog_id (unused) 2905 * @type string $username 2906 * @type string $password 2907 * @type array $category 2908 * } 2795 2909 * @return int|IXR_Error Category ID. 2796 2910 */ 2797 public function wp_newCategory( $args) {2798 $this->escape( $args);2911 public function wp_newCategory( $args ) { 2912 $this->escape( $args ); 2799 2913 2800 $username 2801 $password 2802 $category 2914 $username = $args[1]; 2915 $password = $args[2]; 2916 $category = $args[3]; 2803 2917 2804 2918 if ( !$user = $this->login($username, $password) ) 2805 2919 return $this->error; … … 2860 2974 * 2861 2975 * @since 2.5.0 2862 2976 * 2863 * @param array $args Method parameters. 2977 * @param array $args { 2978 * Method parameters, in this order: 2979 * 2980 * @type int $blog_id (unused) 2981 * @type string $username 2982 * @type string $password 2983 * @type int $category_id 2984 * } 2864 2985 * @return bool|IXR_Error See {@link wp_delete_term()} for return info. 2865 2986 */ 2866 public function wp_deleteCategory( $args) {2867 $this->escape( $args);2987 public function wp_deleteCategory( $args ) { 2988 $this->escape( $args ); 2868 2989 2869 $username 2870 $password 2871 $category_id 2990 $username = $args[1]; 2991 $password = $args[2]; 2992 $category_id = (int) $args[3]; 2872 2993 2873 2994 if ( !$user = $this->login($username, $password) ) 2874 2995 return $this->error; … … 2901 3022 * 2902 3023 * @since 2.2.0 2903 3024 * 2904 * @param array $args Method parameters. 3025 * @param array $args { 3026 * Method parameters, in this order: 3027 * 3028 * @type int $blog_id (unused) 3029 * @type string $username 3030 * @type string $password 3031 * @type array $category 3032 * @type int $max_results 3033 * } 2905 3034 * @return array|IXR_Error 2906 3035 */ 2907 public function wp_suggestCategories( $args) {2908 $this->escape( $args);3036 public function wp_suggestCategories( $args ) { 3037 $this->escape( $args ); 2909 3038 2910 $username 2911 $password 2912 $category 2913 $max_results 3039 $username = $args[1]; 3040 $password = $args[2]; 3041 $category = $args[3]; 3042 $max_results = (int) $args[4]; 2914 3043 2915 3044 if ( !$user = $this->login($username, $password) ) 2916 3045 return $this->error; … … 2938 3067 * 2939 3068 * @since 2.7.0 2940 3069 * 2941 * @param array $args Method parameters. 3070 * @param array $args { 3071 * Method parameters, in this order: 3072 * 3073 * @type int $blog_id (unused) 3074 * @type string $username 3075 * @type string $password 3076 * @type int $comment_id 3077 * } 2942 3078 * @return array|IXR_Error 2943 3079 */ 2944 3080 public function wp_getComment($args) { … … 2979 3115 * 2980 3116 * @since 2.7.0 2981 3117 * 2982 * @param array $args Method parameters. 3118 * @param array $args { 3119 * Method parameters, in this order: 3120 * 3121 * @type int $blog_id (unused) 3122 * @type string $username 3123 * @type string $password 3124 * @type array $struct 3125 * } 2983 3126 * @return array|IXR_Error Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents 2984 3127 */ 2985 public function wp_getComments( $args) {2986 $this->escape( $args);3128 public function wp_getComments( $args ) { 3129 $this->escape( $args ); 2987 3130 2988 $username 2989 $password 2990 $struct 3131 $username = $args[1]; 3132 $password = $args[2]; 3133 $struct = isset( $args[3] ) ? $args[3] : array(); 2991 3134 2992 3135 if ( !$user = $this->login($username, $password) ) 2993 3136 return $this->error; … … 3035 3178 * 3036 3179 * @since 2.7.0 3037 3180 * 3038 * @param array $args Method parameters. Contains: 3039 * - blog_id (unused) 3040 * - username 3041 * - password 3042 * - comment_id 3181 * @param array $args { 3182 * Method parameters, in this order: 3183 * 3184 * @type int $blog_id (unused) 3185 * @type string $username 3186 * @type string $password 3187 * @type int $comment_ID 3188 * } 3043 3189 * @return bool|IXR_Error {@link wp_delete_comment()} 3044 3190 */ 3045 3191 public function wp_deleteComment($args) { … … 3097 3243 * 3098 3244 * @since 2.7.0 3099 3245 * 3246 * @param array $args { 3247 * Method parameters, in this order: 3248 * 3249 * @type int $blog_id (unused) 3250 * @type string $username 3251 * @type string $password 3252 * @type int $comment_ID 3253 * @type array $content_struct 3254 * } 3100 3255 * @param array $args Contains: 3101 3256 * - blog_id (unused) 3102 3257 * - username … … 3103 3258 * - password 3104 3259 * - comment_id 3105 3260 * - content_struct 3106 * @return bool|IXR_Error True, on success.3261 * @return true|IXR_Error True, on success. 3107 3262 */ 3108 public function wp_editComment( $args) {3109 $this->escape( $args);3263 public function wp_editComment( $args ) { 3264 $this->escape( $args ); 3110 3265 3111 3266 $username = $args[1]; 3112 3267 $password = $args[2]; … … 3185 3340 * 3186 3341 * @since 2.7.0 3187 3342 * 3188 * @param array $args Method parameters. 3343 * @param array $args { 3344 * Method parameters, in this order: 3345 * 3346 * @type int $blog_id (unused) 3347 * @type string $username 3348 * @type string $password 3349 * @type string|int $post 3350 * @type array $content_struct 3351 * } 3189 3352 * @return int|IXR_Error {@link wp_new_comment()} 3190 3353 */ 3191 3354 public function wp_newComment($args) { 3192 3355 $this->escape($args); 3193 3356 3194 $username 3195 $password 3196 $post 3357 $username = $args[1]; 3358 $password = $args[2]; 3359 $post = $args[3]; 3197 3360 $content_struct = $args[4]; 3198 3361 3199 3362 /** … … 3288 3451 * 3289 3452 * @since 2.7.0 3290 3453 * 3291 * @param array $args Method parameters. 3454 * @param array $args { 3455 * Method parameters, in this order: 3456 * 3457 * @type int $blog_id (unused) 3458 * @type string $username 3459 * @type string $password 3460 * } 3292 3461 * @return array|IXR_Error 3293 3462 */ 3294 3463 public function wp_getCommentStatusList($args) { 3295 3464 $this->escape( $args ); 3296 3465 3297 $username 3298 $password 3466 $username = $args[1]; 3467 $password = $args[2]; 3299 3468 3300 3469 if ( !$user = $this->login($username, $password) ) 3301 3470 return $this->error; … … 3314 3483 * 3315 3484 * @since 2.5.0 3316 3485 * 3317 * @param array $args Method parameters. 3486 * @param array $args { 3487 * Method parameters, in this order: 3488 * 3489 * @type int $blog_id (unused) 3490 * @type string $username 3491 * @type string $password 3492 * @type int $post_id 3493 * } 3318 3494 * @return array|IXR_Error 3319 3495 */ 3320 3496 public function wp_getCommentCount( $args ) { 3321 $this->escape( $args);3497 $this->escape( $args ); 3322 3498 3323 3499 $username = $args[1]; 3324 3500 $password = $args[2]; … … 3347 3523 * 3348 3524 * @since 2.5.0 3349 3525 * 3350 * @param array $args Method parameters. 3526 * @param array $args { 3527 * Method parameters, in this order: 3528 * 3529 * @type int $blog_id (unused) 3530 * @type string $username 3531 * @type string $password 3532 * } 3351 3533 * @return array|IXR_Error 3352 3534 */ 3353 3535 public function wp_getPostStatusList( $args ) { 3354 3536 $this->escape( $args ); 3355 3537 3356 $username 3357 $password 3538 $username = $args[1]; 3539 $password = $args[2]; 3358 3540 3359 3541 if ( !$user = $this->login($username, $password) ) 3360 3542 return $this->error; … … 3373 3555 * 3374 3556 * @since 2.5.0 3375 3557 * 3376 * @param array $args Method parameters. 3558 * @param array $args { 3559 * Method parameters, in this order: 3560 * 3561 * @type int $blog_id (unused) 3562 * @type string $username 3563 * @type string $password 3564 * } 3377 3565 * @return array|IXR_Error 3378 3566 */ 3379 3567 public function wp_getPageStatusList( $args ) { 3380 3568 $this->escape( $args ); 3381 3569 3382 $username 3383 $password 3570 $username = $args[1]; 3571 $password = $args[2]; 3384 3572 3385 3573 if ( !$user = $this->login($username, $password) ) 3386 3574 return $this->error; … … 3399 3587 * 3400 3588 * @since 2.6.0 3401 3589 * 3402 * @param array $args Method parameters. 3590 * @param array $args { 3591 * Method parameters, in this order: 3592 * 3593 * @type int $blog_id (unused) 3594 * @type string $username 3595 * @type string $password 3596 * } 3403 3597 * @return array|IXR_Error 3404 3598 */ 3405 3599 public function wp_getPageTemplates( $args ) { 3406 3600 $this->escape( $args ); 3407 3601 3408 $username 3409 $password 3602 $username = $args[1]; 3603 $password = $args[2]; 3410 3604 3411 3605 if ( !$user = $this->login($username, $password) ) 3412 3606 return $this->error; … … 3425 3619 * 3426 3620 * @since 2.6.0 3427 3621 * 3428 * @param array $args Method parameters. 3622 * @param array $args { 3623 * Method parameters, in this order: 3624 * 3625 * @type int $blog_id (unused) 3626 * @type string $username 3627 * @type string $password 3628 * @type array $options 3629 * } 3429 3630 * @return array|IXR_Error 3430 3631 */ 3431 3632 public function wp_getOptions( $args ) { … … 3478 3679 * 3479 3680 * @since 2.6.0 3480 3681 * 3481 * @param array $args Method parameters. 3682 * @param array $args { 3683 * Method parameters, in this order: 3684 * 3685 * @type int $blog_id (unused) 3686 * @type string $username 3687 * @type string $password 3688 * @type array $options 3689 * } 3482 3690 * @return array|IXR_Error 3483 3691 */ 3484 3692 public function wp_setOptions( $args ) { … … 3515 3723 * 3516 3724 * @since 3.1.0 3517 3725 * 3518 * @param array $args Method parameters. Contains: 3519 * - blog_id (unused) 3520 * - username 3521 * - password 3522 * - attachment_id 3726 * @param array $args { 3727 * Method parameters, in this order: 3728 * 3729 * @type int $blog_id (unused) 3730 * @type string $username 3731 * @type string $password 3732 * @type int $attachment_id 3733 * } 3523 3734 * @return array|IXR_Error Associative array contains: 3524 3735 * - 'date_created_gmt' 3525 3736 * - 'parent' … … 3530 3741 * - 'description' 3531 3742 * - 'metadata' 3532 3743 */ 3533 public function wp_getMediaItem( $args) {3534 $this->escape( $args);3744 public function wp_getMediaItem( $args ) { 3745 $this->escape( $args ); 3535 3746 3536 3747 $username = $args[1]; 3537 3748 $password = $args[2]; … … 3568 3779 * 3569 3780 * @since 3.1.0 3570 3781 * 3571 * @param array $args Method parameters. Contains: 3572 * - blog_id (unused) 3573 * - username 3574 * - password 3575 * - filter 3782 * @param array $args { 3783 * Method parameters, in this order: 3784 * 3785 * @type int $blog_id (unused) 3786 * @type string $username 3787 * @type string $password 3788 * @type array $struct 3789 * } 3576 3790 * @return array|IXR_Error Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents 3577 3791 */ 3578 3792 public function wp_getMediaLibrary($args) { … … 3611 3825 * 3612 3826 * @since 3.1.0 3613 3827 * 3614 * @param array $args Method parameters. Contains: 3615 * - blog_id (unused) 3616 * - username 3617 * - password 3828 * @param array $args { 3829 * Method parameters, in this order: 3830 * 3831 * @type int $blog_id (unused) 3832 * @type string $username 3833 * @type string $password 3834 * } 3618 3835 * @return array|IXR_Error 3619 3836 */ 3620 3837 public function wp_getPostFormats( $args ) { … … 3658 3875 * @since 3.4.0 3659 3876 * 3660 3877 * @uses get_post_type_object() 3661 * @param array $args Method parameters. Contains: 3662 * - int $blog_id (unused) 3663 * - string $username 3664 * - string $password 3665 * - string $post_type_name 3666 * - array $fields 3878 * @param array $args { 3879 * Method parameters, in this order: 3880 * 3881 * @type int $blog_id (unused) 3882 * @type string $username 3883 * @type string $password 3884 * @type string $post_type_name 3885 * @type array $fields (optional) 3886 * } 3667 3887 * @return array|IXR_Error Array contains: 3668 3888 * - 'labels' 3669 3889 * - 'description' … … 3722 3942 * @since 3.4.0 3723 3943 * 3724 3944 * @uses get_post_types() 3725 * @param array $args Method parameters. Contains: 3726 * - int $blog_id (unused) 3727 * - string $username 3728 * - string $password 3729 * - array $filter 3730 * - array $fields 3945 * @param array $args { 3946 * Method parameters, in this order: 3947 * 3948 * @type int $blog_id (unused) 3949 * @type string $username 3950 * @type string $password 3951 * @type array $filter (optional) 3952 * @type array $fields (optional) 3953 * } 3731 3954 * @return array|IXR_Error 3732 3955 */ 3733 3956 public function wp_getPostTypes( $args ) { … … 3736 3959 3737 3960 $this->escape( $args ); 3738 3961 3739 $username 3740 $password 3741 $filter 3962 $username = $args[1]; 3963 $password = $args[2]; 3964 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3742 3965 3743 3966 if ( isset( $args[4] ) ) { 3744 3967 $fields = $args[4]; … … 3778 4001 * @uses wp_get_post_revisions() 3779 4002 * @see wp_getPost() for more on $fields 3780 4003 * 3781 * @param array $args Method parameters. Contains: 3782 * - int $blog_id (unused) 3783 * - string $username 3784 * - string $password 3785 * - int $post_id 3786 * - array $fields 4004 * @param array $args { 4005 * Method parameters, in this order: 4006 * 4007 * @type int $blog_id (unused) 4008 * @type string $username 4009 * @type string $password 4010 * @type int $post_id 4011 * @type array $fields (optional) 4012 * } 3787 4013 * @return array|IXR_Error contains a collection of posts. 3788 4014 */ 3789 4015 public function wp_getRevisions( $args ) { … … 3792 4018 3793 4019 $this->escape( $args ); 3794 4020 3795 $username 3796 $password 3797 $post_id 4021 $username = $args[1]; 4022 $password = $args[2]; 4023 $post_id = (int) $args[3]; 3798 4024 3799 4025 if ( isset( $args[4] ) ) { 3800 4026 $fields = $args[4]; … … 3854 4080 * 3855 4081 * @uses wp_restore_post_revision() 3856 4082 * 3857 * @param array $args Method parameters. Contains: 3858 * - int $blog_id (unused) 3859 * - string $username 3860 * - string $password 3861 * - int $post_id 4083 * @param array $args { 4084 * Method parameters, in this order: 4085 * 4086 * @type int $blog_id (unused) 4087 * @type string $username 4088 * @type string $password 4089 * @type int $revision_id 4090 * } 3862 4091 * @return bool|IXR_Error false if there was an error restoring, true if success. 3863 4092 */ 3864 4093 public function wp_restoreRevision( $args ) { … … 3909 4138 * 3910 4139 * @since 1.5.0 3911 4140 * 3912 * @param array $args Method parameters. 4141 * @param array $args { 4142 * Method parameters, in this order: 4143 * 4144 * @type int $blog_id (unused) 4145 * @type string $username 4146 * @type string $password 4147 * } 3913 4148 * @return array|IXR_Error 3914 4149 */ 3915 4150 public function blogger_getUsersBlogs($args) { … … 3919 4154 $this->escape($args); 3920 4155 3921 4156 $username = $args[1]; 3922 $password 4157 $password = $args[2]; 3923 4158 3924 4159 if ( !$user = $this->login($username, $password) ) 3925 4160 return $this->error; … … 3978 4213 * 3979 4214 * @since 1.5.0 3980 4215 * 3981 * @param array $args Method parameters. 4216 * @param array $args { 4217 * Method parameters, in this order: 4218 * 4219 * @type int $blog_id (unused) 4220 * @type string $username 4221 * @type string $password 4222 * } 3982 4223 * @return array|IXR_Error 3983 4224 */ 3984 public function blogger_getUserInfo($args) { 4225 public function blogger_getUserInfo( $args ) { 4226 $this->escape( $args ); 3985 4227 3986 $this->escape($args);3987 3988 4228 $username = $args[1]; 3989 $password 4229 $password = $args[2]; 3990 4230 3991 4231 if ( !$user = $this->login($username, $password) ) 3992 4232 return $this->error; … … 4013 4253 * 4014 4254 * @since 1.5.0 4015 4255 * 4016 * @param array $args Method parameters. 4256 * @param array $args { 4257 * Method parameters, in this order: 4258 * 4259 * @type int $blog_id (unused) 4260 * @type int $post_ID 4261 * @type string $username 4262 * @type string $password 4263 * } 4017 4264 * @return array|IXR_Error 4018 4265 */ 4019 public function blogger_getPost($args) { 4266 public function blogger_getPost( $args ) { 4267 $this->escape( $args ); 4020 4268 4021 $this->escape($args); 4022 4023 $post_ID = (int) $args[1]; 4269 $post_ID = (int) $args[1]; 4024 4270 $username = $args[2]; 4025 $password 4271 $password = $args[3]; 4026 4272 4027 4273 if ( !$user = $this->login($username, $password) ) 4028 4274 return $this->error; … … 4058 4304 * 4059 4305 * @since 1.5.0 4060 4306 * 4061 * @param array $args Method parameters. 4307 * @param array $args { 4308 * Method parameters, in this order: 4309 * 4310 * @type string $appkey (unused) 4311 * @type int $blog_id (unused) 4312 * @type string $username 4313 * @type string $password 4314 * @type int $numberposts (optional) 4315 * } 4062 4316 * @return array|IXR_Error 4063 4317 */ 4064 public function blogger_getRecentPosts( $args) {4318 public function blogger_getRecentPosts( $args ) { 4065 4319 4066 4320 $this->escape($args); 4067 4321 4068 4322 // $args[0] = appkey - ignored 4069 4323 $username = $args[2]; 4070 $password 4324 $password = $args[3]; 4071 4325 if ( isset( $args[4] ) ) 4072 4326 $query = array( 'numberposts' => absint( $args[4] ) ); 4073 4327 else … … 4139 4393 * 4140 4394 * @since 1.5.0 4141 4395 * 4142 * @param array $args Method parameters. 4396 * @param array $args { 4397 * Method parameters, in this order: 4398 * 4399 * @type string $appkey (unused) 4400 * @type int $blog_id (unused) 4401 * @type string $username 4402 * @type string $password 4403 * @type string $content 4404 * @type string $publish 4405 * } 4143 4406 * @return int|IXR_Error 4144 4407 */ 4145 public function blogger_newPost($args) { 4408 public function blogger_newPost( $args ) { 4409 $this->escape( $args ); 4146 4410 4147 $this->escape($args);4148 4149 4411 $username = $args[2]; 4150 $password 4151 $content 4152 $publish 4412 $password = $args[3]; 4413 $content = $args[4]; 4414 $publish = $args[5]; 4153 4415 4154 4416 if ( !$user = $this->login($username, $password) ) 4155 4417 return $this->error; … … 4201 4463 * 4202 4464 * @since 1.5.0 4203 4465 * 4204 * @param array $args Method parameters. 4205 * @return bool|IXR_Error true when done. 4466 * @param array $args { 4467 * Method parameters, in this order: 4468 * 4469 * @type int $blog_id (unused) 4470 * @type int $post_ID 4471 * @type string $username 4472 * @type string $password 4473 * @type string $content 4474 * } 4475 * @return true|IXR_Error true when done. 4206 4476 */ 4207 4477 public function blogger_editPost( $args ) { 4208 4478 4209 4479 $this->escape($args); 4210 4480 4211 $post_ID 4212 $username 4213 $password 4214 $content 4481 $post_ID = (int) $args[1]; 4482 $username = $args[2]; 4483 $password = $args[3]; 4484 $content = $args[4]; 4215 4485 4216 4486 if ( ! $user = $this->login( $username, $password ) ) { 4217 4487 return $this->error; … … 4268 4538 * 4269 4539 * @since 1.5.0 4270 4540 * 4271 * @param array $args Method parameters. 4272 * @return bool|IXR_Error True when post is deleted. 4541 * @param array $args { 4542 * Method parameters, in this order: 4543 * 4544 * @type int $blog_id (unused) 4545 * @type int $post_ID 4546 * @type string $username 4547 * @type string $password 4548 * } 4549 * @return true|IXR_Error True when post is deleted. 4273 4550 */ 4274 public function blogger_deletePost( $args) {4275 $this->escape( $args);4551 public function blogger_deletePost( $args ) { 4552 $this->escape( $args ); 4276 4553 4277 $post_ID 4278 $username 4279 $password 4554 $post_ID = (int) $args[1]; 4555 $username = $args[2]; 4556 $password = $args[3]; 4280 4557 4281 4558 if ( !$user = $this->login($username, $password) ) 4282 4559 return $this->error; … … 4341 4618 * 4342 4619 * @since 1.5.0 4343 4620 * 4344 * @param array $args Method parameters. Contains: 4345 * - blog_id (unused) 4346 * - username 4347 * - password 4348 * - content_struct 4349 * - publish 4621 * @param array $args { 4622 * Method parameters, in this order: 4623 * 4624 * @type int $blog_id (unused) 4625 * @type string $username 4626 * @type string $password 4627 * @type array $content_struct 4628 * @type int $publish 4629 * } 4350 4630 * @return int|IXR_Error 4351 4631 */ 4352 4632 public function mw_newPost($args) { 4353 4633 $this->escape($args); 4354 4634 4355 $username = $args[1];4356 $password = $args[2];4635 $username = $args[1]; 4636 $password = $args[2]; 4357 4637 $content_struct = $args[3]; 4358 $publish = isset( $args[4] ) ? $args[4] : 0;4638 $publish = isset( $args[4] ) ? $args[4] : 0; 4359 4639 4360 4640 if ( !$user = $this->login($username, $password) ) 4361 4641 return $this->error; … … 4654 4934 * 4655 4935 * @since 2.1.0 4656 4936 * 4937 * @global wpdb $wpdb 4938 * 4657 4939 * @param int $post_ID Post ID. 4658 4940 * @param string $post_content Post Content for attachment. 4659 4941 */ … … 4675 4957 * 4676 4958 * @since 1.5.0 4677 4959 * 4678 * @param array $args Method parameters. 4960 * @param array $args { 4961 * Method parameters, in this order: 4962 * 4963 * @type int $blog_id (unused) 4964 * @type string $username 4965 * @type string $password 4966 * @type array $content_struct 4967 * @type int $publish 4968 * } 4679 4969 * @return bool|IXR_Error True on success. 4680 4970 */ 4681 public function mw_editPost($args) { 4971 public function mw_editPost( $args ) { 4972 $this->escape( $args ); 4682 4973 4683 $this->escape($args);4684 4685 4974 $post_ID = (int) $args[0]; 4686 4975 $username = $args[1]; 4687 4976 $password = $args[2]; … … 4967 5256 * 4968 5257 * @since 1.5.0 4969 5258 * 4970 * @param array $args Method parameters. 5259 * @param array $args { 5260 * Method parameters, in this order: 5261 * 5262 * @type int $blog_id (unused) 5263 * @type int $post_ID 5264 * @type string $username 5265 * @type string $password 5266 * } 4971 5267 * @return array|IXR_Error 4972 5268 */ 4973 public function mw_getPost($args) { 5269 public function mw_getPost( $args ) { 5270 $this->escape( $args ); 4974 5271 4975 $this->escape($args); 5272 $post_ID = (int) $args[0]; 5273 $username = $args[1]; 5274 $password = $args[2]; 4976 5275 4977 $post_ID = (int) $args[0];4978 $username = $args[1];4979 $password = $args[2];4980 4981 5276 if ( !$user = $this->login($username, $password) ) 4982 5277 return $this->error; 4983 5278 … … 5092 5387 * 5093 5388 * @since 1.5.0 5094 5389 * 5095 * @param array $args Method parameters. 5390 * @param array $args { 5391 * Method parameters, in this order: 5392 * 5393 * @type int $blog_id (unused) 5394 * @type string $username 5395 * @type string $password 5396 * @type int $numberposts 5397 * } 5096 5398 * @return array|IXR_Error 5097 5399 */ 5098 public function mw_getRecentPosts($args) { 5400 public function mw_getRecentPosts( $args ) { 5401 $this->escape( $args ); 5099 5402 5100 $this->escape($args); 5101 5102 $username = $args[1]; 5103 $password = $args[2]; 5403 $username = $args[1]; 5404 $password = $args[2]; 5104 5405 if ( isset( $args[3] ) ) 5105 5406 $query = array( 'numberposts' => absint( $args[3] ) ); 5106 5407 else … … 5204 5505 * 5205 5506 * @since 1.5.0 5206 5507 * 5207 * @param array $args Method parameters. 5508 * @param array $args { 5509 * Method parameters, in this order: 5510 * 5511 * @type int $blog_id (unused) 5512 * @type string $username 5513 * @type string $password 5514 * } 5208 5515 * @return array|IXR_Error 5209 5516 */ 5210 public function mw_getCategories($args) { 5517 public function mw_getCategories( $args ) { 5518 $this->escape( $args ); 5211 5519 5212 $this->escape($args); 5520 $username = $args[1]; 5521 $password = $args[2]; 5213 5522 5214 $username = $args[1];5215 $password = $args[2];5216 5217 5523 if ( !$user = $this->login($username, $password) ) 5218 5524 return $this->error; 5219 5525 … … 5252 5558 * 5253 5559 * @since 1.5.0 5254 5560 * 5255 * @param array $args Method parameters. 5561 * @global wpdb $wpdb 5562 * 5563 * @param array $args { 5564 * Method parameters, in this order: 5565 * 5566 * @type int $blog_id (unused) 5567 * @type string $username 5568 * @type string $password 5569 * @type array $data 5570 * } 5256 5571 * @return array|IXR_Error 5257 5572 */ 5258 public function mw_newMediaObject( $args) {5573 public function mw_newMediaObject( $args ) { 5259 5574 global $wpdb; 5260 5575 5261 $username = $this->escape($args[1]);5262 $password = $this->escape($args[2]);5263 $data 5576 $username = $this->escape( $args[1] ); 5577 $password = $this->escape( $args[2] ); 5578 $data = $args[3]; 5264 5579 5265 5580 $name = sanitize_file_name( $data['name'] ); 5266 5581 $type = $data['type']; … … 5365 5680 * 5366 5681 * @since 1.5.0 5367 5682 * 5368 * @param array $args Method parameters. 5683 * @param array $args { 5684 * Method parameters, in this order: 5685 * 5686 * @type int $blog_id (unused) 5687 * @type string $username 5688 * @type string $password 5689 * @type int $numberposts 5690 * } 5369 5691 * @return array|IXR_Error 5370 5692 */ 5371 public function mt_getRecentPostTitles($args) { 5693 public function mt_getRecentPostTitles( $args ) { 5694 $this->escape( $args ); 5372 5695 5373 $this->escape($args); 5374 5375 $username = $args[1]; 5376 $password = $args[2]; 5696 $username = $args[1]; 5697 $password = $args[2]; 5377 5698 if ( isset( $args[3] ) ) 5378 5699 $query = array( 'numberposts' => absint( $args[3] ) ); 5379 5700 else … … 5419 5740 * 5420 5741 * @since 1.5.0 5421 5742 * 5422 * @param array $args Method parameters. 5743 * @param array $args { 5744 * Method parameters, in this order: 5745 * 5746 * @type int $blog_id (unused) 5747 * @type string $username 5748 * @type string $password 5749 * } 5423 5750 * @return array|IXR_Error 5424 5751 */ 5425 public function mt_getCategoryList($args) { 5752 public function mt_getCategoryList( $args ) { 5753 $this->escape( $args ); 5426 5754 5427 $this->escape($args); 5755 $username = $args[1]; 5756 $password = $args[2]; 5428 5757 5429 $username = $args[1];5430 $password = $args[2];5431 5432 5758 if ( !$user = $this->login($username, $password) ) 5433 5759 return $this->error; 5434 5760 … … 5458 5784 * 5459 5785 * @since 1.5.0 5460 5786 * 5461 * @param array $args Method parameters. 5787 * @param array $args { 5788 * Method parameters, in this order: 5789 * 5790 * @type int $post_ID 5791 * @type string $username 5792 * @type string $password 5793 * } 5462 5794 * @return array|IXR_Error 5463 5795 */ 5464 public function mt_getPostCategories($args) { 5796 public function mt_getPostCategories( $args ) { 5797 $this->escape( $args ); 5465 5798 5466 $this->escape($args); 5799 $post_ID = (int) $args[0]; 5800 $username = $args[1]; 5801 $password = $args[2]; 5467 5802 5468 $post_ID = (int) $args[0];5469 $username = $args[1];5470 $password = $args[2];5471 5472 5803 if ( !$user = $this->login($username, $password) ) 5473 5804 return $this->error; 5474 5805 … … 5502 5833 * 5503 5834 * @since 1.5.0 5504 5835 * 5505 * @param array $args Method parameters. 5506 * @return bool|IXR_Error True on success. 5836 * @param array $args { 5837 * Method parameters, in this order: 5838 * 5839 * @type int $post_ID 5840 * @type string $username 5841 * @type string $password 5842 * @type array $categories 5843 * } 5844 * @return true|IXR_Error True on success. 5507 5845 */ 5508 public function mt_setPostCategories($args) { 5846 public function mt_setPostCategories( $args ) { 5847 $this->escape( $args ); 5509 5848 5510 $this->escape($args); 5511 5512 $post_ID = (int) $args[0]; 5513 $username = $args[1]; 5849 $post_ID = (int) $args[0]; 5850 $username = $args[1]; 5514 5851 $password = $args[2]; 5515 $categories 5852 $categories = $args[3]; 5516 5853 5517 5854 if ( !$user = $this->login($username, $password) ) 5518 5855 return $this->error; … … 5541 5878 * 5542 5879 * @since 1.5.0 5543 5880 * 5544 * @param array $args Method parameters.5545 5881 * @return array 5546 5882 */ 5547 public function mt_supportedMethods($args) { 5548 5883 public function mt_supportedMethods() { 5549 5884 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5550 5885 do_action( 'xmlrpc_call', 'mt.supportedMethods' ); 5551 5886 5552 $supported_methods = array(); 5553 foreach ( $this->methods as $key => $value ) { 5554 $supported_methods[] = $key; 5555 } 5556 5557 return $supported_methods; 5887 return array_keys( $this->methods ); 5558 5888 } 5559 5889 5560 5890 /** … … 5561 5891 * Retrieve an empty array because we don't support per-post text filters. 5562 5892 * 5563 5893 * @since 1.5.0 5564 *5565 * @param array $args Method parameters.5566 5894 */ 5567 public function mt_supportedTextFilters( $args) {5895 public function mt_supportedTextFilters() { 5568 5896 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5569 5897 do_action( 'xmlrpc_call', 'mt.supportedTextFilters' ); 5570 5898 … … 5583 5911 * 5584 5912 * @since 1.5.0 5585 5913 * 5586 * @param array $args Method parameters. 5914 * @global wpdb $wpdb 5915 * 5916 * @param int $post_ID 5587 5917 * @return array|IXR_Error 5588 5918 */ 5589 public function mt_getTrackbackPings($args) { 5590 5919 public function mt_getTrackbackPings( $post_ID ) { 5591 5920 global $wpdb; 5592 5921 5593 $post_ID = intval($args);5594 5595 5922 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5596 5923 do_action( 'xmlrpc_call', 'mt.getTrackbackPings' ); 5597 5924 … … 5626 5953 * 5627 5954 * @since 1.5.0 5628 5955 * 5629 * @param array $args Method parameters. 5956 * @param array $args { 5957 * Method parameters, in this order: 5958 * 5959 * @type int $post_ID 5960 * @type string $username 5961 * @type string $password 5962 * } 5630 5963 * @return int|IXR_Error 5631 5964 */ 5632 public function mt_publishPost($args) { 5965 public function mt_publishPost( $args ) { 5966 $this->escape( $args ); 5633 5967 5634 $this->escape($args); 5968 $post_ID = (int) $args[0]; 5969 $username = $args[1]; 5970 $password = $args[2]; 5635 5971 5636 $post_ID = (int) $args[0];5637 $username = $args[1];5638 $password = $args[2];5639 5640 5972 if ( !$user = $this->login($username, $password) ) 5641 5973 return $this->error; 5642 5974 … … 5657 5989 $postdata['post_category'] = $cats; 5658 5990 $this->escape($postdata); 5659 5991 5660 $result = wp_update_post($postdata); 5661 5662 return $result; 5992 return wp_update_post( $postdata ); 5663 5993 } 5664 5994 5665 5995 /* PingBack functions … … 5671 6001 * 5672 6002 * @since 1.5.0 5673 6003 * 5674 * @param array $args Method parameters. 6004 * @global wpdb $wpdb 6005 * @global string $wp_version 6006 * 6007 * @param array $args { 6008 * Method parameters, in this order: 6009 * 6010 * @type string $pagelinkedfrom 6011 * @type string $pagelinkedto 6012 * } 5675 6013 * @return string|IXR_Error 5676 6014 */ 5677 public function pingback_ping( $args) {5678 global $wpdb ;6015 public function pingback_ping( $args ) { 6016 global $wpdb, $wp_version; 5679 6017 5680 6018 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5681 6019 do_action( 'xmlrpc_call', 'pingback.ping' ); 5682 6020 5683 $this->escape( $args);6021 $this->escape( $args ); 5684 6022 5685 $pagelinkedfrom = $args[0]; 5686 $pagelinkedto = $args[1]; 6023 $pagelinkedfrom = str_replace( '&', '&', $args[0] ); 6024 $pagelinkedto = str_replace( '&', '&', $args[1] ); 6025 $pagelinkedto = str_replace( '&', '&', $pagelinkedto ); 5687 6026 5688 $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);5689 $pagelinkedto = str_replace('&', '&', $pagelinkedto);5690 $pagelinkedto = str_replace('&', '&', $pagelinkedto);5691 5692 6027 /** 5693 6028 * Filter the pingback source URI. 5694 6029 * … … 5766 6101 $remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); 5767 6102 5768 6103 /** This filter is documented in wp-includes/class-http.php */ 5769 $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $ GLOBALS['wp_version']. '; ' . get_bloginfo( 'url' ) );6104 $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); 5770 6105 5771 6106 // Let's check the remote site 5772 6107 $http_api_args = array( … … 5877 6212 * 5878 6213 * @since 1.5.0 5879 6214 * 5880 * @param array $args Method parameters. 6215 * @global wpdb $wpdb 6216 * 6217 * @param string $url 5881 6218 * @return array|IXR_Error 5882 6219 */ 5883 public function pingback_extensions_getPingbacks($args) { 5884 6220 public function pingback_extensions_getPingbacks( $url ) { 5885 6221 global $wpdb; 5886 6222 5887 6223 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5888 6224 do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' ); 5889 6225 5890 $ this->escape($args);6226 $url = $this->escape( $url ); 5891 6227 5892 $url = $args;5893 5894 6228 $post_ID = url_to_postid($url); 5895 6229 if ( !$post_ID ) { 5896 6230 // We aren't sure that the resource is available and/or pingback enabled … … 5921 6255 /** 5922 6256 * @param integer $code 5923 6257 * @param string $message 6258 * @return IXR_Error 5924 6259 */ 5925 6260 protected function pingback_error( $code, $message ) { 5926 6261 /**