| @@ 522-535 (lines=14) @@ | ||
| 519 | ||
| 520 | 	private function format_taxonomy( $taxonomy, $taxonomy_type, $context ) { | |
| 521 | // Permissions | |
| 522 | 		switch ( $context ) { | |
| 523 | case 'edit' : | |
| 524 | $tax = get_taxonomy( $taxonomy_type ); | |
| 525 | if ( !current_user_can( $tax->cap->edit_terms ) ) | |
| 526 | return new WP_Error( 'unauthorized', 'User cannot edit taxonomy', 403 ); | |
| 527 | break; | |
| 528 | case 'display' : | |
| 529 | 			if ( -1 == get_option( 'blog_public' ) && ! current_user_can( 'read' ) ) { | |
| 530 | return new WP_Error( 'unauthorized', 'User cannot view taxonomy', 403 ); | |
| 531 | } | |
| 532 | break; | |
| 533 | default : | |
| 534 | return new WP_Error( 'invalid_context', 'Invalid API CONTEXT', 400 ); | |
| 535 | } | |
| 536 | ||
| 537 | $response = array(); | |
| 538 | $response['ID'] = (int) $taxonomy->term_id; | |
| @@ 1477-1490 (lines=14) @@ | ||
| 1474 | ||
| 1475 | 	function format_taxonomy( $taxonomy, $taxonomy_type, $context ) { | |
| 1476 | // Permissions | |
| 1477 | 		switch ( $context ) { | |
| 1478 | case 'edit': | |
| 1479 | $tax = get_taxonomy( $taxonomy_type ); | |
| 1480 | 				if ( ! current_user_can( $tax->cap->edit_terms ) ) { | |
| 1481 | return new WP_Error( 'unauthorized', 'User cannot edit taxonomy', 403 ); | |
| 1482 | } | |
| 1483 | break; | |
| 1484 | case 'display': | |
| 1485 | 				if ( -1 == get_option( 'blog_public' ) && ! current_user_can( 'read' ) ) { | |
| 1486 | return new WP_Error( 'unauthorized', 'User cannot view taxonomy', 403 ); | |
| 1487 | } | |
| 1488 | break; | |
| 1489 | default: | |
| 1490 | return new WP_Error( 'invalid_context', 'Invalid API CONTEXT', 400 ); | |
| 1491 | } | |
| 1492 | ||
| 1493 | $response = array(); | |