Skip to content

Commit

Permalink
Move from $taxonomy_name to $taxonomy in XML-RPC for consistency with…
Browse files Browse the repository at this point in the history
… the rest of the core APIs. props maxcutler, fixes #20397.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Apr 15, 2012
1 parent 3c61b20 commit 9ef37a9
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions wp-includes/class-wp-xmlrpc-server.php
Expand Up @@ -1438,31 +1438,31 @@ function wp_deleteTerm( $args ) {
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$taxonomy_name = $args[3];
$taxonomy = $args[3];
$term_id = (int) $args[4];

if ( ! $user = $this->login( $username, $password ) )
return $this->error;

do_action( 'xmlrpc_call', 'wp.deleteTerm' );

if ( ! taxonomy_exists( $taxonomy_name ) )
if ( ! taxonomy_exists( $taxonomy ) )
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );

$taxonomy = get_taxonomy( $taxonomy_name );
$taxonomy = get_taxonomy( $taxonomy );

if ( ! current_user_can( $taxonomy->cap->delete_terms ) )
return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );

$term = get_term( $term_id, $taxonomy_name );
$term = get_term( $term_id, $taxonomy->name );

if ( is_wp_error( $term ) )
return new IXR_Error( 500, $term->get_error_message() );

if ( ! $term )
return new IXR_Error( 404, __( 'Invalid term ID.' ) );

$result = wp_delete_term( $term_id, $taxonomy_name );
$result = wp_delete_term( $term_id, $taxonomy->name );

if ( is_wp_error( $result ) )
return new IXR_Error( 500, $term->get_error_message() );
Expand All @@ -1481,7 +1481,7 @@ function wp_deleteTerm( $args ) {
* - int $blog_id
* - string $username
* - string $password
* - string $taxonomy_name
* - string $taxonomy
* - string $term_id
* @return array contains:
* - 'term_id'
Expand All @@ -1500,23 +1500,23 @@ function wp_getTerm( $args ) {
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$taxonomy_name = $args[3];
$taxonomy = $args[3];
$term_id = (int) $args[4];

if ( ! $user = $this->login( $username, $password ) )
return $this->error;

do_action( 'xmlrpc_call', 'wp.getTerm' );

if ( ! taxonomy_exists( $taxonomy_name ) )
if ( ! taxonomy_exists( $taxonomy ) )
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );

$taxonomy = get_taxonomy( $taxonomy_name );
$taxonomy = get_taxonomy( $taxonomy );

if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );

$term = get_term( $term_id , $taxonomy_name, ARRAY_A );
$term = get_term( $term_id , $taxonomy->name, ARRAY_A );

if ( is_wp_error( $term ) )
return new IXR_Error( 500, $term->get_error_message() );
Expand All @@ -1538,7 +1538,7 @@ function wp_getTerm( $args ) {
* - int $blog_id
* - string $username
* - string $password
* - string $taxonomy_name
* - string $taxonomy
* - array $filter optional
* @return array terms
*/
Expand All @@ -1548,18 +1548,18 @@ function wp_getTerms( $args ) {
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$taxonomy_name = $args[3];
$taxonomy = $args[3];
$filter = isset( $args[4] ) ? $args[4] : array();

if ( ! $user = $this->login( $username, $password ) )
return $this->error;

do_action( 'xmlrpc_call', 'wp.getTerms' );

if ( ! taxonomy_exists( $taxonomy_name ) )
if ( ! taxonomy_exists( $taxonomy ) )
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );

$taxonomy = get_taxonomy( $taxonomy_name );
$taxonomy = get_taxonomy( $taxonomy );

if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
Expand Down Expand Up @@ -1587,7 +1587,7 @@ function wp_getTerms( $args ) {
if ( isset( $filter['search'] ) )
$query['search'] = $filter['search'];

$terms = get_terms( $taxonomy_name, $query );
$terms = get_terms( $taxonomy->name, $query );

if ( is_wp_error( $terms ) )
return new IXR_Error( 500, $terms->get_error_message() );
Expand All @@ -1609,7 +1609,7 @@ function wp_getTerms( $args ) {
* - int $blog_id
* - string $username
* - string $password
* - string $taxonomy_name
* - string $taxonomy
* @return array (@see get_taxonomy())
*/
function wp_getTaxonomy( $args ) {
Expand All @@ -1618,17 +1618,17 @@ function wp_getTaxonomy( $args ) {
$blog_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$taxonomy_name = $args[3];
$taxonomy = $args[3];

if ( ! $user = $this->login( $username, $password ) )
return $this->error;

do_action( 'xmlrpc_call', 'wp.getTaxonomy' );

if ( ! taxonomy_exists( $taxonomy_name ) )
if ( ! taxonomy_exists( $taxonomy ) )
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );

$taxonomy = get_taxonomy( $taxonomy_name );
$taxonomy = get_taxonomy( $taxonomy );

if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
Expand Down

0 comments on commit 9ef37a9

Please sign in to comment.