null,
'booking_form' => null,
);
$args = wp_parse_args( $args, $defaults );
wpbc_clear_div();
// Toolbar ////////////////////////////////////////////////////////////////
?>
$el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
);
wpbc_flex_toggle( $params_checkbox );
?>
__( 'Help', 'booking' )
, 'font_icon' => 'wpbc_icn_support' //FixIn: 9.0.1.4 'glyphicon glyphicon-question-sign'
, 'position' => 'right'
, 'items' => array(
array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' )
, array( 'type' => 'link', 'title' => __('Support Forum', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' )
, array( 'type' => 'divider' )
, array( 'type' => 'link', 'title' => __('Contact Support', 'booking'), 'url' => 'mailto:support@wpbookingcalendar.com'
, 'attr' => array( 'style' => 'font-weight: 600;' ) )
, array( 'type' => 'divider' )
, array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) )
, array( 'type' => 'link', 'title' => __('About', 'booking')
// , 'url' => wpbc_up_link()
, 'url' => 'https://wpbookingcalendar.com/' //esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) )
, 'attr' => array(
// 'target' => '_blank'
// 'style' => 'font-weight: 600;'
)
)
)
) );
}
// ---------------------------------------------------------------------------------------------------------------------
// Toolbar Actions B u t t o n s - T i m e l i n e //////////////////
// ---------------------------------------------------------------------------------------------------------------------
/** Navigation Timeline - B u t t o n s */
function wpbc_toolbar_btn__timeline_navigation() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
if ((isset($_REQUEST['wh_booking_type'])) && ( strpos($_REQUEST['wh_booking_type'], ',') !== false ) )
$is_show_resources_matrix = true;
else $is_show_resources_matrix = false;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_REQUEST['view_days_num'] ) )
$view_days_num = intval( $_REQUEST['view_days_num'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
else $view_days_num = get_bk_option( 'booking_view_days_num');
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('scroll_month', 'scroll_day') );
//debuge($_REQUEST, $bk_admin_url);
// Get Data For buttons
if (! $is_show_resources_matrix) {
switch ($view_days_num) {
case '90':
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
else $scroll_day = 0;
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7),
'&scroll_day='.intval($scroll_day-7),
'&scroll_day=0',
'&scroll_day='.intval($scroll_day+7 ),
'&scroll_day='.intval($scroll_day+4*7) );
$scroll_titles = array( __('Previous 4 weeks' ,'booking'),
__('Previous week' ,'booking'),
__('Current week' ,'booking'),
__('Next week' ,'booking'),
__('Next 4 weeks' ,'booking') );
break;
case '30':
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
else $scroll_day = 0;
// FixIn: 8.9.4.3.
// Here we need to define number of days to scroll depends from selected number of days to show.
$days_num_to_scroll = intval( get_bk_option( 'booking_calendar_overview__day_mode__days_number_show' ) );;
if ( empty( $days_num_to_scroll ) ) {
$days_num_to_scroll = 7;
}
$scroll_params = array( '&scroll_day='.intval( $scroll_day - $days_num_to_scroll * 2 ),
'&scroll_day='.intval( $scroll_day - $days_num_to_scroll ),
'&scroll_day=0',
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll ),
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll *2 ) );
$scroll_titles = array( __( 'Previous', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ),
__( 'Previous', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ),
__('Current week' ,'booking'),
__( 'Next', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ),
__( 'Next', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ) );
break;
default: // 365
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$scroll_params = array( '&scroll_month='.intval($scroll_month-3),
'&scroll_month='.intval($scroll_month-1),
'&scroll_month=0',
'&scroll_month='.intval($scroll_month+1 ),
'&scroll_month='.intval($scroll_month+3) );
$scroll_titles = array( __('Previous 3 months' ,'booking'),
__('Previous month' ,'booking'),
__('Current month' ,'booking'),
__('Next month' ,'booking'),
__('Next 3 months' ,'booking') );
break;
}
} else { // Matrix
switch ($view_days_num) {
case '1': //Day
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
else $scroll_day = 0;
$scroll_params = array( '&scroll_day='.intval($scroll_day-7),
'&scroll_day='.intval($scroll_day-1),
'&scroll_day=0',
'&scroll_day='.intval($scroll_day+1 ),
'&scroll_day='.intval($scroll_day+7) );
$scroll_titles = array( __('Previous 7 days' ,'booking'),
__('Previous day' ,'booking'),
__('Current day' ,'booking'),
__('Next day' ,'booking'),
__('Next 7 days' ,'booking') );
break;
case '7': //Week
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
else $scroll_day = 0;
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7),
'&scroll_day='.intval($scroll_day-7),
'&scroll_day=0',
'&scroll_day='.intval($scroll_day+7 ),
'&scroll_day='.intval($scroll_day+4*7) );
$scroll_titles = array( __('Previous 4 weeks' ,'booking'),
__('Previous week' ,'booking'),
__('Current week' ,'booking'),
__('Next week' ,'booking'),
__('Next 4 weeks' ,'booking') );
break;
case '30':
case '60':
case '90': //3 months
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$scroll_params = array( '&scroll_month='.intval($scroll_month-3),
'&scroll_month='.intval($scroll_month-1),
'&scroll_month=0',
'&scroll_month='.intval($scroll_month+1 ),
'&scroll_month='.intval($scroll_month+3) );
$scroll_titles = array( __('Previous 3 months' ,'booking'),
__('Previous month' ,'booking'),
__('Current month' ,'booking'),
__('Next month' ,'booking'),
__('Next 3 months' ,'booking') );
break;
default: // 30, 60, 90...
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$scroll_params = array( '&scroll_month='.intval($scroll_month-3),
'&scroll_month='.intval($scroll_month-1),
'&scroll_month=0',
'&scroll_month='.intval($scroll_month+1 ),
'&scroll_month='.intval($scroll_month+3) );
$scroll_titles = array( __('Previous 3 months' ,'booking'),
__('Previous month' ,'booking'),
__('Current month' ,'booking'),
__('Next month' ,'booking'),
__('Next 3 months' ,'booking') );
break;
}
}
$params = array(
'label_for' => 'calendar_overview_navigation' // "For" parameter of button group element
, 'label' => '' //__('Calendar Navigation', 'booking') // Label above the button group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[0] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[0] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_left'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[1] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[1] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_arrow_left'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'dropdown'
, 'id' => 'timeline_navigation_date'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => __('Custom' ,'booking') , 'position' => 'top' ) // Hint
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_gps_fixed'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
, 'options' => array(
$scroll_titles[2] => "window.location.href='"
. wpbc_get_params_in_url( wpbc_get_bookings_url( false )
, array('scroll_month', 'scroll_day', 'scroll_start_date') )
. $scroll_params[2] . "'"
, 'divider1' => 'divider'
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group')
, array(
'type' => 'text'
, 'id' => 'calendar_overview_navigation_currentdate'
, 'name' => 'calendar_overview_navigation_currentdate'
, 'label' => __('Start Date' ,'booking') . ':'
, 'disabled' => false
, 'class' => 'wpdevbk-filters-section-calendar'
, 'style' => ''
, 'placeholder' => gmdate('Y-m-d')
, 'attr' => array()
, 'value' => ''
)
)
, 'divider2' => 'divider'
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group0', 'style'=>'display: flex;flex-flow: row nowrap;align-items: center;justify-content: flex-end;' ),
array(
'type' => 'button'
, 'title' => __('Apply' ,'booking') // Title of the button
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
, 'link' => 'javascript:void(0)' // Direct link or skip it
, 'action' => "jQuery('#calendar_overview_navigation_container').hide();
window.location.href='"
. wpbc_get_params_in_url( wpbc_get_bookings_url( false )
, array('scroll_month', 'scroll_day', 'scroll_start_date') )
. "&scroll_start_date=' + jQuery('#calendar_overview_navigation_currentdate').val();"
, 'class' => 'button-primary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => ''
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Close' ,'booking') // Title of the button
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
, 'link' => 'javascript:void(0)' // Direct link or skip it
//, 'action' => '' // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => ''
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => 'margin:0 10px;' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
)
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[3] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[3] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_arrow_right'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[4] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[4] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_right'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
);
wpbc_bs_button_group( $params );
}
// ---------------------------------------------------------------------------------------------------------------------
// Toolbar Options B u t t o n s - Add New Booking //////////////////
// ---------------------------------------------------------------------------------------------------------------------
/** Genereate URL based on GET parameters */
function wpbc_get_new_booking_url__base( $skip_parameters = array() ) {
$link_base = wpbc_get_new_booking_url( true, false );
$link_params = array();
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = sanitize_text_field( wp_unslash( $_GET['parent_res'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = sanitize_text_field( wp_unslash( $_GET['booking_form'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_GET['calendar_months_num_in_1_row'] ) ) $link_params['calendar_months_num_in_1_row'] = intval( $_GET['calendar_months_num_in_1_row'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
foreach ( $link_params as $key => $value ) {
if ( ! in_array( $key, $skip_parameters) ) {
$link_base .= '&' . $key . '=' . $value;
}
}
return $link_base;
}
/** Selection Number of visible months */
function wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options = array() ) {
$text_label = __('Visible months' ,'booking') .':' ;
$form_options = array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 );
$parameter_name = 'calendar_months_count';
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] );
else $selected_value = 1;
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ;
$on_change = ''; //'location.href=\'' . $link_base . '\' + this.value;';
$params = array(
'label_for' => $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $parameter_name // HTML ID of element
, 'options' => $form_options // Associated array of titles and values
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $on_change
)
)
);
?> __('All', 'booking'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 );
$parameter_name = 'calendar_months_num_in_1_row';
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] );
else $selected_value = 0;
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ;
$on_change = ''; // 'location.href=\'' . $link_base . '\' + this.value;';
$params = array(
'label_for' => $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $parameter_name // HTML ID of element
, 'options' => $form_options // Associated array of titles and values
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $on_change
)
)
);
?> $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'text'
, 'id' => $parameter_name // HTML ID of element
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'placeholder' => '100%'
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
, array(
'type' => 'select'
, 'id' => $parameter_name . 'units' // HTML ID of element
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values
, 'value' => $selected_value_units // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
)
);
?> $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'text'
, 'id' => $parameter_name // HTML ID of element
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'placeholder' => '48px'
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
, array(
'type' => 'select'
, 'id' => $parameter_name . 'units' // HTML ID of element
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values
, 'value' => $selected_value_units // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
)
);
?> null,
'booking_form' => null,
);
$args = wp_parse_args( $args, $defaults );
$link = wpbc_get_new_booking_url();
if ( null !== $args['resource_id'] ) {
$link .= '&booking_type=' . absint( $args['resource_id'] );
} else {
$link .= ( ! empty( $_REQUEST['booking_type'] ) ) ? '&booking_type=' . intval( $_REQUEST['booking_type'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
}
if ( null !== $args['booking_form'] ) {
$link .= '&booking_form=' . sanitize_text_field( wp_unslash( (string) $args['booking_form'] ) );
} else {
$link .= ( ! empty( $_REQUEST['booking_form'] ) ) ? '&booking_form=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_form'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
}
$link .= ( ! empty( $_REQUEST['booking_hash'] ) ) ? '&booking_hash=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_hash'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$link .= ( ! empty( $_REQUEST['is_show_payment_form'] ) ) ? '&is_show_payment_form=Off' : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$link .= ( ! empty( $_REQUEST['parent_res'] ) ) ? '&parent_res=' . intval( $_REQUEST['parent_res'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$el_id = 'is_allow_bookings_in_past';
$el_value = 'Off';
$params_checkbox = array(
'id' => $el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Allow booking in the past', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
, 'onchange' => "window.location.href='". $link . "&allow_past=1';" // JavaScript code
, 'hint' => array( 'title' => __('Allow booking in the past' ,'booking') , 'position' => 'top' )
);
?> null,
);
$args = wp_parse_args( $args, $defaults );
if ( null !== $args['resource_id'] ) {
$bk_type = absint( $args['resource_id'] );
} elseif ( isset( $_GET['booking_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$bk_type = intval( $_GET['booking_type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
} else {
$bk_type = 1;
}
?> $el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
, 'onchange' => "document.getElementById('is_send_email_for_pending').checked = this.checked;" // JavaScript code
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
);
wpbc_flex_toggle( $params_checkbox );
?>
__( 'Add to Google Calendar', 'booking' )
, 'hint' => __( 'Add to Google Calendar', 'booking' )
, 'class' => 'button-secondary button'
, 'is_show_icon' => true
, 'is_only_url' => false
);
$button_attr = wp_parse_args( $button_attr, $defaults );
$params = array();
$params['timezone'] = get_bk_option('booking_gcal_timezone');
$booking_gcal_events_form_fields = get_bk_option( 'booking_gcal_events_form_fields');
if ( is_serialized( $booking_gcal_events_form_fields ) )
$booking_gcal_events_form_fields = unserialize( $booking_gcal_events_form_fields );
/**
* Array
(
[title] => text^name
[description] => textarea^details
[where] => text^
)
*/
// Fields
$fields = array( 'title' => '', 'description' => '', 'where' => '' );
foreach ( $fields as $key_name => $field_value ) {
if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) {
$field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] );
$field_name = $field_name[ ( count( $field_name ) - 1 ) ]; // FixIn: 8.7.7.6.
if ( (! empty($field_name))
&& (! empty($booking_data['form_data']))
&& (! empty($booking_data['form_data']['_all_fields_']))
&& (! empty($booking_data['form_data']['_all_fields_'][ $field_name ]))
) {
if ( 'description' === $key_name ) { // FixIn: 8.1.3.2.
if ( isset( $booking_data['form_show'] ) ) { // FixIn: 8.7.3.14.
// FixIn: 8.7.11.4.
$fields[ $key_name ] = $booking_data['form_show'];
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
$fields[ $key_name ] = urlencode($fields[ $key_name ]);
$fields[ $key_name ] = htmlentities($fields[ $key_name ] );
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES );
}
} else {
// FixIn: 8.7.11.4.
$fields[ $key_name ] = $booking_data['form_data']['_all_fields_'][ $field_name ];
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
// Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/
// $fields[ $key_name ] = str_replace( array( '%','#', '+', '&' )
// , array( '%25','%23', '%2B', '%26')
// , $fields[ $key_name ]
// );
$fields[ $key_name ] = urlencode($fields[ $key_name ]);
$fields[ $key_name ] = htmlentities($fields[ $key_name ] );
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES );
}
}
}
}
//debuge($booking_gcal_events_form_fields, $fields,$booking_data['form_data']);
// Dates.
$check_in_timestamp = $check_out_timestamp = '';
if ( ! empty( $booking_data[ 'dates_short' ] ) ) {
/* all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong.
* You must use the following date as the end date for a one day all day event,
* or +1 day to whatever you want the end date to be.
*/
$check_in_timestamp = strtotime( $booking_data[ 'dates_short' ][ 0 ], current_time( 'timestamp' ) );
if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) {
$check_in_timestamp = gmdate( "Ymd", $check_in_timestamp ); // All day
} else {
$check_in_timestamp = gmdate( "Ymd\THis", $check_in_timestamp );
//$check_in_timestamp = gmdate( "Ymd\THis\Z", $check_in_timestamp );
}
$check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) );
if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) {
$check_out_timestamp = strtotime( '+1 day', $check_out_timestamp );
$check_out_timestamp = gmdate( "Ymd", $check_out_timestamp ); // All day
} else {
$check_out_timestamp = gmdate( "Ymd\THis", $check_out_timestamp );
//$check_out_timestamp = gmdate( "Ymd\THis\Z", $check_out_timestamp );
}
}
//debuge($check_in_timestamp,$check_out_timestamp, $fields );die;
//Convert an ISO date/time to a UNIX timestamp
//function iso_to_ts( $iso ) {
// sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second );
// return mktime( intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year) );
// 20140127T224000Z
// gmdate("Ymd\THis\Z", time());
/**
action:
action=TEMPLATE
A default required parameter.
src:
Example: src=default%40gmail.com
Format: src=text
This is not covered by Google help but is an optional parameter in order to add an event to a shared calendar rather than a user's default.
text:
Example: text=Garden%20Waste%20Collection
Format: text=text
This is a required parameter giving the event title.
dates:
Example: dates=20090621T063000Z/20090621T080000Z (i.e. an event on 21 June 2009 from 7.30am to 9.0am British Summer Time (=GMT+1)).
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ
This required parameter gives the start and end dates and times (in Greenwich Mean Time) for the event.
location:
Example: location=Home
Format: location=text
The obvious location field.
trp:
Example: trp=false
Format: trp=true/false
Show event as busy (true) or available (false)
sprop:
Example: sprop=http%3A%2F%2Fwww.me.org
Example: sprop=name:Home%20Page
Format: sprop=website and/or sprop=name:website_name
*/
// $link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE';
// $link_add2gcal .= '&text=' . $fields['title'];
// FixIn: 8.7.3.10.
$link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?';
$link_add2gcal .= 'text=' . $fields['title']; // FixIn: 8.7.11.4.
//$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']';
$link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp;
$link_add2gcal .= '&details=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['description'] : '' ); // FixIn: 10.3.0.1.
$link_add2gcal .= '&location=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['where'] : '' );
$link_add2gcal .= '&trp=false';
if ( ! empty( $params['timezone'] ) ) {
$link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone
}
//$link_add2gcal .= '&sprop=';
//$link_add2gcal .= '&sprop=name:';
if ( $button_attr['is_only_url'] ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $link_add2gcal;
} else {
?> 'resources_count'
, 'title' => __('Resources count' ,'booking') . ':'
, 'selected' => 1
, 'options' => array_combine( range(1, 201) ,range(1, 201) )
) ) ;
*/
function wpbc_toolbar_btn__selection_element( $params ) {
$defaults = array(
'name' => 'random_' . wp_rand( 1000, 10000 )
, 'title' => __('Total', 'booking') . ':'
, 'on_change' => '' //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
, 'options' => array()
, 'selected' => 0
);
$params = wp_parse_args( $params, $defaults );
for ( $i = 1; $i < 201; $i++ ) {
$form_options[ $i ] = $i;
}
$params = array(
'label_for' => $params['name'] // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $params['title']
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $params['name'] // HTML ID of element
, 'name' => $params['name'] // HTML ID of element
, 'options' => $params['options'] // Associated array of titles and values
, 'value' => $params['selected'] // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $params['on_change']
)
)
);
?> array( 'search_get_key' => 'wh_resource_id' )
*/
function wpbc_hidden_search_by_id_field_in_main_form( $params = array() ){
$defaults = array(
'search_get_key' => 'wh_search_id'
);
$params = wp_parse_args( $params, $defaults );
$search_form_value = '';
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params['search_get_key'] ] ); // '12,0,45,9' or '10'.
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params['search_get_key'] ] ); // Clean string.
if ( ! empty( $wh_resource_id ) ) {
$search_form_value = $wh_resource_id;
} else {
$search_form_value = $wh_resource_title;
}
}
if ( '' !== $search_form_value ) {
?> 'wpbc_seasonfilters_search_form'
, 'search_get_key' => 'wh_search_id'
, 'is_pseudo' => false
) );
*/
function wpbc_toolbar_search_by_id__top_form( $params ) {
$defaults = array(
'search_form_id' => 'wpbc_seasonfilters_search_form'
, 'search_get_key' => 'wh_search_id'
, 'is_pseudo' => false //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
, 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' // FixIn: 10.0.0.29.
);
$params = wp_parse_args( $params, $defaults );
$exclude_params = array(); //array('page_num', 'orderby', 'order'); - if using "only_these_parameters", then this parameter does NOT require
$only_these_parameters = array( 'page', 'tab', 'subtab', $params[ 'search_get_key' ] ); //FixIn: 8.1.1.11 - added , 'subtab' - ability to search booking resources in sub tab pages in settings
$wpbc_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false, false ), $exclude_params, $only_these_parameters );
$search_form_value = '';
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // '12,0,45,9' or '10'
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // Clean string
if ( ! empty( $wh_resource_id ) ) {
$search_form_value = $wh_resource_id;
} else {
$search_form_value = $wh_resource_title;
}
}
wpbc_clear_div();
?>