Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/inc/components/contacts-box.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
if (! function_exists('blc_get_contacts_output')) {
4
+
function blc_get_contacts_output($args = []) {
5
+
$args = wp_parse_args($args, [
6
+
'data' => [],
7
+
'link_target' => 'no',
8
+
'link_nofollow' => 'no',
9
+
'link_icons' => 'no',
10
+
'type' => 'rounded',
11
+
'fill' => 'outline',
12
+
'size' => ''
13
+
]);
14
+
15
+
$has_enabled_layer = false;
16
+
17
+
foreach ($args['data'] as $single_layer) {
18
+
if ($single_layer['enabled']) {
19
+
$has_enabled_layer = true;
20
+
break;
21
+
}
22
+
}
23
+
24
+
if (! $has_enabled_layer) {
25
+
return '';
26
+
}
27
+
28
+
$link_attr = [];
29
+
30
+
if ($args['link_target'] !== 'no') {
31
+
$link_attr['target'] = '_blank';
32
+
$link_attr['rel'] = 'noopener noreferrer';
33
+
}
34
+
35
+
if ($args['link_nofollow'] !== 'no') {
36
+
if (! isset($link_attr['rel'])) {
37
+
$link_attr['rel'] = '';
38
+
}
39
+
40
+
$link_attr['rel'] = trim($link_attr['rel'] . ' nofollow');
41
+
}
42
+
43
+
$link_attr = blocksy_attr_to_html($link_attr);
44
+
45
+
$custom_icon_defaults = [
46
+
'address' => 'blc blc-map-pin',
47
+
'phone' => 'blc blc-phone',
48
+
'mobile' => 'blc blc-mobile-phone',
49
+
'hours' => 'blc blc-clock',
50
+
'fax' => 'blc blc-fax',
51
+
'email' => 'blc blc-email',
52
+
'website' => 'blc blc-globe',
53
+
];
54
+
55
+
$svg_icons_defaults = [
56
+
'address' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M10,0C6.1,0,3,3.1,3,7c0,4.5,6,11.8,6.2,12.1L10,20l0.8-0.9C11,18.8,17,11.5,17,7C17,3.1,13.9,0,10,0z M10,2c2.8,0,5,2.2,5,5c0,2.7-3.1,7.4-5,9.8C8.1,14.4,5,9.7,5,7C5,4.2,7.2,2,10,2zM10,4.5C8.6,4.5,7.5,5.6,7.5,7S8.6,9.5,10,9.5s2.5-1.1,2.5-2.5S11.4,4.5,10,4.5z"/></svg>',
57
+
58
+
'phone' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M4.4,0C4,0,3.6,0.2,3.2,0.4l0,0l0,0L0.8,2.9l0,0C0,3.6-0.2,4.7,0.1,5.6c0,0,0,0,0,0c0.7,1.9,2.3,5.5,5.6,8.7c3.3,3.3,6.9,4.9,8.7,5.6h0c0.9,0.3,1.9,0.1,2.7-0.5l2.4-2.4c0.6-0.6,0.6-1.7,0-2.4l-3.1-3.1l0,0c-0.6-0.6-1.8-0.6-2.4,0l-1.5,1.5c-0.6-0.3-1.9-1-3.1-2.2C8,9.5,7.4,8.2,7.2,7.6l1.5-1.5c0.6-0.6,0.7-1.7,0-2.4l0,0L8.6,3.6L5.6,0.5l0,0l0,0C5.2,0.2,4.8,0,4.4,0zM4.4,1.5c0.1,0,0.1,0,0.2,0.1l3.1,3.1l0.1,0.1c0,0,0,0.1,0,0.2L5.7,6.9L5.3,7.3l0.2,0.5c0,0,0.9,2.4,2.7,4.1L8.4,12c1.8,1.6,3.9,2.5,3.9,2.5l0.5,0.2l2.3-2.3c0.1-0.1,0.1-0.1,0.2,0l3.1,3.1c0.1,0.1,0.1,0.1,0,0.2l-2.4,2.4c-0.4,0.3-0.7,0.4-1.2,0.2c-1.7-0.7-5.1-2.2-8.1-5.2c-3-3-4.6-6.5-5.2-8.2c-0.1-0.3,0-0.8,0.2-1l0,0l2.3-2.4C4.2,1.6,4.3,1.5,4.4,1.5z"/></svg>',
59
+
60
+
'mobile' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M13.5,20H6.5c-1.6,0-2.9-1.3-2.9-2.9V2.9C3.5,1.3,4.8,0,6.5,0h7.1c1.6,0,2.9,1.3,2.9,2.9v14.1C16.5,18.7,15.2,20,13.5,20zM6.7,1.7C5.8,1.7,5,2.5,5,3.4v13.2c0,0.9,0.7,1.7,1.7,1.7h6.6c0.9,0,1.7-0.7,1.7-1.7V3.4c0-0.9-0.7-1.7-1.7-1.7H6.7z"/><path d="M11.2,4.4H8.8c-0.3,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h2.4c0.3,0,0.6,0.3,0.6,0.6S11.5,4.4,11.2,4.4z"/><circle cx="10" cy="15.7" r="1.2"/></svg>',
61
+
62
+
'hours' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z M10,18.2c-4.5,0-8.2-3.7-8.2-8.2c0-4.5,3.7-8.2,8.2-8.2c4.5,0,8.2,3.7,8.2,8.2C18.2,14.5,14.5,18.2,10,18.2z M14.4,12.2c-0.2,0.3-0.5,0.5-0.8,0.5c-0.1,0-0.3,0-0.4-0.1l-3.6-1.8c-0.3-0.2-0.5-0.5-0.5-0.8V4.5C9.1,4,9.5,3.6,10,3.6s0.9,0.4,0.9,0.9v4.9L14,11C14.5,11.2,14.7,11.8,14.4,12.2z"/></svg>',
63
+
64
+
'fax' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M17.5,5.8h-1.7v-4V0h-1.7H5.8H4.2v1.8v4H2.5C1.1,5.8,0,7,0,8.3v8.3h4.2V20h11.7v-3.3H20V8.3C20,7,18.9,5.8,17.5,5.8zM5.8,1.8h8.3v4H5.8V1.8zM14.2,18.3H5.8v-5h8.3V18.3zM18.3,15h-2.5v-3.3H4.2V15H1.7V8.3c0-0.5,0.4-0.8,0.8-0.8h15c0.5,0,0.8,0.4,0.8,0.8V15zM4.2,9.2c0,0.5-0.4,0.8-0.8,0.8S2.5,9.6,2.5,9.2s0.4-0.8,0.8-0.8S4.2,8.7,4.2,9.2z"/></svg>',
65
+
66
+
'email' => '<svg width="18" height="18" viewBox="0 0 20 20" aria-hidden="true"><path d="M10,0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,0,0.1,0,0.1v6.6c0,0.4,0.3,0.7,0.7,0.7c0.2,0,0.4-0.1,0.5-0.2l0,0l1.4-1.6l1.5,3c0.2,0.4,0.6,0.5,1,0.3c0.4-0.2,0.5-0.6,0.3-1l-1.5-3l2.2-0.4l0,0c0.3-0.1,0.5-0.4,0.5-0.7c0-0.3-0.1-0.5-0.3-0.6l0,0l-5.1-3.6C14.1,10.4,13.9,10.4,13.7,10.4zM2.9,12.6h2.3c0.3,1.2,0.7,2.3,1.1,3.1C4.9,15.1,3.7,14,2.9,12.6z"/></svg>',
69
+
];
70
+
71
+
$attr = [];
72
+
73
+
// if ($args['type'] !== 'simple') {
74
+
$attr['data-icons-type'] = $args['type'];
75
+
// }
76
+
77
+
if ($args['type'] !== 'simple' && ! empty($args['fill'])) {
78
+
$attr['data-icons-type'] .= ':' . $args['fill'];
79
+
}
80
+
81
+
if (! empty($args['size'])) {
82
+
$attr['data-icon-size'] = $args['size'];
83
+
}
84
+
85
+
ob_start(); ?>
86
+
87
+
<ul <?php echo blocksy_attr_to_html($attr) ?>>
88
+
<?php
89
+
$use_link_for_icons = $args['link_icons'] === 'yes';
90
+
91
+
foreach ($args['data'] as $single_layer) {
92
+
?>
93
+
<?php
94
+
if (! $single_layer['enabled']) {
95
+
continue;
96
+
}
97
+
98
+
$item_attr = [];
99
+
100
+
$item_attr['class'] = blocksy_visibility_classes(
101
+
blocksy_akg(
102
+
'visibility',
103
+
$single_layer,
104
+
[
105
+
'desktop' => true,
106
+
'tablet' => true,
107
+
'mobile' => true,
108
+
]
109
+
)
110
+
);
111
+
?>
112
+
<li <?php echo blocksy_attr_to_html($item_attr) ?>>
113
+
<?php
114
+
$link = do_shortcode(blocksy_akg('link', $single_layer, ''));
115
+
116
+
$content = do_shortcode(blocksy_akg('content', $single_layer, ''));
117
+
118
+
if (
119
+
function_exists('blocksy_safe_antispambot')
120
+
&&
121
+
strpos($link, 'mailto:') !== false
122
+
) {
123
+
$content = apply_filters(
124
+
'blocksy:frontend:contact:email:obfuscated-content',
125
+
blocksy_safe_antispambot($content),
126
+
$content
127
+
);
128
+
}
129
+
130
+
if (
131
+
function_exists('blocksy_safe_antispambot')
132
+
&&
133
+
strpos($link, 'mailto:') !== false
134
+
) {
135
+
$link = blocksy_safe_antispambot($link);
136
+
}
137
+
138
+
$link = esc_url($link);
139
+
140
+
$with_link = $use_link_for_icons && !empty(blocksy_akg('link', $single_layer, ''));
141
+
142
+
$icon = blocksy_html_tag(
143
+
'span',
144
+
[
145
+
'class' => 'ct-icon-container'
146
+
],
147
+
$svg_icons_defaults[$single_layer['id']]
148
+
);
149
+
150
+
if ($with_link) {
151
+
$icon = $svg_icons_defaults[$single_layer['id']];
152
+
}
153
+
154
+
if (function_exists('blc_get_icon')) {
155
+
$icon = blc_get_icon([
156
+
'icon_descriptor' => blocksy_akg(
157
+
'icon',
158
+
$single_layer,
159
+
['icon' => $custom_icon_defaults[$single_layer['id']]]
160
+
),
161
+
'icon_container' => ! $with_link,
162
+
'icon_html_atts' => [
163
+
'aria-hidden' => 'true',
164
+
]
165
+
]);
166
+
}
167
+
168
+
if ($with_link) {
169
+
$icon_link_attr = [
170
+
'href' => $link,
171
+
'class' => 'ct-icon-container',
172
+
'aria-label' => blocksy_akg('title', $single_layer, '') . ' ' . $content
173
+
];
174
+
175
+
if ($args['link_target'] === 'yes') {
176
+
$icon_link_attr['target'] = '_blank';
177
+
$icon_link_attr['rel'] = 'noopener noreferrer';
178
+
}
179
+
180
+
if ($args['link_nofollow'] === 'yes') {
181
+
if (! isset($icon_link_attr['rel'])) {
182
+
$icon_link_attr['rel'] = '';
183
+
}
184
+
185
+
$icon_link_attr['rel'] = trim($icon_link_attr['rel'] . ' nofollow');
186
+
}
187
+
188
+
$icon = blocksy_html_tag(
189
+
'a',
190
+
$icon_link_attr,
191
+
$icon
192
+
);
193
+
}
194
+
195
+
echo $icon;
196
+
?>
197
+
198
+
<?php if (
199
+
! empty(blocksy_akg('title', $single_layer, ''))
200
+
||
201
+
! empty($content)
202
+
) { ?>
203
+
<div class="contact-info">
204
+
<?php if (! empty(blocksy_akg('title', $single_layer, ''))) { ?>
205
+
<span class="contact-title">
206
+
<?php echo do_shortcode(blocksy_akg('title', $single_layer, '')) ?>
207
+
</span>
208
+
<?php } ?>
209
+
210
+
<?php if (! empty($content)) { ?>
211
+
<span class="contact-text">
212
+
<?php if (! empty($link)) { ?>
213
+
<a href="<?php echo $link ?>" <?php echo $link_attr ?>>
214
+
<?php } ?>
215
+
216
+
<?php echo $content; ?>
217
+
218
+
<?php if (! empty($link)) { ?>
219
+
</a>
220
+
<?php } ?>
221
+
</span>
222
+
<?php } ?>
223
+
</div>
224
+
<?php } ?>
225
+
</li>
226
+
<?php } ?>
227
+
</ul>
228
+
229
+
<?php
230
+
return ob_get_clean();
231
+
}
232
+
}
233
+