|
@@ 2321-2358 (lines=38) @@
|
| 2318 |
|
* @return array|IXR_Error An associative array of taxonomy data with returned fields determined |
| 2319 |
|
* by `$fields`, or an IXR_Error instance on failure. |
| 2320 |
|
*/ |
| 2321 |
|
public function wp_getTaxonomies( $args ) { |
| 2322 |
|
if ( ! $this->minimum_args( $args, 3 ) ) |
| 2323 |
|
return $this->error; |
| 2324 |
|
|
| 2325 |
|
$this->escape( $args ); |
| 2326 |
|
|
| 2327 |
|
$username = $args[1]; |
| 2328 |
|
$password = $args[2]; |
| 2329 |
|
$filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); |
| 2330 |
|
|
| 2331 |
|
if ( isset( $args[4] ) ) { |
| 2332 |
|
$fields = $args[4]; |
| 2333 |
|
} else { |
| 2334 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 2335 |
|
$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); |
| 2336 |
|
} |
| 2337 |
|
|
| 2338 |
|
if ( ! $user = $this->login( $username, $password ) ) |
| 2339 |
|
return $this->error; |
| 2340 |
|
|
| 2341 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 2342 |
|
do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); |
| 2343 |
|
|
| 2344 |
|
$taxonomies = get_taxonomies( $filter, 'objects' ); |
| 2345 |
|
|
| 2346 |
|
// holds all the taxonomy data |
| 2347 |
|
$struct = array(); |
| 2348 |
|
|
| 2349 |
|
foreach ( $taxonomies as $taxonomy ) { |
| 2350 |
|
// capability check for post_types |
| 2351 |
|
if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) |
| 2352 |
|
continue; |
| 2353 |
|
|
| 2354 |
|
$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields ); |
| 2355 |
|
} |
| 2356 |
|
|
| 2357 |
|
return $struct; |
| 2358 |
|
} |
| 2359 |
|
|
| 2360 |
|
/** |
| 2361 |
|
* Retrieve a user. |
|
@@ 4134-4169 (lines=36) @@
|
| 4131 |
|
* } |
| 4132 |
|
* @return array|IXR_Error |
| 4133 |
|
*/ |
| 4134 |
|
public function wp_getPostTypes( $args ) { |
| 4135 |
|
if ( ! $this->minimum_args( $args, 3 ) ) |
| 4136 |
|
return $this->error; |
| 4137 |
|
|
| 4138 |
|
$this->escape( $args ); |
| 4139 |
|
|
| 4140 |
|
$username = $args[1]; |
| 4141 |
|
$password = $args[2]; |
| 4142 |
|
$filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); |
| 4143 |
|
|
| 4144 |
|
if ( isset( $args[4] ) ) { |
| 4145 |
|
$fields = $args[4]; |
| 4146 |
|
} else { |
| 4147 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 4148 |
|
$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); |
| 4149 |
|
} |
| 4150 |
|
|
| 4151 |
|
if ( ! $user = $this->login( $username, $password ) ) |
| 4152 |
|
return $this->error; |
| 4153 |
|
|
| 4154 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 4155 |
|
do_action( 'xmlrpc_call', 'wp.getPostTypes' ); |
| 4156 |
|
|
| 4157 |
|
$post_types = get_post_types( $filter, 'objects' ); |
| 4158 |
|
|
| 4159 |
|
$struct = array(); |
| 4160 |
|
|
| 4161 |
|
foreach ( $post_types as $post_type ) { |
| 4162 |
|
if ( ! current_user_can( $post_type->cap->edit_posts ) ) |
| 4163 |
|
continue; |
| 4164 |
|
|
| 4165 |
|
$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields ); |
| 4166 |
|
} |
| 4167 |
|
|
| 4168 |
|
return $struct; |
| 4169 |
|
} |
| 4170 |
|
|
| 4171 |
|
/** |
| 4172 |
|
* Retrieve revisions for a specific post. |