|
@@ 2413-2450 (lines=38) @@
|
| 2410 |
|
* @return array|IXR_Error An associative array of taxonomy data with returned fields determined |
| 2411 |
|
* by `$fields`, or an IXR_Error instance on failure. |
| 2412 |
|
*/ |
| 2413 |
|
public function wp_getTaxonomies( $args ) { |
| 2414 |
|
if ( ! $this->minimum_args( $args, 3 ) ) |
| 2415 |
|
return $this->error; |
| 2416 |
|
|
| 2417 |
|
$this->escape( $args ); |
| 2418 |
|
|
| 2419 |
|
$username = $args[1]; |
| 2420 |
|
$password = $args[2]; |
| 2421 |
|
$filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); |
| 2422 |
|
|
| 2423 |
|
if ( isset( $args[4] ) ) { |
| 2424 |
|
$fields = $args[4]; |
| 2425 |
|
} else { |
| 2426 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 2427 |
|
$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); |
| 2428 |
|
} |
| 2429 |
|
|
| 2430 |
|
if ( ! $user = $this->login( $username, $password ) ) |
| 2431 |
|
return $this->error; |
| 2432 |
|
|
| 2433 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 2434 |
|
do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); |
| 2435 |
|
|
| 2436 |
|
$taxonomies = get_taxonomies( $filter, 'objects' ); |
| 2437 |
|
|
| 2438 |
|
// holds all the taxonomy data |
| 2439 |
|
$struct = array(); |
| 2440 |
|
|
| 2441 |
|
foreach ( $taxonomies as $taxonomy ) { |
| 2442 |
|
// capability check for post_types |
| 2443 |
|
if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) |
| 2444 |
|
continue; |
| 2445 |
|
|
| 2446 |
|
$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields ); |
| 2447 |
|
} |
| 2448 |
|
|
| 2449 |
|
return $struct; |
| 2450 |
|
} |
| 2451 |
|
|
| 2452 |
|
/** |
| 2453 |
|
* Retrieve a user. |
|
@@ 4241-4276 (lines=36) @@
|
| 4238 |
|
* } |
| 4239 |
|
* @return array|IXR_Error |
| 4240 |
|
*/ |
| 4241 |
|
public function wp_getPostTypes( $args ) { |
| 4242 |
|
if ( ! $this->minimum_args( $args, 3 ) ) |
| 4243 |
|
return $this->error; |
| 4244 |
|
|
| 4245 |
|
$this->escape( $args ); |
| 4246 |
|
|
| 4247 |
|
$username = $args[1]; |
| 4248 |
|
$password = $args[2]; |
| 4249 |
|
$filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); |
| 4250 |
|
|
| 4251 |
|
if ( isset( $args[4] ) ) { |
| 4252 |
|
$fields = $args[4]; |
| 4253 |
|
} else { |
| 4254 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 4255 |
|
$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); |
| 4256 |
|
} |
| 4257 |
|
|
| 4258 |
|
if ( ! $user = $this->login( $username, $password ) ) |
| 4259 |
|
return $this->error; |
| 4260 |
|
|
| 4261 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 4262 |
|
do_action( 'xmlrpc_call', 'wp.getPostTypes' ); |
| 4263 |
|
|
| 4264 |
|
$post_types = get_post_types( $filter, 'objects' ); |
| 4265 |
|
|
| 4266 |
|
$struct = array(); |
| 4267 |
|
|
| 4268 |
|
foreach ( $post_types as $post_type ) { |
| 4269 |
|
if ( ! current_user_can( $post_type->cap->edit_posts ) ) |
| 4270 |
|
continue; |
| 4271 |
|
|
| 4272 |
|
$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields ); |
| 4273 |
|
} |
| 4274 |
|
|
| 4275 |
|
return $struct; |
| 4276 |
|
} |
| 4277 |
|
|
| 4278 |
|
/** |
| 4279 |
|
* Retrieve revisions for a specific post. |