| 1 |
<?php |
| 2 |
/** Repository bootstrap. @package Booking Calendar */ |
| 3 |
if ( ! defined( 'ABSPATH' ) ) { exit; } |
| 4 |
require_once __DIR__ . '/class-wpbc-appointment-services-repository.php'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Return the shared native Appointment Services repository. |
| 8 |
* |
| 9 |
* @return WPBC_Appointment_Services_Repository Native repository instance. |
| 10 |
*/ |
| 11 |
function wpbc_appointment_services_repository() { |
| 12 |
static $repository = null; |
| 13 |
if ( null === $repository ) { $repository = new WPBC_Appointment_Services_Repository(); } |
| 14 |
return $repository; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Supply the native repository when an extension has not provided one. |
| 19 |
* |
| 20 |
* @param mixed $provider Provider selected by an earlier filter callback. |
| 21 |
* |
| 22 |
* @return object Existing provider or the native repository. |
| 23 |
*/ |
| 24 |
function wpbc_appointment_services_use_native_repository( $provider ) { |
| 25 |
return $provider ? $provider : wpbc_appointment_services_repository(); |
| 26 |
} |
| 27 |
add_filter( 'wpbc_appointment_services_data_provider', 'wpbc_appointment_services_use_native_repository', 10 ); |
| 28 |
|