/
button.php
executable file
·74 lines (61 loc) · 2.2 KB
/
button.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
<?php
$styles = "";
$hover_styles = "";
$mouseout_styles = "";
$roll_styles = "";
//Top Indent
if (!empty($top_indent)) {
$styles .= 'margin-top: ' . (int) $top_indent . 'px;';
$roll_styles.= 'style="margin-top: ' . (int) $top_indent . 'px;"';
}
//Text Color
if (!empty($text_color)) {
$styles .= 'color: ' . $text_color . '; ';
$mouseout_styles.='this.style.color=\'' . $text_color . '\'; ';
}
//Hover Text Color
if (!empty($mouseover_text_color)) {
$hover_styles .= 'this.style.color=\'' . $mouseover_text_color . '\'; ';
}
//Background Color
if (isset($bg_transparent)&&($bg_transparent=='1')){
$bg_color = 'transparent';
}
if (!empty($bg_color)) {
$styles .= 'background-color: ' . $bg_color . '; ';
$mouseout_styles.='this.style.backgroundColor=\'' . $bg_color . '\'; ';
}
//Hover Background Color
if (isset($mouseover_bg_transparent)&&($mouseover_bg_transparent=='1')){
$mouseover_bg_color = 'transparent';
}
if (!empty($mouseover_bg_color)) {
$hover_styles .= 'this.style.backgroundColor=\'' . $mouseover_bg_color . '\'; ';
}
//Border Color
if (isset($border_color_transparent)&&($border_color_transparent=='1')){
$border_color = 'transparent';
}
if (!empty($border_color)) {
$styles .= 'border-color: ' . $border_color . '; ';
$mouseout_styles.='this.style.borderColor=\'' . $border_color . '\'; ';
}
//Hover Border Color
if (isset($mouseover_border_color_transparent)&&($mouseover_border_color_transparent=='1')){
$mouseover_border_color = 'transparent';
}
if (!empty($mouseover_border_color)) {
$hover_styles .= 'this.style.borderColor=\'' . $mouseover_border_color . '\'; ';
}
// Styles
if (!empty($styles)) {
$styles = 'style="' . $styles . '"';
if (!empty($hover_styles)){
$hover_styles = 'onmouseover="' . $hover_styles . '" onmouseout="' . $mouseout_styles . '"';
$styles .= ' '. $hover_styles;
}
}
$type = (isset($type)) ? $type : 'default';
?>
<a href="<?php echo esc_url($url) ?>" <?php echo ($styles ? $styles : '') ?> class="button <?php echo esc_attr($size) ?> <?php echo esc_attr($type) ?>"><?php echo esc_html($text) ?></a>