'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo 'window.location.href="' . $url . '";'; echo ''; echo ''; } // ===================================================================================================================== // == Admin Menu Pages and URLs == // ===================================================================================================================== /** * Check if we edit or create a new page in WordPress ? * @return bool */ function wpbc_is_on_edit_page() { // FixIn: 9.9.0.39. // Elementor. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( ( ! empty( $_REQUEST['action'] ) ) && ( ( 'elementor' === $_REQUEST['action'] ) || ( 'elementor_ajax' === $_REQUEST['action'] ) ) ) { return false; } if ( ( ! empty( $GLOBALS['pagenow'] ) ) && ( is_admin() ) ) { if ( ( 'post.php' === $GLOBALS['pagenow'] ) // Edit - Post / Page. || ( 'post-new.php' === $GLOBALS['pagenow'] ) // Add New - Post / Page. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing // || ( ( 'admin-ajax.php' === $GLOBALS['pagenow'] ) && ( ! empty( $_REQUEST['action'] ) ) && ( 'elementor_ajax' === $_REQUEST['action'] ) ) // Elementor Edit page - Ajax. ) { return true; } } return false; } /** * Get URL to specific Admin Menu page * * @param string $menu_type - { booking | add | resources | settings } * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_menu_url( $menu_type, $is_absolute_url = true, $is_old = true) { $is_old = false; switch ( $menu_type) { case 'booking': // Bookings. case 'bookings': case 'booking-listing': case 'bookings-listing': case 'listing': case 'overview': case 'calendar-overview': case 'timeline': $link = 'wpbc'; break; case 'add': // Add New Booking. case 'add-bookings': case 'add-booking': case 'new': case 'new-bookings': case 'new-booking': $link = 'wpbc&tab=add-booking'; break; case 'availability': $link = 'wpbc-availability'; break; case 'price': $link = 'wpbc-prices'; break; case 'resources': // Resources. case 'booking-resources': $link = 'wpbc-resources'; break; case 'settings': // Settings. case 'options': $link = 'wpbc-settings'; break; case 'setup': // Setup. $link = 'wpbc-setup'; break; default: // Bookings. $link = 'wpbc'; break; } if ( $is_absolute_url ) { $link = admin_url( 'admin.php' ) . '?page=' . $link ; } return $link; } // --------------------------------------------------------------------------------------------------------------------- // == URL of Admin Menu pages == // --------------------------------------------------------------------------------------------------------------------- /** * Get URL of Booking Listing or Calendar Overview page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_bookings_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'booking', $is_absolute_url, $is_old ); } /** * Get URL of Booking > Availability page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_availability_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'availability', $is_absolute_url, $is_old ); } /** * Get URL of Booking > Availability > General Availability page. * * @param boolean $is_absolute_url Absolute or relative url { default: true }. * @param boolean $is_old Legacy compatibility flag. * * @return string URL to General Availability page. */ function wpbc_get_general_availability_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_availability_url( $is_absolute_url, $is_old ) . '&tab=general_availability'; } /** * Get URL of Booking > Availability > Time Slots Availability page. * * @param boolean $is_absolute_url Absolute or relative url { default: true }. * @param boolean $is_old Legacy compatibility flag. * * @return string URL to Time Slots Availability page. */ function wpbc_get_time_slots_availability_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_availability_url( $is_absolute_url, $is_old ) . '&tab=time_slots_availability'; } /** * Get URL of Booking > Availability page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_price_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'price', $is_absolute_url, $is_old ); } /** * Get URL of Booking > Add booking page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_new_booking_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'add', $is_absolute_url, $is_old ); } /** * Get the normalized administrator edit-booking destination. * * Existing installations and malformed stored values retain the popup workflow. * The optional argument keeps normalization independently testable without * changing a saved WordPress option. * * @param null|string $stored_mode Optional stored mode. Null loads the site option. * * @return string Either `popup` or `add_booking_page`. */ function wpbc_get_booking_admin_edit_mode( $stored_mode = null ) { if ( null === $stored_mode ) { $stored_mode = get_bk_option( 'booking_admin_edit_booking_mode' ); } $stored_mode = sanitize_key( (string) $stored_mode ); return in_array( $stored_mode, array( 'popup', 'add_booking_page' ), true ) ? $stored_mode : 'popup'; } /** * Check whether administrator edit links should open the dedicated Add Booking page. * * @param null|string $stored_mode Optional stored mode used for independent testing. * * @return bool True for the dedicated page; false for the default popup. */ function wpbc_is_booking_admin_edit_page_enabled( $stored_mode = null ) { return 'add_booking_page' === wpbc_get_booking_admin_edit_mode( $stored_mode ); } /** * Build the authorized administrator URL for editing one Booking on Add Booking. * * The destination page retains its existing capability, MultiUser ownership, * Booking hash, Resource, and Booking Form checks. This helper only centralizes * the released URL contract used by Booking Listing and Timeline links. * * @param int $resource_id Booking Resource ID. * @param string $booking_hash Booking edit hash. * @param string $booking_form Optional custom Booking Form name. * * @return string Sanitized Add Booking edit URL, or an empty string when required values are missing. */ function wpbc_get_booking_admin_edit_url( $resource_id, $booking_hash, $booking_form = '' ) { $resource_id = absint( $resource_id ); $booking_hash = sanitize_text_field( (string) $booking_hash ); $booking_form = sanitize_text_field( (string) $booking_form ); if ( $resource_id < 1 || '' === $booking_hash ) { return ''; } $query_args = array( 'booking_type' => $resource_id, 'booking_hash' => $booking_hash, 'parent_res' => 1, ); if ( '' !== $booking_form ) { $query_args['booking_form'] = $booking_form; } return esc_url_raw( add_query_arg( $query_args, wpbc_get_new_booking_url( true, false ) ) ); } /** * Get URL of Booking > Resources page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_resources_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'resources', $is_absolute_url, $is_old ); } /** * Get URL of Booking > Resources > Capacity page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_resource_capacity_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_resources_url( $is_absolute_url, $is_old ) . '&tab=capacity'; } /** * Get URL of Booking > Settings page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_settings_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'settings', $is_absolute_url, $is_old ); } /** * Get URL of Booking > Settings > Calendar page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_settings_calendar_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_settings_url( $is_absolute_url, $is_old ) . '&tab=calendar_settings'; } /** * Get URL of Booking > Settings > Appearance / Theme page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_settings_themes_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_settings_url( $is_absolute_url, $is_old ) . '&tab=themes'; } /** * Get URL of Booking > Settings > Form Messages page. * * @param boolean $is_absolute_url Absolute or relative URL. * @param boolean $is_old Legacy menu URL style. * @return string */ function wpbc_get_settings_messages_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_settings_url( $is_absolute_url, $is_old ) . '&tab=form_messages'; } /** * Get URL of Booking > Setup page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbc_get_setup_wizard_page_url( $is_absolute_url = true, $is_old = true ) { return wpbc_get_menu_url( 'setup', $is_absolute_url, $is_old ); } // ----------------------------------------------------------------------------------------------------------------- // == Is this specific admin page ? == // --------------------------------------------------------------------------------------------------------------------- /** * Check if this Booking Listing or Calendar Overview page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_this_plugin_page( $server_param = 'REQUEST_URI' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc' ) !== false ) ) { return true; } return false; } /** * Check if this Booking Listing or Calendar Overview page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_bookings_page( $server_param = 'REQUEST_URI' ) { // Old. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'wpdev-booking.phpwpdev-booking' ) !== false ) && ( strpos( $_SERVER[ $server_param ], 'wpdev-booking.phpwpdev-booking-reservation' ) === false ) ) { return true; } // New. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc' ) !== false ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-' ) === false ) ) { return true; } return false; } /** * Check if this Booking > Add booking page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_new_booking_page( $server_param = 'REQUEST_URI' ) { if ( ! is_admin() || empty( $_SERVER[ $server_param ] ) ) { return false; } // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( wpbc_is_new_booking_page_url( $_SERVER[ $server_param ] ) ) { return true; } return false; } /** * Check if a URL points to Booking > Bookings > Add booking. * * @param string $request_uri URL or request URI. * * @return bool */ function wpbc_is_new_booking_page_url( $request_uri ) { $request_uri = (string) $request_uri; return ( ( false !== strpos( $request_uri, 'page=wpbc' ) ) && ( false === strpos( $request_uri, 'page=wpbc-' ) ) && ( false !== strpos( $request_uri, 'tab=add-booking' ) ) ); } /** * Check if this WP Booking Calendar > Settings > Booking Form page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_settings_form_page( $server_param = 'REQUEST_URI' ) { // Regular user overwrite settings. // Match the legacy `form` tab exactly. A substring check also matched newer // tabs whose names start with `form`, such as `form_messages`. // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $request_uri = ! empty( $_SERVER[ $server_param ] ) ? (string) $_SERVER[ $server_param ] : ''; $is_form_tab = (bool) preg_match( '/(?:[?&])tab=form(?:&|$)/', $request_uri ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $is_multiuser_form_tab = class_exists( 'wpdev_bk_multiuser' ) && ! empty( $_REQUEST['tab'] ) && 'form' === $_REQUEST['tab']; if ( is_admin() && false !== strpos( $request_uri, 'page=wpbc-settings' ) && ( $is_form_tab || $is_multiuser_form_tab ) ) { return true; } return false; } /** * Check if this WP Booking Calendar > Settings > Booking Form Builder (BFB) page. * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_settings_bfb_page( $server_param = 'REQUEST_URI' ) { // Regular user overwrite settings. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) !== false ) && ( ( strpos( $_SERVER[ $server_param ], '&tab=builder_booking_form' ) !== false ) || ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $_REQUEST['tab'] ) ) && ( 'builder_booking_form' === $_REQUEST['tab'] ) ) ) ) { return true; } return false; } /** * Check if this WP Booking Calendar > Settings > Appearance / Theme page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_settings_themes_page( $server_param = 'REQUEST_URI' ) { // Regular user overwrite settings. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( false !== strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) ) && ( false !== strpos( $_SERVER[ $server_param ], '&tab=themes' ) ) ) { return true; } return false; } /** * Check if this WP Booking Calendar > Settings > Calendar page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_settings_calendar_page( $server_param = 'REQUEST_URI' ) { // Regular user overwrite settings. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( false !== strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) ) && ( false !== strpos( $_SERVER[ $server_param ], '&tab=calendar_settings' ) ) ) { return true; } return false; } /** * Check if this is WP Booking Calendar > Settings > Form Messages. * * @param string $server_param Server URL parameter. * @return boolean */ function wpbc_is_settings_messages_page( $server_param = 'REQUEST_URI' ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized return is_admin() && ! empty( $_SERVER[ $server_param ] ) && false !== strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) && false !== strpos( $_SERVER[ $server_param ], '&tab=form_messages' ); } /** * Check if this admin page renders a real front-end booking form or calendar preview. * * @return boolean true | false */ function wpbc_is_admin_page_with_frontend_booking_preview() { return ( wpbc_is_new_booking_page() || wpbc_is_settings_form_page() || wpbc_is_settings_themes_page() || wpbc_is_settings_calendar_page() || wpbc_is_settings_messages_page() || wpbc_is_setup_wizard_page() || wpbc_is_builder_booking_form_page() || ( function_exists( 'wpbc_add_appointment_page_is_active' ) && wpbc_add_appointment_page_is_active() ) || ( function_exists( 'wpbc_is_add_booking_modal_on_booking_listing_page' ) && wpbc_is_add_booking_modal_on_booking_listing_page() ) ); } /** * Check if this Booking > Availability page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_availability_page( $server_param = 'REQUEST_URI' ) { // New. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-availability' ) !== false ) ) { return true; } return false; } /** * Check if this Booking > Availability page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_builder_booking_form_page( $server_param = 'REQUEST_URI' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) !== false ) && ( strpos( $_SERVER[ $server_param ], 'tab=builder_booking_form' ) !== false ) ) { return true; } return false; } /** * Check if this Booking > Setup page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_setup_wizard_page( $server_param = 'REQUEST_URI' ) { // FixIn: 9.8.0.1. // New. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-setup' ) !== false ) ) { return true; } return false; } /** * Check if this Booking > Resources page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_resources_page( $server_param = 'REQUEST_URI' ) { // Old. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'wpdev-booking.phpwpdev-booking-resources' ) !== false ) ) { return true; } // New. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-resources' ) !== false ) ) { return true; } return false; } /** * Check if this Booking > Settings page * * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * * @return boolean true | false */ function wpbc_is_settings_page( $server_param = 'REQUEST_URI' ) { // Old. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'wpdev-booking.phpwpdev-booking-option' ) !== false ) ) { return true; } // New. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( is_admin() ) && ( strpos( $_SERVER[ $server_param ], 'page=wpbc-settings' ) !== false ) ) { return true; } return false; } // ----------------------------------------------------------------------------------------------------------------- // == support == // --------------------------------------------------------------------------------------------------------------------- /** * Transform the REQUEST parameters (GET and POST) into URL * * @param $page_param * @param $exclude_params * @param $only_these_parameters * @param $is_escape_url * @param $only_get * * @return string|null */ function wpbc_get_params_in_url( $page_param , $exclude_params = array(), $only_these_parameters = false, $is_escape_url = true, $only_get = false ){ //FixIn: 8.0.1.101 //Fix: $is_escape_url = false $exclude_params[] = 'page'; $exclude_params[] = 'post_type'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $page_param = $_GET['page']; } $get_paramaters = array( 'page' => $page_param ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $check_params = ( $only_get ) ? $_GET : $_REQUEST; foreach ( $check_params as $prm_key => $prm_value ) { // Skip parameters arrays, like $_GET['rvaluation_to'] = Array ( [0] => 6, [1] => 14, [2] => 14 ) if ( ( is_string( $prm_value ) ) || ( is_numeric( $prm_value ) ) ){ // Check about Too long parameters, if it exists then reset it. if ( strlen( $prm_value ) > 1000 ) { $prm_value = ''; } if ( ! in_array( $prm_key, $exclude_params ) ) { if ( ( $only_these_parameters === false ) || ( in_array( $prm_key, $only_these_parameters ) ) ) { $get_paramaters[ $prm_key ] = $prm_value; } } } } $url = admin_url( add_query_arg( $get_paramaters , 'admin.php' ) ); if ( $is_escape_url ) { $url = esc_url_raw( $url ); // FixIn: 8.1.1.7. } return $url; } function wpbc_left_vertival_nav__get_tab_url( $page_tag, $tab_name, $subtab_name = false, $tags = array( 'tab' => 'tab', 'subtab' => 'subtab' ) ) { if ( false === $subtab_name ) { return esc_url( admin_url( add_query_arg( array( 'page' => $page_tag, $tags['tab'] => $tab_name, ), 'admin.php' ) ) ); } else { return esc_url( admin_url( add_query_arg( array( 'page' => $page_tag, $tags['tab'] => $tab_name, $tags['subtab'] => $subtab_name, ), 'admin.php' ) ) ); } } /** * Get back URL for going from edit season filter or rate to specfic main page. * * @return string|null */ function wpbc_get_back_button_url__for_seasons() { $page_params_arr = array( 'page' => 'wpbc-availability', 'page_num' => 1, ); if ( ! empty( $_REQUEST['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing $page_params_arr['page'] = sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing } if ( ! empty( $_REQUEST['tab'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing $page_params_arr['tab'] = sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing } if ( ! empty( $_REQUEST['page_num'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing $page_params_arr['page_num'] = intval( $_REQUEST['page_num'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing } $back_url = admin_url( add_query_arg( $page_params_arr, 'admin.php' ) ); return $back_url; }