| @@ -5,8 +5,10 @@ | ||
| 5 | 5 | * @package Timetics |
| 6 | 6 | */ |
| 7 | 7 | namespace Timetics\Core\Appointments; |
| 8 | 8 | |
| 9 | +defined( 'ABSPATH' ) || exit; | |
| 10 | + | |
| 9 | 11 | use Timetics\Base\Api; |
| 10 | 12 | use Timetics\Utils\Singleton; |
| 11 | 13 | use WP_Error; |
| 12 | 14 | |
| @@ -208,8 +210,9 @@ | ||
| 208 | 210 | |
| 209 | 211 | $response = [ |
| 210 | 212 | 'success' => 1, |
| 211 | 213 | 'status_code' => 200, |
| 214 | + 'message' => __( 'Category successfully created', 'timetics' ), | |
| 212 | 215 | 'data' => $category, |
| 213 | 216 | ]; |
| 214 | 217 | |
| 215 | 218 | return rest_ensure_response( $response ); |
| @@ -250,8 +253,9 @@ | ||
| 250 | 253 | |
| 251 | 254 | $response = [ |
| 252 | 255 | 'success' => 1, |
| 253 | 256 | 'status_code' => 200, |
| 257 | + 'message' => __( 'Category successfully updated', 'timetics' ), | |
| 254 | 258 | 'data' => $category, |
| 255 | 259 | ]; |
| 256 | 260 | |
| 257 | 261 | return rest_ensure_response( $response ); |
| @@ -313,9 +317,10 @@ | ||
| 313 | 317 | |
| 314 | 318 | $response = [ |
| 315 | 319 | 'success' => 1, |
| 316 | 320 | 'status_code' => 200, |
| 317 | - 'message' => sprintf( __( 'Successfully deleted %d out of %d categories', 'timetics' ), $counter, count( $ids ) ), | |
| 321 | + /* translators: 1: Number of deleted categories, 2: Total number of categories */ | |
| 322 | + 'message' => sprintf( __( 'Successfully deleted %1$d out of %2$d categories', 'timetics' ), $counter, count( $ids ) ), | |
| 318 | 323 | ]; |
| 319 | 324 | |
| 320 | 325 | return rest_ensure_response( $response ); |
| 321 | 326 | } |
| @@ -339,9 +344,9 @@ | ||
| 339 | 344 | |
| 340 | 345 | foreach ( $meeting_ids as $meeting_id ) { |
| 341 | 346 | $terms = get_the_terms( $meeting_id, $this->taxonomy ); |
| 342 | 347 | $categories = [$category_id]; |
| 343 | - | |
| 348 | + | |
| 344 | 349 | if ( $terms && ! is_wp_error( $terms ) ) { |
| 345 | 350 | $categories = array_merge( $categories, array_column( $terms, 'term_id' ) ); |
| 346 | 351 | } |
| 347 | 352 | |
| @@ -357,8 +362,9 @@ | ||
| 357 | 362 | private function get_post_ids( $term_id ) { |
| 358 | 363 | $args = [ |
| 359 | 364 | 'post_type' => 'timetics-appointment', |
| 360 | 365 | 'fields' => 'ids', |
| 366 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Tax query is necessary for filtering appointments by category | |
| 361 | 367 | 'tax_query' => [ |
| 362 | 368 | [ |
| 363 | 369 | 'taxonomy' => 'timetics-meeting-category', |
| 364 | 370 | 'terms' => $term_id, |
| @@ -381,8 +387,9 @@ | ||
| 381 | 387 | 'description' => $appointment->get_description(), |
| 382 | 388 | 'type' => $appointment->get_type(), |
| 383 | 389 | 'locations' => $appointment->get_locations(), |
| 384 | 390 | 'price' => $appointment->get_price(), |
| 391 | + 'visibility' => $appointment->get_visibility(), | |
| 385 | 392 | ]; |
| 386 | 393 | |
| 387 | 394 | return $data; |
| 388 | 395 | } |