Peter Westwood
fe99b07017
XMLRPC: When Editing an existing post make sure to use wp_update_post instead of wp_insert_post so as to not perform destructive actions on the content.
...
The wp.EditPost() API will accept very limited data to only edit specific attributes of a post, if you didn't supply a category change then we would previously
overwrite the original categories with the default cat.
Fixes #22220 props nacin.
git-svn-id: http://core.svn.wordpress.org/trunk@22584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 22:58:24 +00:00
Mark Jaquith
ca7b159cc7
Squash a PHP notice in the XML-RPC server.
...
git-svn-id: http://core.svn.wordpress.org/trunk@22560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-13 22:35:41 +00:00
Ryan Boren
cf596d4979
In wp_xmlrpc_server::_insert_post(), preservea valid post status instead of overwriting it with 'draft'. This preserves the 'inherit' status of attachments. Props markoheijnen. fixes #22335
...
git-svn-id: http://core.svn.wordpress.org/trunk@22368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-05 14:44:25 +00:00
Ryan Boren
3d4470939d
In wp_xmlrpc_server::_insert_post(), don't return an error if set_post_thumbnail() returns false when the attachment ID doesn't change.
...
Props picklepete
fixes #22204
git-svn-id: http://core.svn.wordpress.org/trunk@22277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-23 14:08:20 +00:00
Andrew Nacin
64a9609aeb
Reference xmlrpc.php with the 'rpc' site_url() argument to ensure a proper scheme is applied. see #18731 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 21:55:36 +00:00
Andrew Nacin
dfbe93b7a5
Improve pingback text extraction by stopping at a closing block-level tag. props Otto42. see #21914 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 23:56:32 +00:00
Andrew Nacin
c38412a62f
Request WP_User objects when caling get_users() in XML-RPC's wp.getUsers method. see #18428 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 23:33:35 +00:00
Ryan Boren
7a86de87fb
Reduce use of global. Use get_blog_details() instead. fixes #22090
...
git-svn-id: http://core.svn.wordpress.org/trunk@22108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 12:40:09 +00:00
Andrew Nacin
8f62dfaf00
XML-RPC: Introduce wp.getRevisions and wp.restoreRevision.
...
props brandondove, koke, markoheijnen, JustinSainton, maxcutler.
fixes #21397 .
git-svn-id: http://core.svn.wordpress.org/trunk@22037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 04:17:15 +00:00
Andrew Nacin
646a4fd1e9
XML-RPC: Add an if_not_modified_since argument to wp.editPost.
...
Accepts a GMT date, which is used to compare to the current post_modified_gmt
value for the post being edited. If the post has since been edited (as in, too
old of a date was passed), the edit is rejected as overwriting a newer version.
It is rejected with a HTTP 409 Conflict status code. (Fancy.)
props koke, markoheinjen.
Tests: [UT1049]
see #21397 .
git-svn-id: http://core.svn.wordpress.org/trunk@22034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 03:39:40 +00:00
Andrew Nacin
7078e18d82
XML-RPC: Accept 'url', not 'website' in wp.editProfile. props maxcutler. see #18428 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-23 19:36:17 +00:00
Peter Westwood
2fcdb3395d
XMLRPC: Support searching via wp.getPosts() fixes #21623 props ericmann.
...
git-svn-id: http://core.svn.wordpress.org/trunk@21936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 10:18:32 +00:00
Andrew Nacin
bf3c8017a8
Introduce the xmlrpc_login_error filter, applied to the IXR_Error being returned by the server when login() fails. props JustinSainton, fixes #21907 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 01:36:47 +00:00
Andrew Nacin
c178b59da3
XML-RPC: Have the deprecated login_pass_ok() method wrap login(). Move it below login() so the proper method is found first. see #21907 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 01:27:21 +00:00
Andrew Nacin
3c4460fc86
Allow wp.uploadFile to upload the attachment to a post. props djzone, josephscott, maxcutler. fixes #13917 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 19:06:27 +00:00
Andrew Nacin
f431b408da
Combine some strings. props pavelevap. fixes #21087 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 19:57:05 +00:00
Andrew Nacin
6a71516a85
XML-RPC: Introduce wp.getUsers, wp.getUser, wp.getProfile, wp.editProfile.
...
props maxcutler.
props nprasath002 for earlier patches.
see #18428 .
git-svn-id: http://core.svn.wordpress.org/trunk@21824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-12 00:04:21 +00:00
Andrew Nacin
f84f149445
XML-RPC: Add the 'home' option to wp.getOptons. props mrroundhill. fixes #21822 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 01:26:38 +00:00
Andrew Nacin
26dc1e74e5
Turn XML-RPC on and remove the option on the Writing Settings page.
...
props markoheijnen for the initial patch.
Introduces a new filter, xmlrpc_enabled.
Respects any current callbacks registered to the pre_option_enable_xmlrpc
and option_enable_xmlrpc filters, for anyone forcing it off via code.
fixes #21509 .
git-svn-id: http://core.svn.wordpress.org/trunk@21804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 00:37:31 +00:00
Ryan Boren
bf9cff8bfc
Fix typo in phpdoc for wp_newPost(). Props alyssonweb. fixes #21798
...
git-svn-id: http://core.svn.wordpress.org/trunk@21765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-05 15:36:59 +00:00
Ryan Boren
c55cf716da
Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
...
git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 13:33:00 +00:00
Ryan Boren
52b3f498e6
Add tags_input, page_template, and post_category get magic to WP_Post.
...
Deprecate get_post_to_edit() and wp_get_single_post().
Props scribu
see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-28 19:08:28 +00:00
Ryan Boren
f56d8278bb
Remove return ref from all calls to get_post()
...
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:01:10 +00:00
Ryan Boren
489924938f
Return post_parent, menu_order, guid, and post_mime_type from wp.getPost(). Props maxcutler. fixes #21308
...
git-svn-id: http://core.svn.wordpress.org/trunk@21526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-15 16:06:05 +00:00
ryan
d286875515
switch_to_blog() and restore_current_blog() housekeeping.
...
wp-includes/admin-bar.php:
* Replace get_admin_url() and get_home_url() with admin_url() and home_url() and place them inside a switch/restore. Likewise replace current_user_can_for_blog() with current_user_can(). This avoids doing multiple switch restores.
wp-includes/ms-blogs.php:
* Deprecate the $validate argument to switch_to_blog(). This avoids a not very necessary call to get_blog_details(), possibly saving a few queries.
* Use $_wp_switched and $_wp_switched_stack instead of $switched and $switched_stack to make it less likely these globals will be stomped.
* Use GLOBALS to access blog_id and other globals. I've preferred this style lately since it makes it obvious a global is being used and avoids global blog_id being stomped by a local variable.
* Lose some is_object() checks. wp_get_current_user() always returns an object, for example.
* Call the new WP_Roles::reinit() method.
wp-includes/class-wp-xmlrpc-server.php:
* Replace current_user_can_for_blog() with current_user_can() and move it inside the switch/restore pair. This eliminates a switch/restore.
wp-includes/capabilities.php:
* Use array_keys() instead of $role => $data since $data is unused. I *think* this is a bit faster.
* Introduce WP_Roles::reinit(). This reinitializes WP_Roles and is used after switch_to_blog() has already update the blog ID in the wpdb object. If a global roles array is being used instead of the db, reinit is skipped.
* current_user_can_for_blog() now does a switch/restore. It didn't before meaning it could be reinitializing the user with the wrong role information for the current blog.
wp-includes/ms-settings.php:
* Define $_wp_switched_stack and $_wp_switched. This way switch_to_blog() and restore_current_blog() can rely on it being set.
wp-settings.php:
* Instantiate the WP_Roles global. This was it is always defined during init. To remove the WP_Roles checks from WP_Role and WP_User this would probably have to move before plugins are loaded, which might not be a good thing.
wp-includes/functions.php:
* Update wp_upload_dir() to reference _wp_switched.
git-svn-id: http://core.svn.wordpress.org/trunk@21485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-09 16:28:15 +00:00
ryan
5ca54e7d2f
Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option().
...
Use the regular option functions wrapped in switch_to_blog() and restore_current_blog() instead.
Group multiple operations within a single switch where possible.
fixes #21432
git-svn-id: http://core.svn.wordpress.org/trunk@21414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 17:51:42 +00:00
nacin
81c22c98f8
Don't use switch_to_blog() in wp.getUsersBlogs to improve performance and memory footprint. props mohanjith for initial patch. fixes #20665 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-30 11:49:02 +00:00
nacin
e0012c7e67
Initialize a variable. props maxcutler. fixes #21058 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 19:04:42 +00:00
nacin
9b7e633336
Use set_post_format(), not wp_set_post_terms(), in XML-RPC mw_newPost and mw_editPost. props koke. see #20697 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 21:07:12 +00:00
nacin
1270e4cef6
Check XML-RPC cap before running the query. props maxcutler. see #20991 for trunk.
...
git-svn-id: http://core.svn.wordpress.org/trunk@21137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 19:04:10 +00:00
nacin
92efcbaf6d
Combine 'Invalid term ID.' into the 'Invalid term ID' string. props pavelevap. fixes #20809 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@20996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-05 16:25:05 +00:00
ryan
eaa419dba3
Consolodate some strings. Props pavelevap. fixes #20809
...
git-svn-id: http://core.svn.wordpress.org/trunk@20972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-01 19:05:30 +00:00
ryan
f35fdc678f
Introduce _prepare_comment(). Avoid repeated auth attempts. Props maxcutler. fixes #20703
...
git-svn-id: http://core.svn.wordpress.org/trunk@20856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-23 20:40:40 +00:00
ryan
4077461708
Fix post limiting in wp_getPosts(). Props djcp. fixes #20723
...
git-svn-id: http://core.svn.wordpress.org/trunk@20846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-22 22:25:17 +00:00
ryan
0983e9afcb
Fix wp.getPages response when fetching pages the current user does not have caps for. Props maxcutler, redsweater. fixes #20629
...
git-svn-id: http://core.svn.wordpress.org/trunk@20807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-16 18:06:34 +00:00
ryan
5729685cb7
Remove accidental bits in [20784]
...
git-svn-id: http://core.svn.wordpress.org/trunk@20785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-14 17:01:35 +00:00
ryan
7c3c1267ec
Call filters for default option values only as needed to reduce number of filter calls. Props Ott042. see #20448
...
git-svn-id: http://core.svn.wordpress.org/trunk@20784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-14 17:00:13 +00:00
duck_
2b6e2d287a
Minor XML-RPC documentation improvements. See #20566 .
...
Also make newly introduced _is_greater_than_one() private.
git-svn-id: http://core.svn.wordpress.org/trunk@20782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-14 10:10:01 +00:00
ryan
34a92a5f0e
Remove extra underscore from XML-RPC filter. props maxcutler. fixes #20549
...
git-svn-id: http://core.svn.wordpress.org/trunk@20775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-11 21:04:47 +00:00
ryan
8c114f0c54
Pinking shears
...
git-svn-id: http://core.svn.wordpress.org/trunk@20715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 16:41:59 +00:00
duck_
281ad053fc
Declare visibility of _prepare_post_type() as protected. See #20566 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@20714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 15:59:50 +00:00
nacin
296a97f566
We indent with spaces, not tabs. props sivel. fixes #20394 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@20703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 21:13:08 +00:00
nacin
778c887fef
Have the $fields argument for XML-RPC's wp.getPostType, getPostTypes, wp.getTaxonomy and wp.getTaxonomies take the names of the post type or taxonomy object keys that will be returned.
...
* capabilities becomes cap
* object_types becomes object_type
fixes #17626 .
git-svn-id: http://core.svn.wordpress.org/trunk@20696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 20:29:34 +00:00
nacin
9bb0b895da
Kill all notices in XML-RPC found when running the test suite with WP_DEBUG. see [UT706], [UT707]. see #20566 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@20671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-01 21:03:50 +00:00
nacin
a6b1be42b4
Fix copy-paste issues in XML-RPC's _prepare_taxonomy(). see #20566 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-01 20:33:06 +00:00
nacin
6fff51eebe
Use correct variables. props batmoo. fixes #20566 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-01 01:11:18 +00:00
nacin
f8eeababd4
Use correct variables. props batmoo. fixes #20566 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 23:45:01 +00:00
nacin
57488f2a54
Add @param for the $fields parameter for XML-RPC's _prepare_taxonomy(). props SergeyBiryukov, fixes #20566 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 00:25:14 +00:00
nacin
ede4e67046
Check for the existence of a post before calling current_user_can() with a meta cap on that object. fixes #20336 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 00:19:32 +00:00
nacin
ae772d3850
Introduce minimum_args() method in XML-RPC and leverage it to return errors for insufficient arguments for methods that are new in 3.4.
...
props maxcutler, markoheijnen.
fixes #20394 .
git-svn-id: http://svn.automattic.com/wordpress/trunk@20636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-28 21:25:25 +00:00