Skip to content

Commit

Permalink
Sniffs
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Dec 17, 2023
1 parent 3f3cb3d commit 3bdacb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 14 additions & 3 deletions src/mt-add-to-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,17 @@ function mt_ticket_row( $event_id, $registration, $settings, $type, $available,
if ( 'true' === $options['mt_show_closed'] ) {
$show_closed = 'show';
}
$ticket_type_sales_closed_behavior = apply_filters( 'mt-ticket-type-sales-closed', $show_closed, $event_id );
/**
* Filter whether a ticket type that has closed will be shown for an event.
*
* @hook mt_ticket_type_sales_closed
*
* @param {string} $show_closed 'hide' or 'show'.
* @param {int} $event_id ID for currently displayed post.
*
* @return {string}
*/
$ticket_type_sales_closed_behavior = apply_filters( 'mt_ticket_type_sales_closed', $show_closed, $event_id );
if ( 'hide' === $ticket_type_sales_closed_behavior ) {
// If this ticket type is no longer available, skip.
return false;
Expand Down Expand Up @@ -430,9 +440,10 @@ function mt_ticket_row( $event_id, $registration, $settings, $type, $available,
);

$hide_remaining = mt_hide_remaining( $tickets_remaining );
// Translators: Ticket price label, number remaining.
// Translators: 1 Ticket price label, 2 number remaining as fraction e.g. 2/40, 3 closing span tag..
$remaining_text = sprintf( apply_filters( 'mt_tickets_remaining_discrete_text', __( '%1$s %2$s remaining%3$s', 'my-tickets' ), $ticket_price_label, $remaining, $tickets ), $ticket_price_label . '<span class="tickets-remaining">', "<span class='value remaining-tickets'>" . $remaining . "</span>/<span class='ticket-count'>" . $tickets . '</span>', '</span>' );
$available_text = sprintf( apply_filters( 'mt_tickets_remaining_discrete_text', __( '%1$s %2$s available%3$s', 'my-tickets' ), $ticket_price_label, $remaining, $tickets ), $ticket_price_label . '<span class="tickets-available">', "<span class='value available-tickets'>" . $remaining . '</span>', '</span>' );
// Translators: 1 ticket price label, 2 number remaining as integer, 3 closing span tag.
$available_text = sprintf( apply_filters( 'mt_tickets_available_discrete_text', __( '%1$s %2$s available%3$s', 'my-tickets' ), $ticket_price_label, $remaining, $tickets ), $ticket_price_label . '<span class="tickets-available">', "<span class='value available-tickets'>" . $remaining . '</span>', '</span>' );
if ( 'proportion' === $options['mt_display_remaining'] ) {
$display_text = $remaining_text;
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/mt-ticketing-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function mt_ticketing_settings() {

$mt_show_closed = ( isset( $options['mt_show_closed'] ) ) ? $options['mt_show_closed'] : 'false';
$form .= "<p class='handling ticket-show-closed'><label for='mt_tickets_show_closed'>" . __( 'Show ticket types that are closed in Add to Cart form', 'my-tickets' ) . "</label> <input name='mt_show_closed' id='mt_tickets_show_closed' type='checkbox' value='true'" . checked( $mt_show_closed, 'true', false ) . ' /></p>';

$mt_hide_remaining = ( isset( $options['mt_hide_remaining'] ) ) ? $options['mt_hide_remaining'] : 'false';
$form .= "<p class='handling ticket-hide-remaining'><label for='mt_tickets_hide_remaining'>" . __( 'Hide number of tickets remaining', 'my-tickets' ) . "</label> <input name='mt_hide_remaining' id='mt_tickets_hide_remaining' type='checkbox' value='true'" . checked( $mt_hide_remaining, 'true', false ) . ' /></p>';
$mt_hide_remaining_limit = ( isset( $options['mt_hide_remaining_limit'] ) ) ? $options['mt_hide_remaining_limit'] : 0;
Expand All @@ -211,7 +210,6 @@ function mt_ticketing_settings() {
<option value='proportion'" . selected( $mt_display_remaining, 'proportion', false ) . '>' . __( 'Available/total, e.g. 23/40', 'my-tickets' ) . "</option>
<option value='number'" . selected( $mt_display_remaining, 'number', false ) . '>' . __( 'Available only, e.g. 23', 'my-tickets' ) . '</option>
</select></p>';

$form .= '</fieldset>';
$form .= '<fieldset><legend>' . __( 'Miscellaneous', 'my-tickets' ) . '</legend>';
$mt_ticket_image = ( isset( $options['mt_ticket_image'] ) ) ? $options['mt_ticket_image'] : '';
Expand Down

0 comments on commit 3bdacb1

Please sign in to comment.