Skip to content

Commit

Permalink
Replace tribe_get_request_var() with tec_get_request_var()
Browse files Browse the repository at this point in the history
  • Loading branch information
JPry committed Jan 10, 2025
1 parent 65c5bd6 commit de6da83
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/Tickets/Commerce/Order_Modifiers/Modifier_Admin_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 ) {
Expand Down
4 changes: 2 additions & 2 deletions src/Tickets/Commerce/Order_Modifiers/Modifiers/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '' ),
]
);

Expand All @@ -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', '' ),
]
);

Expand Down
12 changes: 6 additions & 6 deletions src/Tickets/Commerce/Order_Modifiers/Modifiers/Fee.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}

Expand Down Expand Up @@ -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 );

Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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,
]
Expand Down Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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 '<h2 class="nav-tab-wrapper">';
foreach ( $modifiers as $modifier_slug => $modifier_data ) {
Expand Down

0 comments on commit de6da83

Please sign in to comment.