| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
$params = $request->get_params(); |
| 7 |
$status_id = isset( $params['id'] ) ? $params['id'] : 0; |
| 8 |
$status = get_term_by('id', $status_id, 'wpsc_statuses'); |
| 9 |
if ($status) { |
| 10 |
$response = array( |
| 11 |
'id' => $status->term_id, |
| 12 |
'name' => $status->name, |
| 13 |
'textColor' => get_term_meta( $status->term_id, 'wpsc_status_color', true), |
| 14 |
'backgroundColor' => get_term_meta( $status->term_id, 'wpsc_status_background_color', true), |
| 15 |
); |
| 16 |
} else { |
| 17 |
$response = new WP_Error( |
| 18 |
'not_found', |
| 19 |
'Status not found for id '.$status_id, |
| 20 |
array( |
| 21 |
'status' => 404, |
| 22 |
) |
| 23 |
); |
| 24 |
} |