| 1 |
<?php |
| 2 |
|
| 3 |
function osc_theme_dropdown($params, $content = null) { |
| 4 |
extract(shortcode_atts(array( |
| 5 |
'dropup' => '', |
| 6 |
'class' => '' |
| 7 |
), $params)); |
| 8 |
$content = str_replace("]<br />", ']', $content); |
| 9 |
$content = str_replace("]<br />\n", ']', $content); |
| 10 |
$content = str_replace("<br />\n[", '[', $content); |
| 11 |
if ($dropup != 'dropup') { |
| 12 |
$dropup = ''; |
| 13 |
} |
| 14 |
$out = '<div class="btn-group ' . $dropup . ' ' . $class .EBS_CONTAINER_CLASS. '">' . do_shortcode($content) . '</div>'; |
| 15 |
$out .= " |
| 16 |
<script> |
| 17 |
jQuery(document).ready(function(){ |
| 18 |
jQuery('.dropdown-toggle').dropdown(); |
| 19 |
}); |
| 20 |
</script> |
| 21 |
"; |
| 22 |
return $out; |
| 23 |
} |
| 24 |
|
| 25 |
ebs_backward_compatibility_callback('dropdown', 'osc_theme_dropdown'); |
| 26 |
|
| 27 |
function osc_theme_dropdown_head($params, $content = null) { |
| 28 |
extract(shortcode_atts(array( |
| 29 |
'size' => '', |
| 30 |
'style' => '', |
| 31 |
'split' => ''), $params)); |
| 32 |
$out = ''; |
| 33 |
if ($split == "split") { |
| 34 |
$out = '<button type="button" class="btn ' . $size . ' ' . $style .EBS_CONTAINER_CLASS. '">' . $content . '</button>'; |
| 35 |
|
| 36 |
$out .= '<button type="button" class="btn ' . $size . ' ' . $style .EBS_CONTAINER_CLASS. ' dropdown-toggle" data-toggle="dropdown">'; |
| 37 |
$out .= '<span class="caret'.EBS_CONTAINER_CLASS.'"></span></button>'; |
| 38 |
} else { |
| 39 |
$out = ' <button type="button" class="btn ' . $size . ' ' . $style .EBS_CONTAINER_CLASS. ' dropdown-toggle" data-toggle="dropdown">'; |
| 40 |
$out .= $content . ' <span class="caret'.EBS_CONTAINER_CLASS.'"></span> </button>'; |
| 41 |
} |
| 42 |
|
| 43 |
return $out; |
| 44 |
} |
| 45 |
|
| 46 |
ebs_backward_compatibility_callback('dropdownhead', 'osc_theme_dropdown_head'); |
| 47 |
|
| 48 |
function osc_theme_dropdown_body($params, $content = null) { |
| 49 |
$content = str_replace("]<br />", ']', $content); |
| 50 |
$content = str_replace("]<br />\n", ']', $content); |
| 51 |
$content = str_replace("<br />\n[", '[', $content); |
| 52 |
$out = '<ul class="dropdown-menu'.EBS_CONTAINER_CLASS.'" role="menu">' . do_shortcode($content) . '</ul>'; |
| 53 |
return $out; |
| 54 |
} |
| 55 |
|
| 56 |
ebs_backward_compatibility_callback('dropdownbody', 'osc_theme_dropdown_body'); |
| 57 |
|
| 58 |
function osc_theme_dropdown_items($params, $content = null) { |
| 59 |
extract(shortcode_atts(array( |
| 60 |
'type' => '', |
| 61 |
'link' => '', |
| 62 |
'disabled' => ''), $params)); |
| 63 |
$out = ''; |
| 64 |
$out = ''; |
| 65 |
if ($type == "divider") { |
| 66 |
$out = '<li class="divider'.EBS_CONTAINER_CLASS.'"></li>'; |
| 67 |
} elseif ($type == "menuitem") { |
| 68 |
if ($disabled == 'disabled') { |
| 69 |
$out = '<li class="disabled'.EBS_CONTAINER_CLASS.'"><a class="'.EBS_CONTAINER_CLASS.'" href="' . $link . '">' . do_shortcode($content) . '</a></li>'; |
| 70 |
} else { |
| 71 |
$out = '<li><a class="'.EBS_CONTAINER_CLASS.'" href="' . $link . '">' . do_shortcode($content) . '</a></li>'; |
| 72 |
} |
| 73 |
} |
| 74 |
return $out; |
| 75 |
} |
| 76 |
|
| 77 |
ebs_backward_compatibility_callback('dropdownitem', 'osc_theme_dropdown_items'); |