From de6da833242a5aa7620e59cd5baf5bd8652b3883 Mon Sep 17 00:00:00 2001 From: Jeremy Pry Date: Fri, 10 Jan 2025 12:20:13 -0600 Subject: [PATCH] Replace tribe_get_request_var() with tec_get_request_var() --- .../Order_Modifiers/Modifier_Admin_Handler.php | 12 ++++++------ .../Commerce/Order_Modifiers/Modifiers/Coupon.php | 4 ++-- .../Commerce/Order_Modifiers/Modifiers/Fee.php | 12 ++++++------ .../Table_Views/Order_Modifier_Table.php | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Tickets/Commerce/Order_Modifiers/Modifier_Admin_Handler.php b/src/Tickets/Commerce/Order_Modifiers/Modifier_Admin_Handler.php index 9adf6c9d28..13153bafa2 100644 --- a/src/Tickets/Commerce/Order_Modifiers/Modifier_Admin_Handler.php +++ b/src/Tickets/Commerce/Order_Modifiers/Modifier_Admin_Handler.php @@ -257,7 +257,7 @@ public function render_tec_order_modifiers_page(): void { */ protected function get_modifier_data_by_id( int $modifier_id ): ?array { // Get the modifier type from the request or use the default. - $modifier_type = tribe_get_request_var( 'modifier', $this->get_default_type() ); + $modifier_type = tec_get_request_var( 'modifier', $this->get_default_type() ); // Get the appropriate strategy for the selected modifier type. $modifier_strategy = tribe( Controller::class )->get_modifier( $modifier_type ); @@ -353,7 +353,7 @@ public function handle_form_submission(): void { return; } - $raw_data = tribe_get_request_vars( true ); + $raw_data = tec_get_request_vars( true ); $raw_data['order_modifier_id'] = $context['modifier_id']; try { @@ -464,10 +464,10 @@ protected function render_error_message( string $message ): void { */ public function handle_delete_modifier(): void { // Check if the action is 'delete_modifier' and nonce is set. - $action = tribe_get_request_var( 'action', '' ); - $modifier_id = absint( tribe_get_request_var( 'modifier_id', '' ) ); - $nonce = tribe_get_request_var( '_wpnonce', '' ); - $modifier_type = sanitize_key( tribe_get_request_var( 'modifier', '' ) ); + $action = tec_get_request_var( 'action', '' ); + $modifier_id = absint( tec_get_request_var( 'modifier_id', '' ) ); + $nonce = tec_get_request_var( '_wpnonce', '' ); + $modifier_type = sanitize_key( tec_get_request_var( 'modifier', '' ) ); // Early bail if the action is not 'delete_modifier'. if ( 'delete_modifier' !== $action ) { diff --git a/src/Tickets/Commerce/Order_Modifiers/Modifiers/Coupon.php b/src/Tickets/Commerce/Order_Modifiers/Modifiers/Coupon.php index 398ed46d88..4940ff1720 100644 --- a/src/Tickets/Commerce/Order_Modifiers/Modifiers/Coupon.php +++ b/src/Tickets/Commerce/Order_Modifiers/Modifiers/Coupon.php @@ -88,7 +88,7 @@ public function insert_modifier( array $data ): Model { [ 'meta_key' => 'coupons_available', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value - 'meta_value' => tribe_get_request_var( 'order_modifier_coupon_limit', '' ), + 'meta_value' => tec_get_request_var( 'order_modifier_coupon_limit', '' ), ] ); @@ -114,7 +114,7 @@ public function update_modifier( array $data ): Model { [ 'meta_key' => 'coupons_available', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value - 'meta_value' => tribe_get_request_var( 'order_modifier_coupon_limit', '' ), + 'meta_value' => tec_get_request_var( 'order_modifier_coupon_limit', '' ), ] ); diff --git a/src/Tickets/Commerce/Order_Modifiers/Modifiers/Fee.php b/src/Tickets/Commerce/Order_Modifiers/Modifiers/Fee.php index e3b374938a..a22a8edaeb 100644 --- a/src/Tickets/Commerce/Order_Modifiers/Modifiers/Fee.php +++ b/src/Tickets/Commerce/Order_Modifiers/Modifiers/Fee.php @@ -83,7 +83,7 @@ public function insert_modifier( array $data ): Model { $modifier = parent::insert_modifier( $data ); // Handle metadata (e.g., order_modifier_apply_to). - $apply_fee_to = tribe_get_request_var( 'order_modifier_apply_to', '' ); + $apply_fee_to = tec_get_request_var( 'order_modifier_apply_to', '' ); // Handle metadata (e.g., order_modifier_apply_to). $this->handle_meta_data( @@ -100,10 +100,10 @@ public function insert_modifier( array $data ): Model { switch ( $apply_fee_to ) { case 'venue': - $apply_to_post_id = tribe_get_request_var( 'venue_list', null ); + $apply_to_post_id = tec_get_request_var( 'venue_list', null ); break; case 'organizer': - $apply_to_post_id = tribe_get_request_var( 'organizer_list', null ); + $apply_to_post_id = tec_get_request_var( 'organizer_list', null ); break; } @@ -132,7 +132,7 @@ public function update_modifier( array $data ): Model { } // Handle metadata (e.g., order_modifier_apply_to). - $apply_fee_to = tribe_get_request_var( 'order_modifier_apply_to', '' ); + $apply_fee_to = tec_get_request_var( 'order_modifier_apply_to', '' ); $this->maybe_clear_relationships( $modifier->id, $apply_fee_to ); @@ -150,10 +150,10 @@ public function update_modifier( array $data ): Model { switch ( $apply_fee_to ) { case 'venue': - $apply_to_post_ids = tribe_get_request_var( 'venue_list', [] ); + $apply_to_post_ids = tec_get_request_var( 'venue_list', [] ); break; case 'organizer': - $apply_to_post_ids = tribe_get_request_var( 'organizer_list', [] ); + $apply_to_post_ids = tec_get_request_var( 'organizer_list', [] ); break; } diff --git a/src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php b/src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php index 8de64d150a..ab7401ae88 100644 --- a/src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php +++ b/src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php @@ -111,7 +111,7 @@ public function prepare_items() { ]; // Handle search. - $search = tribe_get_request_var( 's', '' ); + $search = tec_get_request_var( 's', '' ); // Pagination parameters. $per_page = $this->get_items_per_page( "{$this->modifier->get_modifier_type()}_per_page", 10 ); @@ -121,8 +121,8 @@ public function prepare_items() { $this->items = $this->modifier->find_by_search( [ 'search_term' => $search, - 'orderby' => sanitize_text_field( tribe_get_request_var( 'orderby', 'display_name' ) ), - 'order' => sanitize_text_field( tribe_get_request_var( 'order', 'asc' ) ), + 'orderby' => tec_get_request_var( 'orderby', 'display_name' ), + 'order' => tec_get_request_var( 'order', 'asc' ), 'limit' => $per_page, 'page' => $current_page, ] @@ -217,10 +217,10 @@ protected function render_actions( string $label, array $actions ): string { * @return void */ public function search_box( $text, $input_id, $placeholder = '' ) { - $search_value = sanitize_text_field( tribe_get_request_var( 's', '' ) ); + $search_value = tec_get_request_var( 's', '' ); // Set the input ID. - $input_id = $input_id . '-search-input'; + $input_id = "{$input_id}-search-input"; // If no placeholder is provided, default to the display_name column. if ( empty( $placeholder ) ) { @@ -252,7 +252,7 @@ public function render_tabs(): void { } // Determine the current modifier, falling back to the default. - $current_modifier = tribe_get_request_var( 'modifier', $this->get_default_type() ); + $current_modifier = tec_get_request_var( 'modifier', $this->get_default_type() ); echo '