| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.1 |
| 3 | 3 | * @package Any |
| 4 | 4 | * @category Toolbar. BS UI Elements for Admin Panel. |
| @@ -54,35 +54,40 @@ | ||
| 54 | 54 | ); |
| 55 | 55 | $item_params = wp_parse_args( $item, $default_item_params ); |
| 56 | 56 | |
| 57 | 57 | ?><a class="button <?php |
| 58 | - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . $item_params['hint']['position'] . ' ' : '' ; | |
| 59 | - echo $item_params['class']; | |
| 60 | - ?>" style="<?php echo $item_params['style']; ?>" | |
| 58 | + echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; | |
| 59 | + echo esc_attr( $item_params['class'] ); | |
| 60 | + ?>" style="<?php echo esc_attr( $item_params['style'] ); ?>" | |
| 61 | 61 | <?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 62 | - title="<?php echo esc_js( $item_params['hint']['title'] ); ?>" | |
| 62 | + title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" | |
| 63 | 63 | <?php } ?> |
| 64 | - href="<?php echo $item_params['link']; ?>" | |
| 64 | + href="<?php echo esc_attr( $item_params['link'] ); ?>" | |
| 65 | 65 | <?php if ( ! empty( $item_params['action'] ) ) { ?> |
| 66 | - onclick="javascript:<?php echo $item_params['action']; ?>" | |
| 66 | + onclick="javascript:<?php | |
| 67 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 68 | + echo $item_params['action']; ?>" | |
| 67 | 69 | <?php } ?> |
| 68 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 70 | + <?php | |
| 71 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 72 | + echo wpbc_get_custom_attr( $item_params ); | |
| 73 | + ?> | |
| 69 | 74 | ><?php |
| 70 | 75 | $btn_icon = ''; |
| 71 | 76 | if ( ! empty( $item_params['icon'] ) ) { |
| 72 | 77 | |
| 73 | - if ( substr( $item_params['icon'], 0, 4 ) != 'http') $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon']; | |
| 74 | - else $img_path = $item_params['icon']; | |
| 78 | + if ( substr( $item_params['icon'], 0, 4 ) != 'http') {$img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon'];} | |
| 79 | + else {$img_path = $item_params['icon'];} | |
| 80 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 81 | + $btn_icon = '<img class="menuicons" src="' . $img_path . '" />'; // Img Icon. | |
| 75 | 82 | |
| 76 | - $btn_icon = '<img class="menuicons" src="' . $img_path . '" />'; // Img Icon | |
| 77 | - | |
| 78 | 83 | } elseif ( ! empty( $item_params['font_icon'] ) ) { |
| 79 | 84 | |
| 80 | - $btn_icon = '<i class="menu_icon icon-1x ' . $item_params['font_icon'] . '"></i>'; // Font Icon | |
| 85 | + $btn_icon = '<i class="menu_icon icon-1x ' . $item_params['font_icon'] . '"></i>'; // Font Icon. | |
| 81 | 86 | |
| 82 | 87 | } |
| 83 | 88 | if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'left' ) ){ |
| 84 | - echo $btn_icon ; | |
| 89 | + echo wp_kses_post( $btn_icon ); | |
| 85 | 90 | if (! empty($item_params['title'])) { |
| 86 | 91 | echo ' '; |
| 87 | 92 | } |
| 88 | 93 | } |
| @@ -87,15 +92,15 @@ | ||
| 87 | 92 | } |
| 88 | 93 | } |
| 89 | 94 | // Text |
| 90 | 95 | echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $item_params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>'; |
| 91 | - echo $item_params['title']; | |
| 96 | + echo wp_kses_post( $item_params['title'] ); | |
| 92 | 97 | if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'right' ) ) |
| 93 | 98 | echo ' ' ; |
| 94 | 99 | echo '</span>'; |
| 95 | 100 | |
| 96 | 101 | if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'right' ) ) |
| 97 | - echo $btn_icon; | |
| 102 | + echo wp_kses_post( $btn_icon ); | |
| 98 | 103 | ?></a><?php |
| 99 | 104 | } |
| 100 | 105 | |
| 101 | 106 | |
| @@ -129,19 +134,26 @@ | ||
| 129 | 134 | ); |
| 130 | 135 | $item_params = wp_parse_args( $item, $default_item_params ); |
| 131 | 136 | |
| 132 | 137 | ?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 133 | - id="<?php echo $item_params['id']; ?>" | |
| 134 | - name="<?php echo $item_params['id']; ?>" | |
| 135 | - style="<?php echo $item_params['style']; ?>" | |
| 136 | - class="form-control <?php echo $item_params['class']; ?>" | |
| 137 | - placeholder="<?php echo $item_params['placeholder']; ?>" | |
| 138 | - value="<?php echo $item_params['value']; ?>" | |
| 138 | + id="<?php echo esc_attr( $item_params['id'] ); ?>" | |
| 139 | + name="<?php echo esc_attr( $item_params['id'] ); ?>" | |
| 140 | + style="<?php echo esc_attr( $item_params['style'] ); ?>" | |
| 141 | + class="form-control <?php echo esc_attr( $item_params['class'] ); ?>" | |
| 142 | + placeholder="<?php echo esc_attr( $item_params['placeholder'] ); ?>" | |
| 143 | + value="<?php | |
| 144 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 145 | + echo $item_params['value']; ?>" | |
| 139 | 146 | <?php disabled( $item_params['disabled'], true ); ?> |
| 140 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 147 | + <?php | |
| 148 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 149 | + echo wpbc_get_custom_attr( $item_params ); | |
| 150 | + ?> | |
| 141 | 151 | <?php |
| 142 | 152 | if ( ! empty( $item_params['onfocus'] ) ) { |
| 143 | - ?> onfocus="javascript:<?php echo $item_params['onfocus']; ?>" <?php | |
| 153 | + ?> onfocus="javascript:<?php | |
| 154 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 155 | + echo $item_params['onfocus']; ?>" <?php | |
| 144 | 156 | } |
| 145 | 157 | ?> |
| 146 | 158 | /><?php |
| 147 | 159 | } |
| @@ -190,16 +202,23 @@ | ||
| 190 | 202 | name="<?php echo esc_attr( $item_params['name'] ); echo ( $item_params['multiple'] ? '[]' : '' ); ?>" |
| 191 | 203 | class="form-control <?php echo esc_attr( $item_params['class'] ); ?>" |
| 192 | 204 | style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 193 | 205 | <?php disabled( $item_params['disabled'], true ); ?> |
| 194 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 206 | + <?php | |
| 207 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 208 | + echo wpbc_get_custom_attr( $item_params ); | |
| 209 | + ?> | |
| 195 | 210 | <?php echo ( $item_params['multiple'] ? ' multiple="MULTIPLE"' : '' ); ?> |
| 196 | 211 | <?php |
| 197 | 212 | if ( ! empty( $item_params['onfocus'] ) ) { |
| 198 | - ?> onfocus="javascript:<?php echo $item_params['onfocus']; ?>" <?php | |
| 213 | + ?> onfocus="javascript:<?php | |
| 214 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 215 | + echo $item_params['onfocus']; ?>" <?php | |
| 199 | 216 | } |
| 200 | 217 | if ( ! empty( $item_params['onchange'] ) ) { |
| 201 | - ?> onchange="javascript:<?php echo $item_params['onchange']; ?>" <?php | |
| 218 | + ?> onchange="javascript:<?php | |
| 219 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 220 | + echo $item_params['onchange']; ?>" <?php | |
| 202 | 221 | } |
| 203 | 222 | ?> |
| 204 | 223 | autocomplete="off" |
| 205 | 224 | ><?php |
| @@ -245,9 +264,12 @@ | ||
| 245 | 264 | } |
| 246 | 265 | ?> |
| 247 | 266 | class="<?php echo esc_attr( $option_data['class'] ); ?>" |
| 248 | 267 | style="<?php echo esc_attr( $option_data['style'] ); ?>" |
| 249 | - <?php echo wpbc_get_custom_attr( $option_data ); ?> | |
| 268 | + <?php | |
| 269 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 270 | + echo wpbc_get_custom_attr( $option_data ); | |
| 271 | + ?> | |
| 250 | 272 | <?php selected( $option_data['selected'], true ); ?> |
| 251 | 273 | <?php if ( ! empty( $item_params['value'] ) ) selected( $item_params['value'], esc_attr( $option_value ) ); //Recheck global selected parameter ?> |
| 252 | 274 | <?php disabled( $option_data['disabled'], true ); ?> |
| 253 | 275 | |
| @@ -320,9 +342,12 @@ | ||
| 320 | 342 | value="<?php echo esc_attr( $item_params['value'] ); ?>" |
| 321 | 343 | aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" |
| 322 | 344 | class="<?php echo esc_attr( $item_params['class'] ); ?>" |
| 323 | 345 | style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 324 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 346 | + <?php | |
| 347 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 348 | + echo wpbc_get_custom_attr( $item_params ); | |
| 349 | + ?> | |
| 325 | 350 | <?php checked( $item_params['selected'], true ); ?> |
| 326 | 351 | <?php disabled( $item_params['disabled'], true ); ?> |
| 327 | 352 | /><?php |
| 328 | 353 | } |
| @@ -346,9 +371,9 @@ | ||
| 346 | 371 | , 'text' => '' // Text tp show for Text element |
| 347 | 372 | ) |
| 348 | 373 | */ |
| 349 | 374 | function wpbc_bs_addon( $item ) { |
| 350 | - $milliseconds = round( microtime( true ) * 1000 ); //FixIn: 8.8.2.1 | |
| 375 | + $milliseconds = round( microtime( true ) * 1000 ); // FixIn: 8.8.2.1. | |
| 351 | 376 | $default_item_params = array( |
| 352 | 377 | 'type' => 'addon' |
| 353 | 378 | , 'element' => 'text' // text | radio | checkbox |
| 354 | 379 | , 'text' => '' // Simple plain text showing |
| @@ -367,9 +392,9 @@ | ||
| 367 | 392 | ?><span class="input-group-addon"><?php |
| 368 | 393 | if ( $item_params['element'] == 'text' ) { |
| 369 | 394 | ?><span class="<?php echo esc_attr( $item_params['class'] ); ?>" |
| 370 | 395 | style="<?php echo esc_attr( $item_params['style'] ); ?>"><?php |
| 371 | - echo $item_params['text']; | |
| 396 | + echo esc_html( $item_params['text'] ); | |
| 372 | 397 | ?></span><?php |
| 373 | 398 | } elseif ( $item_params['element'] == 'checkbox' ) { |
| 374 | 399 | |
| 375 | 400 | if ( empty( $item_params['id'] ) ) |
| @@ -378,14 +403,18 @@ | ||
| 378 | 403 | if ( empty( $item_params['name'] ) ) |
| 379 | 404 | $item_params['name'] = $item_params['id']; |
| 380 | 405 | |
| 381 | 406 | ?><input type="checkbox" |
| 382 | - id="<?php echo $item_params['id']; ?>" | |
| 383 | - name="<?php echo $item_params['name']; ?>" | |
| 384 | - value="<?php echo $item_params['value']; ?>" | |
| 385 | - aria-label="<?php echo $item_params['legend']; ?>" | |
| 386 | - class="<?php echo $item_params['class']; ?>" | |
| 387 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 407 | + id="<?php echo esc_attr( $item_params['id'] ); ?>" | |
| 408 | + name="<?php echo esc_attr( $item_params['name'] ); ?>" | |
| 409 | + value="<?php | |
| 410 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 411 | + echo $item_params['value']; ?>" | |
| 412 | + aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" | |
| 413 | + class="<?php echo esc_attr( $item_params['class'] ); ?>" | |
| 414 | + <?php | |
| 415 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 416 | + echo wpbc_get_custom_attr( $item_params ); ?> | |
| 388 | 417 | <?php if ( $item_params['selected'] ) { echo ' checked="CHECKED" '; } ?> |
| 389 | 418 | /><?php |
| 390 | 419 | |
| 391 | 420 | } elseif ( $item_params['element'] == 'radio' ) { |
| @@ -396,14 +425,18 @@ | ||
| 396 | 425 | if ( empty( $item_params['name'] ) ) |
| 397 | 426 | $item_params['name'] = $item_params['id']; |
| 398 | 427 | |
| 399 | 428 | ?><input type="radio" |
| 400 | - id="<?php echo $item_params['id']; ?>" | |
| 401 | - name="<?php echo $item_params['name']; ?>" | |
| 402 | - value="<?php echo $item_params['value']; ?>" | |
| 403 | - aria-label="<?php echo $item_params['legend']; ?>" | |
| 404 | - class="<?php echo $item_params['class']; ?>" | |
| 405 | - <?php echo wpbc_get_custom_attr( $item_params ); ?> | |
| 429 | + id="<?php echo esc_attr( $item_params['id'] ); ?>" | |
| 430 | + name="<?php echo esc_attr( $item_params['name'] ); ?>" | |
| 431 | + value="<?php | |
| 432 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 433 | + echo $item_params['value']; ?>" | |
| 434 | + aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" | |
| 435 | + class="<?php echo esc_attr( $item_params['class'] ); ?>" | |
| 436 | + <?php | |
| 437 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 438 | + echo wpbc_get_custom_attr( $item_params ); ?> | |
| 406 | 439 | <?php if ( $item_params['selected'] ) { echo ' checked="CHECKED" '; } ?> |
| 407 | 440 | /><?php |
| 408 | 441 | } |
| 409 | 442 | ?></span><?php |
| @@ -455,21 +488,23 @@ | ||
| 455 | 488 | } |
| 456 | 489 | |
| 457 | 490 | ?><a href="javascript:void(0)" |
| 458 | 491 | <?php if (! $is_this_simple_list ) { ?> |
| 459 | - onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();" | |
| 492 | + onclick="javascript:jQuery('#<?php echo esc_js( $params['id'] ); ?>_container').show();" | |
| 460 | 493 | <?php } ?> |
| 461 | 494 | data-toggle="wpbc_dropdown" |
| 462 | - id="<?php echo $params['id'];?>_selector" | |
| 495 | + id="<?php echo esc_attr( $params['id'] );?>_selector" | |
| 463 | 496 | <?php if ( ! empty( $params['hint'] ) ) { ?> |
| 464 | 497 | title="<?php echo esc_js( $params['hint']['title'] ); ?>" |
| 465 | 498 | <?php } ?> |
| 466 | 499 | class="button dropdown-toggle <?php |
| 467 | - echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; | |
| 468 | - echo ( ! empty( $params['class'] ) ) ? $params['class'] . ' ' : '' ; | |
| 500 | + echo esc_attr( ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ); | |
| 501 | + echo esc_attr( ( ! empty( $params['class'] ) ) ? $params['class'] . ' ' : '' ); | |
| 469 | 502 | ?>" |
| 470 | - style="<?php echo $params['style']; ?>" | |
| 471 | - <?php echo wpbc_get_custom_attr( $params ); ?> | |
| 503 | + style="<?php echo esc_attr( $params['style'] ); ?>" | |
| 504 | + <?php | |
| 505 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 506 | + echo wpbc_get_custom_attr( $params ); ?> | |
| 472 | 507 | ><?php |
| 473 | 508 | |
| 474 | 509 | $btn_icon = ''; |
| 475 | 510 | if ( ! empty( $params['icon'] ) ) { |
| @@ -475,9 +510,9 @@ | ||
| 475 | 510 | if ( ! empty( $params['icon'] ) ) { |
| 476 | 511 | |
| 477 | 512 | if ( substr( $params['icon'], 0, 4 ) != 'http') $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $params['icon']; |
| 478 | 513 | else $img_path = $params['icon']; |
| 479 | - | |
| 514 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 480 | 515 | $btn_icon = '<img class="menuicons" src="' . $img_path . '" />'; // Img Icon |
| 481 | 516 | |
| 482 | 517 | } elseif ( ! empty( $params['font_icon'] ) ) { |
| 483 | 518 | |
| @@ -484,24 +519,24 @@ | ||
| 484 | 519 | $btn_icon = '<i class="menu_icon icon-1x ' . $params['font_icon'] . '"></i>'; // Font Icon |
| 485 | 520 | |
| 486 | 521 | } |
| 487 | 522 | if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'left' ) ) |
| 488 | - echo $btn_icon . ' '; | |
| 523 | + {echo wp_kses_post( $btn_icon ) . ' ';} | |
| 489 | 524 | |
| 490 | 525 | // Text |
| 491 | 526 | echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>'; |
| 492 | - echo $params['title']; | |
| 527 | + echo wp_kses_post( $params['title'] ); | |
| 493 | 528 | if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'right' ) ) |
| 494 | 529 | echo ' ' ; |
| 495 | 530 | echo '</span>'; |
| 496 | 531 | |
| 497 | 532 | if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'right' ) ) |
| 498 | - echo $btn_icon; | |
| 533 | + echo wp_kses_post( $btn_icon ); | |
| 499 | 534 | ?> <span class="caret"></span></a><?php |
| 500 | 535 | |
| 501 | 536 | ?><ul |
| 502 | - id="<?php echo $params['id']; ?>_container" | |
| 503 | - class="dropdown-menu dropdown-menu-<?php echo $params['align']; ?>" | |
| 537 | + id="<?php echo esc_attr( $params['id'] ); ?>_container" | |
| 538 | + class="dropdown-menu dropdown-menu-<?php echo esc_attr( $params['align'] ); ?>" | |
| 504 | 539 | ><?php |
| 505 | 540 | |
| 506 | 541 | wpbc_bs_list_of_options_for_dropdown( $params , 'simple' , $is_this_simple_list); |
| 507 | 542 | |
| @@ -510,9 +545,9 @@ | ||
| 510 | 545 | |
| 511 | 546 | |
| 512 | 547 | function wpbc_bs_list_of_options_for_dropdown( $params, $dropdown_type = 'simple', $is_this_simple_list = true ) { |
| 513 | 548 | |
| 514 | - $milliseconds = round( microtime( true ) * 1000 ); //FixIn: 8.8.2.1 | |
| 549 | + $milliseconds = round( microtime( true ) * 1000 ); // FixIn: 8.8.2.1. | |
| 515 | 550 | |
| 516 | 551 | foreach ( $params['options'] as $key => $value ) { |
| 517 | 552 | |
| 518 | 553 | if ( is_array( $value ) ) { // Complex value constructions |
| @@ -599,9 +634,9 @@ | ||
| 599 | 634 | if ( empty( $item_params['id'] ) ) $item_params['id'] = $params['id'] . '_grp_' . $milliseconds ; |
| 600 | 635 | |
| 601 | 636 | if ( empty( $item_params['name'] ) ) $item_params['name'] = $item_params['id']; |
| 602 | 637 | |
| 603 | - ?><div class="dropdown-menu-text-element <?php echo 'dropdown-menu-text-element-count-' . $number_of_text_elements; ?>"><?php | |
| 638 | + ?><div class="dropdown-menu-text-element <?php echo 'dropdown-menu-text-element-count-' . esc_attr( $number_of_text_elements ); ?>"><?php | |
| 604 | 639 | |
| 605 | 640 | if ( ! empty( $item_params['label'] ) ) { |
| 606 | 641 | |
| 607 | 642 | ?><label for="<?php echo esc_attr( $item_params['id'] ); ?>"><?php |
| @@ -648,9 +683,9 @@ | ||
| 648 | 683 | ?><li role="presentation" class="divider"></li><?php |
| 649 | 684 | |
| 650 | 685 | } elseif ( $value == 'header' ) { |
| 651 | 686 | |
| 652 | - ?><li role="presentation" class="dropdown-header"><?php echo $key ?></li><?php | |
| 687 | + ?><li role="presentation" class="dropdown-header"><?php echo esc_attr( $key ) ?></li><?php | |
| 653 | 688 | |
| 654 | 689 | } else { |
| 655 | 690 | ?><li role="presentation" <?php if ( in_array( $value, $params['disabled'] ) === true ) { echo ' class="disabled"'; } ?> > |
| 656 | 691 | <a role="menuitem" |
| @@ -661,19 +696,21 @@ | ||
| 661 | 696 | |
| 662 | 697 | if ( $dropdown_type == 'list' ) { ?> |
| 663 | 698 | |
| 664 | 699 | onclick="javascript: |
| 665 | - wpbc_show_selected_in_dropdown('<?php echo $params['id']; ?>', jQuery(this).html(), '<?php echo $value; ?>'); | |
| 700 | + wpbc_show_selected_in_dropdown('<?php echo esc_js($params['id']); ?>', jQuery(this).html(), '<?php echo esc_js($value); ?>'); | |
| 666 | 701 | <?php if (! $is_this_simple_list ) { ?> |
| 667 | - wpbc_close_dropdown_selectbox( '<?php echo $params['id']; ?>' ); | |
| 702 | + wpbc_close_dropdown_selectbox( '<?php echo esc_js($params['id']); ?>' ); | |
| 668 | 703 | <?php } ?>" |
| 669 | 704 | <?php } else { ?> |
| 670 | 705 | |
| 671 | - onclick="javascript:<?php echo $value; ?>" | |
| 706 | + onclick="javascript:<?php | |
| 707 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 708 | + echo $value; ?>" | |
| 672 | 709 | <?php } |
| 673 | 710 | |
| 674 | 711 | } ?> |
| 675 | - ><?php echo $key; ?></a> | |
| 712 | + ><?php echo esc_html( $key ); ?></a> | |
| 676 | 713 | </li><?php |
| 677 | 714 | } |
| 678 | 715 | } |
| 679 | 716 | |
| @@ -685,19 +722,19 @@ | ||
| 685 | 722 | //////////////////////////////////////////////////////////////////////////////// |
| 686 | 723 | |
| 687 | 724 | /** |
| 688 | 725 | * Button Groups |
| 689 | - * | |
| 726 | + * | |
| 690 | 727 | * @param array $args |
| 691 | - * | |
| 692 | - | |
| 693 | - $params = array( | |
| 728 | + * | |
| 729 | + | |
| 730 | + $params = array( | |
| 694 | 731 | 'label_for' => 'actions' // "For" parameter of button group element |
| 695 | 732 | , 'label' => __('Actions:', 'booking') // Label above the button group |
| 696 | 733 | , 'style' => '' // CSS Style of entire div element |
| 697 | 734 | , 'items' => array( |
| 698 | - array( | |
| 699 | - 'type' => 'button' | |
| 735 | + array( | |
| 736 | + 'type' => 'button' | |
| 700 | 737 | , 'title' => __('Delete', 'booking') // Title of the button |
| 701 | 738 | , 'hint' => array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) // Hint |
| 702 | 739 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 703 | 740 | , 'action' => '' // Some JavaScript to execure, for example run the function |
| @@ -708,12 +745,12 @@ | ||
| 708 | 745 | , 'style' => '' // Any CSS class here |
| 709 | 746 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 710 | 747 | , 'attr' => array() |
| 711 | 748 | ) |
| 712 | - , array( | |
| 749 | + , array( | |
| 713 | 750 | 'type' => 'button' |
| 714 | 751 | , 'title' => __('Delete', 'booking') |
| 715 | - , 'class' => 'button-primary' | |
| 752 | + , 'class' => 'button-primary' | |
| 716 | 753 | , 'font_icon' => 'wpbc_icn_delete_outline' |
| 717 | 754 | , 'icon_position' => 'left' |
| 718 | 755 | , 'action' => "jQuery('#booking_filters_formID').trigger( 'submit' );" |
| 719 | 756 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| @@ -718,46 +755,46 @@ | ||
| 718 | 755 | , 'action' => "jQuery('#booking_filters_formID').trigger( 'submit' );" |
| 719 | 756 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 720 | 757 | ) |
| 721 | 758 | ) |
| 722 | - ); | |
| 723 | - wpbc_bs_button_group( $params ); | |
| 724 | - | |
| 759 | + ); | |
| 760 | + wpbc_bs_button_group( $params ); | |
| 761 | + | |
| 725 | 762 | */ |
| 726 | 763 | function wpbc_bs_button_group( $args = array() ) { |
| 727 | - | |
| 764 | + | |
| 728 | 765 | $milliseconds = round(microtime(true) * 1000); |
| 729 | - | |
| 730 | - $defaults = array( | |
| 766 | + | |
| 767 | + $defaults = array( | |
| 731 | 768 | 'label_for' => 'btn_bs_' . $milliseconds // "For" parameter of label element |
| 732 | 769 | , 'label' => '' // Label above element |
| 733 | 770 | , 'style' => '' // CSS of entire div element |
| 734 | - , 'items' => array() // Array of elements | |
| 771 | + , 'items' => array() // Array of elements | |
| 735 | 772 | ); |
| 736 | - | |
| 773 | + | |
| 737 | 774 | $params = wp_parse_args( $args, $defaults ); |
| 738 | - | |
| 739 | - ?><div class="control-group" style="<?php echo $params['style']; ?>" ><?php | |
| 740 | - if (! empty( $params['label'] ) ) { | |
| 741 | - ?><label for="<?php echo $params['label_for']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php | |
| 742 | - } | |
| 743 | - ?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo $params['label_for']; ?>"> | |
| 744 | - <div class="btn-group" role="group" aria-label="..."><?php | |
| 745 | - | |
| 775 | + | |
| 776 | + ?><div class="control-group" style="<?php echo esc_attr( $params['style'] ); ?>" ><?php | |
| 777 | + if (! empty( $params['label'] ) ) { | |
| 778 | + ?><label for="<?php echo esc_attr( $params['label_for'] ); ?>" class="control-label"><?php echo esc_html( $params['label'] ); ?></label><?php | |
| 779 | + } | |
| 780 | + ?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo esc_attr( $params['label_for'] ); ?>"> | |
| 781 | + <div class="btn-group" role="group" aria-label="..."><?php | |
| 782 | + | |
| 746 | 783 | foreach ( $params['items'] as $item ) { |
| 747 | - | |
| 784 | + | |
| 748 | 785 | switch ( $item['type'] ) { |
| 749 | - | |
| 786 | + | |
| 750 | 787 | case 'button': |
| 751 | 788 | wpbc_bs_button( $item ); |
| 752 | - break; | |
| 789 | + break; | |
| 753 | 790 | case 'dropdown': |
| 754 | - wpbc_bs_dropdown( $item ); | |
| 791 | + wpbc_bs_dropdown( $item ); | |
| 755 | 792 | break; |
| 756 | 793 | default: |
| 757 | 794 | break; |
| 758 | 795 | } |
| 759 | - | |
| 796 | + | |
| 760 | 797 | } ?> |
| 761 | 798 | </div> |
| 762 | 799 | </div> |
| 763 | 800 | </div><?php |
| @@ -765,188 +802,188 @@ | ||
| 765 | 802 | |
| 766 | 803 | |
| 767 | 804 | /** |
| 768 | 805 | * Show Input Group |
| 769 | - * | |
| 806 | + * | |
| 770 | 807 | * @param array $args |
| 771 | - * | |
| 772 | - | |
| 773 | - $params = array( | |
| 808 | + * | |
| 809 | + | |
| 810 | + $params = array( | |
| 774 | 811 | 'label_for' => 'min_cost' // "For" parameter of label element |
| 775 | 812 | , 'label' => __('Min / Max cost:', 'booking') // Label above the input group |
| 776 | 813 | , 'style' => '' // CSS Style of entire div element |
| 777 | 814 | , 'items' => array( |
| 778 | - array( | |
| 779 | - 'type' => 'addon' | |
| 815 | + array( | |
| 816 | + 'type' => 'addon' | |
| 780 | 817 | , 'element' => 'text' // text | radio | checkbox |
| 781 | 818 | , 'text' => __('Cost', 'booking') . ':' |
| 782 | 819 | , 'class' => '' // Any CSS class here |
| 783 | 820 | , 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 784 | - ) | |
| 785 | - , array( | |
| 786 | - 'type' => 'addon' | |
| 821 | + ) | |
| 822 | + , array( | |
| 823 | + 'type' => 'addon' | |
| 787 | 824 | , 'element' => 'checkbox' // text | radio | checkbox |
| 788 | 825 | , 'id' => 'apply_elem' // ID, if this radio | checkbox element |
| 789 | 826 | , 'name' => 'apply_elem' // Name, if this radio | checkbox element |
| 790 | 827 | , 'value' => 'On' // value, if this radio | checkbox element |
| 791 | - , 'selected' => false // Selected, if this radio | checkbox element | |
| 828 | + , 'selected' => false // Selected, if this radio | checkbox element | |
| 792 | 829 | , 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 793 | 830 | , 'class' => '' // Any CSS class here |
| 794 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 795 | - ) | |
| 796 | - , array( | |
| 797 | - 'type' => 'addon' | |
| 831 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 832 | + ) | |
| 833 | + , array( | |
| 834 | + 'type' => 'addon' | |
| 798 | 835 | , 'element' => 'radio' // text | radio | checkbox |
| 799 | 836 | , 'id' => 'min_elem' // ID, if this radio | checkbox element |
| 800 | 837 | , 'name' => 'cost_elem' // Name, if this radio | checkbox element |
| 801 | 838 | , 'value' => 'min' // value, if this radio | checkbox element |
| 802 | - , 'selected' => false // Selected, if this radio | checkbox element | |
| 839 | + , 'selected' => false // Selected, if this radio | checkbox element | |
| 803 | 840 | , 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 804 | 841 | , 'class' => '' // Any CSS class here |
| 805 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 806 | - ) | |
| 807 | - // Warning! Can be text or selectbox, not both OR you need to define width | |
| 808 | - , array( | |
| 842 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 843 | + ) | |
| 844 | + // Warning! Can be text or selectbox, not both OR you need to define width | |
| 845 | + , array( | |
| 809 | 846 | 'type' => 'text' |
| 810 | - , 'id' => 'min_cost' // HTML ID of element | |
| 847 | + , 'id' => 'min_cost' // HTML ID of element | |
| 811 | 848 | , 'value' => '' // Value of Text field |
| 812 | 849 | , 'placeholder' => __('Reason of Cancelation', 'booking') |
| 813 | 850 | , 'style' => 'width:100px;' // CSS of select element |
| 814 | 851 | , 'class' => '' // CSS Class of select element |
| 815 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 816 | - ) | |
| 817 | - , array( | |
| 818 | - 'type' => 'addon' | |
| 852 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 853 | + ) | |
| 854 | + , array( | |
| 855 | + 'type' => 'addon' | |
| 819 | 856 | , 'element' => 'text' // text | radio | checkbox |
| 820 | 857 | , 'text' => ' - ' // Simple plain text showing |
| 821 | - ) | |
| 822 | - , array( | |
| 858 | + ) | |
| 859 | + , array( | |
| 823 | 860 | 'type' => 'text' |
| 824 | - , 'id' => 'max_cost' // HTML ID of element | |
| 861 | + , 'id' => 'max_cost' // HTML ID of element | |
| 825 | 862 | , 'value' => '' // Value of Text field |
| 826 | 863 | , 'placeholder' => __('Max Cost', 'booking') |
| 827 | 864 | , 'style' => '' // CSS of select element |
| 828 | 865 | , 'class' => '' // CSS Class of select element |
| 829 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 866 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 830 | 867 | |
| 831 | 868 | ) |
| 832 | - , array( | |
| 833 | - 'type' => 'addon' | |
| 869 | + , array( | |
| 870 | + 'type' => 'addon' | |
| 834 | 871 | , 'element' => 'radio' // text | radio | checkbox |
| 835 | 872 | , 'id' => 'max_elem' // ID, if this radio | checkbox element |
| 836 | 873 | , 'name' => 'cost_elem' // Name, if this radio | checkbox element |
| 837 | 874 | , 'value' => 'max' // value, if this radio | checkbox element |
| 838 | - , 'selected' => false // Selected, if this radio | checkbox element | |
| 875 | + , 'selected' => false // Selected, if this radio | checkbox element | |
| 839 | 876 | , 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 840 | 877 | , 'class' => '' // Any CSS class here |
| 841 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 842 | - ) | |
| 843 | - // Warning! Can be text or selectbox, not both OR you need to define width | |
| 844 | - , array( | |
| 845 | - 'type' => 'select' | |
| 878 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 879 | + ) | |
| 880 | + // Warning! Can be text or selectbox, not both OR you need to define width | |
| 881 | + , array( | |
| 882 | + 'type' => 'select' | |
| 846 | 883 | , 'id' => 'select_option' // HTML ID of element |
| 847 | - , 'options' => array( 'delete' => __('Delete', 'booking'), 'any' => __('Any','booking'), 'specific' => __('Specific', 'booking') ) // Associated array of titles and values | |
| 884 | + , 'options' => array( 'delete' => __('Delete', 'booking'), 'any' => __('Any','booking'), 'specific' => __('Specific', 'booking') ) // Associated array of titles and values | |
| 848 | 885 | , 'disabled_options' => array( 'any' ) // If some options disbaled, then its must list here |
| 849 | - , 'default' => 'specific' // Some Value from optins array that selected by default | |
| 886 | + , 'default' => 'specific' // Some Value from optins array that selected by default | |
| 850 | 887 | , 'style' => 'width:200px;' // CSS of select element |
| 851 | 888 | , 'class' => '' // CSS Class of select element |
| 852 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 889 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 853 | 890 | ) |
| 854 | - | |
| 891 | + | |
| 855 | 892 | // Select Advanced option list |
| 856 | - , array( | |
| 857 | - 'type' => 'select' | |
| 858 | - , 'id' => 'select_form_help_shortcode' | |
| 859 | - , 'name' => 'select_form_help_shortcode' | |
| 860 | - , 'style' => '' | |
| 861 | - , 'class' => '' | |
| 893 | + , array( | |
| 894 | + 'type' => 'select' | |
| 895 | + , 'id' => 'select_form_help_shortcode' | |
| 896 | + , 'name' => 'select_form_help_shortcode' | |
| 897 | + , 'style' => '' | |
| 898 | + , 'class' => '' | |
| 862 | 899 | , 'multiple' => false |
| 863 | 900 | , 'disabled' => false |
| 864 | - , 'disabled_options' => array() // If some options disbaled, then its must list here | |
| 865 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 866 | - , 'options' => array( // Associated array of titles and values | |
| 867 | - 'info' => array( | |
| 901 | + , 'disabled_options' => array() // If some options disbaled, then its must list here | |
| 902 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 903 | + , 'options' => array( // Associated array of titles and values | |
| 904 | + 'info' => array( | |
| 868 | 905 | 'title' => __('General Info', 'booking') |
| 869 | - , 'id' => '' | |
| 870 | - , 'name' => '' | |
| 871 | - , 'style' => '' | |
| 872 | - , 'class' => '' | |
| 906 | + , 'id' => '' | |
| 907 | + , 'name' => '' | |
| 908 | + , 'style' => '' | |
| 909 | + , 'class' => '' | |
| 873 | 910 | , 'disabled' => false |
| 874 | 911 | , 'selected' => false |
| 875 | - , 'attr' => array() | |
| 912 | + , 'attr' => array() | |
| 876 | 913 | ) |
| 877 | - , 'optgroup_sf_s' => array( | |
| 914 | + , 'optgroup_sf_s' => array( | |
| 878 | 915 | 'optgroup' => true |
| 879 | 916 | , 'close' => false |
| 880 | - , 'title' => ' ' . __('Standard Fields' ,'booking') | |
| 917 | + , 'title' => ' ' . __('Standard Fields' ,'booking') | |
| 881 | 918 | ) |
| 882 | - , 'text' => array( | |
| 919 | + , 'text' => array( | |
| 883 | 920 | 'title' => __('Text', 'booking') |
| 884 | - , 'id' => '' | |
| 885 | - , 'name' => '' | |
| 921 | + , 'id' => '' | |
| 922 | + , 'name' => '' | |
| 886 | 923 | , 'style' => '' |
| 887 | - , 'class' => '' | |
| 924 | + , 'class' => '' | |
| 888 | 925 | , 'disabled' => false |
| 889 | 926 | , 'selected' => false |
| 890 | - , 'attr' => array() | |
| 927 | + , 'attr' => array() | |
| 891 | 928 | ) |
| 892 | - , 'select' => array( | |
| 929 | + , 'select' => array( | |
| 893 | 930 | 'title' => __('Select', 'booking') |
| 894 | - , 'id' => '' | |
| 895 | - , 'name' => '' | |
| 931 | + , 'id' => '' | |
| 932 | + , 'name' => '' | |
| 896 | 933 | , 'style' => '' |
| 897 | - , 'class' => '' | |
| 934 | + , 'class' => '' | |
| 898 | 935 | , 'disabled' => false |
| 899 | 936 | , 'selected' => false |
| 900 | - , 'attr' => array() | |
| 937 | + , 'attr' => array() | |
| 901 | 938 | ) |
| 902 | - , 'textarea' => array( | |
| 939 | + , 'textarea' => array( | |
| 903 | 940 | 'title' => __('Textarea', 'booking') |
| 904 | - , 'id' => '' | |
| 905 | - , 'name' => '' | |
| 941 | + , 'id' => '' | |
| 942 | + , 'name' => '' | |
| 906 | 943 | , 'style' => '' |
| 907 | - , 'class' => '' | |
| 944 | + , 'class' => '' | |
| 908 | 945 | , 'disabled' => false |
| 909 | 946 | , 'selected' => false |
| 910 | - , 'attr' => array() | |
| 947 | + , 'attr' => array() | |
| 911 | 948 | ) |
| 912 | - , 'checkbox' => array( | |
| 949 | + , 'checkbox' => array( | |
| 913 | 950 | 'title' => __('Checkbox', 'booking') |
| 914 | - , 'id' => '' | |
| 915 | - , 'name' => '' | |
| 951 | + , 'id' => '' | |
| 952 | + , 'name' => '' | |
| 916 | 953 | , 'style' => '' |
| 917 | - , 'class' => '' | |
| 954 | + , 'class' => '' | |
| 918 | 955 | , 'disabled' => false |
| 919 | 956 | , 'selected' => false |
| 920 | - , 'attr' => array() | |
| 957 | + , 'attr' => array() | |
| 921 | 958 | ) |
| 922 | 959 | , 'optgroup_sf_e' => array( 'optgroup' => true, 'close' => true ) |
| 923 | - | |
| 924 | - | |
| 925 | - , 'optgroup_af_s' => array( | |
| 960 | + | |
| 961 | + | |
| 962 | + , 'optgroup_af_s' => array( | |
| 926 | 963 | 'optgroup' => true |
| 927 | 964 | , 'close' => false |
| 928 | - , 'title' => ' ' . __('Advanced Fields' ,'booking') | |
| 965 | + , 'title' => ' ' . __('Advanced Fields' ,'booking') | |
| 929 | 966 | ) |
| 930 | - , 'info_advanced' => array( | |
| 967 | + , 'info_advanced' => array( | |
| 931 | 968 | 'title' => __('Info', 'booking') |
| 932 | - , 'id' => '' | |
| 933 | - , 'name' => '' | |
| 969 | + , 'id' => '' | |
| 970 | + , 'name' => '' | |
| 934 | 971 | , 'style' => '' |
| 935 | - , 'class' => '' | |
| 972 | + , 'class' => '' | |
| 936 | 973 | , 'disabled' => false |
| 937 | 974 | , 'selected' => false |
| 938 | - , 'attr' => array() | |
| 975 | + , 'attr' => array() | |
| 939 | 976 | ) |
| 940 | 977 | , 'optgroup_af_e' => array( 'optgroup' => true, 'close' => true ) |
| 941 | - | |
| 978 | + | |
| 942 | 979 | ) |
| 943 | - , 'value' => '' // Some Value from optins array that selected by default | |
| 980 | + , 'value' => '' // Some Value from optins array that selected by default | |
| 944 | 981 | , 'onfocus' => '' |
| 945 | - , 'onchange' => "jQuery('.wpbc_field_generator').hide();jQuery('.wpbc_field_generator_' + this.options[this.selectedIndex].value ).show();" | |
| 982 | + , 'onchange' => "jQuery('.wpbc_field_generator').hide();jQuery('.wpbc_field_generator_' + this.options[this.selectedIndex].value ).show();" | |
| 946 | 983 | ) |
| 947 | - , array( | |
| 948 | - 'type' => 'button' | |
| 984 | + , array( | |
| 985 | + 'type' => 'button' | |
| 949 | 986 | , 'title' => __('Delete', 'booking') // Title of the button |
| 950 | 987 | , 'hint' => array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) // Hint |
| 951 | 988 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 952 | 989 | , 'action' => '' // Some JavaScript to execure, for example run the function |
| @@ -956,65 +993,64 @@ | ||
| 956 | 993 | , 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 957 | 994 | , 'style' => '' // Any CSS class here |
| 958 | 995 | , 'attr' => array() |
| 959 | 996 | ) |
| 960 | - , array( | |
| 997 | + , array( | |
| 961 | 998 | 'type' => 'button' |
| 962 | 999 | , 'title' => __('Delete', 'booking') |
| 963 | - , 'class' => 'button-primary' | |
| 1000 | + , 'class' => 'button-primary' | |
| 964 | 1001 | , 'font_icon' => 'wpbc_icn_delete_outline' |
| 965 | 1002 | , 'icon_position' => 'left' |
| 966 | 1003 | , 'action' => "jQuery('#booking_filters_formID').trigger( 'submit' );" |
| 967 | 1004 | ) |
| 968 | 1005 | ) |
| 969 | - ); | |
| 970 | - ?><div class="control-group wpbc-no-padding" style="max-width:730px;"><?php | |
| 971 | - wpbc_bs_input_group( $params ); | |
| 1006 | + ); | |
| 1007 | + ?><div class="control-group wpbc-no-padding" style="max-width:730px;"><?php | |
| 1008 | + wpbc_bs_input_group( $params ); | |
| 972 | 1009 | ?></div><?php |
| 973 | 1010 | |
| 974 | 1011 | */ |
| 975 | 1012 | function wpbc_bs_input_group( $args = array() ) { |
| 976 | - | |
| 1013 | + | |
| 977 | 1014 | $milliseconds = round(microtime(true) * 1000); |
| 978 | - | |
| 979 | - $defaults = array( | |
| 1015 | + | |
| 1016 | + $defaults = array( | |
| 980 | 1017 | 'label_for' => 'btn_bs_' . $milliseconds // "For" parameter of label element |
| 981 | 1018 | , 'label' => '' // Label above element |
| 982 | 1019 | , 'style' => '' // CSS of entire div element |
| 983 | - , 'items' => array() // Array of elements | |
| 1020 | + , 'items' => array() // Array of elements | |
| 984 | 1021 | ); |
| 985 | - | |
| 1022 | + | |
| 986 | 1023 | $params = wp_parse_args( $args, $defaults ); |
| 987 | 1024 | |
| 988 | - ?><div class="wpbc-no-padding" style="width:auto;<?php echo $params['style']; ?>" ><?php | |
| 989 | - if (! empty( $params['label'] ) ) { | |
| 990 | - ?><label for="<?php echo $params['label_for']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php | |
| 991 | - } | |
| 992 | - ?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo $params['label_for']; ?>_toolbar"> | |
| 993 | - <div class="input-group" role="group" aria-label="..."><?php | |
| 1025 | + ?><div class="wpbc-no-padding" style="width:auto;<?php echo esc_attr( $params['style'] ); ?>" ><?php | |
| 1026 | + if (! empty( $params['label'] ) ) { | |
| 1027 | + ?><label for="<?php echo esc_attr( $params['label_for'] ); ?>" class="control-label"><?php echo esc_html( $params['label'] ); ?></label><?php | |
| 1028 | + } | |
| 1029 | + ?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo esc_attr( $params['label_for'] ); ?>_toolbar"> | |
| 1030 | + <div class="input-group" role="group" aria-label="..."><?php | |
| 994 | 1031 | |
| 995 | 1032 | foreach ( $params['items'] as $item ) { |
| 1033 | + switch ( $item['type']){ | |
| 996 | 1034 | |
| 997 | - switch ( $item['type'] ) { | |
| 1035 | + case 'button': | |
| 1036 | + ?><div class="input-group-btn"><?php | |
| 998 | 1037 | |
| 999 | - case 'button': | |
| 1000 | - ?><div class="input-group-btn"><?php | |
| 1001 | - | |
| 1002 | 1038 | wpbc_bs_button( $item ); |
| 1003 | - | |
| 1004 | - ?></div><?php | |
| 1039 | + | |
| 1040 | + ?></div><?php | |
| 1005 | 1041 | break; |
| 1006 | 1042 | |
| 1007 | - case 'text': | |
| 1008 | - wpbc_bs_text( $item ); | |
| 1009 | - break; | |
| 1010 | - | |
| 1011 | - case 'select': | |
| 1043 | + case 'text': | |
| 1044 | + wpbc_bs_text( $item ); | |
| 1045 | + break; | |
| 1046 | + | |
| 1047 | + case 'select': | |
| 1012 | 1048 | wpbc_bs_select( $item ); |
| 1013 | - break; | |
| 1014 | - | |
| 1015 | - case 'addon': //FixIn: 9.5.4.9 | |
| 1016 | - $item['style'] = empty($item['style']) ? 'line-height: 21px;' : $item['style'] . 'line-height: 21px;margin-right: -10px;'; //FixIn: 9.5.4.9 | |
| 1049 | + break; | |
| 1050 | + | |
| 1051 | + case 'addon': // FixIn: 9.5.4.9. | |
| 1052 | + $item['style'] = empty($item['style']) ? 'line-height: 21px;' : $item['style'] . 'line-height: 21px;margin-right: -10px;'; // FixIn: 9.5.4.9. | |
| 1017 | 1053 | wpbc_bs_addon( $item ); |
| 1018 | 1054 | ?></div><!-- /input-group --> |
| 1019 | 1055 | </div> |
| 1020 | 1056 | </div> |
| @@ -1019,10 +1055,10 @@ | ||
| 1019 | 1055 | </div> |
| 1020 | 1056 | </div> |
| 1021 | 1057 | </div> |
| 1022 | 1058 | <div class="control-group wpbc-no-padding"> |
| 1023 | - <div class="wpbc-no-padding" style="width:auto;<?php echo $params['style']; ?>" > | |
| 1024 | - <div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo $params['label_for']; ?>_toolbar"> | |
| 1059 | + <div class="wpbc-no-padding" style="width:auto;<?php echo esc_attr( $params['style'] ); ?>" > | |
| 1060 | + <div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo esc_attr( $params['label_for'] ); ?>_toolbar"> | |
| 1025 | 1061 | <div class="input-group" role="group" aria-label="..."><?php |
| 1026 | 1062 | |
| 1027 | 1063 | break; |
| 1028 | 1064 | default: |
| @@ -1027,78 +1063,78 @@ | ||
| 1027 | 1063 | break; |
| 1028 | 1064 | default: |
| 1029 | 1065 | break; |
| 1030 | 1066 | } |
| 1031 | - } | |
| 1067 | + } | |
| 1032 | 1068 | |
| 1033 | - ?></div><!-- /input-group --> | |
| 1069 | + ?></div><!-- /input-group --> | |
| 1034 | 1070 | </div> |
| 1035 | - </div><?php | |
| 1071 | + </div><?php | |
| 1036 | 1072 | } |
| 1037 | 1073 | |
| 1038 | 1074 | |
| 1039 | 1075 | /** |
| 1040 | 1076 | * Selectbox - Dropdown List with comple UI elements |
| 1041 | - * | |
| 1077 | + * | |
| 1042 | 1078 | * @param array $args = array( |
| 1043 | 1079 | 'id' => '' // HTML ID of element |
| 1044 | 1080 | , 'id2' => '' // (optional) HTML ID of 2nd element |
| 1045 | 1081 | , 'default' => '' // Some Value from optins array that selected by default |
| 1046 | 1082 | , 'default2' => '' // (optional) Some Value from optins array that selected by default |
| 1047 | - , 'hint' => '' // (optional) Hint: array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) | |
| 1048 | - , 'css_classes' => '' // (optional) | |
| 1083 | + , 'hint' => '' // (optional) Hint: array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) | |
| 1084 | + , 'css_classes' => '' // (optional) | |
| 1049 | 1085 | , 'label' => '' // (optional) Label of element "at Top of element" |
| 1050 | 1086 | , 'title' => '' // Title of element "Inside of element" |
| 1051 | - , 'align' => 'left' // (optional) Align: left | right | |
| 1087 | + , 'align' => 'left' // (optional) Align: left | right | |
| 1052 | 1088 | , 'disabled' => array() // (optional) If some options disbaled, then its must list here |
| 1053 | - , 'options' => array( // Associated array of titles and values | |
| 1089 | + , 'options' => array( // Associated array of titles and values | |
| 1054 | 1090 | __('Bla bla bla', 'booking') => '1' |
| 1055 | 1091 | , 'divider0' => 'divider' |
| 1056 | 1092 | , __('Section Header', 'booking') => 'header' |
| 1057 | 1093 | ... |
| 1058 | - | |
| 1059 | - , '_radio_or_checkbox' => array( | |
| 1060 | - array( 'type' => 'radio' // 'radio' or 'checkbox' | |
| 1094 | + | |
| 1095 | + , '_radio_or_checkbox' => array( | |
| 1096 | + array( 'type' => 'radio' // 'radio' or 'checkbox' | |
| 1061 | 1097 | , 'id' => $item_params['id'] // HTML ID of element |
| 1062 | 1098 | , 'name' => $item_params['name'] |
| 1063 | 1099 | , 'style' => '' // CSS of select element |
| 1064 | - , 'class' => '' // CSS Class of select element | |
| 1100 | + , 'class' => '' // CSS Class of select element | |
| 1065 | 1101 | , 'disabled' => false |
| 1066 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1067 | - , 'legend' => '' // aria-label parameter | |
| 1068 | - , 'value' => '' // Some Value from optins array that selected by default | |
| 1102 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1103 | + , 'legend' => '' // aria-label parameter | |
| 1104 | + , 'value' => '' // Some Value from optins array that selected by default | |
| 1069 | 1105 | , 'selected' => false // Selected or not |
| 1070 | 1106 | , 'label' => '' // Label - title |
| 1071 | 1107 | ) |
| 1072 | 1108 | ) |
| 1073 | - , '_select' => array( | |
| 1074 | - array( 'type' => 'select' | |
| 1109 | + , '_select' => array( | |
| 1110 | + array( 'type' => 'select' | |
| 1075 | 1111 | , 'id' => '' // HTML ID of element |
| 1076 | 1112 | , 'style' => '' // CSS of select element |
| 1077 | 1113 | , 'class' => '' // CSS Class of select element |
| 1078 | 1114 | , 'multiple' => false |
| 1079 | 1115 | , 'disabled' => false |
| 1080 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1081 | - , 'options' => array() // Associated array of titles and values | |
| 1116 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1117 | + , 'options' => array() // Associated array of titles and values | |
| 1082 | 1118 | , 'disabled_options' => array() // If some options disbaled, then its must list here |
| 1083 | - , 'value' => '' // Some Value from optins array that selected by default | |
| 1119 | + , 'value' => '' // Some Value from optins array that selected by default | |
| 1084 | 1120 | ) |
| 1085 | 1121 | ) |
| 1086 | - , '_texts' => array( | |
| 1087 | - array( 'type' => 'text' | |
| 1088 | - , 'id' => '' | |
| 1089 | - , 'name' => '' | |
| 1090 | - , 'label' => '' | |
| 1122 | + , '_texts' => array( | |
| 1123 | + array( 'type' => 'text' | |
| 1124 | + , 'id' => '' | |
| 1125 | + , 'name' => '' | |
| 1126 | + , 'label' => '' | |
| 1091 | 1127 | , 'disabled' => false |
| 1092 | 1128 | , 'class' => '' |
| 1093 | 1129 | , 'style' => '' |
| 1094 | - , 'placeholder' => '' | |
| 1130 | + , 'placeholder' => '' | |
| 1095 | 1131 | , 'attr' => array() |
| 1096 | 1132 | , 'value' => '' |
| 1097 | 1133 | ) |
| 1098 | 1134 | ) |
| 1099 | - , '_buttons' => array( | |
| 1100 | - array( 'type' => 'button' | |
| 1135 | + , '_buttons' => array( | |
| 1136 | + array( 'type' => 'button' | |
| 1101 | 1137 | , 'title' => '' // Title of the button |
| 1102 | 1138 | , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1103 | 1139 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1104 | 1140 | , 'action' => "wpbc_close_dropdown_selectbox( '" . $params['id'] . "' )" // Some JavaScript to execure, for example run the function |
| @@ -1112,11 +1148,11 @@ | ||
| 1112 | 1148 | ) |
| 1113 | 1149 | ) |
| 1114 | 1150 | ) |
| 1115 | 1151 | ); |
| 1116 | - * | |
| 1152 | + * | |
| 1117 | 1153 | Exmaple #1: |
| 1118 | - $params = array( // Pending, Active, Suspended, Terminated, Cancelled, Fraud | |
| 1154 | + $params = array( // Pending, Active, Suspended, Terminated, Cancelled, Fraud | |
| 1119 | 1155 | 'id' => 'wh_approved' |
| 1120 | 1156 | , 'options' => array ( |
| 1121 | 1157 | __('Pending', 'booking') => '0', |
| 1122 | 1158 | __('Approved', 'booking') => '1', |
| @@ -1123,18 +1159,18 @@ | ||
| 1123 | 1159 | , 'divider0' => 'divider' |
| 1124 | 1160 | , __('Section Header', 'booking') => 'header' |
| 1125 | 1161 | , __('Any', 'booking') => '' |
| 1126 | 1162 | ) |
| 1127 | - , 'disabled' => array( '' ) // It will disable "Any" option | |
| 1163 | + , 'disabled' => array( '' ) // It will disable "Any" option | |
| 1128 | 1164 | , 'default' => ( isset( $_REQUEST[ 'wh_approved' ] ) ) ? esc_attr( $_REQUEST[ 'wh_approved' ] ) : '' |
| 1129 | 1165 | , 'label' => ''//__('Status', 'booking') . ':' |
| 1130 | - , 'title' => __('Bookings', 'booking') | |
| 1131 | - ); | |
| 1132 | - | |
| 1133 | - wpbc_bs_dropdown_list( $params ); | |
| 1166 | + , 'title' => __('Bookings', 'booking') | |
| 1167 | + ); | |
| 1134 | 1168 | |
| 1169 | + wpbc_bs_dropdown_list( $params ); | |
| 1170 | + | |
| 1135 | 1171 | Exmaple #2: |
| 1136 | - $dates_interval = array( | |
| 1172 | + $dates_interval = array( | |
| 1137 | 1173 | 1 => '1' . ' ' . __('day' ,'booking') |
| 1138 | 1174 | , 2 => '2' . ' ' . __('days' ,'booking') |
| 1139 | 1175 | , 3 => '3' . ' ' . __('days' ,'booking') |
| 1140 | 1176 | , 4 => '4' . ' ' . __('days' ,'booking') |
| @@ -1147,9 +1183,9 @@ | ||
| 1147 | 1183 | , 90 => '3' . ' ' . __('months' ,'booking') |
| 1148 | 1184 | , 183 => '6' . ' ' . __('months' ,'booking') |
| 1149 | 1185 | , 365 => '1' . ' ' . __('Year' ,'booking') |
| 1150 | 1186 | ); |
| 1151 | - $params = array( | |
| 1187 | + $params = array( | |
| 1152 | 1188 | 'id' => 'wh_booking_date' |
| 1153 | 1189 | , 'id2' => 'wh_booking_date2' |
| 1154 | 1190 | , 'default' => ( isset( $_REQUEST[ 'wh_booking_date' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date' ] ) : '' |
| 1155 | 1191 | , 'default2' => ( isset( $_REQUEST[ 'wh_booking_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date2' ] ) : '' |
| @@ -1154,9 +1190,9 @@ | ||
| 1154 | 1190 | , 'default' => ( isset( $_REQUEST[ 'wh_booking_date' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date' ] ) : '' |
| 1155 | 1191 | , 'default2' => ( isset( $_REQUEST[ 'wh_booking_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date2' ] ) : '' |
| 1156 | 1192 | , 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' ) |
| 1157 | 1193 | , 'label' => ''//__('Booked Dates', 'booking') . ':' |
| 1158 | - , 'title' => __('Dates', 'booking') | |
| 1194 | + , 'title' => __('Dates', 'booking') | |
| 1159 | 1195 | , 'options' => array ( |
| 1160 | 1196 | __('Current dates' ,'booking') => '0' |
| 1161 | 1197 | , __('Today' ,'booking') => '1' |
| 1162 | 1198 | , __('Previous dates' ,'booking') => '2' |
| @@ -1164,131 +1200,131 @@ | ||
| 1164 | 1200 | , 'divider1' => 'divider' |
| 1165 | 1201 | , __('Today check in/out' ,'booking') => '9' |
| 1166 | 1202 | , __('Check In - Tomorrow' ,'booking') => '7' |
| 1167 | 1203 | , __('Check Out - Tomorrow' ,'booking') => '8' |
| 1168 | - , 'divider2' => 'divider' | |
| 1169 | - , 'next' => array( | |
| 1204 | + , 'divider2' => 'divider' | |
| 1205 | + , 'next' => array( | |
| 1170 | 1206 | array( |
| 1171 | - 'type' => 'radio' | |
| 1207 | + 'type' => 'radio' | |
| 1172 | 1208 | , 'label' => __('Next' ,'booking') |
| 1173 | - , 'id' => 'wh_booking_datedays_interval1' | |
| 1174 | - , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1209 | + , 'id' => 'wh_booking_datedays_interval1' | |
| 1210 | + , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1175 | 1211 | , 'style' => '' // CSS of select element |
| 1176 | - , 'class' => '' // CSS Class of select element | |
| 1212 | + , 'class' => '' // CSS Class of select element | |
| 1177 | 1213 | , 'disabled' => false |
| 1178 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1179 | - , 'legend' => '' // aria-label parameter | |
| 1180 | - , 'value' => '4' // Some Value from optins array that selected by default | |
| 1181 | - , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1214 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1215 | + , 'legend' => '' // aria-label parameter | |
| 1216 | + , 'value' => '4' // Some Value from optins array that selected by default | |
| 1217 | + , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1182 | 1218 | && ( $_REQUEST[ 'wh_booking_datedays_interval_Radios'] == '4' ) ) ? true : false |
| 1183 | 1219 | ) |
| 1184 | - , array( | |
| 1220 | + , array( | |
| 1185 | 1221 | 'type' => 'select' |
| 1186 | - , 'attr' => array() | |
| 1222 | + , 'attr' => array() | |
| 1187 | 1223 | , 'name' => 'wh_booking_datenext' |
| 1188 | - , 'id' => 'wh_booking_datenext' | |
| 1224 | + , 'id' => 'wh_booking_datenext' | |
| 1189 | 1225 | , 'options' => $dates_interval |
| 1190 | 1226 | , 'value' => isset( $_REQUEST[ 'wh_booking_datenext'] ) ? esc_attr( $_REQUEST[ 'wh_booking_datenext'] ) : '' |
| 1191 | - ) | |
| 1192 | - ) | |
| 1193 | - , 'prior' => array( | |
| 1194 | - array( | |
| 1227 | + ) | |
| 1228 | + ) | |
| 1229 | + , 'prior' => array( | |
| 1230 | + array( | |
| 1195 | 1231 | 'type' => 'radio' |
| 1196 | 1232 | , 'label' => __('Prior' ,'booking') |
| 1197 | - , 'id' => 'wh_booking_datedays_interval2' | |
| 1198 | - , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1233 | + , 'id' => 'wh_booking_datedays_interval2' | |
| 1234 | + , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1199 | 1235 | , 'style' => '' // CSS of select element |
| 1200 | - , 'class' => '' // CSS Class of select element | |
| 1236 | + , 'class' => '' // CSS Class of select element | |
| 1201 | 1237 | , 'disabled' => false |
| 1202 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1203 | - , 'legend' => '' // aria-label parameter | |
| 1204 | - , 'value' => '5' // Some Value from optins array that selected by default | |
| 1205 | - , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1238 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1239 | + , 'legend' => '' // aria-label parameter | |
| 1240 | + , 'value' => '5' // Some Value from optins array that selected by default | |
| 1241 | + , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1206 | 1242 | && ( $_REQUEST[ 'wh_booking_datedays_interval_Radios'] == '5' ) ) ? true : false |
| 1207 | 1243 | ) |
| 1208 | - , array( | |
| 1244 | + , array( | |
| 1209 | 1245 | 'type' => 'select' |
| 1210 | - , 'attr' => array() | |
| 1246 | + , 'attr' => array() | |
| 1211 | 1247 | , 'name' => 'wh_booking_dateprior' |
| 1212 | - , 'id' => 'wh_booking_dateprior' | |
| 1248 | + , 'id' => 'wh_booking_dateprior' | |
| 1213 | 1249 | , 'options' => $dates_interval |
| 1214 | 1250 | , 'value' => isset( $_REQUEST[ 'wh_booking_dateprior'] ) ? esc_attr( $_REQUEST[ 'wh_booking_dateprior'] ) : '' |
| 1215 | - ) | |
| 1216 | - ) | |
| 1217 | - , 'fixed' => array( array( 'type' => 'group', 'class' => 'input-group text-group'), | |
| 1218 | - array( | |
| 1251 | + ) | |
| 1252 | + ) | |
| 1253 | + , 'fixed' => array( array( 'type' => 'group', 'class' => 'input-group text-group'), | |
| 1254 | + array( | |
| 1219 | 1255 | 'type' => 'radio' |
| 1220 | 1256 | , 'label' => __('Dates' ,'booking') |
| 1221 | - , 'id' => 'wh_booking_datedays_interval3' | |
| 1222 | - , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1257 | + , 'id' => 'wh_booking_datedays_interval3' | |
| 1258 | + , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1223 | 1259 | , 'style' => '' // CSS of select element |
| 1224 | - , 'class' => '' // CSS Class of select element | |
| 1260 | + , 'class' => '' // CSS Class of select element | |
| 1225 | 1261 | , 'disabled' => false |
| 1226 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1227 | - , 'legend' => '' // aria-label parameter | |
| 1228 | - , 'value' => '6' // Some Value from optins array that selected by default | |
| 1229 | - , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1262 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1263 | + , 'legend' => '' // aria-label parameter | |
| 1264 | + , 'value' => '6' // Some Value from optins array that selected by default | |
| 1265 | + , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1230 | 1266 | && ( $_REQUEST[ 'wh_booking_datedays_interval_Radios'] == '6' ) ) ? true : false |
| 1231 | 1267 | ) |
| 1232 | - , array( | |
| 1233 | - 'type' => 'text' | |
| 1234 | - , 'id' => 'wh_booking_datefixeddates' | |
| 1235 | - , 'name' => 'wh_booking_datefixeddates' | |
| 1268 | + , array( | |
| 1269 | + 'type' => 'text' | |
| 1270 | + , 'id' => 'wh_booking_datefixeddates' | |
| 1271 | + , 'name' => 'wh_booking_datefixeddates' | |
| 1236 | 1272 | , 'label' => __('Check-in' ,'booking') . ':' |
| 1237 | 1273 | , 'disabled' => false |
| 1238 | 1274 | , 'class' => 'wpdevbk-filters-section-calendar' // This class add datepicker |
| 1239 | 1275 | , 'style' => '' |
| 1240 | - , 'placeholder' => date( 'Y-m-d' ) | |
| 1241 | - , 'attr' => array() | |
| 1276 | + , 'placeholder' => gmdate( 'Y-m-d' ) | |
| 1277 | + , 'attr' => array() | |
| 1242 | 1278 | , 'value' => isset( $_REQUEST[ 'wh_booking_datefixeddates'] ) ? esc_attr( $_REQUEST[ 'wh_booking_datefixeddates'] ) : '' |
| 1243 | - ) | |
| 1244 | - , array( | |
| 1245 | - 'type' => 'text' | |
| 1246 | - , 'id' => 'wh_booking_date2fixeddates' | |
| 1247 | - , 'name' => 'wh_booking_date2fixeddates' | |
| 1279 | + ) | |
| 1280 | + , array( | |
| 1281 | + 'type' => 'text' | |
| 1282 | + , 'id' => 'wh_booking_date2fixeddates' | |
| 1283 | + , 'name' => 'wh_booking_date2fixeddates' | |
| 1248 | 1284 | , 'label' => __('Check-out' ,'booking') . ':' |
| 1249 | 1285 | , 'disabled' => false |
| 1250 | 1286 | , 'class' => 'wpdevbk-filters-section-calendar' // This class add datepicker |
| 1251 | 1287 | , 'style' => '' |
| 1252 | - , 'placeholder' => date( 'Y-m-d' ) | |
| 1253 | - , 'attr' => array() | |
| 1288 | + , 'placeholder' => gmdate( 'Y-m-d' ) | |
| 1289 | + , 'attr' => array() | |
| 1254 | 1290 | , 'value' => isset( $_REQUEST[ 'wh_booking_date2fixeddates'] ) ? esc_attr( $_REQUEST[ 'wh_booking_date2fixeddates'] ) : '' |
| 1255 | - ) | |
| 1256 | - ) | |
| 1257 | - , 'divider3' => 'divider' | |
| 1258 | - , 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') | |
| 1259 | - , array( | |
| 1291 | + ) | |
| 1292 | + ) | |
| 1293 | + , 'divider3' => 'divider' | |
| 1294 | + , 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') | |
| 1295 | + , array( | |
| 1260 | 1296 | 'type' => 'radio' |
| 1261 | 1297 | , 'label' => __('Tada' ,'booking') |
| 1262 | - , 'id' => 'wh_booking_datedays_interval4' | |
| 1263 | - , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1298 | + , 'id' => 'wh_booking_datedays_interval4' | |
| 1299 | + , 'name' => 'wh_booking_datedays_interval_Radios' | |
| 1264 | 1300 | , 'style' => '' // CSS of select element |
| 1265 | - , 'class' => '' // CSS Class of select element | |
| 1301 | + , 'class' => '' // CSS Class of select element | |
| 1266 | 1302 | , 'disabled' => false |
| 1267 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1268 | - , 'legend' => '' // aria-label parameter | |
| 1269 | - , 'value' => '10' // Some Value from optins array that selected by default | |
| 1270 | - , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1303 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1304 | + , 'legend' => '' // aria-label parameter | |
| 1305 | + , 'value' => '10' // Some Value from optins array that selected by default | |
| 1306 | + , 'selected' => ( isset($_REQUEST[ 'wh_booking_datedays_interval_Radios'] ) | |
| 1271 | 1307 | && ( $_REQUEST[ 'wh_booking_datedays_interval_Radios'] == '10' ) ) ? true : false |
| 1272 | 1308 | ) |
| 1273 | - | |
| 1274 | - , array( | |
| 1275 | - 'type' => 'text' | |
| 1276 | - , 'id' => 'wh_booking_datecustom' | |
| 1277 | - , 'name' => 'wh_booking_datecustom' | |
| 1309 | + | |
| 1310 | + , array( | |
| 1311 | + 'type' => 'text' | |
| 1312 | + , 'id' => 'wh_booking_datecustom' | |
| 1313 | + , 'name' => 'wh_booking_datecustom' | |
| 1278 | 1314 | , 'label' => __('Custom' ,'booking') . ':' |
| 1279 | 1315 | , 'disabled' => false |
| 1280 | 1316 | , 'class' => '' |
| 1281 | 1317 | , 'style' => '' |
| 1282 | - , 'placeholder' => date( 'Y' ) | |
| 1283 | - , 'attr' => array() | |
| 1318 | + , 'placeholder' => gmdate( 'Y' ) | |
| 1319 | + , 'attr' => array() | |
| 1284 | 1320 | , 'value' => isset( $_REQUEST[ 'wh_booking_datecustom'] ) ? esc_attr( $_REQUEST[ 'wh_booking_datecustom'] ) : '' |
| 1285 | 1321 | ) |
| 1286 | 1322 | ) |
| 1287 | - , 'divider4' => 'divider' | |
| 1288 | - , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), | |
| 1289 | - array( | |
| 1290 | - 'type' => 'button' | |
| 1323 | + , 'divider4' => 'divider' | |
| 1324 | + , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), | |
| 1325 | + array( | |
| 1326 | + 'type' => 'button' | |
| 1291 | 1327 | , 'title' => __('Apply' ,'booking') // Title of the button |
| 1292 | 1328 | , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1293 | 1329 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1294 | 1330 | , 'action' => "wpbc_show_selected_in_dropdown__radio_select_option(" |
| @@ -1303,12 +1339,12 @@ | ||
| 1303 | 1339 | , 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1304 | 1340 | , 'style' => '' // Any CSS class here |
| 1305 | 1341 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1306 | 1342 | , 'attr' => array() |
| 1307 | - | |
| 1343 | + | |
| 1308 | 1344 | ) |
| 1309 | - , array( | |
| 1310 | - 'type' => 'button' | |
| 1345 | + , array( | |
| 1346 | + 'type' => 'button' | |
| 1311 | 1347 | , 'title' => __('Close' ,'booking') // Title of the button |
| 1312 | 1348 | , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1313 | 1349 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1314 | 1350 | //, 'action' => '' // Some JavaScript to execure, for example run the function |
| @@ -1317,18 +1353,18 @@ | ||
| 1317 | 1353 | , 'font_icon' => '' |
| 1318 | 1354 | , 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1319 | 1355 | , 'style' => '' // Any CSS class here |
| 1320 | 1356 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1321 | - , 'attr' => array() | |
| 1357 | + , 'attr' => array() | |
| 1322 | 1358 | ) |
| 1323 | 1359 | ) |
| 1324 | 1360 | ) |
| 1325 | - ); | |
| 1326 | - wpbc_bs_dropdown_list( $params ); | |
| 1361 | + ); | |
| 1362 | + wpbc_bs_dropdown_list( $params ); | |
| 1327 | 1363 | |
| 1328 | 1364 | |
| 1329 | 1365 | Exmaple #3: |
| 1330 | - $params = array( | |
| 1366 | + $params = array( | |
| 1331 | 1367 | 'id' => 'wh_pay_status' |
| 1332 | 1368 | // , 'id2' => 'wh_booking_date2' |
| 1333 | 1369 | , 'default' => ( isset( $_REQUEST[ 'wh_pay_status' ] ) ) ? esc_attr( $_REQUEST[ 'wh_pay_status' ] ) : 'all' |
| 1334 | 1370 | // , 'default2' => ( isset( $_REQUEST[ 'wh_booking_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date2' ] ) : '' |
| @@ -1333,9 +1369,9 @@ | ||
| 1333 | 1369 | , 'default' => ( isset( $_REQUEST[ 'wh_pay_status' ] ) ) ? esc_attr( $_REQUEST[ 'wh_pay_status' ] ) : 'all' |
| 1334 | 1370 | // , 'default2' => ( isset( $_REQUEST[ 'wh_booking_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_booking_date2' ] ) : '' |
| 1335 | 1371 | , 'hint' => array( 'title' => __('Payment status' ,'booking') , 'position' => 'top' ) |
| 1336 | 1372 | , 'label' => ''//__('Booked Dates', 'booking') . ':' |
| 1337 | - , 'title' => __('Payment', 'booking') | |
| 1373 | + , 'title' => __('Payment', 'booking') | |
| 1338 | 1374 | , 'options' => array ( |
| 1339 | 1375 | __('Any Status' ,'booking') =>'all', |
| 1340 | 1376 | 'divider0' => 'divider', |
| 1341 | 1377 | __('Paid OK' ,'booking') =>'group_ok', |
| @@ -1341,42 +1377,42 @@ | ||
| 1341 | 1377 | __('Paid OK' ,'booking') =>'group_ok', |
| 1342 | 1378 | __('Unknown Status' ,'booking') =>'group_unknown', |
| 1343 | 1379 | __('Not Completed' ,'booking') =>'group_pending', |
| 1344 | 1380 | __('Failed' ,'booking') =>'group_failed' |
| 1345 | - , 'divider2' => 'divider' | |
| 1346 | - , 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') | |
| 1347 | - , array( | |
| 1381 | + , 'divider2' => 'divider' | |
| 1382 | + , 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') | |
| 1383 | + , array( | |
| 1348 | 1384 | 'type' => 'radio' |
| 1349 | - , 'label' => __('Custom' ,'booking') | |
| 1350 | - , 'id' => 'wh_pay_statuscustom_radios1' | |
| 1351 | - , 'name' => 'wh_pay_statuscustom_Radios' | |
| 1385 | + , 'label' => __('Custom' ,'booking') | |
| 1386 | + , 'id' => 'wh_pay_statuscustom_radios1' | |
| 1387 | + , 'name' => 'wh_pay_statuscustom_Radios' | |
| 1352 | 1388 | , 'style' => '' // CSS of select element |
| 1353 | - , 'class' => '' // CSS Class of select element | |
| 1389 | + , 'class' => '' // CSS Class of select element | |
| 1354 | 1390 | , 'disabled' => false |
| 1355 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1356 | - , 'legend' => '' // aria-label parameter | |
| 1357 | - , 'value' => '1' // Some Value from optins array that selected by default | |
| 1358 | - , 'selected' => ( isset($_REQUEST[ 'wh_pay_statuscustom_Radios'] ) | |
| 1391 | + , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 1392 | + , 'legend' => '' // aria-label parameter | |
| 1393 | + , 'value' => '1' // Some Value from optins array that selected by default | |
| 1394 | + , 'selected' => ( isset($_REQUEST[ 'wh_pay_statuscustom_Radios'] ) | |
| 1359 | 1395 | && ( $_REQUEST[ 'wh_pay_statuscustom_Radios'] == '1' ) ) ? true : false |
| 1360 | 1396 | ) |
| 1361 | 1397 | |
| 1362 | - , array( | |
| 1363 | - 'type' => 'text' | |
| 1364 | - , 'id' => 'wh_pay_statuscustom' | |
| 1365 | - , 'name' => 'wh_pay_statuscustom' | |
| 1398 | + , array( | |
| 1399 | + 'type' => 'text' | |
| 1400 | + , 'id' => 'wh_pay_statuscustom' | |
| 1401 | + , 'name' => 'wh_pay_statuscustom' | |
| 1366 | 1402 | , 'label' => __('Payment status' ,'booking') . ':' |
| 1367 | 1403 | , 'disabled' => false |
| 1368 | 1404 | , 'class' => '' |
| 1369 | 1405 | , 'style' => '' |
| 1370 | 1406 | , 'placeholder' => '' |
| 1371 | - , 'attr' => array() | |
| 1407 | + , 'attr' => array() | |
| 1372 | 1408 | , 'value' => isset( $_REQUEST[ 'wh_pay_statuscustom'] ) ? esc_attr( $_REQUEST[ 'wh_pay_statuscustom'] ) : '' |
| 1373 | 1409 | ) |
| 1374 | 1410 | ) |
| 1375 | - , 'divider4' => 'divider' | |
| 1376 | - , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), | |
| 1377 | - array( | |
| 1378 | - 'type' => 'button' | |
| 1411 | + , 'divider4' => 'divider' | |
| 1412 | + , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), | |
| 1413 | + array( | |
| 1414 | + 'type' => 'button' | |
| 1379 | 1415 | , 'title' => __('Apply' ,'booking') // Title of the button |
| 1380 | 1416 | , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1381 | 1417 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1382 | 1418 | , 'action' => "wpbc_show_selected_in_dropdown__radio_select_option(" |
| @@ -1393,10 +1429,10 @@ | ||
| 1393 | 1429 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1394 | 1430 | , 'attr' => array() |
| 1395 | 1431 | |
| 1396 | 1432 | ) |
| 1397 | - , array( | |
| 1398 | - 'type' => 'button' | |
| 1433 | + , array( | |
| 1434 | + 'type' => 'button' | |
| 1399 | 1435 | , 'title' => __('Close' ,'booking') // Title of the button |
| 1400 | 1436 | , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1401 | 1437 | , 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1402 | 1438 | //, 'action' => '' // Some JavaScript to execure, for example run the function |
| @@ -1405,31 +1441,31 @@ | ||
| 1405 | 1441 | , 'font_icon' => '' |
| 1406 | 1442 | , 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1407 | 1443 | , 'style' => '' // Any CSS class here |
| 1408 | 1444 | , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1409 | - , 'attr' => array() | |
| 1445 | + , 'attr' => array() | |
| 1410 | 1446 | ) |
| 1411 | 1447 | ) |
| 1412 | 1448 | ) |
| 1413 | - ); | |
| 1414 | - wpbc_bs_dropdown_list( $params ); | |
| 1449 | + ); | |
| 1450 | + wpbc_bs_dropdown_list( $params ); | |
| 1415 | 1451 | |
| 1416 | 1452 | */ |
| 1417 | 1453 | function wpbc_bs_dropdown_list( $args = array() ) { |
| 1418 | - | |
| 1454 | + | |
| 1419 | 1455 | $milliseconds = round(microtime(true) * 1000); |
| 1420 | - | |
| 1456 | + | |
| 1421 | 1457 | $defaults = array( |
| 1422 | 1458 | 'id' => '' // HTML ID of element |
| 1423 | 1459 | , 'id2' => '' // HTML ID of 2nd element |
| 1424 | 1460 | , 'default' => '' // Some Value from optins array that selected by default |
| 1425 | 1461 | , 'default2' => '' // Some Value from optins array that selected by default |
| 1426 | - , 'hint' => '' // Hint // array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) | |
| 1427 | - , 'css_classes' => '' | |
| 1462 | + , 'hint' => '' // Hint // array( 'title' => __('Delete booking' ,'booking') , 'position' => 'bottom' ) | |
| 1463 | + , 'css_classes' => '' | |
| 1428 | 1464 | , 'label' => '' // Label of element "at Top of element" |
| 1429 | 1465 | , 'title' => '' // Title of element "Inside of element" |
| 1430 | - , 'align' => 'left' // Align: left | right | |
| 1431 | - , 'options' => array() // Associated array of titles and values | |
| 1466 | + , 'align' => 'left' // Align: left | right | |
| 1467 | + , 'options' => array() // Associated array of titles and values | |
| 1432 | 1468 | , 'disabled' => array() // If some options disbaled, then its must list here |
| 1433 | 1469 | ); |
| 1434 | 1470 | $params = wp_parse_args( $args, $defaults ); |
| 1435 | 1471 | |
| @@ -1435,17 +1471,17 @@ | ||
| 1435 | 1471 | |
| 1436 | 1472 | // Check if this list Simple or Complex (with input elements) //////////// |
| 1437 | 1473 | $is_this_simple_list = true; //FixIn: 9.0.1.1.1 |
| 1438 | 1474 | foreach ( $params['options'] as $key => $value ) { |
| 1439 | - if ( is_array( $value ) ) { | |
| 1475 | + if ( is_array( $value ) ) { | |
| 1440 | 1476 | $is_this_simple_list = false; |
| 1441 | 1477 | break; |
| 1442 | - } | |
| 1443 | - } | |
| 1478 | + } | |
| 1479 | + } | |
| 1444 | 1480 | |
| 1445 | 1481 | // Selected Value ////////////////////////////////////////////////////////// |
| 1446 | 1482 | $wpbc_value = $params[ 'default' ]; |
| 1447 | - | |
| 1483 | + | |
| 1448 | 1484 | $wpbc_selector_default = array_search( $wpbc_value, $params['options'] ); |
| 1449 | 1485 | if ( $wpbc_selector_default === false ) { |
| 1450 | 1486 | $wpbc_selector_default = key( $params['options'] ); |
| 1451 | 1487 | $wpbc_selector_default_value = current( $params['options'] ); |
| @@ -1450,54 +1486,61 @@ | ||
| 1450 | 1486 | $wpbc_selector_default = key( $params['options'] ); |
| 1451 | 1487 | $wpbc_selector_default_value = current( $params['options'] ); |
| 1452 | 1488 | } else |
| 1453 | 1489 | $wpbc_selector_default_value = $wpbc_value; |
| 1454 | - | |
| 1455 | - $wpbc_selector_default_value2 = $params[ 'default2' ]; | |
| 1456 | - | |
| 1490 | + | |
| 1491 | + $wpbc_selector_default_value2 = $params[ 'default2' ]; | |
| 1492 | + | |
| 1457 | 1493 | // Initial setting title, if already was request ///////////////////////// |
| 1458 | - if ( isset( $_REQUEST[ esc_attr( $params['id'] ) ] ) ) { | |
| 1459 | - ?><script type="text/javascript"> | |
| 1494 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 1495 | + if ( isset( $_REQUEST[ esc_attr( $params['id'] ) ] ) ) { | |
| 1496 | + ?><script type="text/javascript"> | |
| 1460 | 1497 | jQuery(document).ready( function(){ |
| 1461 | 1498 | jQuery('#<?php echo esc_attr( $params['id'] ); ?>_container .button.button-primary').trigger( "click" ); |
| 1462 | - }); | |
| 1463 | - </script><?php | |
| 1464 | - } | |
| 1465 | - //////////////////////////////////////////////////////////////////////////// | |
| 1466 | - ?> | |
| 1499 | + }); | |
| 1500 | + </script><?php | |
| 1501 | + } | |
| 1502 | + // ----------------------------------------------------------------------------------------------------------------- | |
| 1503 | + ?> | |
| 1467 | 1504 | <div class="control-group"> |
| 1468 | - <?php if ( ! empty( $params['label'] ) ) { | |
| 1469 | - ?><label for="<?php echo $params['id']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php | |
| 1505 | + <?php if ( ! empty( $params['label'] ) ) { | |
| 1506 | + ?><label for="<?php echo esc_attr( $params['id'] ); ?>" class="control-label"><?php echo esc_html( $params['label'] ); ?></label><?php | |
| 1470 | 1507 | } |
| 1471 | 1508 | ?><div> |
| 1472 | - <div class="btn-group"> | |
| 1473 | - <a href="javascript:void(0)" | |
| 1509 | + <div class="btn-group"> | |
| 1510 | + <a href="javascript:void(0)" | |
| 1474 | 1511 | <?php if (! $is_this_simple_list ) { ?> |
| 1475 | - onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();" | |
| 1512 | + onclick="javascript:jQuery('#<?php echo esc_js( $params['id'] ); ?>_container').show();" | |
| 1476 | 1513 | <?php } ?> |
| 1477 | - data-toggle="wpbc_dropdown" | |
| 1478 | - id="<?php echo $params['id'];?>_selector" | |
| 1514 | + data-toggle="wpbc_dropdown" | |
| 1515 | + id="<?php echo esc_attr( $params['id'] ); ?>_selector" | |
| 1479 | 1516 | <?php if ( ! empty( $params['hint'] ) ) { ?> |
| 1480 | 1517 | title="<?php echo esc_js( $params['hint']['title'] ); ?>" |
| 1481 | - <?php } ?> | |
| 1482 | - class="button button-secondary dropdown-toggle <?php | |
| 1483 | - echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; | |
| 1484 | - echo ( ! empty( $params['css_classes'] ) ) ? $params['css_classes'] . ' ' : '' ; | |
| 1485 | - ?>" | |
| 1486 | - <?php echo wpbc_get_custom_attr( $params ); ?> | |
| 1518 | + <?php } ?> | |
| 1519 | + class="button button-secondary dropdown-toggle <?php | |
| 1520 | + echo esc_attr( ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ); | |
| 1521 | + echo esc_attr( ( ! empty( $params['css_classes'] ) ) ? $params['css_classes'] . ' ' : '' ); | |
| 1522 | + ?>" | |
| 1523 | + <?php | |
| 1524 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1525 | + echo wpbc_get_custom_attr( $params ); ?> | |
| 1487 | 1526 | ><label class="label_in_filters" |
| 1488 | - ><?php echo $params['title']; ?>: </label> <span class="wpbc_selected_in_dropdown"><?php echo $wpbc_selector_default; ?></span> <span class="caret"></span></a> | |
| 1489 | - <ul | |
| 1490 | - id="<?php echo $params['id']; ?>_container" | |
| 1491 | - class="dropdown-menu dropdown-menu-<?php echo $params['align']; ?>" | |
| 1527 | + ><?php echo wp_kses_post( $params['title'] ); ?>: </label> <span class="wpbc_selected_in_dropdown"><?php echo wp_kses_post( $wpbc_selector_default ); ?></span> <span class="caret"></span></a> | |
| 1528 | + <ul | |
| 1529 | + id="<?php echo esc_attr( $params['id'] ); ?>_container" | |
| 1530 | + class="dropdown-menu dropdown-menu-<?php echo esc_attr( $params['align'] ); ?>" | |
| 1492 | 1531 | ><?php |
| 1493 | - | |
| 1532 | + | |
| 1494 | 1533 | wpbc_bs_list_of_options_for_dropdown( $params , 'list', $is_this_simple_list ); |
| 1495 | - | |
| 1534 | + | |
| 1496 | 1535 | ?></ul> |
| 1497 | - <input type="hidden" autocomplete="off" value="<?php echo $wpbc_selector_default_value; ?>" id="<?php echo $params['id']; ?>" name="<?php echo $params['id']; ?>" /> | |
| 1536 | + <input type="hidden" autocomplete="off" value="<?php | |
| 1537 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1538 | + echo $wpbc_selector_default_value; ?>" id="<?php echo esc_attr( $params['id'] ); ?>" name="<?php echo esc_attr( $params['id'] ); ?>" /> | |
| 1498 | 1539 | <?php if ( ! empty($params['id2'] ) ) { ?> |
| 1499 | - <input type="hidden" autocomplete="off" value="<?php echo $wpbc_selector_default_value2; ?>" id="<?php echo $params['id2']; ?>" name="<?php echo $params['id2']; ?>" /> | |
| 1540 | + <input type="hidden" autocomplete="off" value="<?php | |
| 1541 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1542 | + echo $wpbc_selector_default_value2; ?>" id="<?php echo esc_attr( $params['id2'] ); ?>" name="<?php echo esc_attr( $params['id2'] ); ?>" /> | |
| 1500 | 1543 | <?php } ?> |
| 1501 | 1544 | </div> |
| 1502 | 1545 | </div> |
| 1503 | 1546 | </div> |
| @@ -1551,12 +1594,12 @@ | ||
| 1551 | 1594 | <a href="javascript:void(0)" |
| 1552 | 1595 | data-toggle="wpbc_dropdown" |
| 1553 | 1596 | aria-expanded="true" |
| 1554 | 1597 | <?php if ( ! empty( $params['hint'] ) ) { ?> |
| 1555 | - title="<?php echo esc_js( $params['hint']['title'] ); ?>" | |
| 1598 | + title="<?php echo esc_attr( $params['hint']['title'] ); ?>" | |
| 1556 | 1599 | <?php } ?> |
| 1557 | 1600 | class="dropdown-toggle nav-tab <?php |
| 1558 | - echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; | |
| 1601 | + echo esc_attr( ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ); | |
| 1559 | 1602 | ?>"><?php |
| 1560 | 1603 | |
| 1561 | 1604 | if ( ! empty( $params['icon'] ) ) { |
| 1562 | 1605 | |
| @@ -1561,17 +1604,18 @@ | ||
| 1561 | 1604 | if ( ! empty( $params['icon'] ) ) { |
| 1562 | 1605 | |
| 1563 | 1606 | if ( substr( $params['icon'], 0, 4 ) != 'http') $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $params['icon']; |
| 1564 | 1607 | else $img_path = $params['icon']; |
| 1565 | - | |
| 1566 | - ?><img class="menuicons" src="<?php echo $img_path; ?>"><?php // Img Icon | |
| 1608 | + | |
| 1609 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 1610 | + ?><img class="menuicons" src="<?php echo esc_attr( $img_path ); ?>"><?php // Img Icon | |
| 1567 | 1611 | |
| 1568 | 1612 | } elseif ( ! empty( $params['font_icon'] ) ) { |
| 1569 | 1613 | |
| 1570 | - ?><i class="menu_icon icon-1x <?php echo $params['font_icon']; ?>"></i> <?php // Font Icon | |
| 1614 | + ?><i class="menu_icon icon-1x <?php echo wp_kses_post($params['font_icon']); ?>"></i> <?php // Font Icon | |
| 1571 | 1615 | |
| 1572 | 1616 | } ?><span |
| 1573 | - class="nav-tab-text"><?php echo $params['title']; ?></span> <b | |
| 1617 | + class="nav-tab-text"><?php echo wp_kses_post( $params['title'] ); ?></span> <b | |
| 1574 | 1618 | class="caret" style="border-top-color: #333333 !important;"></b></a> |
| 1575 | 1619 | <ul class="dropdown-menu" role="menu" style="<?php echo ( ( $params['position'] == 'right' ) ? 'right:0px; left:auto;' : '' ); ?>"> |
| 1576 | 1620 | <?php |
| 1577 | 1621 | foreach ( $params['items'] as $items ) { |
| @@ -1581,13 +1625,17 @@ | ||
| 1581 | 1625 | ?><li class="divider"></li><?php |
| 1582 | 1626 | break; |
| 1583 | 1627 | |
| 1584 | 1628 | case 'text': |
| 1585 | - ?><li <?php echo wpbc_get_custom_attr( $items ); ?> ><?php echo $items['title']; ?></li><?php | |
| 1629 | + ?><li <?php | |
| 1630 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1631 | + echo wpbc_get_custom_attr( $items ); ?> ><?php echo wp_kses_post( $items['title'] ); ?></li><?php | |
| 1586 | 1632 | break; |
| 1587 | 1633 | |
| 1588 | 1634 | default: |
| 1589 | - ?><li><a <?php echo wpbc_get_custom_attr( $items ); ?> href="<?php echo $items['url']; ?>"><?php echo $items['title']; ?></a></li><?php | |
| 1635 | + ?><li><a <?php | |
| 1636 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1637 | + echo wpbc_get_custom_attr( $items ); ?> href="<?php echo esc_attr( $items['url'] ); ?>"><?php echo wp_kses_post( $items['title'] ); ?></a></li><?php | |
| 1590 | 1638 | break; |
| 1591 | 1639 | } |
| 1592 | 1640 | } |
| 1593 | 1641 | ?> |
| @@ -1608,11 +1656,11 @@ | ||
| 1608 | 1656 | * |
| 1609 | 1657 | * Example: |
| 1610 | 1658 | $params['btn_vm_calendar'] = array( |
| 1611 | 1659 | 'title' => '' |
| 1612 | - , 'hint' => array( 'title' => __('Calendar Overview' ,'booking') , 'position' => 'bottom' ) | |
| 1660 | + , 'hint' => array( 'title' => __('Timeline View' ,'booking') , 'position' => 'bottom' ) | |
| 1613 | 1661 | , 'selected' => ( $selected_view_mode == 'vm_calendar' ) ? true : false |
| 1614 | - , 'link' => $bk_admin_url . '&view_mode=vm_calendar' | |
| 1662 | + , 'link' => $bk_admin_url . '&tab=vm_calendar' | |
| 1615 | 1663 | , 'icon' => '' |
| 1616 | 1664 | , 'font_icon' => 'glyphicon glyphicon-calendar' |
| 1617 | 1665 | ); |
| 1618 | 1666 | |
| @@ -1622,9 +1670,9 @@ | ||
| 1622 | 1670 | ?><div role="group" class="btn-group-vertical" aria-label="..." ><?php |
| 1623 | 1671 | |
| 1624 | 1672 | foreach ( $params as $btn_id => $btn_params ) { |
| 1625 | 1673 | |
| 1626 | - ?><a id="<?php echo $btn_id; ?>" | |
| 1674 | + ?><a id="<?php echo esc_attr( $btn_id ); ?>" | |
| 1627 | 1675 | <?php if ( ! empty( $btn_params['hint'] ) ) { ?> |
| 1628 | 1676 | title="<?php echo esc_js( $btn_params['hint']['title'] ); ?>" |
| 1629 | 1677 | <?php |
| 1630 | 1678 | /* data-original-title="<?php echo esc_js( $btn_params['hint'] ); ?>" */ |
| @@ -1629,13 +1677,15 @@ | ||
| 1629 | 1677 | <?php |
| 1630 | 1678 | /* data-original-title="<?php echo esc_js( $btn_params['hint'] ); ?>" */ |
| 1631 | 1679 | } ?> |
| 1632 | 1680 | class="button button-secondary <?php |
| 1633 | - echo ( $btn_params['selected'] ) ? 'active ' : '' ; | |
| 1634 | - echo ( ! empty( $btn_params['hint'] ) ) ? 'tooltip_' . $btn_params['hint']['position'] . ' ' : '' ; | |
| 1635 | - echo ( ! empty( $btn_params['css_classes'] ) ) ? $btn_params['css_classes'] . ' ' : '' ; | |
| 1681 | + echo esc_attr( ( $btn_params['selected'] ) ? 'active ' : '' ); | |
| 1682 | + echo esc_attr( ( ! empty( $btn_params['hint'] ) ) ? 'tooltip_' . $btn_params['hint']['position'] . ' ' : '' ); | |
| 1683 | + echo esc_attr( ( ! empty( $btn_params['css_classes'] ) ) ? $btn_params['css_classes'] . ' ' : '' ); | |
| 1636 | 1684 | ?>" |
| 1637 | - href="<?php echo $btn_params['link']; ?>" | |
| 1685 | + href="<?php | |
| 1686 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1687 | + echo $btn_params['link']; ?>" | |
| 1638 | 1688 | onclick="javascript:void(0)" |
| 1639 | 1689 | ><?php |
| 1640 | 1690 | |
| 1641 | 1691 | // Icon |
| @@ -1646,13 +1696,14 @@ | ||
| 1646 | 1696 | $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $btn_params['icon']; |
| 1647 | 1697 | else |
| 1648 | 1698 | $img_path = $btn_params['icon']; |
| 1649 | 1699 | |
| 1650 | - ?><img class="menuicons" src="<?php echo $img_path; ?>" style="width:20px;" /><?php // IMG Icon | |
| 1700 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 1701 | + ?><img class="menuicons" src="<?php echo esc_attr( $img_path ); ?>" style="width:20px;" /><?php // IMG Icon | |
| 1651 | 1702 | |
| 1652 | 1703 | } elseif ( ! empty( $btn_params['font_icon'] ) ) { |
| 1653 | 1704 | |
| 1654 | - ?><i class="menu_icon icon-1x <?php echo $btn_params['font_icon']; ?>"></i><?php // Font Icon | |
| 1705 | + ?><i class="menu_icon icon-1x <?php echo esc_attr( $btn_params['font_icon'] ); ?>"></i><?php // Font Icon | |
| 1655 | 1706 | } else { |
| 1656 | 1707 | $is_icon_not_showed = true; |
| 1657 | 1708 | } |
| 1658 | 1709 | |
| @@ -1657,9 +1708,9 @@ | ||
| 1657 | 1708 | } |
| 1658 | 1709 | |
| 1659 | 1710 | // Text |
| 1660 | 1711 | if ( ( ! empty( $btn_params['title'] ) ) && ( ( $is_icon_not_showed ) ) ){ |
| 1661 | - ?><span class="btn-group-vertical-text" > <?php echo esc_js( $btn_params['title'] ); ?></span><?php | |
| 1712 | + ?><span class="btn-group-vertical-text" > <?php echo wp_kses_post( $btn_params['title'] ); ?></span><?php | |
| 1662 | 1713 | } |
| 1663 | 1714 | |
| 1664 | 1715 | ?></a><?php |
| 1665 | 1716 | } |
| @@ -1725,23 +1776,24 @@ | ||
| 1725 | 1776 | if ( $tab['disabled'] ) { |
| 1726 | 1777 | $tab['link'] = 'javascript:void(0)'; |
| 1727 | 1778 | $html_tag = 'span'; |
| 1728 | 1779 | } |
| 1729 | - | |
| 1730 | - | |
| 1780 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1731 | 1781 | echo '<' , $html_tag , ' '; // Start HTML Tag |
| 1732 | 1782 | |
| 1733 | 1783 | if ( $html_tag == 'a' ) { // Paramters for A tag |
| 1734 | 1784 | |
| 1785 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1735 | 1786 | echo ' href="' , $tab['link'] , '" '; |
| 1736 | - //echo ' title="' , esc_js( $tab['title'] ) , '" '; | |
| 1737 | 1787 | |
| 1738 | - if ( ! empty( $tab['onclick'] ) ) | |
| 1739 | - echo ' onclick="javascript:' , $tab['onclick'] , '" '; | |
| 1788 | + if ( ! empty( $tab['onclick'] ) ){ | |
| 1789 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1790 | + echo ' onclick="javascript:' , $tab['onclick'] , '" '; | |
| 1791 | + } | |
| 1740 | 1792 | } |
| 1741 | 1793 | |
| 1742 | 1794 | if ( ! empty( $tab['hint'] ) ) { // Hint |
| 1743 | - echo ' title="' , esc_js( $tab['hint']['title'] ) , '" '; | |
| 1795 | + echo ' title="' . esc_attr( $tab['hint']['title'] ) . '" '; | |
| 1744 | 1796 | } |
| 1745 | 1797 | |
| 1746 | 1798 | echo ' class="nav-tab'; // CSS Classes |
| 1747 | 1799 | |
| @@ -1747,17 +1799,19 @@ | ||
| 1747 | 1799 | |
| 1748 | 1800 | if ( $tab['top'] !== true ) echo ' wpdevelop-submenu-tab'; |
| 1749 | 1801 | if ( $tab['default'] ) echo ' nav-tab-active'; |
| 1750 | 1802 | if ( $tab['disabled'] ) echo ' wpdevelop-tab-disabled'; |
| 1751 | - if ( ! empty( $tab['hint'] ) ) echo ' tooltip_' , $tab['hint']['position']; | |
| 1752 | - if ( ! empty( $tab['position'] ) ) echo ' nav-tab-position-' , $tab['position']; | |
| 1803 | + if ( ! empty( $tab['hint'] ) ) echo ' tooltip_' . esc_attr( $tab['hint']['position'] ); | |
| 1804 | + if ( ! empty( $tab['position'] ) ) echo ' nav-tab-position-' . esc_attr( $tab['position'] ); | |
| 1753 | 1805 | if ( ! empty( $tab['hided'] ) ) echo ' hide'; |
| 1754 | 1806 | |
| 1755 | - echo ' ' , $tab['css_classes']; | |
| 1807 | + echo ' ' . esc_attr( $tab['css_classes'] ); | |
| 1756 | 1808 | |
| 1757 | 1809 | echo '" '; |
| 1758 | 1810 | |
| 1759 | - echo wpbc_get_custom_attr( $tab ); | |
| 1811 | + | |
| 1812 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1813 | + echo wpbc_get_custom_attr( $tab ); | |
| 1760 | 1814 | echo '>'; // Close > for A or SPAN |
| 1761 | 1815 | |
| 1762 | 1816 | |
| 1763 | 1817 | // Icon |
| @@ -1768,13 +1822,14 @@ | ||
| 1768 | 1822 | $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $tab['icon']; |
| 1769 | 1823 | else |
| 1770 | 1824 | $img_path = $tab['icon']; |
| 1771 | 1825 | |
| 1772 | - ?><img class="menuicons" src="<?php echo $img_path; ?>" style="width:20px;" /><?php // IMG Icon | |
| 1826 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 1827 | + ?><img class="menuicons" src="<?php echo esc_attr( $img_path ); ?>" style="width:20px;" /><?php // IMG Icon | |
| 1773 | 1828 | |
| 1774 | 1829 | } elseif ( ! empty( $tab['font_icon'] ) ) { |
| 1775 | 1830 | |
| 1776 | - ?><i class="menu_icon icon-1x <?php echo $tab['font_icon']; ?>"></i><?php // Font Icon | |
| 1831 | + ?><i class="menu_icon icon-1x <?php echo esc_attr( $tab['font_icon'] ); ?>"></i><?php // Font Icon | |
| 1777 | 1832 | } else { |
| 1778 | 1833 | $is_icon_showed = false; |
| 1779 | 1834 | } |
| 1780 | 1835 | |
| @@ -1783,9 +1838,9 @@ | ||
| 1783 | 1838 | ?><span class="<?php echo ( $is_icon_showed ) ? 'nav-tab-text' : ''; ?>" style="<?php echo esc_attr( $tab['text_css'] ); ?>" ><?php |
| 1784 | 1839 | if ( ! empty( $tab['title'] ) ) { |
| 1785 | 1840 | echo ( $is_icon_showed ) ? ' ' : ''; |
| 1786 | 1841 | } |
| 1787 | - echo $tab['title']; | |
| 1842 | + echo wp_kses_post( $tab['title'] ); | |
| 1788 | 1843 | ?></span><?php |
| 1789 | 1844 | |
| 1790 | 1845 | // C h e c k b o x |
| 1791 | 1846 | if ( $tab['checkbox'] !== false ) { |
| @@ -1790,27 +1845,30 @@ | ||
| 1790 | 1845 | // C h e c k b o x |
| 1791 | 1846 | if ( $tab['checkbox'] !== false ) { |
| 1792 | 1847 | ?><input type="checkbox" |
| 1793 | 1848 | <?php if ( $tab['checkbox']['checked'] ) echo ' checked="CHECKED" '; ?> |
| 1794 | - name="<?php echo $tab['checkbox']['name']; ?>_dublicated" | |
| 1795 | - id="<?php echo $tab['checkbox']['name']; ?>_dublicated" | |
| 1796 | - value="<?php echo ( isset( $tab['checkbox']['value'] ) ? $tab['checkbox']['value'] : '' ); ?>" | |
| 1797 | - onchange="javascript: <?php if ( isset( $tab['checkbox']['onclick'] ) ) { | |
| 1798 | - echo $tab['checkbox']['onclick']; | |
| 1799 | - } else { | |
| 1800 | - ?>if ( jQuery('#<?php echo $tab['checkbox']['name']; ?>').length > 0 ) { document.getElementById('<?php echo $tab['checkbox']['name']; ?>').checked = this.checked; }<?php | |
| 1801 | - } | |
| 1802 | - ?>" | |
| 1849 | + name="<?php echo esc_attr( $tab['checkbox']['name'] ); ?>_dublicated" | |
| 1850 | + id="<?php echo esc_attr( $tab['checkbox']['name'] ); ?>_dublicated" | |
| 1851 | + value="<?php | |
| 1852 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1853 | + echo ( isset( $tab['checkbox']['value'] ) ? $tab['checkbox']['value'] : '' ); ?>" | |
| 1854 | + onchange="javascript: <?php if ( isset( $tab['checkbox']['onclick'] ) ) { | |
| 1855 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1856 | + echo $tab['checkbox']['onclick']; | |
| 1857 | + } else { | |
| 1858 | + ?>if ( jQuery('#<?php echo esc_js( $tab['checkbox']['name'] ); ?>').length > 0 ) { document.getElementById('<?php echo esc_js( $tab['checkbox']['name'] ); ?>').checked = this.checked; }<?php | |
| 1859 | + } | |
| 1860 | + ?>" | |
| 1803 | 1861 | /><?php |
| 1804 | 1862 | } |
| 1805 | 1863 | |
| 1806 | - | |
| 1864 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1807 | 1865 | echo '</' , $html_tag , '>'; |
| 1808 | 1866 | |
| 1809 | 1867 | |
| 1810 | 1868 | if ( |
| 1811 | 1869 | ( isset( $tab['top'] ) ) && ( $tab['top'] ) |
| 1812 | - && ( isset( $tab['position'] ) ) && ( $tab['position'] !== 'right' ) //FixIn: 6.0.1.13 | |
| 1870 | + && ( isset( $tab['position'] ) ) && ( $tab['position'] !== 'right' ) // FixIn: 6.0.1.13. | |
| 1813 | 1871 | ) |
| 1814 | 1872 | echo ' '; |
| 1815 | 1873 | } |
| 1816 | 1874 | |
| @@ -1907,17 +1965,25 @@ | ||
| 1907 | 1965 | $params['params']['container_attr'] = WPBC_Settings_API::get_custom_attr_static( array( 'attr' => $params['params']['container_attr'] ) ); |
| 1908 | 1966 | $params['params']['link_attr'] = WPBC_Settings_API::get_custom_attr_static( array( 'attr' => $params['params']['link_attr'] ) ); |
| 1909 | 1967 | $params['params']['content_attr'] = WPBC_Settings_API::get_custom_attr_static( array( 'attr' => $params['params']['content_attr'] ) ); |
| 1910 | 1968 | |
| 1911 | - ?><div class="wpbc_container_open_or_closed <?php echo ( $params['is_open'] ? '':' wpbc_container_closed ' ); | |
| 1912 | - echo esc_attr( $params['params']['container_class'] ); ?>" <?php echo $params['params']['container_attr']; ?>><?php | |
| 1969 | + ?><div class="wpbc_container_open_or_closed <?php echo esc_attr( ( $params['is_open'] ? '':' wpbc_container_closed ' ) ); | |
| 1970 | + echo esc_attr( $params['params']['container_class'] ); ?>" <?php | |
| 1971 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1972 | + echo $params['params']['container_attr']; ?>><?php | |
| 1913 | 1973 | |
| 1914 | - ?><a href="javascript:void(0)" class="wpbc_container_open_or_closed__link <?php echo esc_attr( $params['params']['link_class'] ); ?>" <?php echo $params['params']['link_attr']; ?>><?php | |
| 1915 | - echo $params['title']; | |
| 1974 | + ?><a href="javascript:void(0)" class="wpbc_container_open_or_closed__link <?php echo esc_attr( $params['params']['link_class'] ); ?>" <?php | |
| 1975 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1976 | + echo $params['params']['link_attr']; ?>><?php | |
| 1977 | + echo wp_kses_post( $params['title'] ); | |
| 1916 | 1978 | ?></a><?php |
| 1917 | 1979 | ?><div class="wpbc_container_open_or_closed__content <?php echo esc_attr( $params['params']['content_class'] ); ?>" |
| 1918 | - <?php echo ( $params['is_open'] ? '':' style="display:none;" ' ); ?> | |
| 1919 | - <?php echo $params['params']['content_attr']; ?>><?php | |
| 1980 | + <?php | |
| 1981 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1982 | + echo ( $params['is_open'] ? '':' style="display:none;" ' ); ?> | |
| 1983 | + <?php | |
| 1984 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1985 | + echo $params['params']['content_attr']; ?>><?php | |
| 1920 | 1986 | |
| 1921 | 1987 | return ob_get_clean(); |
| 1922 | 1988 | } |
| 1923 | 1989 | |
| @@ -1950,23 +2016,29 @@ | ||
| 1950 | 2016 | |
| 1951 | 2017 | //////////////////////////////////////////////////////////////////////////////// |
| 1952 | 2018 | // JS & CSS |
| 1953 | 2019 | //////////////////////////////////////////////////////////////////////////////// |
| 1954 | -/** Tooltips JavaScript functions */ | |
| 1955 | -function wpbc_bs_javascript_tooltips() { | |
| 1956 | - | |
| 1957 | - ?><span id="wpbc_tooltips_container"></span><?php | |
| 1958 | - //FixIn: 7.0.1.10 | |
| 2020 | +/** Tooltips JavaScript functions */ | |
| 2021 | +function wpbc_bs_javascript_tooltips() { | |
| 2022 | + static $is_rendered = false; | |
| 2023 | + | |
| 2024 | + if ( $is_rendered ) { | |
| 2025 | + return; | |
| 2026 | + } | |
| 2027 | + $is_rendered = true; | |
| 2028 | + | |
| 2029 | + ?><span id="wpbc_tooltips_container"></span><?php | |
| 2030 | + // FixIn: 7.0.1.10. | |
| 1959 | 2031 | ?><script type="text/javascript"> |
| 1960 | 2032 | |
| 1961 | 2033 | function wpbc_define_tippy_tooltips( parent_class ){ |
| 1962 | 2034 | |
| 1963 | 2035 | if ( 'function' !== typeof( wpbc_tippy ) ){ |
| 1964 | - alert( 'WPBC Error. JavaScript library "wpbc_tippy" was not defined.' ); | |
| 2036 | + console.log( 'WPBC Error. JavaScript library "wpbc_tippy" was not defined.' ); | |
| 1965 | 2037 | return false; |
| 1966 | 2038 | } |
| 1967 | 2039 | |
| 1968 | - //FixIn: 9.0.1.1 | |
| 2040 | + // FixIn: 9.0.1.1. | |
| 1969 | 2041 | /** |
| 1970 | 2042 | * Get Title to show in tooltip. |
| 1971 | 2043 | * By default getting text from 'data-original-title' attribute, if not exist, |
| 1972 | 2044 | * then checking 'title' attribute and replacing it by 'data-original-title' |
| @@ -1999,18 +2071,20 @@ | ||
| 1999 | 2071 | return wpbc_get_tippy_tooltip_title_text( reference ); |
| 2000 | 2072 | }, |
| 2001 | 2073 | placement: 'bottom-start', |
| 2002 | 2074 | } ); |
| 2003 | - wpbc_tippy( parent_class + '.tooltip_bottom', { | |
| 2075 | + wpbc_tippy( parent_class + '.tooltip_right', { | |
| 2004 | 2076 | content( reference ){ |
| 2005 | 2077 | return wpbc_get_tippy_tooltip_title_text( reference ); |
| 2006 | 2078 | }, |
| 2007 | - placement: 'bottom-start', | |
| 2079 | + placement: 'right', | |
| 2008 | 2080 | } ); |
| 2009 | - wpbc_tippy( parent_class + '.tooltip_right', { | |
| 2081 | + // FixIn: 10.11.5.8. | |
| 2082 | + wpbc_tippy( parent_class + '.tooltip_right_offset', { | |
| 2010 | 2083 | content( reference ){ |
| 2011 | 2084 | return wpbc_get_tippy_tooltip_title_text( reference ); |
| 2012 | 2085 | }, |
| 2086 | + offset: [0, 25], | |
| 2013 | 2087 | placement: 'right', |
| 2014 | 2088 | } ); |
| 2015 | 2089 | wpbc_tippy( parent_class + '.tooltip_left', { |
| 2016 | 2090 | content( reference ){ |
| @@ -2021,11 +2095,19 @@ | ||
| 2021 | 2095 | |
| 2022 | 2096 | return true; |
| 2023 | 2097 | } |
| 2024 | 2098 | |
| 2025 | - jQuery( document ).ready( function (){ | |
| 2099 | + //jQuery( document ).ready( function (){ | |
| 2100 | + <?php | |
| 2101 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 2102 | + echo wpbc_jq_ready_start(); | |
| 2103 | + ?> | |
| 2026 | 2104 | wpbc_define_tippy_tooltips( '' ); |
| 2027 | - } ); | |
| 2105 | + <?php | |
| 2106 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 2107 | + echo wpbc_jq_ready_end(); | |
| 2108 | + ?> | |
| 2109 | + //} ); | |
| 2028 | 2110 | </script><?php |
| 2029 | 2111 | } |
| 2030 | 2112 | |
| 2031 | 2113 | |
| @@ -2030,58 +2112,28 @@ | ||
| 2030 | 2112 | |
| 2031 | 2113 | |
| 2032 | 2114 | /** Popover JavaScript functions */ |
| 2033 | 2115 | function wpbc_bs_javascript_popover() { |
| 2034 | - | |
| 2035 | - ?><script type="text/javascript"> | |
| 2116 | + //FixIn: 10.2.0.4 //FixIn: 10.1.3.7 /* //FixIn: 9.0.1.1 */ | |
| 2036 | 2117 | |
| 2037 | - function wpbc_define_tippy_popover(){ | |
| 2118 | + ob_start(); | |
| 2038 | 2119 | |
| 2039 | - if ( 'function' !== typeof( wpbc_tippy ) ) { | |
| 2040 | - alert( 'WPBC Error. wpbc_tippy was not defined.' ); | |
| 2041 | - return false; | |
| 2042 | - } | |
| 2120 | + //INFO: Important! Please be carefully with comments such as this // it can corrupt everything. Please use this commenting: /**/ | |
| 2121 | + ?> <script type="text/javascript"> <?php | |
| 2122 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 2123 | + echo wpbc_jq_ready_start(); | |
| 2043 | 2124 | |
| 2044 | - //FixIn: 9.0.1.1 | |
| 2045 | - wpbc_tippy( '.popover_bottom.popover_click', { | |
| 2046 | - content( reference ){ | |
| 2047 | - var popover_title = reference.getAttribute( 'data-original-title' ); | |
| 2048 | - var popover_content = reference.getAttribute( 'data-content' ); | |
| 2049 | - return '<div class="popover popover_tippy">' | |
| 2050 | - + '<div class="popover-close"><a href="javascript:void(0)" onclick="javascript:this.parentElement.parentElement.parentElement.parentElement.parentElement._tippy.hide();" >×</a></div>' | |
| 2051 | - // + '<div class="popover-title">' | |
| 2052 | - // + popover_title | |
| 2053 | - // + '</div>' | |
| 2054 | - // + '<div class="popover-content">' | |
| 2055 | - + popover_content | |
| 2056 | - //+ '</div>' | |
| 2057 | - + '</div>'; | |
| 2058 | - }, | |
| 2059 | - allowHTML : true, | |
| 2060 | - trigger : 'manual', | |
| 2061 | - interactive : true, | |
| 2062 | - hideOnClick : false, | |
| 2063 | - interactiveBorder: 10, | |
| 2064 | - maxWidth : 550, | |
| 2065 | - theme : 'wpbc-tippy-popover', | |
| 2066 | - placement : 'bottom-start', | |
| 2067 | - touch: ['hold', 500], // 500ms delay | |
| 2068 | - } ); | |
| 2125 | + ?> wpbc_define_tippy_popover(); <?php | |
| 2126 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 2127 | + echo wpbc_jq_ready_end(); | |
| 2128 | + ?> </script> <?php | |
| 2069 | 2129 | |
| 2070 | - // Define ability to open / close popover by clicking on link | |
| 2071 | - jQuery( '.popover_bottom.popover_click' ).on( 'click', function (){ | |
| 2072 | - if( this._tippy.state.isVisible ) { | |
| 2073 | - this._tippy.hide(); | |
| 2074 | - } else { | |
| 2075 | - this._tippy.show(); | |
| 2076 | - } | |
| 2077 | - }); | |
| 2078 | - } | |
| 2130 | + $content_popover = ob_get_clean(); | |
| 2079 | 2131 | |
| 2080 | - <?php echo wpbc_jq_ready_start(); //FixIn: 10.1.3.7 ?> | |
| 2081 | - wpbc_define_tippy_popover(); //FixIn: 9.0.1.1 | |
| 2082 | - <?php echo wpbc_jq_ready_end(); ?> | |
| 2083 | - </script><?php | |
| 2132 | + $content_popover = str_replace( array( "\n" , "\r" ), '', $content_popover); // FixIn: 10.1.4.1. | |
| 2133 | + | |
| 2134 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 2135 | + echo $content_popover; | |
| 2084 | 2136 | } |
| 2085 | 2137 | |
| 2086 | 2138 | |
| 2087 | 2139 | |
| @@ -2106,5 +2158,5 @@ | ||
| 2106 | 2158 | } |
| 2107 | 2159 | } |
| 2108 | 2160 | |
| 2109 | 2161 | return implode( ' ', $attributes ); |
| 2110 | -} | |
| 2162 | +} | |