Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions assets/public/sass/partials/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,28 @@
}
}
}

/* Funding links rendered as buttons on the booking confirmation page */
.cb-booking-funding {
.cb-button-funding-local,
.cb-button-funding-plugin {
@extend .cb-button;
display: inline-flex;
align-items: center;
gap: var(--commonsbooking-spacer-small);
}

.cb-button-funding-local {
background-color: var(--commonsbooking-color-secondary); /* CB blue */
}

.cb-button-funding-plugin {
background-color: var(--commonsbooking-color-primary); /* CB light green */
}

.cb-funding-logo {
height: 1.2em;
width: auto;
vertical-align: middle;
}
}
82 changes: 82 additions & 0 deletions includes/OptionsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,88 @@
'id' => 'globalLocationSettings',
'fields' => Location::getOverbookingSettingsMetaboxes(),
),
'contactSupport' => array(
'title' => __( 'Contact, support & legal', 'commonsbooking' ),
'id' => 'contactSupport',
'desc' => commonsbooking_sanitizeHTML( __( 'These details are shown on the booking confirmation page in the "Need help?", "Rate our service" and "Booking terms" sections. Leave any field empty to hide that line.', 'commonsbooking' ) ),
'fields' => array(
array(
'name' => esc_html__( 'Support phone number', 'commonsbooking' ),
'desc' => esc_html__( 'Phone number rendered as a clickable tel: link in the "Need help?" section.', 'commonsbooking' ),
'id' => 'contact_phone',
'type' => 'text',
'default' => '',
),
array(
'name' => esc_html__( 'Support email', 'commonsbooking' ),
'desc' => esc_html__( 'Email address rendered as a mailto: link in the "Need help?" section.', 'commonsbooking' ),
'id' => 'contact_email',
'type' => 'text',
'default' => '',
),
array(
'name' => esc_html__( 'Contact form URL', 'commonsbooking' ),
'desc' => esc_html__( 'Full URL to a contact form page. Shown as a link in the "Need help?" section.', 'commonsbooking' ),
'id' => 'contact_form_url',
'type' => 'text_url',
'default' => '',
),
array(
'name' => esc_html__( 'Service rating URL', 'commonsbooking' ),
'desc' => esc_html__( 'External rating or review URL (e.g. a Google review link or feedback form). Shown in the "Rate our service" section.', 'commonsbooking' ),
'id' => 'service_rating_url',
'type' => 'text_url',
'default' => '',
),
array(
'name' => esc_html__( 'Booking terms (AGB) URL', 'commonsbooking' ),
'desc' => esc_html__( 'Link to your booking terms or AGB page. Shown as a "Booking terms" link.', 'commonsbooking' ),
'id' => 'booking_terms_url',
'type' => 'text_url',
'default' => '',
),
array(
'name' => esc_html__( 'Show "Fund the local initiative" link', 'commonsbooking' ),
'desc' => esc_html__( 'When enabled and a URL is set below, a link inviting users to support your local initiative is shown on the booking confirmation page.', 'commonsbooking' ),
'id' => 'fund_local_enable',
'type' => 'checkbox',
),
array(
'name' => esc_html__( 'Local initiative funding label', 'commonsbooking' ),
'desc' => esc_html__( 'Link text shown for the local initiative funding link.', 'commonsbooking' ),
'id' => 'fund_local_label',
'type' => 'text',
'default' => esc_html__( 'Support our initiative', 'commonsbooking' ),
),
array(
'name' => esc_html__( 'Local initiative funding URL', 'commonsbooking' ),
'desc' => esc_html__( 'URL to your donation or membership page.', 'commonsbooking' ),
'id' => 'fund_local_url',
'type' => 'text_url',
'default' => '',
),
array(
'name' => esc_html__( 'Show "Fund plugin development" link', 'commonsbooking' ),
'desc' => esc_html__( 'When enabled, a link inviting users to support CommonsBooking plugin development is shown on the booking confirmation page.', 'commonsbooking' ),
'id' => 'fund_plugin_enable',
'type' => 'checkbox',
),
array(
'name' => esc_html__( 'Plugin funding label', 'commonsbooking' ),
'desc' => esc_html__( 'Link text shown for the plugin development funding link.', 'commonsbooking' ),
'id' => 'fund_plugin_label',
'type' => 'text',
'default' => esc_html__( 'Support CommonsBooking development', 'commonsbooking' ),
),
array(
'name' => esc_html__( 'Plugin funding URL', 'commonsbooking' ),
'desc' => esc_html__( 'URL to the CommonsBooking project donation page. Defaults to the wielebenwir support page.', 'commonsbooking' ),
'id' => 'fund_plugin_url',
'type' => 'text_url',
'default' => 'https://www.wielebenwir.de/verein/unterstutzen',
),
),
),
),
),
/* Tab: general end*/
Expand Down
102 changes: 102 additions & 0 deletions templates/booking-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
$current_status = $booking->post_status;
$internal_comment = $booking->getMeta( 'internal-comment' );

$contact_phone = Settings::getOption( 'commonsbooking_options_general', 'contact_phone' );
$contact_email = Settings::getOption( 'commonsbooking_options_general', 'contact_email' );
$contact_form_url = Settings::getOption( 'commonsbooking_options_general', 'contact_form_url', 'esc_url' );
$service_rating_url = Settings::getOption( 'commonsbooking_options_general', 'service_rating_url', 'esc_url' );
$booking_terms_url = Settings::getOption( 'commonsbooking_options_general', 'booking_terms_url', 'esc_url' );

$fund_local_enable = Settings::getOption( 'commonsbooking_options_general', 'fund_local_enable' );
$fund_local_label = Settings::getOption( 'commonsbooking_options_general', 'fund_local_label' );
$fund_local_url = Settings::getOption( 'commonsbooking_options_general', 'fund_local_url', 'esc_url' );
$fund_plugin_enable = Settings::getOption( 'commonsbooking_options_general', 'fund_plugin_enable' );
$fund_plugin_label = Settings::getOption( 'commonsbooking_options_general', 'fund_plugin_label' );
$fund_plugin_url = Settings::getOption( 'commonsbooking_options_general', 'fund_plugin_url', 'esc_url' );

$show_fund_local = ( $fund_local_enable === 'on' ) && ! empty( $fund_local_url );
$show_fund_plugin = ( $fund_plugin_enable === 'on' ) && ! empty( $fund_plugin_url );


do_action( 'commonsbooking_before_booking-single', $booking->ID, $booking );

Expand Down Expand Up @@ -187,6 +203,92 @@
<?php
}
}

if ( ! empty( $contact_phone ) || ! empty( $contact_email ) || ! empty( $contact_form_url ) ) {
?>
<div class="cb-wrapper cb-booking-help">
<div class="cb-list-header">
<h3><?php echo esc_html__( 'Need help?', 'commonsbooking' ); ?></h3>
</div>
<?php if ( ! empty( $contact_phone ) ) { ?>
<div class="cb-list-content cb-help-phone cb-col-30-70">
<div><?php echo esc_html__( 'Phone', 'commonsbooking' ); ?></div>
<div><a href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+]/', '', $contact_phone ) ); ?>"><?php echo esc_html( $contact_phone ); ?></a></div>
</div>
<?php
}
if ( ! empty( $contact_email ) ) {
?>
<div class="cb-list-content cb-help-email cb-col-30-70">
<div><?php echo esc_html__( 'Email', 'commonsbooking' ); ?></div>
<div><a href="mailto:<?php echo esc_attr( sanitize_email( $contact_email ) ); ?>"><?php echo esc_html( $contact_email ); ?></a></div>
</div>
<?php
}
if ( ! empty( $contact_form_url ) ) {
?>
<div class="cb-list-content cb-help-form cb-col-30-70">
<div><?php echo esc_html__( 'Contact form', 'commonsbooking' ); ?></div>
<div><a href="<?php echo esc_url( $contact_form_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html__( 'Open contact form', 'commonsbooking' ); ?></a></div>
</div>
<?php
}
?>
</div><!-- cb-booking-help -->
<?php
}

if ( ! empty( $service_rating_url ) ) {
?>
<div class="cb-wrapper cb-booking-rating">
<div class="cb-list-header">
<h3><?php echo esc_html__( 'Rate our service', 'commonsbooking' ); ?></h3>
</div>
<div class="cb-list-content cb-rating cb-col-30-70">
<div><?php echo esc_html__( 'Your feedback', 'commonsbooking' ); ?></div>
<div><a href="<?php echo esc_url( $service_rating_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html__( 'Leave a rating', 'commonsbooking' ); ?></a></div>
</div>
</div><!-- cb-booking-rating -->
<?php
}

if ( $show_fund_local || $show_fund_plugin ) {
?>
<div class="cb-wrapper cb-booking-funding">
<div class="cb-list-header">
<h3><?php echo esc_html__( 'Support us', 'commonsbooking' ); ?></h3>
</div>
<?php if ( $show_fund_local ) { ?>
<div class="cb-list-content cb-funding-local cb-col-30-70">
<div><?php echo esc_html__( 'Local initiative', 'commonsbooking' ); ?></div>
<div><a class="cb-button cb-button-funding-local" href="<?php echo esc_url( $fund_local_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html( ! empty( $fund_local_label ) ? $fund_local_label : __( 'Support our initiative', 'commonsbooking' ) ); ?></a></div>
</div>
<?php
}
if ( $show_fund_plugin ) {
?>
<div class="cb-list-content cb-funding-plugin cb-col-30-70">
<div><?php echo esc_html__( 'Plugin development', 'commonsbooking' ); ?></div>
<div><a class="cb-button cb-button-funding-plugin" href="<?php echo esc_url( $fund_plugin_url ); ?>" target="_blank" rel="noopener"><img class="cb-funding-logo" src="<?php echo esc_url( COMMONSBOOKING_PLUGIN_ASSETS_URL . 'global/cb-ci/logo.png' ); ?>" alt="" aria-hidden="true" /><?php echo esc_html( ! empty( $fund_plugin_label ) ? $fund_plugin_label : __( 'Support CommonsBooking development', 'commonsbooking' ) ); ?></a></div>
</div>
<?php
}
?>
</div><!-- cb-booking-funding -->
<?php
}

if ( ! empty( $booking_terms_url ) ) {
?>
<div class="cb-wrapper cb-booking-terms">
<div class="cb-list-content cb-terms cb-col-30-70">
<div><?php echo esc_html__( 'Booking terms', 'commonsbooking' ); ?></div>
<div><a href="<?php echo esc_url( $booking_terms_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html__( 'Read booking terms', 'commonsbooking' ); ?></a></div>
</div>
</div><!-- cb-booking-terms -->
<?php
}

if ( $current_status && $current_status !== 'draft' ) {

?>
Expand Down
Loading