| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version 1.0 |
| 4 |
* @package Booking Calendar Shortcodes Config |
| 5 |
* @subpackage Shortcodes Content - 'Search Form': [bookingsearch searchresults='https://servcer.com/search-form/' searchresultstitle='{searchresults} Result(s) Found' noresultstitle='Nothing Found'] |
| 6 |
* @category Shortcodes |
| 7 |
* |
| 8 |
* @author wpdevelop |
| 9 |
* @link https://wpbookingcalendar.com/ |
| 10 |
* @email info@wpbookingcalendar.com |
| 11 |
* |
| 12 |
* @modified 2024-03-05 |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
// ===================================================================================================================== |
| 20 |
// Shortcode [bookingsearch searchresults='https://servcer.com/search-form/' searchresultstitle='{searchresults} Result(s) Found' noresultstitle='Nothing Found'] |
| 21 |
// ===================================================================================================================== |
| 22 |
|
| 23 |
/** |
| 24 |
* Content of PopUp - for shortcode [bookingsearch] |
| 25 |
* |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
function wpbc_shortcode_config__content__bookingsearch() { |
| 29 |
|
| 30 |
$shortcode_name = 'bookingsearch'; |
| 31 |
|
| 32 |
?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php |
| 33 |
|
| 34 |
wpbc_shortcode_config__bookingsearch__top_tabs(); |
| 35 |
|
| 36 |
// 'General' -------------------------------------------------------------------------------------------------- |
| 37 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general"><?php |
| 38 |
|
| 39 |
//-------------------------------------------------------------------------------------------------------------- |
| 40 |
// 'Upgrade to Pro' widget |
| 41 |
//-------------------------------------------------------------------------------------------------------------- |
| 42 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 43 |
'id' => 'widget_wpbc_dismiss__booking_search', |
| 44 |
'dismiss_css_class' => '.wpbc_dismiss__booking_search', |
| 45 |
'blured_in_versions' => array( 'free', 'ps', 'bs', 'bm' ), |
| 46 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#search' ), |
| 47 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 48 |
'versions' => 'Business Large, MultiUser versions', |
| 49 |
'css' => 'transform: translate(0) translateY(120px);' |
| 50 |
) ); |
| 51 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 52 |
echo $upgrade_content_arr['content']; |
| 53 |
|
| 54 |
//-------------------------------------------------------------------------------------------------------------- |
| 55 |
// Real Content |
| 56 |
//-------------------------------------------------------------------------------------------------------------- |
| 57 |
|
| 58 |
?><table class="form-table wpbc_dismiss__booking_search <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"><tbody><?php |
| 59 |
|
| 60 |
// Select 'Search Form' | 'Search Results' |
| 61 |
wpbc_shortcode_config_fields__searchform__searchresults( $shortcode_name . '_wpbc_search_form_results', $shortcode_name ); |
| 62 |
|
| 63 |
wpbc_shortcode_config_fields__searchresults_new_page( $shortcode_name . '_wpbc_search_new_page', $shortcode_name ); |
| 64 |
|
| 65 |
// FixIn: 10.0.0.41. |
| 66 |
// wpbc_shortcode_config_fields__searchavailability_text_header( $shortcode_name . '_wpbc_search_header', $shortcode_name ); |
| 67 |
// wpbc_shortcode_config_fields__searchavailability_text_nothing_found( $shortcode_name . '_wpbc_search_nothing_found', $shortcode_name ); |
| 68 |
|
| 69 |
wpbc_shortcode_config_fields__searchavailability_only_for_users( $shortcode_name . '_wpbc_search_for_users', $shortcode_name ); |
| 70 |
|
| 71 |
?></tbody></table> |
| 72 |
</div><?php |
| 73 |
|
| 74 |
|
| 75 |
?> |
| 76 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 77 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 78 |
<span class="in-button-text">‹</span> |
| 79 |
</a> |
| 80 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 81 |
<span class="in-button-text">›</span> |
| 82 |
</a> |
| 83 |
</div> |
| 84 |
<?php |
| 85 |
|
| 86 |
?></div><?php |
| 87 |
|
| 88 |
wpbc_clear_div(); |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
/** |
| 93 |
* Top Tabs for shortcode [booking ...] |
| 94 |
* @return void |
| 95 |
*/ |
| 96 |
function wpbc_shortcode_config__bookingsearch__top_tabs(){ |
| 97 |
|
| 98 |
$shortcode_name = 'booking'; |
| 99 |
|
| 100 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 101 |
|
| 102 |
$js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 103 |
. "jQuery(this).addClass('nav-tab-active');" |
| 104 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 105 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 106 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 107 |
|
| 108 |
wpbc_bs_display_tab( array( |
| 109 |
'title' => __('Search Availability', 'booking') |
| 110 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 111 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();" |
| 112 |
, 'font_icon' => 'menu_icon icon-1x wpbc-bi-search' |
| 113 |
, 'default' => true |
| 114 |
) ); |
| 115 |
// wpbc_bs_display_tab( array( |
| 116 |
// 'title' => __('Advanced', 'booking') |
| 117 |
// // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 118 |
// , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();" |
| 119 |
// , 'font_icon' => 'wpbc_icn_tune' |
| 120 |
// , 'default' => false |
| 121 |
// |
| 122 |
// ) ); |
| 123 |
|
| 124 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
// ===================================================================================================================== |
| 130 |
// Fields |
| 131 |
// ===================================================================================================================== |
| 132 |
|
| 133 |
|
| 134 |
/** |
| 135 |
* Shortcode Fields: View Mode: |
| 136 |
* |
| 137 |
* @param $id |
| 138 |
* @param $group_key |
| 139 |
* |
| 140 |
* @return void |
| 141 |
*/ |
| 142 |
function wpbc_shortcode_config_fields__searchform__searchresults( $id , $group_key ){ |
| 143 |
|
| 144 |
$optiopns_for_search = array(); |
| 145 |
$optiopns_for_search['bookingsearch'] = array( 'title' => __( 'Search form', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_single' ) ); |
| 146 |
$optiopns_for_search['bookingsearchresults'] = array( 'title' => __( 'Search results ', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_single' ) ); |
| 147 |
|
| 148 |
WPBC_Settings_API::field_radio_row_static( $id |
| 149 |
, array( |
| 150 |
'type' => 'radio' |
| 151 |
, 'title' => __('Select type of shortcode', 'booking') |
| 152 |
, 'description' => ''//__('Select type of view format.' ,'booking') |
| 153 |
, 'description_tag' => 'span' |
| 154 |
, 'label' => '' |
| 155 |
, 'multiple' => false |
| 156 |
, 'group' => $group_key |
| 157 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed0 ' . $id . '_wpbc_sc_view_mode' |
| 158 |
, 'class' => '' |
| 159 |
, 'css' => 'margin-right:10px;' |
| 160 |
, 'only_field' => false |
| 161 |
, 'attr' => array() |
| 162 |
, 'value' => 'bookingsearch' |
| 163 |
, 'options' => $optiopns_for_search |
| 164 |
) |
| 165 |
); |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
/** |
| 170 |
* Shortcode Field: Header in search results: '{searchresults} Result(s) Found' |
| 171 |
* |
| 172 |
* @param $id |
| 173 |
* @param $group_key |
| 174 |
* |
| 175 |
* @return void |
| 176 |
*/ |
| 177 |
function wpbc_shortcode_config_fields__searchavailability_text_header ($id , $group_key ){ |
| 178 |
|
| 179 |
WPBC_Settings_API::field_text_row_static( $id |
| 180 |
, array( |
| 181 |
'type' => 'text' |
| 182 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' . '{searchresults} ' . __('Result(s) Found','booking') |
| 183 |
, 'title' => __( 'Title of Search results', 'booking' ) |
| 184 |
/* translators: 1: ... */ |
| 185 |
, 'description' => sprintf( __( 'Type the title of Search results. %s - show number of search results', 'booking' ) , '<code>{searchresults}</code>' ) |
| 186 |
, 'description_tag' => 'span' |
| 187 |
, 'label' => '' |
| 188 |
, 'class' => '' |
| 189 |
, 'css' => '' |
| 190 |
, 'group' => $group_key |
| 191 |
, 'tr_class' => $group_key . '_standard_section wpbc_search_availability_form' |
| 192 |
, 'only_field' => false |
| 193 |
, 'attr' => array() |
| 194 |
, 'value' => '{searchresults} ' . __('Result(s) Found','booking') |
| 195 |
) |
| 196 |
); |
| 197 |
|
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
/** |
| 202 |
* Shortcode Field: Header in search results: '{searchresults} Result(s) Found' |
| 203 |
* |
| 204 |
* @param $id |
| 205 |
* @param $group_key |
| 206 |
* |
| 207 |
* @return void |
| 208 |
*/ |
| 209 |
function wpbc_shortcode_config_fields__searchavailability_text_nothing_found ($id , $group_key ){ |
| 210 |
|
| 211 |
WPBC_Settings_API::field_text_row_static( $id |
| 212 |
, array( |
| 213 |
'type' => 'text' |
| 214 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' . __('Nothing Found','booking') |
| 215 |
, 'title' => __( 'Nothing Found Message', 'booking' ) |
| 216 |
, 'description' => __( 'Type the message, when nothing found.', 'booking' ) |
| 217 |
, 'description_tag' => 'span' |
| 218 |
, 'label' => '' |
| 219 |
, 'class' => '' |
| 220 |
, 'css' => '' |
| 221 |
, 'group' => $group_key |
| 222 |
, 'tr_class' => $group_key . '_standard_section wpbc_search_availability_form' |
| 223 |
, 'only_field' => false |
| 224 |
, 'attr' => array() |
| 225 |
, 'value' => __('Nothing Found','booking') |
| 226 |
) |
| 227 |
); |
| 228 |
|
| 229 |
} |
| 230 |
|
| 231 |
|
| 232 |
/** |
| 233 |
* Shortcode Fields: OPTION - "Define External URL for search results" |
| 234 |
* |
| 235 |
* @param $id |
| 236 |
* @param $group_key |
| 237 |
* |
| 238 |
* @return void |
| 239 |
*/ |
| 240 |
function wpbc_shortcode_config_fields__searchresults_new_page( $id , $group_key ){ |
| 241 |
|
| 242 |
// --------------------------------------------------------------------------------------------------------- |
| 243 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled' |
| 244 |
, array( |
| 245 |
'type' => 'checkbox' |
| 246 |
, 'title' => __('Search results on new page', 'booking') |
| 247 |
, 'description' => __('Check this box to show search results on other page', 'booking') |
| 248 |
, 'description_tag' => 'span' |
| 249 |
, 'label' => '' |
| 250 |
, 'class' => '' |
| 251 |
, 'css' => '' |
| 252 |
, 'attr' => array() |
| 253 |
, 'group' => $group_key |
| 254 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed wpbc_search_availability_form' |
| 255 |
, 'only_field' => false |
| 256 |
, 'is_new_line' => false |
| 257 |
, 'value' => false |
| 258 |
) |
| 259 |
); |
| 260 |
|
| 261 |
|
| 262 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed wpbc_search_availability_form <?php echo esc_attr( $id ); ?>_wpbc_sc_searchresults_new_page"> |
| 263 |
<th scope="row" style="vertical-align: middle;"> |
| 264 |
<label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('URL of search results:', 'booking'); ?></label> |
| 265 |
</th> |
| 266 |
<td class=""><fieldset><?php |
| 267 |
|
| 268 |
WPBC_Settings_API::field_text_row_static( $id . '_url' |
| 269 |
, array( |
| 270 |
'type' => 'text' |
| 271 |
, 'placeholder' => get_option('siteurl') . '/search-results/' |
| 272 |
, 'class' => '' |
| 273 |
, 'css' => '' |
| 274 |
, 'only_field' => true |
| 275 |
, 'attr' => array() |
| 276 |
, 'value' => '' |
| 277 |
) |
| 278 |
); |
| 279 |
?><span class="description"> <?php esc_html_e('Type the URL of search results page.' ,'booking'); ?></span></fieldset></td> |
| 280 |
</tr><?php |
| 281 |
|
| 282 |
?><tr style="height:20px;border-bottom: 0px solid #eee;" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_search_availability_form <?php echo esc_attr( $id ); ?>_wpbc_sc_searchresults_new_page"><td colspan="2"></td></tr><?php |
| 283 |
} |
| 284 |
|
| 285 |
|
| 286 |
/** |
| 287 |
* Shortcode Field: Header in search results: '{searchresults} Result(s) Found' |
| 288 |
* |
| 289 |
* @param $id |
| 290 |
* @param $group_key |
| 291 |
* |
| 292 |
* @return void |
| 293 |
*/ |
| 294 |
function wpbc_shortcode_config_fields__searchavailability_only_for_users ($id , $group_key ){ |
| 295 |
|
| 296 |
if ( class_exists( 'wpdev_bk_multiuser' ) ) { |
| 297 |
|
| 298 |
WPBC_Settings_API::field_text_row_static( $id |
| 299 |
, array( |
| 300 |
'type' => 'text' |
| 301 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' . '1,3,99' |
| 302 |
, 'title' => __( 'Search only for users', 'booking' ) |
| 303 |
, 'description' => __( 'Type IDs of the users (separated by comma ",") for searching availability only for these users, or leave it blank for searching for all users.', 'booking' ) |
| 304 |
, 'description_tag' => 'p' |
| 305 |
, 'label' => '' |
| 306 |
, 'class' => '' |
| 307 |
, 'css' => '' |
| 308 |
, 'group' => $group_key |
| 309 |
, 'tr_class' => $group_key . '_standard_section wpbc_search_availability_form' |
| 310 |
, 'only_field' => false |
| 311 |
, 'attr' => array() |
| 312 |
, 'value' => '' |
| 313 |
) |
| 314 |
); |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
|