set_offer_status( $vefmb_offer_id, $vefmb_new_status );
$vefmb_notice = 'published' === $vefmb_new_status
? __( 'Offer published. Visitors can now book it.', 'vefmultibooking' )
: __( 'Offer put back to draft. Visitors no longer see it.', 'vefmultibooking' );
}
}
// The form that sets what the site rents out is saved before the page is drawn (VEFMB_Admin_Flow::maybe_save_display()).
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only: only shows the confirmation.
if ( isset( $_GET['vefmb_display_saved'] ) ) {
$vefmb_notice = __( 'Saved. The words of the menu follow your choice.', 'vefmultibooking' );
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only: selects the screen.
$vefmb_view = isset( $_GET['view'] ) ? sanitize_key( wp_unslash( $_GET['view'] ) ) : '';
?>
list_offers(),
static function ( $offer ) {
return 'archived' !== ( $offer['status'] ?? '' );
}
);
$vefmb_settings = VEFMB_Settings::get_all();
$vefmb_pay = ( '' !== trim( (string) ( $vefmb_settings['stripe_test_secret_key'] ?? '' ) ) || '' !== trim( (string) ( $vefmb_settings['stripe_live_secret_key'] ?? '' ) )
|| '' !== trim( (string) ( $vefmb_settings['paypal_sandbox_client_id'] ?? '' ) ) || '' !== trim( (string) ( $vefmb_settings['paypal_live_client_id'] ?? '' ) ) );
?>
list_offer_resources( $vefmb_offer_id );
$vefmb_issues = $vefmb_offers_service->get_bookability_issues( $vefmb_offer_id );
$vefmb_is_pub = 'published' === $vefmb_offer['status'];
// Points of the offer, then product by product: what is missing and where to solve it.
$vefmb_offer_points = array_values(
array_filter(
(array) ( VEFMB_Readiness::everything()['offers'][ $vefmb_offer_id ] ?? array() ),
static function ( $point ) {
return 'resource_not_ready' !== $point['code'];
}
)
);
?>
get_resource( (int) $vefmb_link['resource_id'] );
if ( ! $vefmb_resource ) {
continue;
}
$vefmb_res_points = (array) ( VEFMB_Readiness::everything()['resources'][ (int) $vefmb_resource['id'] ] ?? array() );
$vefmb_res_alert = array_filter(
$vefmb_res_points,
static function ( $point ) {
return VEFMB_Readiness::TIP !== $point['level'];
}
);
?>
⚠️
$vefmb_step ) {
if ( 'todo' === ( $vefmb_statuses[ $vefmb_slug ] ?? 'todo' ) && empty( $vefmb_step['optional'] ) ) {
$vefmb_next = $vefmb_slug;
break;
}
}
/**
* State of one step of an item, from the points found for it.
*
* @param string $slug Step slug.
* @param array
> $points Points of the item.
* @return string done, warn or todo.
*/
$vefmb_pill_state = static function ( $slug, array $points ) {
$here = array_filter(
$points,
static function ( $point ) use ( $slug ) {
return $point['step'] === $slug;
}
);
$worst = VEFMB_Readiness::worst( $here );
return VEFMB_Readiness::ERROR === $worst ? 'todo' : ( VEFMB_Readiness::WARNING === $worst ? 'warn' : 'done' );
};
?>
list_offers() as $vefmb_prog_offer ) {
++$vefmb_offer_total;
if ( 'published' === $vefmb_prog_offer['status'] && ! $vefmb_offers_service->get_bookability_issues( $vefmb_prog_offer['id'] ) ) {
++$vefmb_offer_ready;
}
}
if ( $vefmb_offer_total ) :
$vefmb_pct = (int) round( 100 * $vefmb_offer_ready / $vefmb_offer_total );
?>
list_resources();
if ( ! $vefmb_list ) :
?>
list_offers(),
static function ( $offer ) {
return 'archived' !== ( $offer['status'] ?? '' );
}
);
if ( ! $vefmb_offer_list ) :
?>