Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • Docs Home

Packages

  • BKAP
    • Addons
    • Admin-Bookings
    • Attribute-Lockout
    • Block-Pricing
    • Booking-Box
    • Booking-Confirmation
    • Booking-Process
    • Cancel-Order
    • Cart
    • Checkout-Process
    • Core
    • Date-Time
    • Emails
    • Functions
    • Global-Function
    • Global-Settings
    • Google-Calendar-Sync
    • ICS
    • Import-Booking
    • Labels
    • License
    • Menus
    • Meta-Boxes
    • Reschedule
    • Resources
    • Search-Widget
    • Special-Price
    • Uninstall
    • Validation
    • Variation-Lockout
    • Vendors
      • Dokan
      • WC-Vendors
    • View-Bookings
  • None

Classes

  • bkap_common
  • bkap_load_scripts_class

Functions

  • bkap_add_days_to_date
  • bkap_array_of_given_date_range
  • bkap_booked_resources
  • bkap_booking_posts_for_resource
  • bkap_calculate_bookings_for_resource
  • bkap_check_resource_booked_in_date_range
  • bkap_delete_event_from_gcal
  • bkap_get_book_arrays
  • bkap_get_booked
  • bkap_get_booked_checkout
  • bkap_get_day_between_Week
  • bkap_get_lockout
  • bkap_get_month_range
  • bkap_get_posted_availability
  • bkap_get_total_timeslot_maximum_booking
  • bkap_get_week_range
  • bkap_insert_event_to_gcal
  • bkap_save_resources
  • bkapSortByPriority
  • get_availability_for_date
  • get_booked_multiple
  • get_bookings_for_date
  • get_bookings_for_range
  • get_date_lockout
  • get_slot_availability
  • get_slot_lockout
  • get_standard_decimal_thousand_separator_price

Class bkap_common

Contains common functions used all over the plugin.

Package: BKAP\Global-Function
Author: Tyche Softwares
Class: bkap_common
Located at bkap-common.php

Methods summary

public static
# bkap_min_date_based_on_AdvanceBookingPeriod( integer $product_id, string $current_time )

Return min date based on the Advance Booking Period.

Return min date based on the Advance Booking Period.

Parameters

$product_id
  • Product ID for which calculations need to be done.
$current_time
  • UNIX TimeStamp

Returns


$min_date date - 'j-n-Y' format

Since

4.1.0
public static boolean
# bkap_check_timeslot_for_weekday( integer $product_id, string $start_date )

Return true/false based on the timeslot available for selected date.

Return true/false based on the timeslot available for selected date.

Parameters

$product_id
  • Product ID
$start_date
  • Date for which availability is being checked

Returns

boolean

Since

4.3.0
public static string
# bkap_ajax_on_select_date( integer $product_id )

Return function name to be executed when multiple time slots are enabled.

Return function name to be executed when multiple time slots are enabled.

This function returns the function name to display the timeslots on the frontend if type of timeslot is Multiple for multiple time slots addon.

Parameters

$product_id

Returns

string

Since

2.0
public static array
# bkap_get_betweendays( string $StartDate, string $EndDate, $format = 'd-n-Y' )

Return an array of dates that fall in a date range

Return an array of dates that fall in a date range

This function returns an array of dates that falls in a date range in the d-n-Y format.

Parameters

$StartDate
d-n-Y format
$EndDate
d-n-Y format
$format

Returns

array
$Days - array of dates within the range

Since

2.0
public static array
# bkap_get_betweendays_when_flat( string $StartDate, string $EndDate, $pro_id, $format = 'd-n-Y' )

Return an array of dates that fall in a date range

Return an array of dates that fall in a date range

This function returns an array of dates that falls in a date range in the d-n-Y format including the end date if the flat charge per day is enable.

Parameters

$StartDate
d-n-Y format
$EndDate
d-n-Y format
$pro_id
$format

Returns

array
$Days - array of dates within the range

Since

4.7.0
public static integer
# bkap_get_product_id( integer $product_id )

Send the Base language product ID

Send the Base language product ID

This function has been written as a part of making the Booking plugin compatible with WPML. It returns the base language Product ID when WPML is enabled.

Parameters

$product_id

Returns

integer
$base_product_id

Since

2.0
public static integer
# bkap_get_variation_id( integer $variation_id )

Send the Base language Variation ID

Send the Base language Variation ID

This function has been written as a part of making the Booking plugin compatible with WPML. It returns the base language Variation ID when WPML is enabled.

Parameters

$variation_id
  • Variation ID

Returns

integer
Variation ID

Since

4.5.1
public static integer
# bkap_get_custom_post( integer $product_id, integer $variation_id, string $product_type )

Returns the selected setting of Multicurrency at product level from WPML plugin when it is active

Returns the selected setting of Multicurrency at product level from WPML plugin when it is active

This function has been written as a part of making the Booking plugin compatible with WPML. It returns the selected setting of Multicurrency at product level from WPML plugin when it is active

Parameters

$product_id
  • Product ID
$variation_id
  • Variation ID
$product_type
  • Product Type

Returns

integer
$custom_post

Since

4.3.0
public static integer
# bkap_get_price( integer $product_id, integer $variation_id, string $product_type, string $check_in = '', string $check_out = '' )

Return Woocommerce price

Return Woocommerce price

This function returns the Woocommerce price applicable for a product. Different Product Types such as simple, variable, bundles etc. have been taken into account here.

Parameters

$product_id
$variation_id
$product_type
  • simple, bundled, composite, variation etc.
$check_in
  • booking start date
$check_out
  • booking end date

Returns

integer
$price

Since

4.3.0
public static
# get_bundle_price( $price, integer $product_id, integer $variation_id )

Calculates the Total Bundle Price

Calculates the Total Bundle Price

The bundle price + the Individual child price based on the bundle settings

Parameters

$price
Bundle Price
$product_id
  • Product ID
$variation_id
  • Variation ID

Returns


$price - Final Bundle Price

Since

4.3.0
public static integer
# get_composite_price( integer $price, integer $product_id, integer $variation_id )

Calculates the Total Composite Price

Calculates the Total Composite Price

The composite price + the Individual child price based on the product settings

Parameters

$price
$product_id
$variation_id

Returns

integer
$price

Since

4.7.0
public static string
# bkap_get_product_type( $product_id )

Return product type

Return product type

Returns the Product type based on the ID received

Returns

string
$product_type

Since

4.2.0

Params

integer $product_id
public static integer
# woo_product_addons_compatibility_cart( integer $diff_days, array $cart_item_meta, integer $product_quantity )

Returns the WooCommerce Product Addons Options total

Returns the WooCommerce Product Addons Options total

This function returns the WooCommerce Product Addons options total selected by a user for a given product.

Parameters

$diff_days
Number of days between start and end. 1 in case of single days
$cart_item_meta
Cart Item Meta array
$product_quantity
Product Quantity

Returns

integer
Total Price after calculations

Since

4.5.0 added $product_quantity variable
public static boolean
# bkap_product_requires_confirmation( integer $product_id )

Checks if the product requires booking confirmation from admin

Checks if the product requires booking confirmation from admin

If the Product is a bookable product and requires confirmation, returns true else returns false

Parameters

$product_id

Returns

boolean

Since

2.5
public static boolean
# bkap_cart_requires_confirmation( )

Checks if Cart contains bookable products that require confirmation

Checks if Cart contains bookable products that require confirmation

Returns true if Cart contains any bookable products that require confirmation, else returns false.

Returns

boolean

Since

2.5
public static boolean
# bkap_order_requires_confirmation( WC_Order $order )

Checks if an order contains products that require admin confirmation.

Checks if an order contains products that require admin confirmation.

Parameters

$order

Returns

boolean

Since

2.5
public static stdClass
# get_bkap_booking( integer $item_id )

Returns a booking object containing booking details for a bookable item in an order. Used in Confirmation/Cancellation emails

Returns a booking object containing booking details for a bookable item in an order. Used in Confirmation/Cancellation emails

Parameters

$item_id

Returns

stdClass

Since

2.5
public static integer
# bkap_get_number_of_slots( integer $product_id, string $date_check_in )

Returns the number of time slots present for a date. The date needs to be passed in the j-n-Y format

Returns the number of time slots present for a date. The date needs to be passed in the j-n-Y format

Parameters

$product_id
$date_check_in

Returns

integer
$number_of_slots

Since

2.6
public static boolean
# bkap_get_bookable_status( integer $product_id )

Checks whether a product is bookable or no

Checks whether a product is bookable or no

Parameters

$product_id

Returns

boolean
$bookable

Since

2.6
public static array
# get_woocommerce_product_list( boolean $variations = true )

Get all products and variations and sort alphbetically, return in array (title, id)

Get all products and variations and sort alphbetically, return in array (title, id)

Parameters

$variations
  • True if variations for a product also need to be returned, else false

Returns

array
$full_product_list

Since

2.6
public static array
# get_woocommerce_product_list_f_p( )

Get all products and sort alphbetically. Return in array (title, id, fixed block option, price range option)

Get all products and sort alphbetically. Return in array (title, id, fixed block option, price range option)

Returns

array
$full_product_list

Since

4.1.0
public static
# bkap_update_order_item_meta( integer $item_id, integer $product_id, array $booking_data, boolean $gcal_import = false )

Adds item meta for bookable products when an order is placed

Adds item meta for bookable products when an order is placed

Parameters

$item_id
$product_id
$booking_data
$gcal_import

Since

4.1.0
public static array
# bkap_get_total_bookings_to_export( integer $user_id )

Creates a list of orders that are not yet exported to GCal

Creates a list of orders that are not yet exported to GCal

Parameters

$user_id
  • To check if it's being run for a tour operator

Returns

array
$total_orders_to_export

Since

2.6
public static array
# get_currency_args( )

Returns an array with currency data

Returns an array with currency data

Returns

array
$wc_price_args - array of currency data such as currency, separators etc.

Since

2.6.3
public static
# bkap_add_notice( )

The below function adds notices to be displayed. It displays the notices as well using print notices function. This helps in displaying notices without having to reload the page.

The below function adds notices to be displayed. It displays the notices as well using print notices function. This helps in displaying notices without having to reload the page.

Since

2.9
public static
# bkap_clear_notice( )

This function clears any notices set in the session

This function clears any notices set in the session

Since

2.9
public static object
# dateTimeDiff( object $date1, object $date2 )

This function will return the differance days between two dates. An object similar to the one returned by the new DateTime() is returned.

This function will return the differance days between two dates. An object similar to the one returned by the new DateTime() is returned.

Parameters

$date1
  • Date 1
$date2
  • Date 2

Returns

object
$result - contains difference details between 2 dates

Since

3.1
public static array
# _date_range_limit( integer $start, integer $end, integer $adj, string $a, string $b, array $result )

Calculates the difference between the dates. Called from dateTimeDiff()

Calculates the difference between the dates. Called from dateTimeDiff()

Parameters

$start
$end
$adj
adj
$a
$b
$result

Returns

array
$result

Since

3.1
public static object
# _date_range_limit_days( array $base, object $result )

Calculates the Ramge Limit. Called from dateTimeDiff()

Calculates the Ramge Limit. Called from dateTimeDiff()

Parameters

$base
$result

Returns

object
$result

Since

3.1
public static array
# _date_normalize( array $base, object $result )

Normalize the Date. Called from dateTimeDiff()

Normalize the Date. Called from dateTimeDiff()

Parameters

$base
$result

Returns

array
$result

Since

3.1
public static boolean
# bkap_check_date_set( string $date )

Ensures whether the date is a future date. Used when exporting bookings to Google Calendar

Ensures whether the date is a future date. Used when exporting bookings to Google Calendar

Parameters

$date
  • Booking Date

Returns

boolean
$future_date_set

Since

2.6
public static boolean
# bkap_cart_contains_bookable( )

Returns TRUE if a cart contains bookable products

Returns TRUE if a cart contains bookable products

Returns

boolean
$contains_bookable

Since

2.5
public static array
# get_bkap_booking_statuses( )

Create and return an array of valid Booking statuses

Create and return an array of valid Booking statuses

Returns

array
$allowed_status - booking statuses

Since

4.0.0
public static array
# get_bkap_event_statuses( )

Create and return an array of valid event statuses - For Imported Events from Google Calendar

Create and return an array of valid event statuses - For Imported Events from Google Calendar

Returns

array
$allowed_status - event statuses

Since

4.0.0
public static integer
# get_booking_id( integer $item_id )

Fetches the Booking Post ID using the Item ID

Fetches the Booking Post ID using the Item ID

Parameters

$item_id
  • Item ID

Returns

integer
booking ID from wp_post

Since

4.0.0
public static boolean
# bkap_check_specific_date_has_timeslot( integer $product_id )

This function Checks if the Specific Date contains time slot or not.

This function Checks if the Specific Date contains time slot or not.

Parameters

$product_id

Returns

boolean
$timeslots_present

Since

4.2
public static integer
# bkap_get_parent_id( integer $child_id )

The function checks if the passed product ID is listed as a child in _children postmeta.

The function checks if the passed product ID is listed as a child in _children postmeta.

If yes, then it returns the parent product ID else it returns 0

Parameters

$child_id

Returns

integer
$parent_id

Since

3.5.2
public static WC_Product
# bkap_get_product( integer|string $product_id )

Get WooCommerce Product object

Get WooCommerce Product object

Parameters

$product_id
Product ID

Returns

WC_Product
Product Object

Since

4.1.1
public static array
# bkap_get_cart_item_addon_data( array $cart_item )

Get Gravity Forms Addon Data for pricing purpose from cart item

Get Gravity Forms Addon Data for pricing purpose from cart item

Parameters

$cart_item
Cart Item Array

Returns

array
Addon Pricing array

Since

4.2
public static float
# bkap_get_wpa_cart_totals( array $cart_item )

Get WooCommerce Product addons prices

Get WooCommerce Product addons prices

Parameters

$cart_item
Cart Item

Returns

float
Addon Total

Since

4.2
public static array
# bkap_get_order_item_addon_data( WC_Order_Item $order_item )

Get Addon data for pricing purpose from Order Item data Includes Gravity Form Addons as well as WooCommerce Product Addons

Get Addon data for pricing purpose from Order Item data Includes Gravity Form Addons as well as WooCommerce Product Addons

Parameters

$order_item
Order Item object

Returns

array
Addon pricing array

Since

4.2
public static boolean
# bkap_is_cartitem_composite( array $cart_item )

Check if cart item passed is composite in some parent product

Check if cart item passed is composite in some parent product

Parameters

$cart_item
Cart Item Array

Returns

boolean

Since

4.7.0
public static boolean
# bkap_is_orderitem_composite( WC_Order_Item $item )

Check if order item is composite in some parent product

Check if order item is composite in some parent product

Parameters

$item
Order Item object

Returns

boolean

Since

4.7.0
public static boolean
# bkap_is_cartitem_bundled( array $cart_item )

Check if cart item passed is bundled in some parent product

Check if cart item passed is bundled in some parent product

Parameters

$cart_item
Cart Item Array

Returns

boolean

Since

4.2
public static boolean
# bkap_is_orderitem_bundled( WC_Order_Item $item )

Check if order item is bundled in some parent product

Check if order item is bundled in some parent product

Parameters

$item
Order Item object

Returns

boolean

Since

4.2
public static array
# bkap_bundle_add_to_cart_config( WC_Product $product )

Get cart configuration for Bundled Products

Get cart configuration for Bundled Products

Parameters

$product
Product Object

Returns

array
Cart Config

Since

4.2
public static
# get_booking_ids_from_order_id( integer $order_id )

Returns an array of Booking IDs for the order ID sent.

Returns an array of Booking IDs for the order ID sent.

Parameters

$order_id

Since

4.2.0
public static array
# bkap_get_bookings( string|array $post_status, array $additional_args = '' )

Returns an array of all bookings for passed status.

Returns an array of all bookings for passed status.

Parameters

$post_status
  • Valid Booking Statuses
$additional_args
  • that can be added to the query.

Returns

array
$bookings_array - Bookings present in wp_posts

Since

4.2.0
public static string
# get_mapped_status( string $status )

Returns the Status Label

Returns the Status Label

Parameters

$status
  • Booking status

Returns

string

Since

4.2.0
API documentation generated by ApiGen