Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
pkevan committed Dec 18, 2024
1 parent beb4a18 commit 1e7f05e
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions public_html/wp-content/plugins/camptix/inc/class-camptix-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ public function admin_menu_fix() {

// Make sure Tickets is selected when creating a new ticket.
if ( 'post-new.php' == $pagenow && 'tix_ticket' == $typenow ) {
add_filter( 'submenu_file', function () {
return 'edit.php?post_type=tix_ticket';
} );
add_filter( 'submenu_file',
function () {
return 'edit.php?post_type=tix_ticket';
}
);
}
}

Expand Down Expand Up @@ -253,6 +255,7 @@ public function menu_tools_summarize() {
/**
* Hooked at (almost) admin_init, fired if one requested a
* Summarize export. Serves the download file.
*
* @see menu_tools_summarize()
*/
public function summarize_admin_init() {
Expand All @@ -262,13 +265,14 @@ public function summarize_admin_init() {

if ( isset( $_POST['tix_export_summary'], $_POST['tix_summarize_by'] ) && check_admin_referer( 'tix_summarize' ) ) {
$summarize_by = $_POST['tix_summarize_by'];
if ( ! array_key_exists( $summarize_by, $this->get_available_summary_fields() ) )
if ( ! array_key_exists( $summarize_by, $this->get_available_summary_fields() ) ) {
return;
}

$fields = $this->get_available_summary_fields();
$summary = $this->get_summary( $summarize_by );
$summary_title = $fields[ $summarize_by ];
$filename = sprintf( 'camptix-summary-%s-%s.csv', sanitize_title_with_dashes( $summary_title ), date( 'Y-m-d' ) );
$filename = sprintf( 'camptix-summary-%s-%s.csv', sanitize_title_with_dashes( $summary_title ), gmdate( 'Y-m-d' ) );

header( 'Content-Type: text/csv' );
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
Expand Down Expand Up @@ -317,10 +321,10 @@ public function table( $rows, $classes = 'widefat' ) {
<tbody>
<?php foreach ( $rows as $row ) : ?>
<?php
$alt = ( $alt == '' ) ? 'alternate' : '';
$alt = ( '' == $alt ) ? 'alternate' : '';
$values = array_values( $row );
?>
<tr class="<?php echo esc_attr( $alt ); ?> tix-row-<?php echo sanitize_title_with_dashes( array_shift( $values ) ); ?>">
<tr class="<?php echo esc_attr( $alt ); ?> tix-row-<?php echo esc_attr( sanitize_title_with_dashes( array_shift( $values ) ) ); ?>">
<?php foreach ( $row as $column => $value ) : ?>
<td class="tix-<?php echo esc_attr( sanitize_title_with_dashes( $column ) ); ?>">
<span><?php echo wp_kses( $value, 'post' ); ?></span>
Expand All @@ -339,11 +343,6 @@ public function table( $rows, $classes = 'widefat' ) {
public function admin_enqueue_scripts() {
global $wp_query;

if ( ! $wp_query->query_vars ) { // only on singular admin pages.
if ( 'tix_ticket' == get_post_type() || 'tix_coupon' == get_post_type() ) {
}
}

// Let's see whether to include admin.css and admin.js.
if ( is_admin() ) {
$screen = get_current_screen();
Expand Down Expand Up @@ -399,7 +398,7 @@ public function admin_init() {
$this->menu_setup_controls();

// Let's add some help tabs.
require_once dirname( __FILE__ ) . '/help.php';
require_once __DIR__ . '/help.php';
}

/**
Expand Down Expand Up @@ -430,7 +429,7 @@ public function menu_setup_controls() {
__( 'Enable Refunds', 'wordcamporg' ),
'field_enable_refunds',
false,
esc_html__( "This will allows your customers to refund their tickets purchase by filling out a simple refund form.", 'wordcamporg' )
esc_html__( 'This will allows your customers to refund their tickets purchase by filling out a simple refund form.', 'wordcamporg' )
);

break;
Expand All @@ -443,9 +442,10 @@ public function menu_setup_controls() {
'payment_method_' . $key . '_enabled',
__( 'Enabled', 'wordcamporg' ),
array( $payment_method_obj, '_camptix_settings_enabled_callback' ),
'camptix_options', 'payment_' . $key, array(
'camptix_options', 'payment_' . $key,
array(
'name' => "camptix_options[payment_methods][{$key}]",
'value' => isset( $this->options[ 'payment_methods' ][$key] ) ? (bool) $this->options[ 'payment_methods' ][ $key ] : false,
'value' => isset( $this->options['payment_methods'][$key] ) ? (bool) $this->options['payment_methods'][ $key ] : false,
)
);

Expand Down Expand Up @@ -477,18 +477,19 @@ public function menu_setup_controls() {
add_settings_section( 'general', esc_html__( 'Beta Features', 'wordcamporg' ), array( $this, 'menu_setup_section_beta' ), 'camptix_options' );

$this->add_settings_field_helper(
'reservations_enabled',
esc_html__( 'Enable Reservations', 'wordcamporg' ),
'field_yesno',
false,
esc_html__( 'Reservations is a way to make sure that a certain group of people, can always purchase their tickets, even if you sell out fast.', 'wordcamporg' )
'reservations_enabled',
esc_html__( 'Enable Reservations', 'wordcamporg' ),
'field_yesno',
false,
esc_html__( 'Reservations is a way to make sure that a certain group of people, can always purchase their tickets, even if you sell out fast.', 'wordcamporg' )
);

if ( current_user_can( $this->caps['refund_all'] ) ) {
$this->add_settings_field_helper(
'refund_all_enabled',
esc_html__( 'Enable Refund All', 'wordcamporg' ),
'field_yesno', false,
'field_yesno',
false,
esc_html__( 'Allows to refund all purchased tickets by an admin via the Tools menu.', 'wordcamporg' )
);
}
Expand Down

0 comments on commit 1e7f05e

Please sign in to comment.