| 1 |
<?php /** |
| 2 |
* @version 1.1 |
| 3 |
* @package Any |
| 4 |
* @category Toolbar. BS UI Elements for Admin Panel. |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site http://oplugins.com/ |
| 8 |
* @email info@oplugins.com |
| 9 |
* |
| 10 |
* @modified 2015-11-14 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
//////////////////////////////////////////////////////////////////////////////// |
| 17 |
// Single elements ////////////////////////////////////////////////////// |
| 18 |
//////////////////////////////////////////////////////////////////////////////// |
| 19 |
|
| 20 |
/** Show BS Button |
| 21 |
* |
| 22 |
* @param array $item |
| 23 |
array( |
| 24 |
'type' => 'button' |
| 25 |
, 'title' => '' // Title of the button |
| 26 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 27 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 28 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 29 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 30 |
, 'icon' => '' |
| 31 |
, 'font_icon' => '' |
| 32 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 33 |
, 'style' => '' // Any CSS class here |
| 34 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 35 |
, 'attr' => array() |
| 36 |
); |
| 37 |
*/ |
| 38 |
function wpbm_bs_button( $item ) { |
| 39 |
|
| 40 |
$default_item_params = array( |
| 41 |
'type' => 'button' |
| 42 |
, 'title' => '' // Title of the button |
| 43 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 44 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 45 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 46 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 47 |
, 'icon' => '' |
| 48 |
, 'font_icon' => '' |
| 49 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 50 |
, 'style' => '' // Any CSS class here |
| 51 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 52 |
, 'attr' => array() |
| 53 |
); |
| 54 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 55 |
|
| 56 |
?><a class="button <?php |
| 57 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . $item_params['hint']['position'] . ' ' : '' ; |
| 58 |
echo $item_params['class']; |
| 59 |
?>" style="<?php echo $item_params['style']; ?>" |
| 60 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 61 |
title="<?php echo esc_js( $item_params['hint']['title'] ); ?>" |
| 62 |
<?php } ?> |
| 63 |
href="<?php echo $item_params['link']; ?>" |
| 64 |
<?php if ( ! empty( $item_params['action'] ) ) { ?> |
| 65 |
onclick="javascript:<?php echo $item_params['action']; ?>" |
| 66 |
<?php } ?> |
| 67 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 68 |
><?php |
| 69 |
$btn_icon = ''; |
| 70 |
if ( ! empty( $item_params['icon'] ) ) { |
| 71 |
|
| 72 |
if ( substr( $item_params['icon'], 0, 4 ) != 'http') $img_path = WPBM_PLUGIN_URL . '/assets/img/' . $item_params['icon']; |
| 73 |
else $img_path = $item_params['icon']; |
| 74 |
|
| 75 |
$btn_icon = '<img class="menuicons" src="' . $img_path . '" />'; // Img Icon |
| 76 |
|
| 77 |
} elseif ( ! empty( $item_params['font_icon'] ) ) { |
| 78 |
|
| 79 |
$btn_icon = '<i class="menu_icon icon-1x ' . $item_params['font_icon'] . '"></i>'; // Font Icon |
| 80 |
|
| 81 |
} |
| 82 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'left' ) ) |
| 83 |
echo $btn_icon . ' '; |
| 84 |
|
| 85 |
// Text |
| 86 |
echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $item_params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>'; |
| 87 |
echo $item_params['title']; |
| 88 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'right' ) ) |
| 89 |
echo ' ' ; |
| 90 |
echo '</span>'; |
| 91 |
|
| 92 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon_position'] == 'right' ) ) |
| 93 |
echo $btn_icon; |
| 94 |
?></a><?php |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
/** Show BS text |
| 99 |
* |
| 100 |
* @param array $item |
| 101 |
array( |
| 102 |
'id' => '' // HTML ID of element |
| 103 |
, 'value' => '' |
| 104 |
, 'placeholder' => '' |
| 105 |
, 'style' => '' // CSS of select element |
| 106 |
, 'class' => '' // CSS Class of select element |
| 107 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 108 |
); |
| 109 |
*/ |
| 110 |
function wpbm_bs_text( $item ) { |
| 111 |
|
| 112 |
$default_item_params = array( |
| 113 |
'type' => 'text' |
| 114 |
, 'id' => '' |
| 115 |
, 'name' => '' |
| 116 |
, 'label' => '' |
| 117 |
, 'disabled' => false |
| 118 |
, 'class' => '' |
| 119 |
, 'style' => '' |
| 120 |
, 'placeholder' => '' |
| 121 |
, 'attr' => array() |
| 122 |
, 'value' => '' |
| 123 |
, 'onfocus' => '' |
| 124 |
); |
| 125 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 126 |
|
| 127 |
?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 128 |
id="<?php echo $item_params['id']; ?>" |
| 129 |
name="<?php echo $item_params['id']; ?>" |
| 130 |
style="<?php echo $item_params['style']; ?>" |
| 131 |
class="form-control <?php echo $item_params['class']; ?>" |
| 132 |
placeholder="<?php echo $item_params['placeholder']; ?>" |
| 133 |
value="<?php echo $item_params['value']; ?>" |
| 134 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 135 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 136 |
<?php |
| 137 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 138 |
?> onfocus="javascript:<?php echo $item_params['onfocus']; ?>" <?php |
| 139 |
} |
| 140 |
?> |
| 141 |
/><?php |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
/** Show BS selectbox |
| 146 |
* |
| 147 |
* @param array $item |
| 148 |
array( |
| 149 |
'id' => '' // HTML ID of element |
| 150 |
, 'name' => '' |
| 151 |
, 'style' => '' // CSS of select element |
| 152 |
, 'class' => '' // CSS Class of select element |
| 153 |
, 'multiple' => false |
| 154 |
, 'disabled' => false |
| 155 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 156 |
, 'options' => array() // Associated array of titles and values |
| 157 |
, 'disabled_options' => array() // If some options disbaled, then its must list here |
| 158 |
, 'value' => '' // Some Value from optins array that selected by default |
| 159 |
, 'onfocus' => '' |
| 160 |
, 'onchange' => '' |
| 161 |
) |
| 162 |
*/ |
| 163 |
function wpbm_bs_select( $item ) { |
| 164 |
|
| 165 |
$default_item_params = array( |
| 166 |
'id' => '' // HTML ID of element |
| 167 |
, 'name' => '' |
| 168 |
, 'style' => '' // CSS of select element |
| 169 |
, 'class' => '' // CSS Class of select element |
| 170 |
, 'multiple' => false |
| 171 |
, 'disabled' => false |
| 172 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 173 |
, 'options' => array() // Associated array of titles and values |
| 174 |
, 'disabled_options' => array() // If some options disbaled, then its must list here |
| 175 |
, 'value' => '' // Some Value from optins array that selected by default |
| 176 |
, 'onfocus' => '' |
| 177 |
, 'onchange' => '' |
| 178 |
); |
| 179 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 180 |
|
| 181 |
|
| 182 |
?><select |
| 183 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 184 |
name="<?php echo esc_attr( $item_params['name'] ); echo ( $item_params['multiple'] ? '[]' : '' ); ?>" |
| 185 |
class="form-control <?php echo esc_attr( $item_params['class'] ); ?>" |
| 186 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 187 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 188 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 189 |
<?php echo ( $item_params['multiple'] ? ' multiple="MULTIPLE"' : '' ); ?> |
| 190 |
<?php |
| 191 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 192 |
?> onfocus="javascript:<?php echo $item_params['onfocus']; ?>" <?php |
| 193 |
} |
| 194 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 195 |
?> onchange="javascript:<?php echo $item_params['onchange']; ?>" <?php |
| 196 |
} |
| 197 |
?> |
| 198 |
autocomplete="off" |
| 199 |
><?php |
| 200 |
foreach ( $item_params['options'] as $option_value => $option_data ) { |
| 201 |
|
| 202 |
if ( ! is_array( $option_data ) ) { |
| 203 |
$option_data = array( 'title' => $option_data ); |
| 204 |
$is_was_simple = true; |
| 205 |
} else $is_was_simple = false; |
| 206 |
|
| 207 |
$default_option_params = array( |
| 208 |
'id' => '' // HTML ID of element |
| 209 |
, 'name' => '' |
| 210 |
, 'style' => '' // CSS of select element |
| 211 |
, 'class' => '' // CSS Class of select element |
| 212 |
, 'disabled' => false |
| 213 |
, 'selected' => false |
| 214 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 215 |
, 'value' => '' // Some Value from optins array that selected by default |
| 216 |
|
| 217 |
, 'optgroup' => false // Use only if you need to show OPTGROUP - Also need to use 'title' of start, end 'close' for END |
| 218 |
, 'close' => false |
| 219 |
|
| 220 |
); |
| 221 |
$option_data = wp_parse_args( $option_data, $default_option_params ); |
| 222 |
|
| 223 |
if ( $option_data['optgroup'] ) { // OPTGROUP |
| 224 |
|
| 225 |
if ( ! $option_data['close'] ) { |
| 226 |
?><optgroup label="<?php echo esc_attr( $option_data['title'] ); ?>"><?php |
| 227 |
} else { |
| 228 |
?></optgroup><?php |
| 229 |
} |
| 230 |
|
| 231 |
} else { // OPTION |
| 232 |
|
| 233 |
?><option |
| 234 |
value="<?php echo esc_attr( $option_value ); ?>" |
| 235 |
<?php |
| 236 |
if ( $is_was_simple ) { |
| 237 |
selected( $option_value, $item_params['value'] ); |
| 238 |
disabled( in_array( $option_value, $item_params['disabled_options'] ), true ); |
| 239 |
} |
| 240 |
?> |
| 241 |
class="<?php echo esc_attr( $option_data['class'] ); ?>" |
| 242 |
style="<?php echo esc_attr( $option_data['style'] ); ?>" |
| 243 |
<?php echo wpbm_get_custom_attr( $option_data ); ?> |
| 244 |
<?php selected( $option_data['selected'], true ); ?> |
| 245 |
<?php if ( ! empty( $item_params['value'] ) ) selected( $item_params['value'], esc_attr( $option_value ) ); //Recheck global selected parameter ?> |
| 246 |
<?php disabled( $option_data['disabled'], true ); ?> |
| 247 |
|
| 248 |
><?php echo esc_attr( $option_data['title'] ); ?></option><?php |
| 249 |
} |
| 250 |
} |
| 251 |
?></select><?php |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
/** Show BS checkbox |
| 256 |
* |
| 257 |
* @param array $item |
| 258 |
array( |
| 259 |
'type' => 'radio' |
| 260 |
, 'id' => '' // HTML ID of element |
| 261 |
, 'name' => '' |
| 262 |
, 'style' => '' // CSS of select element |
| 263 |
, 'class' => '' // CSS Class of select element |
| 264 |
, 'disabled' => false |
| 265 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 266 |
, 'legend' => '' // aria-label parameter |
| 267 |
, 'value' => '' // Some Value from optins array that selected by default |
| 268 |
, 'selected' => false // Selected or not |
| 269 |
); |
| 270 |
*/ |
| 271 |
function wpbm_bs_radio( $item ) { |
| 272 |
$item['type'] = 'radio'; |
| 273 |
wpbm_bs_checkbox( $item ); |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
/** Show BS checkbox |
| 278 |
* |
| 279 |
* @param array $item |
| 280 |
array( |
| 281 |
'type' => 'checkbox' |
| 282 |
, 'id' => '' // HTML ID of element |
| 283 |
, 'name' => '' |
| 284 |
, 'style' => '' // CSS of select element |
| 285 |
, 'class' => '' // CSS Class of select element |
| 286 |
, 'disabled' => false |
| 287 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 288 |
, 'legend' => '' // aria-label parameter |
| 289 |
, 'value' => '' // Some Value from optins array that selected by default |
| 290 |
, 'selected' => false // Selected or not |
| 291 |
); |
| 292 |
*/ |
| 293 |
function wpbm_bs_checkbox( $item ) { |
| 294 |
|
| 295 |
$default_item_params = array( |
| 296 |
'type' => 'checkbox' |
| 297 |
, 'id' => '' // HTML ID of element |
| 298 |
, 'name' => '' |
| 299 |
, 'style' => '' // CSS of select element |
| 300 |
, 'class' => '' // CSS Class of select element |
| 301 |
, 'disabled' => false |
| 302 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 303 |
, 'legend' => '' // aria-label parameter |
| 304 |
, 'value' => '' // Some Value from optins array that selected by default |
| 305 |
, 'selected' => false // Selected or not |
| 306 |
); |
| 307 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 308 |
|
| 309 |
?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 310 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 311 |
name="<?php echo esc_attr( $item_params['name'] ); ?>" |
| 312 |
value="<?php echo esc_attr( $item_params['value'] ); ?>" |
| 313 |
aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" |
| 314 |
class="<?php echo esc_attr( $item_params['class'] ); ?>" |
| 315 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 316 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 317 |
<?php checked( $item_params['selected'], true ); ?> |
| 318 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 319 |
/><?php |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
/** Show BS addon |
| 324 |
* |
| 325 |
* @param array $item |
| 326 |
array( |
| 327 |
'type' => 'addon' |
| 328 |
, 'element' => 'text' // text | radio | checkbox |
| 329 |
, 'text' => '' // Simple plain text showing |
| 330 |
, 'id' => '' // ID, if this radio | checkbox element |
| 331 |
, 'name' => '' // Name, if this radio | checkbox element |
| 332 |
, 'value' => '' // value, if this radio | checkbox element |
| 333 |
, 'selected' => false // Selected, if this radio | checkbox element |
| 334 |
, 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 335 |
, 'class' => '' // Any CSS class here |
| 336 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 337 |
, 'text' => '' // Text tp show for Text element |
| 338 |
) |
| 339 |
*/ |
| 340 |
function wpbm_bs_addon( $item ) { |
| 341 |
|
| 342 |
$default_item_params = array( |
| 343 |
'type' => 'addon' |
| 344 |
, 'element' => 'text' // text | radio | checkbox |
| 345 |
, 'text' => '' // Simple plain text showing |
| 346 |
, 'id' => '' // ID, if this radio | checkbox element |
| 347 |
, 'name' => '' // Name, if this radio | checkbox element |
| 348 |
, 'value' => '' // value, if this radio | checkbox element |
| 349 |
, 'selected' => false // Selected, if this radio | checkbox element |
| 350 |
, 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 351 |
, 'class' => '' // Any CSS class here |
| 352 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 353 |
, 'text' => '' // Text tp show for Text element |
| 354 |
, 'style' => '' |
| 355 |
); |
| 356 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 357 |
|
| 358 |
?><span class="input-group-addon"><?php |
| 359 |
if ( $item_params['element'] == 'text' ) { |
| 360 |
?><span class="<?php echo esc_attr( $item_params['class'] ); ?>" |
| 361 |
style="<?php echo esc_attr( $item_params['style'] ); ?>"><?php |
| 362 |
echo $item_params['text']; |
| 363 |
?></span><?php |
| 364 |
} elseif ( $item_params['element'] == 'checkbox' ) { |
| 365 |
|
| 366 |
if ( empty( $item_params['id'] ) ) |
| 367 |
$item_params['id'] = $item_params['element'] . '_grp_' . $milliseconds ; |
| 368 |
|
| 369 |
if ( empty( $item_params['name'] ) ) |
| 370 |
$item_params['name'] = $item_params['id']; |
| 371 |
|
| 372 |
?><input type="checkbox" |
| 373 |
id="<?php echo $item_params['id']; ?>" |
| 374 |
name="<?php echo $item_params['name']; ?>" |
| 375 |
value="<?php echo $item_params['value']; ?>" |
| 376 |
aria-label="<?php echo $item_params['legend']; ?>" |
| 377 |
class="<?php echo $item_params['class']; ?>" |
| 378 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 379 |
<?php if ( $item_params['selected'] ) { echo ' checked="CHECKED" '; } ?> |
| 380 |
/><?php |
| 381 |
|
| 382 |
} elseif ( $item_params['element'] == 'radio' ) { |
| 383 |
|
| 384 |
if ( empty( $item_params['id'] ) ) |
| 385 |
$item_params['id'] = $item_params['element'] . '_grp_' . $milliseconds ; |
| 386 |
|
| 387 |
if ( empty( $item_params['name'] ) ) |
| 388 |
$item_params['name'] = $item_params['id']; |
| 389 |
|
| 390 |
?><input type="radio" |
| 391 |
id="<?php echo $item_params['id']; ?>" |
| 392 |
name="<?php echo $item_params['name']; ?>" |
| 393 |
value="<?php echo $item_params['value']; ?>" |
| 394 |
aria-label="<?php echo $item_params['legend']; ?>" |
| 395 |
class="<?php echo $item_params['class']; ?>" |
| 396 |
<?php echo wpbm_get_custom_attr( $item_params ); ?> |
| 397 |
<?php if ( $item_params['selected'] ) { echo ' checked="CHECKED" '; } ?> |
| 398 |
/><?php |
| 399 |
} |
| 400 |
?></span><?php |
| 401 |
|
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
/** Show BS Dropdown |
| 406 |
* |
| 407 |
* @param array $item |
| 408 |
array( |
| 409 |
|
| 410 |
); |
| 411 |
*/ |
| 412 |
function wpbm_bs_dropdown( $item ) { |
| 413 |
|
| 414 |
$default_item_params = array( |
| 415 |
'id' => '' // HTML ID of element |
| 416 |
, 'default' => '' // Some Value from optins array that selected by default |
| 417 |
, 'hint' => '' // Hint // array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) |
| 418 |
, 'class' => 'button-secondary' |
| 419 |
, 'style' => '' // Any CSS style |
| 420 |
, 'label' => '' // Label of element "at Top of element" |
| 421 |
, 'title' => '' // Title of element "Inside of element" |
| 422 |
, 'align' => 'left' // Align: left | right |
| 423 |
, 'attr' => array() |
| 424 |
, 'icon' => '' |
| 425 |
, 'font_icon' => '' |
| 426 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 427 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 428 |
, 'disabled' => array() // If some options disbaled, then its must list here |
| 429 |
, 'options' => array() // Associated array of titles and values |
| 430 |
); |
| 431 |
$params = wp_parse_args( $item, $default_item_params ); |
| 432 |
|
| 433 |
|
| 434 |
$milliseconds = round(microtime(true) * 1000); |
| 435 |
|
| 436 |
if ( empty( $params['id'] ) ) $params['id'] = 'wpbm_bs_dropdown' . $milliseconds; |
| 437 |
|
| 438 |
// Check if this list Simple or Complex (with input elements) //////////// |
| 439 |
$is_this_simple_list = true; |
| 440 |
foreach ( $params['options'] as $key => $value ) { |
| 441 |
if ( is_array( $value ) ) { |
| 442 |
$is_this_simple_list = false; |
| 443 |
break; |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
?><a href="javascript:void(0)" |
| 448 |
<?php if (! $is_this_simple_list ) { ?> |
| 449 |
onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();" |
| 450 |
<?php } ?> |
| 451 |
data-toggle="dropdown" |
| 452 |
id="<?php echo $params['id'];?>_selector" |
| 453 |
<?php if ( ! empty( $params['hint'] ) ) { ?> |
| 454 |
title="<?php echo esc_js( $params['hint']['title'] ); ?>" |
| 455 |
<?php } ?> |
| 456 |
class="button dropdown-toggle <?php |
| 457 |
echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; |
| 458 |
echo ( ! empty( $params['class'] ) ) ? $params['class'] . ' ' : '' ; |
| 459 |
?>" |
| 460 |
style="<?php echo $params['style']; ?>" |
| 461 |
<?php echo wpbm_get_custom_attr( $params ); ?> |
| 462 |
><?php |
| 463 |
|
| 464 |
$btn_icon = ''; |
| 465 |
if ( ! empty( $params['icon'] ) ) { |
| 466 |
|
| 467 |
if ( substr( $params['icon'], 0, 4 ) != 'http') $img_path = WPBM_PLUGIN_URL . '/assets/img/' . $params['icon']; |
| 468 |
else $img_path = $params['icon']; |
| 469 |
|
| 470 |
$btn_icon = '<img class="menuicons" src="' . $img_path . '" />'; // Img Icon |
| 471 |
|
| 472 |
} elseif ( ! empty( $params['font_icon'] ) ) { |
| 473 |
|
| 474 |
$btn_icon = '<i class="menu_icon icon-1x ' . $params['font_icon'] . '"></i>'; // Font Icon |
| 475 |
|
| 476 |
} |
| 477 |
if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'left' ) ) |
| 478 |
echo $btn_icon . ' '; |
| 479 |
|
| 480 |
// Text |
| 481 |
echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>'; |
| 482 |
echo $params['title']; |
| 483 |
if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'right' ) ) |
| 484 |
echo ' ' ; |
| 485 |
echo '</span>'; |
| 486 |
|
| 487 |
if ( ( ! empty( $btn_icon ) ) && ( $params['icon_position'] == 'right' ) ) |
| 488 |
echo $btn_icon; |
| 489 |
?> <span class="caret"></span></a><?php |
| 490 |
|
| 491 |
?><ul |
| 492 |
id="<?php echo $params['id']; ?>_container" |
| 493 |
class="dropdown-menu dropdown-menu-<?php echo $params['align']; ?>" |
| 494 |
><?php |
| 495 |
|
| 496 |
wpbm_bs_list_of_options_for_dropdown( $params , 'simple' , $is_this_simple_list); |
| 497 |
|
| 498 |
?></ul><?php |
| 499 |
} |
| 500 |
|
| 501 |
|
| 502 |
function wpbm_bs_list_of_options_for_dropdown( $params, $dropdown_type = 'simple', $is_this_simple_list = true ) { |
| 503 |
|
| 504 |
foreach ( $params['options'] as $key => $value ) { |
| 505 |
|
| 506 |
if ( is_array( $value ) ) { // Complex value constructions |
| 507 |
|
| 508 |
?><li role="presentation"> |
| 509 |
<div class="btn-toolbar" role="toolbar"> |
| 510 |
<?php |
| 511 |
$item_params = reset($value) ; |
| 512 |
|
| 513 |
$default_item_params = array( |
| 514 |
'id' => '' // HTML ID of element |
| 515 |
, 'default' => '' // Some Value from optins array that selected by default |
| 516 |
, 'hint' => '' // Hint // array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) |
| 517 |
, 'class' => 'button-secondary' |
| 518 |
, 'style' => '' // Any CSS style |
| 519 |
, 'label' => '' // Label of element "at Top of element" |
| 520 |
, 'title' => '' // Title of element "Inside of element" |
| 521 |
, 'align' => 'left' // Align: left | right |
| 522 |
, 'attr' => array() |
| 523 |
, 'icon' => '' |
| 524 |
, 'font_icon' => '' |
| 525 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 526 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 527 |
, 'disabled' => array() // If some options disbaled, then its must list here |
| 528 |
, 'options' => array() // Associated array of titles and values |
| 529 |
); |
| 530 |
$item_params = wp_parse_args( $item_params, $default_item_params ); |
| 531 |
|
| 532 |
?> |
| 533 |
<div class="<?php echo ( $item_params['type'] == 'group' ) ? esc_attr( $item_params['class'] ) : 'input-group'; ?>" |
| 534 |
style="<?php echo ( $item_params['type'] == 'group' ) ? esc_attr( $item_params['style'] ) : ''; ?>" |
| 535 |
role="group"><?php |
| 536 |
|
| 537 |
// Count number of text elements in this LI section |
| 538 |
$number_of_text_elements = 0; |
| 539 |
foreach ( $value as $item_params ) { |
| 540 |
if ( $item_params['type'] == 'text' ) |
| 541 |
$number_of_text_elements++; |
| 542 |
} |
| 543 |
$focus_element_id = 'shjgkdfhgjhhsjgkhjkgdhghdjghjdkghjkdhgjkfghdfjhgjdkdgkhjf'; |
| 544 |
foreach ( $value as $item_params ) { |
| 545 |
|
| 546 |
$item_type = $item_params['type']; |
| 547 |
|
| 548 |
switch ( $item_type ) { |
| 549 |
|
| 550 |
case 'checkbox': |
| 551 |
case 'radio': |
| 552 |
?><span class="input-group-addon"><?php |
| 553 |
|
| 554 |
if ( empty( $item_params['id'] ) ) $item_params['id'] = $params['id'] . '_grp_' . $milliseconds ; |
| 555 |
|
| 556 |
if ( empty( $item_params['name'] ) ) $item_params['name'] = $item_params['id']; |
| 557 |
|
| 558 |
$focus_element_id = esc_attr( $item_params['id'] ); |
| 559 |
|
| 560 |
wpbm_bs_checkbox( $item_params ); |
| 561 |
|
| 562 |
if ( ! empty( $item_params['label'] ) ) { |
| 563 |
|
| 564 |
?><label for="<?php echo esc_attr( $item_params['id'] ); ?>"><?php |
| 565 |
|
| 566 |
echo wp_kses_post( $item_params['label'] ); |
| 567 |
?></label><?php |
| 568 |
} |
| 569 |
?></span><?php |
| 570 |
|
| 571 |
break; |
| 572 |
|
| 573 |
case 'select': |
| 574 |
|
| 575 |
if ( empty( $item_params['id'] ) ) $item_params['id'] = $params['id'] . '_grp_' . $milliseconds ; |
| 576 |
|
| 577 |
if ( empty( $item_params['name'] ) ) $item_params['name'] = $item_params['id']; |
| 578 |
|
| 579 |
$item_params['onfocus'] = "jQuery('#" . $focus_element_id ."').prop('checked', true);"; |
| 580 |
|
| 581 |
wpbm_bs_select( $item_params ); |
| 582 |
|
| 583 |
break; |
| 584 |
|
| 585 |
case 'text': |
| 586 |
|
| 587 |
if ( empty( $item_params['id'] ) ) $item_params['id'] = $params['id'] . '_grp_' . $milliseconds ; |
| 588 |
|
| 589 |
if ( empty( $item_params['name'] ) ) $item_params['name'] = $item_params['id']; |
| 590 |
|
| 591 |
?><div class="dropdown-menu-text-element <?php echo 'dropdown-menu-text-element-count-' . $number_of_text_elements; ?>"><?php |
| 592 |
|
| 593 |
if ( ! empty( $item_params['label'] ) ) { |
| 594 |
|
| 595 |
?><label for="<?php echo esc_attr( $item_params['id'] ); ?>"><?php |
| 596 |
|
| 597 |
echo wp_kses_post( $item_params['label'] ); |
| 598 |
|
| 599 |
?></label><?php |
| 600 |
} |
| 601 |
|
| 602 |
?><legend class="screen-reader-text"><span><?php echo wp_kses_post( $item_params['label'] ); ?></span></legend><?php |
| 603 |
|
| 604 |
$item_params['onfocus'] = "jQuery('#" . $focus_element_id ."').prop('checked', true);"; |
| 605 |
|
| 606 |
wpbm_bs_text( $item_params ); |
| 607 |
|
| 608 |
?></div><?php |
| 609 |
|
| 610 |
break; |
| 611 |
|
| 612 |
case 'button': |
| 613 |
|
| 614 |
$default_item_params = array( |
| 615 |
'action' => "wpbm_close_dropdown_selectbox( '" . $params['id'] . "' )" // Close list and uncheck any checkboxes or radio boxes in dropdown list |
| 616 |
); |
| 617 |
|
| 618 |
$item_params = wp_parse_args( $item_params, $default_item_params ); |
| 619 |
|
| 620 |
wpbm_bs_button( $item_params ); |
| 621 |
break; |
| 622 |
|
| 623 |
default: |
| 624 |
break; |
| 625 |
} |
| 626 |
} |
| 627 |
?> |
| 628 |
</div> |
| 629 |
</div> |
| 630 |
</li><?php |
| 631 |
|
| 632 |
} else { |
| 633 |
|
| 634 |
if ( $value == 'divider' ) { |
| 635 |
|
| 636 |
?><li role="presentation" class="divider"></li><?php |
| 637 |
|
| 638 |
} elseif ( $value == 'header' ) { |
| 639 |
|
| 640 |
?><li role="presentation" class="dropdown-header"><?php echo $key ?></li><?php |
| 641 |
|
| 642 |
} else { |
| 643 |
?><li role="presentation" <?php if ( in_array( $value, $params['disabled'] ) === true ) { echo ' class="disabled"'; } ?> > |
| 644 |
<a role="menuitem" |
| 645 |
tabindex="-1" |
| 646 |
href="javascript:void(0)" |
| 647 |
<?php |
| 648 |
if ( in_array( $value, $params['disabled'] ) !== true ) { |
| 649 |
|
| 650 |
if ( $dropdown_type == 'list' ) { ?> |
| 651 |
|
| 652 |
onclick="javascript: |
| 653 |
wpbm_show_selected_in_dropdown('<?php echo $params['id']; ?>', jQuery(this).html(), '<?php echo $value; ?>'); |
| 654 |
<?php if (! $is_this_simple_list ) { ?> |
| 655 |
wpbm_close_dropdown_selectbox( '<?php echo $params['id']; ?>' ); |
| 656 |
<?php } ?>" |
| 657 |
<?php } else { ?> |
| 658 |
|
| 659 |
onclick="javascript:<?php echo $value; ?>" |
| 660 |
<?php } |
| 661 |
|
| 662 |
} ?> |
| 663 |
><?php echo $key; ?></a> |
| 664 |
</li><?php |
| 665 |
} |
| 666 |
} |
| 667 |
|
| 668 |
} |
| 669 |
} |
| 670 |
|
| 671 |
//////////////////////////////////////////////////////////////////////////////// |
| 672 |
// Control elements ////////////////////////////////////////////////////// |
| 673 |
//////////////////////////////////////////////////////////////////////////////// |
| 674 |
|
| 675 |
/** Button Groups |
| 676 |
* |
| 677 |
* @param array $args |
| 678 |
* |
| 679 |
|
| 680 |
$params = array( |
| 681 |
'label_for' => 'actions' // "For" parameter of button group element |
| 682 |
, 'label' => __('Actions:', 'booking-manager') // Label above the button group |
| 683 |
, 'style' => '' // CSS Style of entire div element |
| 684 |
, 'items' => array( |
| 685 |
array( |
| 686 |
'type' => 'button' |
| 687 |
, 'title' => __('Delete', 'booking-manager') // Title of the button |
| 688 |
, 'hint' => array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) // Hint |
| 689 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 690 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 691 |
, 'class' => '' // button-secondary | button-primary |
| 692 |
, 'icon' => '' |
| 693 |
, 'font_icon' => '' |
| 694 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 695 |
, 'style' => '' // Any CSS class here |
| 696 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 697 |
, 'attr' => array() |
| 698 |
) |
| 699 |
, array( |
| 700 |
'type' => 'button' |
| 701 |
, 'title' => __('Delete', 'booking-manager') |
| 702 |
, 'class' => 'button-primary' |
| 703 |
, 'font_icon' => 'glyphicon glyphicon-trash' |
| 704 |
, 'icon_position' => 'left' |
| 705 |
, 'action' => "jQuery('#opl_filters_formID').submit();" |
| 706 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 707 |
) |
| 708 |
) |
| 709 |
); |
| 710 |
wpbm_bs_button_group( $params ); |
| 711 |
|
| 712 |
*/ |
| 713 |
function wpbm_bs_button_group( $args = array() ) { |
| 714 |
|
| 715 |
$milliseconds = round(microtime(true) * 1000); |
| 716 |
|
| 717 |
$defaults = array( |
| 718 |
'label_for' => 'btn_bs_' . $milliseconds // "For" parameter of label element |
| 719 |
, 'label' => '' // Label above element |
| 720 |
, 'style' => '' // CSS of entire div element |
| 721 |
, 'items' => array() // Array of elements |
| 722 |
); |
| 723 |
|
| 724 |
$params = wp_parse_args( $args, $defaults ); |
| 725 |
|
| 726 |
?><div class="control-group" style="<?php echo $params['style']; ?>" ><?php |
| 727 |
if (! empty( $params['label'] ) ) { |
| 728 |
?><label for="<?php echo $params['label_for']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php |
| 729 |
} |
| 730 |
?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo $params['label_for']; ?>"> |
| 731 |
<div class="btn-group" role="group" aria-label="..."><?php |
| 732 |
|
| 733 |
foreach ( $params['items'] as $item ) { |
| 734 |
|
| 735 |
switch ( $item['type'] ) { |
| 736 |
|
| 737 |
case 'button': |
| 738 |
wpbm_bs_button( $item ); |
| 739 |
break; |
| 740 |
case 'dropdown': |
| 741 |
wpbm_bs_dropdown( $item ); |
| 742 |
break; |
| 743 |
default: |
| 744 |
break; |
| 745 |
} |
| 746 |
|
| 747 |
} ?> |
| 748 |
</div> |
| 749 |
</div> |
| 750 |
</div><?php |
| 751 |
} |
| 752 |
|
| 753 |
|
| 754 |
/** Show Input Group |
| 755 |
* |
| 756 |
* @param array $args |
| 757 |
* |
| 758 |
|
| 759 |
$params = array( |
| 760 |
'label_for' => 'min_cost' // "For" parameter of label element |
| 761 |
, 'label' => __('Min / Max cost:', 'booking-manager') // Label above the input group |
| 762 |
, 'style' => '' // CSS Style of entire div element |
| 763 |
, 'items' => array( |
| 764 |
array( |
| 765 |
'type' => 'addon' |
| 766 |
, 'element' => 'text' // text | radio | checkbox |
| 767 |
, 'text' => __('Cost', 'booking-manager') . ':' |
| 768 |
, 'class' => '' // Any CSS class here |
| 769 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 770 |
) |
| 771 |
, array( |
| 772 |
'type' => 'addon' |
| 773 |
, 'element' => 'checkbox' // text | radio | checkbox |
| 774 |
, 'id' => 'apply_elem' // ID, if this radio | checkbox element |
| 775 |
, 'name' => 'apply_elem' // Name, if this radio | checkbox element |
| 776 |
, 'value' => 'On' // value, if this radio | checkbox element |
| 777 |
, 'selected' => false // Selected, if this radio | checkbox element |
| 778 |
, 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 779 |
, 'class' => '' // Any CSS class here |
| 780 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 781 |
) |
| 782 |
, array( |
| 783 |
'type' => 'addon' |
| 784 |
, 'element' => 'radio' // text | radio | checkbox |
| 785 |
, 'id' => 'min_elem' // ID, if this radio | checkbox element |
| 786 |
, 'name' => 'cost_elem' // Name, if this radio | checkbox element |
| 787 |
, 'value' => 'min' // value, if this radio | checkbox element |
| 788 |
, 'selected' => false // Selected, if this radio | checkbox element |
| 789 |
, 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 790 |
, 'class' => '' // Any CSS class here |
| 791 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 792 |
) |
| 793 |
// Warning! Can be text or selectbox, not both OR you need to define width |
| 794 |
, array( |
| 795 |
'type' => 'text' |
| 796 |
, 'id' => 'min_cost' // HTML ID of element |
| 797 |
, 'value' => '' // Value of Text field |
| 798 |
, 'placeholder' => __('Reason of Cancelation', 'booking-manager') |
| 799 |
, 'style' => 'width:100px;' // CSS of select element |
| 800 |
, 'class' => '' // CSS Class of select element |
| 801 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 802 |
) |
| 803 |
, array( |
| 804 |
'type' => 'addon' |
| 805 |
, 'element' => 'text' // text | radio | checkbox |
| 806 |
, 'text' => ' - ' // Simple plain text showing |
| 807 |
) |
| 808 |
, array( |
| 809 |
'type' => 'text' |
| 810 |
, 'id' => 'max_cost' // HTML ID of element |
| 811 |
, 'value' => '' // Value of Text field |
| 812 |
, 'placeholder' => __('Max Cost', 'booking-manager') |
| 813 |
, 'style' => '' // CSS of select element |
| 814 |
, 'class' => '' // CSS Class of select element |
| 815 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 816 |
|
| 817 |
) |
| 818 |
, array( |
| 819 |
'type' => 'addon' |
| 820 |
, 'element' => 'radio' // text | radio | checkbox |
| 821 |
, 'id' => 'max_elem' // ID, if this radio | checkbox element |
| 822 |
, 'name' => 'cost_elem' // Name, if this radio | checkbox element |
| 823 |
, 'value' => 'max' // value, if this radio | checkbox element |
| 824 |
, 'selected' => false // Selected, if this radio | checkbox element |
| 825 |
, 'legend' => '' // aria-label parameter , if this radio | checkbox element |
| 826 |
, 'class' => '' // Any CSS class here |
| 827 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 828 |
) |
| 829 |
// Warning! Can be text or selectbox, not both OR you need to define width |
| 830 |
, array( |
| 831 |
'type' => 'select' |
| 832 |
, 'id' => 'select_option' // HTML ID of element |
| 833 |
, 'options' => array( 'delete' => __('Delete', 'booking-manager'), 'any' => __('Any', 'booking-manager'), 'specific' => __('Specific', 'booking-manager') ) // Associated array of titles and values |
| 834 |
, 'disabled_options' => array( 'any' ) // If some options disbaled, then its must list here |
| 835 |
, 'default' => 'specific' // Some Value from optins array that selected by default |
| 836 |
, 'style' => 'width:200px;' // CSS of select element |
| 837 |
, 'class' => '' // CSS Class of select element |
| 838 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 839 |
) |
| 840 |
|
| 841 |
// Select Advanced option list |
| 842 |
, array( |
| 843 |
'type' => 'select' |
| 844 |
, 'id' => 'select_form_help_shortcode' |
| 845 |
, 'name' => 'select_form_help_shortcode' |
| 846 |
, 'style' => '' |
| 847 |
, 'class' => '' |
| 848 |
, 'multiple' => false |
| 849 |
, 'disabled' => false |
| 850 |
, 'disabled_options' => array() // If some options disbaled, then its must list here |
| 851 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 852 |
, 'options' => array( // Associated array of titles and values |
| 853 |
'info' => array( |
| 854 |
'title' => __('General Info', 'booking-manager') |
| 855 |
, 'id' => '' |
| 856 |
, 'name' => '' |
| 857 |
, 'style' => '' |
| 858 |
, 'class' => '' |
| 859 |
, 'disabled' => false |
| 860 |
, 'selected' => false |
| 861 |
, 'attr' => array() |
| 862 |
) |
| 863 |
, 'optgroup_sf_s' => array( |
| 864 |
'optgroup' => true |
| 865 |
, 'close' => false |
| 866 |
, 'title' => ' ' . __('Standard Fields' , 'booking-manager') |
| 867 |
) |
| 868 |
, 'text' => array( |
| 869 |
'title' => __('Text', 'booking-manager') |
| 870 |
, 'id' => '' |
| 871 |
, 'name' => '' |
| 872 |
, 'style' => '' |
| 873 |
, 'class' => '' |
| 874 |
, 'disabled' => false |
| 875 |
, 'selected' => false |
| 876 |
, 'attr' => array() |
| 877 |
) |
| 878 |
, 'select' => array( |
| 879 |
'title' => __('Select', 'booking-manager') |
| 880 |
, 'id' => '' |
| 881 |
, 'name' => '' |
| 882 |
, 'style' => '' |
| 883 |
, 'class' => '' |
| 884 |
, 'disabled' => false |
| 885 |
, 'selected' => false |
| 886 |
, 'attr' => array() |
| 887 |
) |
| 888 |
, 'textarea' => array( |
| 889 |
'title' => __('Textarea', 'booking-manager') |
| 890 |
, 'id' => '' |
| 891 |
, 'name' => '' |
| 892 |
, 'style' => '' |
| 893 |
, 'class' => '' |
| 894 |
, 'disabled' => false |
| 895 |
, 'selected' => false |
| 896 |
, 'attr' => array() |
| 897 |
) |
| 898 |
, 'checkbox' => array( |
| 899 |
'title' => __('Checkbox', 'booking-manager') |
| 900 |
, 'id' => '' |
| 901 |
, 'name' => '' |
| 902 |
, 'style' => '' |
| 903 |
, 'class' => '' |
| 904 |
, 'disabled' => false |
| 905 |
, 'selected' => false |
| 906 |
, 'attr' => array() |
| 907 |
) |
| 908 |
, 'optgroup_sf_e' => array( 'optgroup' => true, 'close' => true ) |
| 909 |
|
| 910 |
|
| 911 |
, 'optgroup_af_s' => array( |
| 912 |
'optgroup' => true |
| 913 |
, 'close' => false |
| 914 |
, 'title' => ' ' . __('Advanced Fields' , 'booking-manager') |
| 915 |
) |
| 916 |
, 'info_advanced' => array( |
| 917 |
'title' => __('Info', 'booking-manager') |
| 918 |
, 'id' => '' |
| 919 |
, 'name' => '' |
| 920 |
, 'style' => '' |
| 921 |
, 'class' => '' |
| 922 |
, 'disabled' => false |
| 923 |
, 'selected' => false |
| 924 |
, 'attr' => array() |
| 925 |
) |
| 926 |
, 'optgroup_af_e' => array( 'optgroup' => true, 'close' => true ) |
| 927 |
|
| 928 |
) |
| 929 |
, 'value' => '' // Some Value from optins array that selected by default |
| 930 |
, 'onfocus' => '' |
| 931 |
, 'onchange' => "jQuery('.wpbm_field_generator').hide();jQuery('.wpbm_field_generator_' + this.options[this.selectedIndex].value ).show();" |
| 932 |
) |
| 933 |
, array( |
| 934 |
'type' => 'button' |
| 935 |
, 'title' => __('Delete', 'booking-manager') // Title of the button |
| 936 |
, 'hint' => array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) // Hint |
| 937 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 938 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 939 |
, 'class' => '' // button-secondary | button-primary |
| 940 |
, 'icon' => '' |
| 941 |
, 'font_icon' => '' |
| 942 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 943 |
, 'style' => '' // Any CSS class here |
| 944 |
, 'attr' => array() |
| 945 |
) |
| 946 |
, array( |
| 947 |
'type' => 'button' |
| 948 |
, 'title' => __('Delete', 'booking-manager') |
| 949 |
, 'class' => 'button-primary' |
| 950 |
, 'font_icon' => 'glyphicon glyphicon-trash' |
| 951 |
, 'icon_position' => 'left' |
| 952 |
, 'action' => "jQuery('#bookingmanager_filters_formID').submit();" |
| 953 |
) |
| 954 |
) |
| 955 |
); |
| 956 |
?><div class="control-group wpbm-no-padding" style="max-width:730px;"><?php |
| 957 |
wpbm_bs_input_group( $params ); |
| 958 |
?></div><?php |
| 959 |
|
| 960 |
*/ |
| 961 |
function wpbm_bs_input_group( $args = array() ) { |
| 962 |
|
| 963 |
$milliseconds = round(microtime(true) * 1000); |
| 964 |
|
| 965 |
$defaults = array( |
| 966 |
'label_for' => 'btn_bs_' . $milliseconds // "For" parameter of label element |
| 967 |
, 'label' => '' // Label above element |
| 968 |
, 'style' => '' // CSS of entire div element |
| 969 |
, 'items' => array() // Array of elements |
| 970 |
); |
| 971 |
|
| 972 |
$params = wp_parse_args( $args, $defaults ); |
| 973 |
|
| 974 |
?><div class="wpbm-no-padding" style="width:auto;<?php echo $params['style']; ?>" ><?php |
| 975 |
if (! empty( $params['label'] ) ) { |
| 976 |
?><label for="<?php echo $params['label_for']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php |
| 977 |
} |
| 978 |
?><div class="btn-toolbar" role="toolbar" aria-label="..." id="<?php echo $params['label_for']; ?>_toolbar"> |
| 979 |
<div class="input-group" role="group" aria-label="..."><?php |
| 980 |
|
| 981 |
foreach ( $params['items'] as $item ) { |
| 982 |
|
| 983 |
switch ( $item['type'] ) { |
| 984 |
|
| 985 |
case 'button': |
| 986 |
?><div class="input-group-btn"><?php |
| 987 |
|
| 988 |
wpbm_bs_button( $item ); |
| 989 |
|
| 990 |
?></div><?php |
| 991 |
break; |
| 992 |
|
| 993 |
case 'text': |
| 994 |
wpbm_bs_text( $item ); |
| 995 |
break; |
| 996 |
|
| 997 |
case 'select': |
| 998 |
wpbm_bs_select( $item ); |
| 999 |
break; |
| 1000 |
|
| 1001 |
case 'addon': |
| 1002 |
wpbm_bs_addon( $item ); |
| 1003 |
break; |
| 1004 |
default: |
| 1005 |
break; |
| 1006 |
} |
| 1007 |
} |
| 1008 |
|
| 1009 |
?></div><!-- /input-group --> |
| 1010 |
</div> |
| 1011 |
</div><?php |
| 1012 |
} |
| 1013 |
|
| 1014 |
|
| 1015 |
/** Selectbox - Dropdown List with comple UI elements |
| 1016 |
* |
| 1017 |
* @param array $args = array( |
| 1018 |
'id' => '' // HTML ID of element |
| 1019 |
, 'id2' => '' // (optional) HTML ID of 2nd element |
| 1020 |
, 'default' => '' // Some Value from optins array that selected by default |
| 1021 |
, 'default2' => '' // (optional) Some Value from optins array that selected by default |
| 1022 |
, 'hint' => '' // (optional) Hint: array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) |
| 1023 |
, 'css_classes' => '' // (optional) |
| 1024 |
, 'label' => '' // (optional) Label of element "at Top of element" |
| 1025 |
, 'title' => '' // Title of element "Inside of element" |
| 1026 |
, 'align' => 'left' // (optional) Align: left | right |
| 1027 |
, 'disabled' => array() // (optional) If some options disbaled, then its must list here |
| 1028 |
, 'options' => array( // Associated array of titles and values |
| 1029 |
__('Bla bla bla', 'booking-manager') => '1' |
| 1030 |
, 'divider0' => 'divider' |
| 1031 |
, __('Section Header', 'booking-manager') => 'header' |
| 1032 |
... |
| 1033 |
|
| 1034 |
, '_radio_or_checkbox' => array( |
| 1035 |
array( 'type' => 'radio' // 'radio' or 'checkbox' |
| 1036 |
, 'id' => $item_params['id'] // HTML ID of element |
| 1037 |
, 'name' => $item_params['name'] |
| 1038 |
, 'style' => '' // CSS of select element |
| 1039 |
, 'class' => '' // CSS Class of select element |
| 1040 |
, 'disabled' => false |
| 1041 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1042 |
, 'legend' => '' // aria-label parameter |
| 1043 |
, 'value' => '' // Some Value from optins array that selected by default |
| 1044 |
, 'selected' => false // Selected or not |
| 1045 |
, 'label' => '' // Label - title |
| 1046 |
) |
| 1047 |
) |
| 1048 |
, '_select' => array( |
| 1049 |
array( 'type' => 'select' |
| 1050 |
, 'id' => '' // HTML ID of element |
| 1051 |
, 'style' => '' // CSS of select element |
| 1052 |
, 'class' => '' // CSS Class of select element |
| 1053 |
, 'multiple' => false |
| 1054 |
, 'disabled' => false |
| 1055 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1056 |
, 'options' => array() // Associated array of titles and values |
| 1057 |
, 'disabled_options' => array() // If some options disbaled, then its must list here |
| 1058 |
, 'value' => '' // Some Value from optins array that selected by default |
| 1059 |
) |
| 1060 |
) |
| 1061 |
, '_texts' => array( |
| 1062 |
array( 'type' => 'text' |
| 1063 |
, 'id' => '' |
| 1064 |
, 'name' => '' |
| 1065 |
, 'label' => '' |
| 1066 |
, 'disabled' => false |
| 1067 |
, 'class' => '' |
| 1068 |
, 'style' => '' |
| 1069 |
, 'placeholder' => '' |
| 1070 |
, 'attr' => array() |
| 1071 |
, 'value' => '' |
| 1072 |
) |
| 1073 |
) |
| 1074 |
, '_buttons' => array( |
| 1075 |
array( 'type' => 'button' |
| 1076 |
, 'title' => '' // Title of the button |
| 1077 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 1078 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1079 |
, 'action' => "wpbm_close_dropdown_selectbox( '" . $params['id'] . "' )" // Some JavaScript to execure, for example run the function |
| 1080 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 1081 |
, 'icon' => '' |
| 1082 |
, 'font_icon' => '' |
| 1083 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1084 |
, 'style' => '' // Any CSS class here |
| 1085 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1086 |
, 'attr' => array() |
| 1087 |
) |
| 1088 |
) |
| 1089 |
) |
| 1090 |
); |
| 1091 |
* |
| 1092 |
Exmaple #1: |
| 1093 |
$params = array( // Pending, Active, Suspended, Terminated, Cancelled, Fraud |
| 1094 |
'id' => 'wh_approved' |
| 1095 |
, 'options' => array ( |
| 1096 |
__('Pending', 'booking-manager') => '0', |
| 1097 |
__('Approved', 'booking-manager') => '1', |
| 1098 |
, 'divider0' => 'divider' |
| 1099 |
, __('Section Header', 'booking-manager') => 'header' |
| 1100 |
, __('Any', 'booking-manager') => '' |
| 1101 |
) |
| 1102 |
, 'disabled' => array( '' ) // It will disable "Any" option |
| 1103 |
, 'default' => ( isset( $_REQUEST[ 'wh_approved' ] ) ) ? esc_attr( $_REQUEST[ 'wh_approved' ] ) : '' |
| 1104 |
, 'label' => ''//__('Status', 'booking-manager') . ':' |
| 1105 |
, 'title' => __('Items', 'booking-manager') |
| 1106 |
); |
| 1107 |
|
| 1108 |
wpbm_bs_dropdown_list( $params ); |
| 1109 |
|
| 1110 |
Exmaple #2: |
| 1111 |
$dates_interval = array( |
| 1112 |
1 => '1' . ' ' . __('day' , 'booking-manager') |
| 1113 |
, 2 => '2' . ' ' . __('days' , 'booking-manager') |
| 1114 |
, 3 => '3' . ' ' . __('days' , 'booking-manager') |
| 1115 |
, 4 => '4' . ' ' . __('days' , 'booking-manager') |
| 1116 |
, 5 => '5' . ' ' . __('days' , 'booking-manager') |
| 1117 |
, 6 => '6' . ' ' . __('days' , 'booking-manager') |
| 1118 |
, 7 => '1' . ' ' . __('week' , 'booking-manager') |
| 1119 |
, 14 => '2' . ' ' . __('weeks' , 'booking-manager') |
| 1120 |
, 30 => '1' . ' ' . __('month' , 'booking-manager') |
| 1121 |
, 60 => '2' . ' ' . __('months' , 'booking-manager') |
| 1122 |
, 90 => '3' . ' ' . __('months' , 'booking-manager') |
| 1123 |
, 183 => '6' . ' ' . __('months' , 'booking-manager') |
| 1124 |
, 365 => '1' . ' ' . __('Year' , 'booking-manager') |
| 1125 |
); |
| 1126 |
$params = array( |
| 1127 |
'id' => 'wh_bookingmanager_date' |
| 1128 |
, 'id2' => 'wh_bookingmanager_date2' |
| 1129 |
, 'default' => ( isset( $_REQUEST[ 'wh_bookingmanager_date' ] ) ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_date' ] ) : '' |
| 1130 |
, 'default2' => ( isset( $_REQUEST[ 'wh_bookingmanager_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_date2' ] ) : '' |
| 1131 |
, 'hint' => array( 'title' => __('Filter itenms by dates' , 'booking-manager') , 'position' => 'top' ) |
| 1132 |
, 'label' => ''//__('Booked Dates', 'booking-manager') . ':' |
| 1133 |
, 'title' => __('Dates', 'booking-manager') |
| 1134 |
, 'options' => array ( |
| 1135 |
__('Current dates' , 'booking-manager') => '0' |
| 1136 |
, __('Today' , 'booking-manager') => '1' |
| 1137 |
, __('Previous dates' , 'booking-manager') => '2' |
| 1138 |
, __('All dates' , 'booking-manager') => '3' |
| 1139 |
, 'divider1' => 'divider' |
| 1140 |
, __('Today check in/out' , 'booking-manager') => '9' |
| 1141 |
, __('Check In - Tomorrow' , 'booking-manager') => '7' |
| 1142 |
, __('Check Out - Tomorrow' , 'booking-manager') => '8' |
| 1143 |
, 'divider2' => 'divider' |
| 1144 |
, 'next' => array( |
| 1145 |
array( |
| 1146 |
'type' => 'radio' |
| 1147 |
, 'label' => __('Next' , 'booking-manager') |
| 1148 |
, 'id' => 'wh_bookingmanager_datedays_interval1' |
| 1149 |
, 'name' => 'wh_bookingmanager_datedays_interval_Radios' |
| 1150 |
, 'style' => '' // CSS of select element |
| 1151 |
, 'class' => '' // CSS Class of select element |
| 1152 |
, 'disabled' => false |
| 1153 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1154 |
, 'legend' => '' // aria-label parameter |
| 1155 |
, 'value' => '4' // Some Value from optins array that selected by default |
| 1156 |
, 'selected' => ( isset($_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] ) |
| 1157 |
&& ( $_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] == '4' ) ) ? true : false |
| 1158 |
) |
| 1159 |
, array( |
| 1160 |
'type' => 'select' |
| 1161 |
, 'attr' => array() |
| 1162 |
, 'name' => 'wh_bookingmanager_datenext' |
| 1163 |
, 'id' => 'wh_bookingmanager_datenext' |
| 1164 |
, 'options' => $dates_interval |
| 1165 |
, 'value' => isset( $_REQUEST[ 'wh_bookingmanager_datenext'] ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_datenext'] ) : '' |
| 1166 |
) |
| 1167 |
) |
| 1168 |
, 'prior' => array( |
| 1169 |
array( |
| 1170 |
'type' => 'radio' |
| 1171 |
, 'label' => __('Prior' , 'booking-manager') |
| 1172 |
, 'id' => 'wh_bookingmanager_datedays_interval2' |
| 1173 |
, 'name' => 'wh_bookingmanager_datedays_interval_Radios' |
| 1174 |
, 'style' => '' // CSS of select element |
| 1175 |
, 'class' => '' // CSS Class of select element |
| 1176 |
, 'disabled' => false |
| 1177 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1178 |
, 'legend' => '' // aria-label parameter |
| 1179 |
, 'value' => '5' // Some Value from optins array that selected by default |
| 1180 |
, 'selected' => ( isset($_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] ) |
| 1181 |
&& ( $_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] == '5' ) ) ? true : false |
| 1182 |
) |
| 1183 |
, array( |
| 1184 |
'type' => 'select' |
| 1185 |
, 'attr' => array() |
| 1186 |
, 'name' => 'wh_bookingmanager_dateprior' |
| 1187 |
, 'id' => 'wh_bookingmanager_dateprior' |
| 1188 |
, 'options' => $dates_interval |
| 1189 |
, 'value' => isset( $_REQUEST[ 'wh_bookingmanager_dateprior'] ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_dateprior'] ) : '' |
| 1190 |
) |
| 1191 |
) |
| 1192 |
, 'fixed' => array( array( 'type' => 'group', 'class' => 'input-group text-group'), |
| 1193 |
array( |
| 1194 |
'type' => 'radio' |
| 1195 |
, 'label' => __('Dates' , 'booking-manager') |
| 1196 |
, 'id' => 'wh_bookingmanager_datedays_interval3' |
| 1197 |
, 'name' => 'wh_bookingmanager_datedays_interval_Radios' |
| 1198 |
, 'style' => '' // CSS of select element |
| 1199 |
, 'class' => '' // CSS Class of select element |
| 1200 |
, 'disabled' => false |
| 1201 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1202 |
, 'legend' => '' // aria-label parameter |
| 1203 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 1204 |
, 'selected' => ( isset($_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] ) |
| 1205 |
&& ( $_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] == '6' ) ) ? true : false |
| 1206 |
) |
| 1207 |
, array( |
| 1208 |
'type' => 'text' |
| 1209 |
, 'id' => 'wh_bookingmanager_datefixeddates' |
| 1210 |
, 'name' => 'wh_bookingmanager_datefixeddates' |
| 1211 |
, 'label' => __('Check-in' , 'booking-manager') . ':' |
| 1212 |
, 'disabled' => false |
| 1213 |
, 'class' => 'wpdevbk-filters-section-calendar' // This class add datepicker |
| 1214 |
, 'style' => '' |
| 1215 |
, 'placeholder' => date( 'Y-m-d' ) |
| 1216 |
, 'attr' => array() |
| 1217 |
, 'value' => isset( $_REQUEST[ 'wh_bookingmanager_datefixeddates'] ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_datefixeddates'] ) : '' |
| 1218 |
) |
| 1219 |
, array( |
| 1220 |
'type' => 'text' |
| 1221 |
, 'id' => 'wh_bookingmanager_date2fixeddates' |
| 1222 |
, 'name' => 'wh_bookingmanager_date2fixeddates' |
| 1223 |
, 'label' => __('Check-out' , 'booking-manager') . ':' |
| 1224 |
, 'disabled' => false |
| 1225 |
, 'class' => 'wpdevbk-filters-section-calendar' // This class add datepicker |
| 1226 |
, 'style' => '' |
| 1227 |
, 'placeholder' => date( 'Y-m-d' ) |
| 1228 |
, 'attr' => array() |
| 1229 |
, 'value' => isset( $_REQUEST[ 'wh_bookingmanager_date2fixeddates'] ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_date2fixeddates'] ) : '' |
| 1230 |
) |
| 1231 |
) |
| 1232 |
, 'divider3' => 'divider' |
| 1233 |
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') |
| 1234 |
, array( |
| 1235 |
'type' => 'radio' |
| 1236 |
, 'label' => __('Tada' , 'booking-manager') |
| 1237 |
, 'id' => 'wh_bookingmanager_datedays_interval4' |
| 1238 |
, 'name' => 'wh_bookingmanager_datedays_interval_Radios' |
| 1239 |
, 'style' => '' // CSS of select element |
| 1240 |
, 'class' => '' // CSS Class of select element |
| 1241 |
, 'disabled' => false |
| 1242 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1243 |
, 'legend' => '' // aria-label parameter |
| 1244 |
, 'value' => '10' // Some Value from optins array that selected by default |
| 1245 |
, 'selected' => ( isset($_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] ) |
| 1246 |
&& ( $_REQUEST[ 'wh_bookingmanager_datedays_interval_Radios'] == '10' ) ) ? true : false |
| 1247 |
) |
| 1248 |
|
| 1249 |
, array( |
| 1250 |
'type' => 'text' |
| 1251 |
, 'id' => 'wh_bookingmanager_datecustom' |
| 1252 |
, 'name' => 'wh_bookingmanager_datecustom' |
| 1253 |
, 'label' => __('Custom' , 'booking-manager') . ':' |
| 1254 |
, 'disabled' => false |
| 1255 |
, 'class' => '' |
| 1256 |
, 'style' => '' |
| 1257 |
, 'placeholder' => date( 'Y' ) |
| 1258 |
, 'attr' => array() |
| 1259 |
, 'value' => isset( $_REQUEST[ 'wh_bookingmanager_datecustom'] ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_datecustom'] ) : '' |
| 1260 |
) |
| 1261 |
) |
| 1262 |
, 'divider4' => 'divider' |
| 1263 |
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), |
| 1264 |
array( |
| 1265 |
'type' => 'button' |
| 1266 |
, 'title' => __('Apply' , 'booking-manager') // Title of the button |
| 1267 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 1268 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1269 |
, 'action' => "wpbm_show_selected_in_dropdown__radio_select_option(" |
| 1270 |
. " 'wh_bookingmanager_date'" |
| 1271 |
. ", 'wh_bookingmanager_date2'" |
| 1272 |
. ", 'wh_bookingmanager_datedays_interval_Radios' " |
| 1273 |
. ");" |
| 1274 |
// Some JavaScript to execure, for example run the function |
| 1275 |
, 'class' => 'button-primary' // button-secondary | button-primary |
| 1276 |
, 'icon' => '' |
| 1277 |
, 'font_icon' => '' |
| 1278 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1279 |
, 'style' => '' // Any CSS class here |
| 1280 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1281 |
, 'attr' => array() |
| 1282 |
|
| 1283 |
) |
| 1284 |
, array( |
| 1285 |
'type' => 'button' |
| 1286 |
, 'title' => __('Close' , 'booking-manager') // Title of the button |
| 1287 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 1288 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1289 |
//, 'action' => '' // Some JavaScript to execure, for example run the function |
| 1290 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 1291 |
, 'icon' => '' |
| 1292 |
, 'font_icon' => '' |
| 1293 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1294 |
, 'style' => '' // Any CSS class here |
| 1295 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1296 |
, 'attr' => array() |
| 1297 |
) |
| 1298 |
) |
| 1299 |
) |
| 1300 |
); |
| 1301 |
wpbm_bs_dropdown_list( $params ); |
| 1302 |
|
| 1303 |
|
| 1304 |
Exmaple #3: |
| 1305 |
$params = array( |
| 1306 |
'id' => 'wh_pay_status' |
| 1307 |
// , 'id2' => 'wh_bookingmanager_date2' |
| 1308 |
, 'default' => ( isset( $_REQUEST[ 'wh_pay_status' ] ) ) ? esc_attr( $_REQUEST[ 'wh_pay_status' ] ) : 'all' |
| 1309 |
// , 'default2' => ( isset( $_REQUEST[ 'wh_bookingmanager_date2' ] ) ) ? esc_attr( $_REQUEST[ 'wh_bookingmanager_date2' ] ) : '' |
| 1310 |
, 'hint' => array( 'title' => __('Payment status' , 'booking-manager') , 'position' => 'top' ) |
| 1311 |
, 'label' => ''//__('Booked Dates', 'booking-manager') . ':' |
| 1312 |
, 'title' => __('Payment', 'booking-manager') |
| 1313 |
, 'options' => array ( |
| 1314 |
__('Any Status' , 'booking-manager') =>'all', |
| 1315 |
'divider0' => 'divider', |
| 1316 |
__('Paid OK' , 'booking-manager') =>'group_ok', |
| 1317 |
__('Unknown Status' , 'booking-manager') =>'group_unknown', |
| 1318 |
__('Not Completed' , 'booking-manager') =>'group_pending', |
| 1319 |
__('Failed' , 'booking-manager') =>'group_failed' |
| 1320 |
, 'divider2' => 'divider' |
| 1321 |
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') |
| 1322 |
, array( |
| 1323 |
'type' => 'radio' |
| 1324 |
, 'label' => __('Custom' , 'booking-manager') |
| 1325 |
, 'id' => 'wh_pay_statuscustom_radios1' |
| 1326 |
, 'name' => 'wh_pay_statuscustom_Radios' |
| 1327 |
, 'style' => '' // CSS of select element |
| 1328 |
, 'class' => '' // CSS Class of select element |
| 1329 |
, 'disabled' => false |
| 1330 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1331 |
, 'legend' => '' // aria-label parameter |
| 1332 |
, 'value' => '1' // Some Value from optins array that selected by default |
| 1333 |
, 'selected' => ( isset($_REQUEST[ 'wh_pay_statuscustom_Radios'] ) |
| 1334 |
&& ( $_REQUEST[ 'wh_pay_statuscustom_Radios'] == '1' ) ) ? true : false |
| 1335 |
) |
| 1336 |
|
| 1337 |
, array( |
| 1338 |
'type' => 'text' |
| 1339 |
, 'id' => 'wh_pay_statuscustom' |
| 1340 |
, 'name' => 'wh_pay_statuscustom' |
| 1341 |
, 'label' => __('Payment status' , 'booking-manager') . ':' |
| 1342 |
, 'disabled' => false |
| 1343 |
, 'class' => '' |
| 1344 |
, 'style' => '' |
| 1345 |
, 'placeholder' => '' |
| 1346 |
, 'attr' => array() |
| 1347 |
, 'value' => isset( $_REQUEST[ 'wh_pay_statuscustom'] ) ? esc_attr( $_REQUEST[ 'wh_pay_statuscustom'] ) : '' |
| 1348 |
) |
| 1349 |
) |
| 1350 |
, 'divider4' => 'divider' |
| 1351 |
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), |
| 1352 |
array( |
| 1353 |
'type' => 'button' |
| 1354 |
, 'title' => __('Apply' , 'booking-manager') // Title of the button |
| 1355 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 1356 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1357 |
, 'action' => "wpbm_show_selected_in_dropdown__radio_select_option(" |
| 1358 |
. " 'wh_pay_status'" |
| 1359 |
. ", ''" |
| 1360 |
. ", 'wh_pay_statuscustom_Radios' " |
| 1361 |
. ");" |
| 1362 |
// Some JavaScript to execure, for example run the function |
| 1363 |
, 'class' => 'button-primary' // button-secondary | button-primary |
| 1364 |
, 'icon' => '' |
| 1365 |
, 'font_icon' => '' |
| 1366 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1367 |
, 'style' => '' // Any CSS class here |
| 1368 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1369 |
, 'attr' => array() |
| 1370 |
|
| 1371 |
) |
| 1372 |
, array( |
| 1373 |
'type' => 'button' |
| 1374 |
, 'title' => __('Close' , 'booking-manager') // Title of the button |
| 1375 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' , 'booking-manager') , 'position' => 'bottom' ) |
| 1376 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1377 |
//, 'action' => '' // Some JavaScript to execure, for example run the function |
| 1378 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 1379 |
, 'icon' => '' |
| 1380 |
, 'font_icon' => '' |
| 1381 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1382 |
, 'style' => '' // Any CSS class here |
| 1383 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1384 |
, 'attr' => array() |
| 1385 |
) |
| 1386 |
) |
| 1387 |
) |
| 1388 |
); |
| 1389 |
wpbm_bs_dropdown_list( $params ); |
| 1390 |
|
| 1391 |
*/ |
| 1392 |
function wpbm_bs_dropdown_list( $args = array() ) { |
| 1393 |
|
| 1394 |
$milliseconds = round(microtime(true) * 1000); |
| 1395 |
|
| 1396 |
$defaults = array( |
| 1397 |
'id' => '' // HTML ID of element |
| 1398 |
, 'id2' => '' // HTML ID of 2nd element |
| 1399 |
, 'default' => '' // Some Value from optins array that selected by default |
| 1400 |
, 'default2' => '' // Some Value from optins array that selected by default |
| 1401 |
, 'hint' => '' // Hint // array( 'title' => __('Delete' , 'booking-manager') , 'position' => 'bottom' ) |
| 1402 |
, 'css_classes' => '' |
| 1403 |
, 'label' => '' // Label of element "at Top of element" |
| 1404 |
, 'title' => '' // Title of element "Inside of element" |
| 1405 |
, 'align' => 'left' // Align: left | right |
| 1406 |
, 'options' => array() // Associated array of titles and values |
| 1407 |
, 'disabled' => array() // If some options disbaled, then its must list here |
| 1408 |
); |
| 1409 |
$params = wp_parse_args( $args, $defaults ); |
| 1410 |
|
| 1411 |
// Check if this list Simple or Complex (with input elements) //////////// |
| 1412 |
$is_this_simple_list = true; |
| 1413 |
foreach ( $params['options'] as $key => $value ) { |
| 1414 |
if ( is_array( $value ) ) { |
| 1415 |
$is_this_simple_list = false; |
| 1416 |
break; |
| 1417 |
} |
| 1418 |
} |
| 1419 |
|
| 1420 |
// Selected Value ////////////////////////////////////////////////////////// |
| 1421 |
$wpbm_value = $params[ 'default' ]; |
| 1422 |
|
| 1423 |
$wpbm_selector_default = array_search( $wpbm_value, $params['options'] ); |
| 1424 |
if ( $wpbm_selector_default === false ) { |
| 1425 |
$wpbm_selector_default = key( $params['options'] ); |
| 1426 |
$wpbm_selector_default_value = current( $params['options'] ); |
| 1427 |
} else |
| 1428 |
$wpbm_selector_default_value = $wpbm_value; |
| 1429 |
|
| 1430 |
$wpbm_selector_default_value2 = $params[ 'default2' ]; |
| 1431 |
|
| 1432 |
// Initial setting title, if already was request ///////////////////////// |
| 1433 |
if ( isset( $_REQUEST[ esc_attr( $params['id'] ) ] ) ) { |
| 1434 |
?><script type="text/javascript"> |
| 1435 |
jQuery(document).ready( function(){ |
| 1436 |
jQuery('#<?php echo esc_attr( $params['id'] ); ?>_container .button.button-primary').trigger( "click" ); |
| 1437 |
}); |
| 1438 |
</script><?php |
| 1439 |
} |
| 1440 |
//////////////////////////////////////////////////////////////////////////// |
| 1441 |
?> |
| 1442 |
<div class="control-group"> |
| 1443 |
<?php if ( ! empty( $params['label'] ) ) { |
| 1444 |
?><label for="<?php echo $params['id']; ?>" class="control-label"><?php echo $params['label']; ?></label><?php |
| 1445 |
} |
| 1446 |
?><div> |
| 1447 |
<div class="btn-group"> |
| 1448 |
<a href="javascript:void(0)" |
| 1449 |
<?php if (! $is_this_simple_list ) { ?> |
| 1450 |
onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();" |
| 1451 |
<?php } ?> |
| 1452 |
data-toggle="dropdown" |
| 1453 |
id="<?php echo $params['id'];?>_selector" |
| 1454 |
<?php if ( ! empty( $params['hint'] ) ) { ?> |
| 1455 |
title="<?php echo esc_js( $params['hint']['title'] ); ?>" |
| 1456 |
<?php } ?> |
| 1457 |
class="button button-secondary dropdown-toggle <?php |
| 1458 |
echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; |
| 1459 |
echo ( ! empty( $params['css_classes'] ) ) ? $params['css_classes'] . ' ' : '' ; |
| 1460 |
?>" |
| 1461 |
<?php echo wpbm_get_custom_attr( $params ); ?> |
| 1462 |
><label class="label_in_filters" |
| 1463 |
><?php echo $params['title']; ?>: </label> <span class="wpbm_selected_in_dropdown"><?php echo $wpbm_selector_default; ?></span> <span class="caret"></span></a> |
| 1464 |
<ul |
| 1465 |
id="<?php echo $params['id']; ?>_container" |
| 1466 |
class="dropdown-menu dropdown-menu-<?php echo $params['align']; ?>" |
| 1467 |
><?php |
| 1468 |
|
| 1469 |
wpbm_bs_list_of_options_for_dropdown( $params , 'list', $is_this_simple_list ); |
| 1470 |
|
| 1471 |
?></ul> |
| 1472 |
<input type="hidden" autocomplete="off" value="<?php echo $wpbm_selector_default_value; ?>" id="<?php echo $params['id']; ?>" name="<?php echo $params['id']; ?>" /> |
| 1473 |
<?php if ( ! empty($params['id2'] ) ) { ?> |
| 1474 |
<input type="hidden" autocomplete="off" value="<?php echo $wpbm_selector_default_value2; ?>" id="<?php echo $params['id2']; ?>" name="<?php echo $params['id2']; ?>" /> |
| 1475 |
<?php } ?> |
| 1476 |
</div> |
| 1477 |
</div> |
| 1478 |
</div> |
| 1479 |
<?php |
| 1480 |
} |
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
//////////////////////////////////////////////////////////////////////////////// |
| 1485 |
// Drop Down Menu |
| 1486 |
//////////////////////////////////////////////////////////////////////////////// |
| 1487 |
|
| 1488 |
/** Show Dropdown Menu |
| 1489 |
* |
| 1490 |
* Usage: |
| 1491 |
|
| 1492 |
wpbm_dropdown_menu( array( |
| 1493 |
'title' => __('Help', 'booking-manager') |
| 1494 |
, 'hint' => array( 'title' => __('Help info' , 'booking-manager') , 'position' => 'bottom' ) |
| 1495 |
, 'font_icon' => 'glyphicon glyphicon-question-sign' |
| 1496 |
, 'position' => 'right' |
| 1497 |
, 'items' => array( |
| 1498 |
array( 'type' => 'link', 'title' => __('About Plugin', 'booking-manager'), 'url' => 'http://oplugins.com/plugins/booking-manager' ) |
| 1499 |
, array( 'type' => 'divider' ) |
| 1500 |
, array( 'type' => 'text', 'title' => __('Text', 'booking-manager') ) |
| 1501 |
, array( 'type' => 'link', 'title' => __('Help', 'booking-manager'), 'url' => 'http://oplugins.com/plugins/booking-manager//help/' ) |
| 1502 |
, array( 'type' => 'link', 'title' => __('FAQ', 'booking-manager'), 'url' => 'http://oplugins.com/plugins/booking-manager/#faq' ) |
| 1503 |
, array( 'type' => 'link', 'title' => __('Technical Support', 'booking-manager'), 'url' => 'http://oplugins.com/plugins/booking-manager/#support' ) |
| 1504 |
, array( 'type' => 'divider' ) |
| 1505 |
, array( 'type' => 'link', 'title' => __('Upgrade Now', 'booking-manager'), 'url' => 'http://http://oplugins.com/plugins/booking-manager/', 'style' => 'font-weight: 600;' , 'attr' => array( 'target' => '_blank' ) ) |
| 1506 |
) |
| 1507 |
) ); |
| 1508 |
* |
| 1509 |
* @param array $args |
| 1510 |
*/ |
| 1511 |
function wpbm_bs_dropdown_menu( $args = array() ) { |
| 1512 |
|
| 1513 |
$defaults = array( |
| 1514 |
'title' => '', |
| 1515 |
'hint' => '', |
| 1516 |
'icon' => '', |
| 1517 |
'font_icon' => '', |
| 1518 |
'position' => '', |
| 1519 |
'items' => array() |
| 1520 |
); |
| 1521 |
$params = wp_parse_args( $args, $defaults ); |
| 1522 |
|
| 1523 |
?><span class="dropdown <?php echo ( ( $params['position'] == 'right' ) ? 'pull-right' : '' ); ?>"> |
| 1524 |
<a href="javascript:void(0)" |
| 1525 |
data-toggle="dropdown" |
| 1526 |
aria-expanded="true" |
| 1527 |
<?php if ( ! empty( $params['hint'] ) ) { ?> |
| 1528 |
title="<?php echo esc_js( $params['hint']['title'] ); ?>" |
| 1529 |
<?php } ?> |
| 1530 |
class="dropdown-toggle nav-tab <?php |
| 1531 |
echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; |
| 1532 |
?>"><?php |
| 1533 |
|
| 1534 |
if ( ! empty( $params['icon'] ) ) { |
| 1535 |
|
| 1536 |
if ( substr( $params['icon'], 0, 4 ) != 'http') $img_path = WPBM_PLUGIN_URL . '/assets/img/' . $params['icon']; |
| 1537 |
else $img_path = $params['icon']; |
| 1538 |
|
| 1539 |
?><img class="menuicons" src="<?php echo $img_path; ?>"><?php // Img Icon |
| 1540 |
|
| 1541 |
} elseif ( ! empty( $params['font_icon'] ) ) { |
| 1542 |
|
| 1543 |
?><i class="menu_icon icon-1x <?php echo $params['font_icon']; ?>"></i> <?php // Font Icon |
| 1544 |
|
| 1545 |
} ?><span |
| 1546 |
class="nav-tab-text"><?php echo $params['title']; ?></span> <b |
| 1547 |
class="caret" style="border-top-color: #333333 !important;"></b></a> |
| 1548 |
<ul class="dropdown-menu" role="menu" style="<?php echo ( ( $params['position'] == 'right' ) ? 'right:0px; left:auto;' : '' ); ?>"> |
| 1549 |
<?php |
| 1550 |
foreach ( $params['items'] as $items ) { |
| 1551 |
switch ( $items['type'] ) { |
| 1552 |
|
| 1553 |
case 'divider': |
| 1554 |
?><li class="divider"></li><?php |
| 1555 |
break; |
| 1556 |
|
| 1557 |
case 'text': |
| 1558 |
?><li <?php echo wpbm_get_custom_attr( $items ); ?> ><?php echo $items['title']; ?></li><?php |
| 1559 |
break; |
| 1560 |
|
| 1561 |
default: |
| 1562 |
?><li><a <?php echo wpbm_get_custom_attr( $items ); ?> href="<?php echo $items['url']; ?>"><?php echo $items['title']; ?></a></li><?php |
| 1563 |
break; |
| 1564 |
} |
| 1565 |
} |
| 1566 |
?> |
| 1567 |
</ul> |
| 1568 |
</span><?php |
| 1569 |
} |
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
//////////////////////////////////////////////////////////////////////////////// |
| 1574 |
// Vertical Buttons Group |
| 1575 |
//////////////////////////////////////////////////////////////////////////////// |
| 1576 |
|
| 1577 |
/** Devine Vertical Buttons Group |
| 1578 |
* |
| 1579 |
* @param array $params |
| 1580 |
* |
| 1581 |
* Example: |
| 1582 |
$params['btn_vm_calendar'] = array( |
| 1583 |
'title' => '' |
| 1584 |
, 'hint' => array( 'title' => __('Calendar Overview' , 'booking-manager') , 'position' => 'bottom' ) |
| 1585 |
, 'selected' => ( $selected_view_mode == 'vm_calendar' ) ? true : false |
| 1586 |
, 'link' => $bk_admin_url . '&view_mode=vm_calendar' |
| 1587 |
, 'icon' => '' |
| 1588 |
, 'font_icon' => 'glyphicon glyphicon-calendar' |
| 1589 |
); |
| 1590 |
|
| 1591 |
*/ |
| 1592 |
function wpbm_bs_vertical_buttons_group( $params ) { |
| 1593 |
|
| 1594 |
?><div role="group" class="btn-group-vertical" aria-label="..." ><?php |
| 1595 |
|
| 1596 |
foreach ( $params as $btn_id => $btn_params ) { |
| 1597 |
|
| 1598 |
?><a id="<?php echo $btn_id; ?>" |
| 1599 |
<?php if ( ! empty( $btn_params['hint'] ) ) { ?> |
| 1600 |
title="<?php echo esc_js( $btn_params['hint']['title'] ); ?>" |
| 1601 |
<?php |
| 1602 |
/* data-original-title="<?php echo esc_js( $btn_params['hint'] ); ?>" */ |
| 1603 |
} ?> |
| 1604 |
class="button button-secondary <?php |
| 1605 |
echo ( $btn_params['selected'] ) ? 'active ' : '' ; |
| 1606 |
echo ( ! empty( $btn_params['hint'] ) ) ? 'tooltip_' . $btn_params['hint']['position'] . ' ' : '' ; |
| 1607 |
echo ( ! empty( $btn_params['css_classes'] ) ) ? $btn_params['css_classes'] . ' ' : '' ; |
| 1608 |
?>" |
| 1609 |
href="<?php echo $btn_params['link']; ?>" |
| 1610 |
onclick="javascript:void(0)" |
| 1611 |
><?php |
| 1612 |
|
| 1613 |
// Icon |
| 1614 |
$is_icon_not_showed = false; |
| 1615 |
if ( ! empty( $btn_params['icon'] ) ) { |
| 1616 |
|
| 1617 |
if ( substr( $btn_params['icon'], 0, 4 ) != 'http') |
| 1618 |
$img_path = WPBM_PLUGIN_URL . '/assets/img/' . $btn_params['icon']; |
| 1619 |
else |
| 1620 |
$img_path = $btn_params['icon']; |
| 1621 |
|
| 1622 |
?><img class="menuicons" src="<?php echo $img_path; ?>" style="width:20px;" /><?php // IMG Icon |
| 1623 |
|
| 1624 |
} elseif ( ! empty( $btn_params['font_icon'] ) ) { |
| 1625 |
|
| 1626 |
?><i class="menu_icon icon-1x <?php echo $btn_params['font_icon']; ?>"></i><?php // Font Icon |
| 1627 |
} else { |
| 1628 |
$is_icon_not_showed = true; |
| 1629 |
} |
| 1630 |
|
| 1631 |
// Text |
| 1632 |
if ( ( ! empty( $btn_params['title'] ) ) && ( ( ! $this->is_only_icons ) || ( $is_icon_not_showed ) ) ){ |
| 1633 |
?><span class="btn-group-vertical-text" > <?php echo esc_js( $btn_params['title'] ); ?></span><?php |
| 1634 |
} |
| 1635 |
|
| 1636 |
?></a><?php |
| 1637 |
} |
| 1638 |
|
| 1639 |
?></div><?php |
| 1640 |
|
| 1641 |
} |
| 1642 |
|
| 1643 |
|
| 1644 |
|
| 1645 |
//////////////////////////////////////////////////////////////////////////////// |
| 1646 |
// Navigation Toolbar Tabs |
| 1647 |
//////////////////////////////////////////////////////////////////////////////// |
| 1648 |
|
| 1649 |
/** Display Tab in Navigation line |
| 1650 |
* |
| 1651 |
* @param array $args |
| 1652 |
array( |
| 1653 |
'title' => '' // Title of TAB |
| 1654 |
, 'hint' => array( 'title' => '', 'position' => 'bottom' ) // Hint |
| 1655 |
, 'link' => 'javascript:void(0)' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link |
| 1656 |
, 'onclick' => '' // JS action |
| 1657 |
, 'position' => '' // 'left' || 'right' || '' |
| 1658 |
, 'css_classes' => '' // CSS class(es) |
| 1659 |
, 'icon' => '' // Icon - link to the real PNG img |
| 1660 |
, 'font_icon' => '' // CSS definition of forn Icon |
| 1661 |
, 'default' => false // Is it activated by default: true || false. |
| 1662 |
, 'disabled' => false // Is this sub tab deactivated: true || false. |
| 1663 |
, 'checkbox' => false // false or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status', 'value' => '', 'onclick' => '' ) |
| 1664 |
, 'top' => true // Top or Bottom TAB: true || false. |
| 1665 |
) |
| 1666 |
*/ |
| 1667 |
function wpbm_bs_display_tab( $args = array() ) { |
| 1668 |
|
| 1669 |
$defaults = array( |
| 1670 |
'top' => true, |
| 1671 |
'title' => '', |
| 1672 |
'hint' => '', |
| 1673 |
'link' => 'javascript:void(0)', |
| 1674 |
'onclick' => '', |
| 1675 |
'css_classes' => '', |
| 1676 |
'icon' => '', |
| 1677 |
'font_icon' => '', |
| 1678 |
'checkbox' => false, |
| 1679 |
'disabled' => false, |
| 1680 |
'default' => false |
| 1681 |
); |
| 1682 |
|
| 1683 |
$tab = wp_parse_args( $args, $defaults ); |
| 1684 |
|
| 1685 |
|
| 1686 |
if ( ( ! empty( $tab['hint'] ) ) && ( is_string( $tab['hint'] ) ) ) { // Compatibility with previous hint declaration |
| 1687 |
|
| 1688 |
if ( $tab['top'] === true ) $tab['hint'] = array( 'title' => $tab['hint'], 'position' => 'top' ); |
| 1689 |
else $tab['hint'] = array( 'title' => $tab['hint'], 'position' => 'bottom' ); |
| 1690 |
} |
| 1691 |
|
| 1692 |
|
| 1693 |
$html_tag = 'a'; |
| 1694 |
|
| 1695 |
if ( $tab['disabled'] ) { |
| 1696 |
$tab['link'] = 'javascript:void(0)'; |
| 1697 |
$html_tag = 'span'; |
| 1698 |
} |
| 1699 |
|
| 1700 |
|
| 1701 |
echo '<' , $html_tag , ' '; // Start HTML Tag |
| 1702 |
|
| 1703 |
if ( $html_tag == 'a' ) { // Paramters for A tag |
| 1704 |
|
| 1705 |
echo ' href="' , $tab['link'] , '" '; |
| 1706 |
//echo ' title="' , esc_js( $tab['title'] ) , '" '; |
| 1707 |
|
| 1708 |
if ( ! empty( $tab['onclick'] ) ) |
| 1709 |
echo ' onclick="javascript:' , $tab['onclick'] , '" '; |
| 1710 |
} |
| 1711 |
|
| 1712 |
if ( ! empty( $tab['hint'] ) ) { // Hint |
| 1713 |
echo ' title="' , esc_js( $tab['hint']['title'] ) , '" '; |
| 1714 |
} |
| 1715 |
|
| 1716 |
echo ' class="nav-tab'; // CSS Classes |
| 1717 |
|
| 1718 |
if ( $tab['top'] !== true ) echo ' wpdevelop-submenu-tab'; |
| 1719 |
if ( $tab['default'] ) echo ' nav-tab-active'; |
| 1720 |
if ( $tab['disabled'] ) echo ' wpdevelop-tab-disabled'; |
| 1721 |
if ( ! empty( $tab['hint'] ) ) echo ' tooltip_' , $tab['hint']['position']; |
| 1722 |
if ( ! empty( $tab['position'] ) ) echo ' nav-tab-position-' , $tab['position']; |
| 1723 |
if ( ! empty( $tab['hided'] ) ) echo ' hide'; |
| 1724 |
|
| 1725 |
echo ' ' , $tab['css_classes']; |
| 1726 |
|
| 1727 |
echo '" '; |
| 1728 |
|
| 1729 |
echo wpbm_get_custom_attr( $tab ); |
| 1730 |
echo '>'; // Close > for A or SPAN |
| 1731 |
|
| 1732 |
|
| 1733 |
// Icon |
| 1734 |
$is_icon_showed = true; |
| 1735 |
if ( ! empty( $tab['icon'] ) ) { |
| 1736 |
|
| 1737 |
if ( substr( $tab['icon'], 0, 4 ) != 'http') |
| 1738 |
$img_path = WPBM_PLUGIN_URL . '/assets/img/' . $tab['icon']; |
| 1739 |
else |
| 1740 |
$img_path = $tab['icon']; |
| 1741 |
|
| 1742 |
?><img class="menuicons" src="<?php echo $img_path; ?>" style="width:20px;" /><?php // IMG Icon |
| 1743 |
|
| 1744 |
} elseif ( ! empty( $tab['font_icon'] ) ) { |
| 1745 |
|
| 1746 |
?><i class="menu_icon icon-1x <?php echo $tab['font_icon']; ?>"></i><?php // Font Icon |
| 1747 |
} else { |
| 1748 |
$is_icon_showed = false; |
| 1749 |
} |
| 1750 |
|
| 1751 |
// Text |
| 1752 |
|
| 1753 |
?><span class="<?php echo ( $is_icon_showed ) ? 'nav-tab-text' : ''; ?>" ><?php |
| 1754 |
echo ( $is_icon_showed ) ? ' ' : ''; |
| 1755 |
echo $tab['title']; |
| 1756 |
?></span><?php |
| 1757 |
|
| 1758 |
// C h e c k b o x |
| 1759 |
if ( $tab['checkbox'] !== false ) { |
| 1760 |
?><input type="checkbox" |
| 1761 |
<?php if ( $tab['checkbox']['checked'] ) echo ' checked="CHECKED" '; ?> |
| 1762 |
name="<?php echo $tab['checkbox']['name']; ?>_dublicated" |
| 1763 |
id="<?php echo $tab['checkbox']['name']; ?>_dublicated" |
| 1764 |
value="<?php echo ( isset( $tab['checkbox']['value'] ) ? $tab['checkbox']['value'] : '' ); ?>" |
| 1765 |
onchange="javascript: <?php if ( isset( $tab['checkbox']['onclick'] ) ) { |
| 1766 |
echo $tab['checkbox']['onclick']; |
| 1767 |
} else { |
| 1768 |
?>if ( jQuery('#<?php echo $tab['checkbox']['name']; ?>').length > 0 ) { document.getElementById('<?php echo $tab['checkbox']['name']; ?>').checked = this.checked; }<?php |
| 1769 |
} |
| 1770 |
?>" |
| 1771 |
/><?php |
| 1772 |
} |
| 1773 |
|
| 1774 |
|
| 1775 |
echo '</' , $html_tag , '>'; |
| 1776 |
|
| 1777 |
|
| 1778 |
if ( |
| 1779 |
( isset( $tab['top'] ) ) && ( $tab['top'] ) |
| 1780 |
&& ( isset( $tab['position'] ) ) && ( $tab['position'] !== 'right' ) //FixIn: 6.0.1.13 |
| 1781 |
) |
| 1782 |
echo ' '; |
| 1783 |
} |
| 1784 |
|
| 1785 |
function wpbm_bs_toolbar_tabs_html_container_start() { |
| 1786 |
|
| 1787 |
?> |
| 1788 |
<div class="wpdvlp-top-tabs"> |
| 1789 |
<div class="wpdvlp-tabs-wrapper"> |
| 1790 |
<div class="nav-tabs" ><?php // T O P T A B S |
| 1791 |
} |
| 1792 |
|
| 1793 |
function wpbm_bs_toolbar_tabs_html_container_end() { |
| 1794 |
|
| 1795 |
?></div><!-- nav-tabs --> |
| 1796 |
</div><!-- wpdvlp-tabs-wrapper --> |
| 1797 |
</div><!-- wpdvlp-top-tabs --><?php |
| 1798 |
} |
| 1799 |
|
| 1800 |
function wpbm_bs_toolbar_sub_html_container_start() { |
| 1801 |
// S U B T A B S or U I elements |
| 1802 |
?><div class="wpdvlp-sub-tabs"> |
| 1803 |
<div class="wpdvlp-tabs-wrapper"> |
| 1804 |
<div class="nav-tabs"><?php |
| 1805 |
} |
| 1806 |
|
| 1807 |
function wpbm_bs_toolbar_sub_html_container_end() { |
| 1808 |
|
| 1809 |
?><div class="clear"></div> |
| 1810 |
</div><!-- nav-tabs --> |
| 1811 |
</div><!-- wpdvlp-tabs-wrapper --> |
| 1812 |
</div><!-- wpdvlp-sub-tabs --><?php |
| 1813 |
} |
| 1814 |
|
| 1815 |
|
| 1816 |
|
| 1817 |
//////////////////////////////////////////////////////////////////////////////// |
| 1818 |
// HTML sections and groups |
| 1819 |
//////////////////////////////////////////////////////////////////////////////// |
| 1820 |
|
| 1821 |
/** Clear Div */ |
| 1822 |
function wpbm_clear_div() { |
| 1823 |
?><div class="clear"></div><?php |
| 1824 |
} |
| 1825 |
|
| 1826 |
|
| 1827 |
|
| 1828 |
//////////////////////////////////////////////////////////////////////////////// |
| 1829 |
// JS & CSS |
| 1830 |
//////////////////////////////////////////////////////////////////////////////// |
| 1831 |
/** Tooltips JavaScript functions */ |
| 1832 |
function wpbm_bs_javascript_tooltips() { |
| 1833 |
|
| 1834 |
?><span id="wpbm_tooltips_container"></span><?php |
| 1835 |
|
| 1836 |
?><script type="text/javascript"> |
| 1837 |
jQuery(document).ready( function(){ |
| 1838 |
jQuery('.tooltip_right').tooltip( { |
| 1839 |
animation: true |
| 1840 |
, delay: { show: 500, hide: 100 } |
| 1841 |
, selector: false |
| 1842 |
, placement: 'right' |
| 1843 |
, trigger: 'hover' |
| 1844 |
, title: '' |
| 1845 |
, template: '<div class="wpdevelop tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1846 |
, container: '#wpbm_tooltips_container' |
| 1847 |
, viewport: '#wpbody-content' |
| 1848 |
}); |
| 1849 |
|
| 1850 |
jQuery('.tooltip_left').tooltip( { |
| 1851 |
animation: true |
| 1852 |
, delay: { show: 500, hide: 100 } |
| 1853 |
, selector: false |
| 1854 |
, placement: 'left' |
| 1855 |
, trigger: 'hover' |
| 1856 |
, title: '' |
| 1857 |
, template: '<div class="wpdevelop tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1858 |
, container: '#wpbm_tooltips_container' |
| 1859 |
, viewport: '#wpbody-content' |
| 1860 |
}); |
| 1861 |
|
| 1862 |
jQuery('.tooltip_top').tooltip( { |
| 1863 |
animation: true |
| 1864 |
, delay: { show: 500, hide: 100 } |
| 1865 |
, selector: false |
| 1866 |
, placement: 'top' |
| 1867 |
, trigger: 'hover' |
| 1868 |
, title: '' |
| 1869 |
, template: '<div class="wpdevelop tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1870 |
, container: '#wpbm_tooltips_container' |
| 1871 |
, viewport: '#wpbody-content' |
| 1872 |
}); |
| 1873 |
|
| 1874 |
jQuery('.tooltip_bottom').tooltip( { |
| 1875 |
animation: true |
| 1876 |
, delay: { show: 500, hide: 100 } |
| 1877 |
, selector: false |
| 1878 |
, placement: 'bottom' |
| 1879 |
, trigger: 'hover' |
| 1880 |
, title: '' |
| 1881 |
, template: '<div class="wpdevelop tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1882 |
, container: '#wpbm_tooltips_container' |
| 1883 |
, viewport: '#wpbody-content' |
| 1884 |
}); |
| 1885 |
|
| 1886 |
jQuery('.tooltip_top_slow').tooltip( { |
| 1887 |
animation: true |
| 1888 |
, delay: { show: 2500, hide: 100 } |
| 1889 |
, selector: false |
| 1890 |
, placement: 'top' |
| 1891 |
, trigger: 'hover' |
| 1892 |
, title: '' |
| 1893 |
, template: '<div class="wpdevelop tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1894 |
, container: '#wpbm_tooltips_container' |
| 1895 |
, viewport: '#wpbody-content' |
| 1896 |
}); |
| 1897 |
|
| 1898 |
}); |
| 1899 |
</script><?php |
| 1900 |
} |
| 1901 |
|
| 1902 |
|
| 1903 |
/** Popover JavaScript functions */ |
| 1904 |
function wpbm_bs_javascript_popover() { |
| 1905 |
|
| 1906 |
?><script type="text/javascript"> |
| 1907 |
jQuery(document).ready( function(){ |
| 1908 |
|
| 1909 |
jQuery('.popover_click.popover_bottom').popover( { |
| 1910 |
placement: 'bottom auto' |
| 1911 |
, trigger:'manual' |
| 1912 |
//, delay: {show: 100, hide: 8} |
| 1913 |
, content: '' |
| 1914 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-close"><a href="javascript:void(0)" data-dismiss="popover" aria-hidden="true">×</a></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1915 |
, container: '.wpbm_container_frame' |
| 1916 |
, html: 'true' |
| 1917 |
}); |
| 1918 |
jQuery('.popover_click.popover_top').popover( { |
| 1919 |
placement: 'top auto' |
| 1920 |
, trigger:'manual' |
| 1921 |
//, delay: {show: 100, hide: 8} |
| 1922 |
, content: '' |
| 1923 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-close"><a href="javascript:void(0)" data-dismiss="popover" aria-hidden="true">×</a></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1924 |
, container: '.wpbm_container_frame' |
| 1925 |
, html: 'true' |
| 1926 |
}); |
| 1927 |
jQuery('.popover_click.popover_left').popover( { |
| 1928 |
placement: 'left auto' |
| 1929 |
, trigger:'manual' |
| 1930 |
//, delay: {show: 100, hide: 8} |
| 1931 |
, content: '' |
| 1932 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-close"><a href="javascript:void(0)" data-dismiss="popover" aria-hidden="true">×</a></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1933 |
, container: '.wpbm_container_frame' |
| 1934 |
, html: 'true' |
| 1935 |
}); |
| 1936 |
jQuery('.popover_click.popover_right').popover( { |
| 1937 |
placement: 'right auto' |
| 1938 |
, trigger:'manual' |
| 1939 |
//, delay: {show: 100, hide: 8} |
| 1940 |
, content: '' |
| 1941 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-close"><a href="javascript:void(0)" data-dismiss="popover" aria-hidden="true">×</a></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1942 |
, container: '.wpbm_container_frame' |
| 1943 |
, html: 'true' |
| 1944 |
}); |
| 1945 |
|
| 1946 |
// Close popover by clicking on X button |
| 1947 |
jQuery(document).on("click", ".popover .popover-close a" , function(){ |
| 1948 |
jQuery(this).parents(".popover").popover('hide'); |
| 1949 |
}); |
| 1950 |
// Show or hide popover on click at target element |
| 1951 |
jQuery(document).on("click", ".popover_click" , function(){ |
| 1952 |
jQuery(this).popover('toggle'); |
| 1953 |
|
| 1954 |
//Solving Issue: sometime, when many elements at the page with long popover, its can overlap exist elements, and then its does not possible to click on elements. |
| 1955 |
jQuery('.wpbm_container_ajax_replace .popover.fade.bottom:not(.in)').css('left','-9000px'); |
| 1956 |
|
| 1957 |
}); |
| 1958 |
|
| 1959 |
jQuery('.popover_hover.popover_bottom').popover( { |
| 1960 |
placement: 'bottom auto' |
| 1961 |
, trigger:'hover' |
| 1962 |
, delay: {show: 100, hide: 100} |
| 1963 |
, content: '' |
| 1964 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1965 |
, container: '.wpbm_container_frame' |
| 1966 |
, html: 'true' |
| 1967 |
}); |
| 1968 |
jQuery('.popover_hover.popover_top').popover( { |
| 1969 |
placement: 'top auto' |
| 1970 |
, trigger:'hover' |
| 1971 |
, delay: {show: 100, hide: 100} |
| 1972 |
, content: '' |
| 1973 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1974 |
, container: '.wpbm_container_frame' |
| 1975 |
, html: 'true' |
| 1976 |
}); |
| 1977 |
jQuery('.popover_hover.popover_left').popover( { |
| 1978 |
placement: 'left auto' |
| 1979 |
, trigger:'hover' |
| 1980 |
, delay: {show: 100, hide: 100} |
| 1981 |
, content: '' |
| 1982 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1983 |
, container: '.wpbm_container_frame' |
| 1984 |
, html: 'true' |
| 1985 |
}); |
| 1986 |
jQuery('.popover_hover.popover_right').popover( { |
| 1987 |
placement: 'right auto' |
| 1988 |
, trigger:'hover' |
| 1989 |
, delay: {show: 100, hide: 100} |
| 1990 |
, content: '' |
| 1991 |
, template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
| 1992 |
, container: '.wpbm_container_frame' |
| 1993 |
, html: 'true' |
| 1994 |
}); |
| 1995 |
|
| 1996 |
////////////////////////////////////////////////////////////////////// |
| 1997 |
////////////////////////////////////////////////////////////////////// |
| 1998 |
}); |
| 1999 |
</script><?php |
| 2000 |
} |
| 2001 |
|
| 2002 |
|
| 2003 |
|
| 2004 |
//////////////////////////////////////////////////////////////////////////////// |
| 2005 |
// S U P P O R T |
| 2006 |
//////////////////////////////////////////////////////////////////////////////// |
| 2007 |
|
| 2008 |
/** Get custom atrributes for HTML elements |
| 2009 |
* |
| 2010 |
* @param array $field |
| 2011 |
* @return type |
| 2012 |
*/ |
| 2013 |
function wpbm_get_custom_attr( $field ) { |
| 2014 |
|
| 2015 |
$attributes = array(); |
| 2016 |
|
| 2017 |
if ( ! empty( $field['attr'] ) && is_array( $field['attr'] ) ) { |
| 2018 |
|
| 2019 |
foreach ( $field['attr'] as $attr => $attr_v ) { |
| 2020 |
$attributes[] = esc_attr( $attr ) . '="' . esc_attr( $attr_v ) . '"'; |
| 2021 |
} |
| 2022 |
} |
| 2023 |
|
| 2024 |
return implode( ' ', $attributes ); |
| 2025 |
} |