| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
// custom validation filter |
| 4 |
function eshb_validate_for_required ( $value ) { |
| 5 |
// return error message if empty |
| 6 |
if ( empty( $value ) ) { |
| 7 |
return esc_html__( 'This field is required.', 'easy-hotel' ); |
| 8 |
} |
| 9 |
}; |
| 10 |
|
| 11 |
include 'accomodation/accomodation.php'; |
| 12 |
include 'session/session.php'; |
| 13 |
include 'service/service.php'; |
| 14 |
include 'booking/booking.php'; |
| 15 |
include 'coupon/coupon.php'; |
| 16 |
include 'booking-request/booking-request.php'; |
| 17 |
include 'payment/payment.php'; |
| 18 |
|
| 19 |
|
| 20 |
add_action( 'plugins_loaded', function(){ |
| 21 |
|
| 22 |
|
| 23 |
// add nonce param to edit url |
| 24 |
add_filter( 'get_edit_post_link', function( $link, $post_id, $context ) { |
| 25 |
|
| 26 |
// Check for your custom post type (optional) |
| 27 |
if ( in_array(get_post_type( $post_id ), ['eshb_booking', 'eshb_payment', 'eshb_coupon', 'eshb_booking_request', 'eshb_service', 'eshb_session']) ) { |
| 28 |
// Add your custom parameter |
| 29 |
$nonce_action = ESHB_Helper::generate_secure_nonce_action('eshb_global_nonce_action'); |
| 30 |
$link = add_query_arg( 'nonce', wp_create_nonce($nonce_action), $link ); |
| 31 |
} |
| 32 |
|
| 33 |
return $link; |
| 34 |
}, 10, 3 ); |
| 35 |
} ); |
| 36 |
|