-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbluem-interface.php
More file actions
764 lines (674 loc) · 27.4 KB
/
Copy pathbluem-interface.php
File metadata and controls
764 lines (674 loc) · 27.4 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
<?php
if (! defined('ABSPATH')) {
exit;
}
// @todo create a language file and consistently localize everything
function bluem_get_idin_logo_html(): string
{
return "<img src='"
. plugin_dir_url(__FILE__) . "assets/bluem/idin.png' class='bluem-idin-logo'
style='float:left; max-height:64px; margin:10pt 20pt 0 10pt;' alt='iDIN logo' />";
}
// @todo make a stylesheet and include it, move all inline styles there.
function bluem_get_bluem_logo_html($height = 64): string
{
return sprintf(
'<img src="%sassets/bluem/logo.png" class="bluem-bluem-logo" height="' . esc_attr($height) . '" style="max-height:' . esc_attr($height) . 'px; margin:10pt; margin-bottom:0; alt="Bluem logo"
"/>',
plugin_dir_url(__FILE__)
);
}
function bluem_render_request_table($categoryName, $requests, $users_by_id = []): void
{
if (count($requests) === 0) {
echo '<p>';
printf(
/* translators: %s: Name of the category (Bluem service) */
esc_html__('No transactions yet for %s', 'bluem'),
esc_attr($categoryName)
);
echo '</p>';
return;
} ?>
<div class="bluem-requests-table-container">
<table class="table widefat bluem-requests-table">
<thead>
<tr>
<th style="width:20%;"><?php esc_html_e('Request', 'bluem'); ?></th>
<th style="width:20%;"><?php esc_html_e('User', 'bluem'); ?></th>
<th style="width:15%;"><?php esc_html_e('Date', 'bluem'); ?></th>
<th style="width:20%;"><?php esc_html_e('Additional info', 'bluem'); ?></th>
<th style="width:20%;"><?php esc_html_e('Status', 'bluem'); ?></th>
<th style="width:5%;"></th>
</tr>
</thead>
<tbody>
<?php
foreach ($requests as $r) {
$prettyRequestDate = date_i18n('d-m-Y H:i:s', strtotime($r->timestamp));
?>
<tr>
<td width="20%">
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-transactions&request_id=' . $r->id)); ?>"
target="_self">
<?php echo esc_html($r->description); ?>
</a>
<br>
<span style="color:#aaa; font-size:9pt;">
<?php echo $categoryName; ?> · <?php echo esc_html($r->transaction_id); ?>
</span>
</td>
<td width="20%"><?php bluem_render_request_user($r, $users_by_id); ?></td>
<td width="15%" title="<?php echo esc_attr($prettyRequestDate); ?>">
<?php echo esc_html($prettyRequestDate); ?>
</td>
<td width="20%">
<?php
if (! is_null($r->order_id) && $r->order_id != '0') {
try {
$order = new WC_Order($r->order_id);
} catch (Throwable $th) {
$order = false;
}
if ($order !== false) {
?>
<a href="<?php echo esc_url(admin_url("post.php?post={$r->order_id}&action=edit")); ?>"
target="_blank">
<?php esc_html_e('Order', 'bluem'); ?> <?php echo esc_html($order->get_order_number()); ?>
(<?php echo wp_kses_post(wc_price($order->get_total())); ?>)
</a>
<?php
} else {
echo ' ';
}
}
?>
<?php
if (isset($r->debtor_reference) && $r->debtor_reference !== '') {
?>
<span style="color:#aaa; font-size:9pt; display:block;"><?php esc_html_e('Customer reference', 'bluem'); ?>:
<?php
echo esc_html($r->debtor_reference);
?>
</span>
<?php
}
?>
</td>
<td width="20%"><?php bluem_render_request_status($r->status); ?></td>
<td width="5%"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php
}
function bluem_render_request_status(string $status): void
{
switch (strtolower($status)) {
case 'created': {
echo "<span style='color:#1a94c0;'>
<span class='dashicons dashicons-plus-alt'></span>
" . esc_html__('Created', 'bluem') . '
</span>';
break;
}
case 'success': {
echo "<span style='color:#2e9801'>
<span class='dashicons dashicons-yes-alt'></span>
" . esc_html__('Completed successfully', 'bluem') . '
</span>';
break;
}
case 'cancelled': {
echo "<span style='color:#bd1818'>
<span class='dashicons dashicons-dismiss'></span>
" . esc_html__('Cancelled', 'bluem') . '</span>';
break;
}
case 'expired': {
echo "<span style='color:#bd1818'>
<span class='dashicons dashicons-dismiss'></span>
" . esc_html__('Expired', 'bluem') . '</span>';
break;
}
case 'open':
case 'new': {
echo "<span style='color:#6a4285'>
<span class='dashicons dashicons-editor-help'></span>
" . esc_html__('Open', 'bluem') . '</span>';
break;
}
case 'pending': {
echo "<span style='color:#6a4285' title='this request may still need to be signed by a second signatory'>
<span class='dashicons dashicons-editor-help'></span>
" . esc_html__('Awaiting processing', 'bluem') . '</span>';
break;
}
case 'processing': {
echo "<span style='color:#6a4285'>
<span class='dashicons dashicons-marker'></span>
" . esc_html__('Processing', 'bluem') . '</span>';
break;
}
case 'insufficient': {
echo "<span style='color:#ac1111'>
<span class='dashicons dashicons-dismiss'></span>
" . esc_html__('Insufficient', 'bluem') . '</span>';
break;
}
case 'failure': {
echo "<span style='color:#ac1111'>
<span class='dashicons dashicons-dismiss'></span>
" . esc_html__('Failed', 'bluem') . '</span>';
break;
}
default: {
echo 'Status:' . esc_html($status);
break;
}
}
}
function bluem_render_request_user(object $r, array $users_by_id): void
{
if (isset($users_by_id[(int) $r->user_id])) {
?>
<a href="<?php echo esc_url(admin_url('user-edit.php?user_id=' . $r->user_id . '#user_' . $r->type)); ?>"
target="_blank">
<?php echo esc_html($users_by_id[(int) $r->user_id]->user_nicename); ?>
</a>
<?php
} else {
esc_html_e('Guest / unknown', 'bluem');
}
}
function bluem_render_footer($align_right = true): void
{
?>
<p style="display:block;
<?php
if ($align_right) {
echo 'text-align:right;';
}
?>
">
<?php esc_html_e('Need help?', 'bluem'); ?>
<br>
<a href="https://bluem-development.github.io/bluem-docs/wordpress-woo-handleiding.html"
target="_blank" style="text-decoration:none;">
<span class="dashicons dashicons-media-document"></span>
<?php esc_html_e('Manual', 'bluem'); ?>
<small>
<span class="dashicons dashicons-external"></span>
</small>
</a>
·
<a href="mailto:pluginsupport@bluem.nl?subject=Bluem+WordPress+Plugin" target="_blank"
style="text-decoration:none;">
<span class="dashicons dashicons-editor-help"></span>
<?php esc_html_e('E-mail support', 'bluem'); ?></a>
</p>
<?php
}
function bluem_render_requests_list($requests)
{
?>
<div class="bluem-request-list">
<?php
foreach ($requests as $r) {
$pl = json_decode($r->payload);
?>
<div class="bluem-request-list-item">
<?php
if ($r->type === 'payments' || $r->type === 'mandates') {
if (! is_null($pl)) {
?>
<div class="bluem-request-list-item-floater">
<?php
foreach ($pl as $k => $v) {
bluem_render_obj_row_recursive($k, $v);
}
?>
</div>
<?php
}
} elseif ($r->type === 'identity') {
?>
<div class="bluem-request-list-item-floater">
<?php
if (! is_null($pl)) {
?>
<div>
<?php
if (
isset($pl->report->CustomerIDResponse)
&& $pl->report->CustomerIDResponse . '' != ''
) {
?>
<span class="bluem-request-label">
<?php esc_html_e('CustomerID', 'bluem'); ?>:
</span>
<?php echo esc_html($pl->report->CustomerIDResponse); ?>
<?php
}
?>
</div>
<?php if (isset($pl->report->AddressResponse)) { ?>
<div>
<span class="bluem-request-label">
<?php esc_html_e('Address', 'bluem'); ?>:
</span>
<?php
foreach ($pl->report->AddressResponse as $k => $v) {
echo esc_html($v . ' ');
}
?>
</div>
<?php
}
?>
<?php if (isset($pl->report->BirthDateResponse)) { ?>
<div>
<span class="bluem-request-label">
<?php esc_html_e('Birth date', 'bluem'); ?>:
</span>
<?php echo esc_html($pl->report->BirthDateResponse); ?>
</div>
<?php } ?>
<?php if (isset($pl->report->EmailResponse)) { ?>
<div>
<span class="bluem-request-label">
<?php esc_html_e('Email', 'bluem'); ?>:
</span>
<?php echo esc_html($pl->report->EmailResponse); ?>
</div>
<?php } ?>
<?php if (isset($pl->report->TelephoneResponse1)) { ?>
<div>
<span class="bluem-request-label">
<?php esc_html_e('Phone no.', 'bluem'); ?>:
</span>
<?php echo esc_html($pl->report->TelephoneResponse1); ?>
</div>
<?php } ?>
<?php
if (isset($pl->environment)) {
?>
<div>
<span class="bluem-request-label">
<?php esc_html_e('Bluem mode', 'bluem'); ?>:
</span>
<?php echo esc_attr(ucfirst($pl->environment)); ?>
</div>
<?php
}
?>
<?php
}
?>
</div>
<?php
}
?>
<div class="bluem-request-list-item-row bluem-request-list-item-row-title">
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-transactions&request_id=' . $r->id)); ?>"
target="_self">
<?php echo esc_html($r->description); ?>
</a>
</div>
<div class="bluem-request-list-item-row">
<span class="bluem-request-label">
<?php esc_html_e('Type', 'bluem'); ?>:
</span>
<?php echo esc_html(bluem_get_request_type_label($r->type ?? '')); ?>
</div>
<div class="bluem-request-list-item-row">
<span class="bluem-request-label">
<?php esc_html_e('Transaction number', 'bluem'); ?>:
</span>
<?php echo esc_html($r->transaction_id); ?>
</div>
<?php
if (isset($r->debtor_reference) && $r->debtor_reference !== '') {
?>
<div class="bluem-request-list-item-row">
<span class="bluem-request-label">
<?php esc_html_e('Customer reference', 'bluem'); ?>:
</span>
<?php echo esc_html($r->debtor_reference); ?>
</div>
<?php
}
?>
<div class="bluem-request-list-item-row">
<span class="bluem-request-label">
<?php esc_html_e('Time', 'bluem'); ?>
</span>
<?php $rdate = new DateTimeImmutable($r->timestamp, new DateTimeZone('Europe/Amsterdam')); ?>
<?php echo esc_html($rdate->format('d-m-Y H:i:s')); ?>
</div>
<div class="bluem-request-list-item-row">
<span class="bluem-request-label">
<?php esc_html_e('Status', 'bluem'); ?>:
</span>
<?php bluem_render_request_status($r->status); ?>
</div>
</div>
<?php
}
?>
</div>
<?php
}
/**
* Return a readable label for the request type stored in the request table.
*
* @param mixed $type Request type stored by the payment or identity flow.
*/
function bluem_get_request_type_label($type): string
{
$type = strtolower(trim((string) $type));
$labels = [
'ideal' => __('iDEAL', 'bluem'),
'creditcard' => __('Credit card', 'bluem'),
'paypal' => __('PayPal', 'bluem'),
'sofort' => __('SOFORT', 'bluem'),
'cartebancaire' => __('Carte Bancaire', 'bluem'),
'mandates' => __('eMandate', 'bluem'),
'payments' => __('Payment', 'bluem'),
'identity' => __('iDIN', 'bluem'),
];
return $labels[$type] ?? ($type !== '' ? ucfirst($type) : __('Unknown', 'bluem'));
}
function bluem_render_obj_row_recursive($key, $value, $level = 0): void
{
if ($key === 'linked_orders') {
return;
}
if (is_numeric($key)) {
$key = '';
$prettyKey = '';
} else {
$prettyKey = ucfirst(str_replace(['_', 'Response1', 'Response', 'id'], [
' ',
'',
'',
'ID',
], $key));
if ($level > 1) {
$prettyKey = str_repeat(' ', $level - 1) . $prettyKey;
}
}
if ($prettyKey !== '') {
echo wp_kses_post(
"<span class='bluem-request-label' title='" . esc_attr($prettyKey) . "'>
" . esc_html($prettyKey) . ':
</span> '
);
}
if (is_string($value)) {
if ($prettyKey === 'Contactform7') {
bluem_woocommerce_render_contactform7_table($value);
} elseif ($prettyKey === 'Details') {
bluem_woocommerce_render_details_table($value);
} else {
echo wp_kses_post($value);
}
} elseif (is_iterable($value) || is_object($value)) {
echo '<br>';
foreach ($value as $valuekey => $valuevalue) {
if ($valuekey === 'linked_orders') {
continue;
}
bluem_render_obj_row_recursive($valuekey, $valuevalue, $level + 1);
}
} elseif (is_bool($value)) {
echo ' ' . ($value ? esc_html__('Yes', 'bluem') : esc_html__('No', 'bluem'));
}
echo '<br>';
}
function bluem_woocommerce_render_details_table(string $value): void
{
$additional_details = json_decode($value);
if (! empty($additional_details)) {
$formHTML = '';
if (! empty($additional_details->id) || ! empty($additional_details->payload)) {
$formHTML = '<table style="padding:5pt; border:1px solid #ddd; margin:10px 0; display: inline-block; vertical-align: inherit;">
<thead>
<tr>
<th style="text-align: left;">' . esc_html__('Name', 'bluem') . '</th>
<th style="text-align: left;">' . esc_html__('Value', 'bluem') . '</th>
</tr>
</thead>
<tbody>';
}
if (! empty($additional_details->payload)) {
try {
$additional_details_payload = json_decode($additional_details->payload, false, 512, JSON_THROW_ON_ERROR);
} catch (Exception $e) {
$additional_details_payload = [];
}
foreach ($additional_details_payload as $dKey => $dValue) {
if ($dKey === 'source_url') {
$dValue = '<a href="' . $dValue . '" target="_blank">' . $dValue . '</a>';
}
$formHTML .= sprintf(
"
<tr>
<td><span class='bluem-request-label'>%s</span></td>
<td>%s</td></tr>",
ucfirst(str_replace('_', ' ', $dKey)),
$dValue
);
}
$formLink = admin_url("admin.php?page=gf_entries&view=entry&id={$additional_details_payload->form_id}&lid={$additional_details_payload->entry_id}&order=ASC&filter&paged=1&pos=0&field_id&operator");
$formHTML .= "
<tr>
<td><span class='bluem-request-label'>" . esc_html__('Form entry', 'bluem') . "</span></td>
<td>
<a href=\"$formLink\" target='_blank'>
" . esc_html__('View', 'bluem') . '</a>
</td>
</tr>';
}
$formHTML .= '</tbody></table>';
if (! empty($formHTML)) {
echo wp_kses_post($formHTML);
} else {
echo wp_kses_post($value);
}
}
}
function bluem_woocommerce_render_contactform7_table(string $value): void
{
try {
$contactFormData = json_decode($value, false, 512, JSON_THROW_ON_ERROR);
} catch (Exception $e) {
$contactFormData = null;
}
if (! empty($contactFormData)) {
$formHTML = '';
if (! empty($contactFormData->id)) {
$formHTML = '<table style="display: inline-block; vertical-align: inherit;">
<thead>
<tr>
<th style="text-align: left;">' . esc_html__('Name', 'bluem') . '</th>
<th style="text-align: left;">' . esc_html__('Value', 'bluem') . '</th>
</tr>
</thead>
<tbody>
<tr>
<td>' . esc_html__('Form ID', 'bluem') . ':</td>
<td>' . $contactFormData->id . '</td>
</tr>';
}
if (! empty($contactFormData->payload)) {
foreach ($contactFormData->payload as $payloadKey => $payloadValue) {
$formHTML .= '<tr>
<td>' . wp_kses_post($payloadKey) . '</td>';
if (is_object($payloadValue) || is_array($payloadValue)) {
$payloadValue = json_encode($payloadValue);
}
$formHTML .= '<td>' . wp_kses_post($payloadValue) . '</td>
</tr>';
}
}
$formHTML .= '</tbody></table>';
if (! empty($formHTML)) {
echo wp_kses_post($formHTML);
} else {
echo wp_kses_post($value);
}
}
}
function bluem_render_requests_type($cat): string
{
if ($cat === 'mandates') {
return esc_html__('eMandates', 'bluem');
}
if ($cat === 'ideal') {
return esc_html__('iDEAL', 'bluem');
}
if ($cat === 'creditcard') {
return esc_html__('Creditcard', 'bluem');
}
if ($cat === 'paypal') {
return esc_html__('PayPal', 'bluem');
}
if ($cat === 'cartebancaire') {
return esc_html__('Carte Bancaire', 'bluem');
}
if ($cat === 'sofort') {
return esc_html__('SOFORT', 'bluem');
}
if ($cat === 'identity') {
return esc_html__('Identity', 'bluem');
}
if ($cat === 'integrations') {
return esc_html__('Integrations', 'bluem');
}
return esc_html__('Unknown type', 'bluem') . ': ' . esc_html($cat);
}
function bluem_render_requests_table_title($cat): void
{
$result = '';
if ($cat === 'mandates') {
$result .= '<span class="dashicons dashicons-money"></span> ';
$result .= esc_html__('eMandates', 'bluem');
} elseif ($cat === 'ideal') {
$result .= '<span class="dashicons dashicons-money-alt"></span> ';
$result .= esc_html__('iDEAL payments', 'bluem');
} elseif ($cat === 'creditcard') {
$result .= '<span class="dashicons dashicons-money-alt"></span> ';
$result .= esc_html__('Credit card payments', 'bluem');
} elseif ($cat === 'paypal') {
$result .= '<span class="dashicons dashicons-money-alt"></span> ';
$result .= esc_html__('PayPal payments', 'bluem');
} elseif ($cat === 'cartebancaire') {
$result .= '<span class="dashicons dashicons-money-alt"></span> ';
$result .= esc_html__('Carte Bancaire payments', 'bluem');
} elseif ($cat === 'sofort') {
$result .= '<span class="dashicons dashicons-money-alt"></span> ';
$result .= esc_html__('SOFORT payments', 'bluem');
} elseif ($cat === 'identity') {
$result .= '<span class="dashicons dashicons-businessperson"></span> ';
$result .= esc_html__('Identity', 'bluem');
} elseif ($cat === 'integrations') {
$result .= '<span class="dashicons dashicons-businessperson"></span> ';
$result .= esc_html__('Integrations', 'bluem');
}
echo '<h2>' . wp_kses_post($result) . '</h2>';
}
function bluem_render_nav_header($active_page = '')
{
?>
<nav class="nav-tab-wrapper">
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-admin')); ?>"
<?php
if ($active_page === 'home') {
echo 'class="nav-tab nav-active tab-active active" style="background-color: #fff;"';
} else {
echo 'class="nav-tab"';
}
?>>
<span class="dashicons dashicons-admin-home"></span>
<?php esc_html_e('Home', 'bluem'); ?>
</a>
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-activate')); ?>"
<?php
if ($active_page === 'activate') {
echo 'class="nav-tab nav-active tab-active active" style="background-color: #fff;"';
} else {
echo 'class="nav-tab"';
}
?>>
<span class="dashicons dashicons-yes-alt"></span>
<?php esc_html_e('Activation', 'bluem'); ?>
</a>
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-transactions')); ?>"
<?php
if ($active_page === 'transactions') {
echo 'class="nav-tab nav-active tab-active active" style="background-color: #fff;"';
} else {
echo 'class="nav-tab"';
}
?>>
<span class="dashicons dashicons-money"></span>
<?php esc_html_e('Transactions', 'bluem'); ?>
</a>
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-settings')); ?>"
<?php
if ($active_page === 'settings') {
echo 'class="nav-tab nav-active tab-active active" style="background-color: #fff;"';
} else {
echo 'class="nav-tab"';
}
?>>
<span class="dashicons dashicons-admin-settings"></span>
<?php esc_html_e('Settings', 'bluem'); ?>
</a>
<a href="<?php echo esc_url(admin_url('admin.php?page=bluem-status')); ?>"
<?php
if ($active_page === 'status') {
echo 'class="nav-tab nav-active tab-active active" style="background-color: #fff;"';
} else {
echo 'class="nav-tab"';
}
?>>
<span class="dashicons dashicons-info"></span>
<?php esc_html_e('Status', 'bluem'); ?>
</a>
<a href="https://bluem-development.github.io/bluem-docs/wordpress-woo-handleiding.html"
target="_blank"
class="nav-tab">
<span class="dashicons dashicons-media-document"></span>
<?php esc_html_e('Manual', 'bluem'); ?>
<small>
<span class="dashicons dashicons-external"></span>
</small>
</a>
<a href="mailto:pluginsupport@bluem.nl?subject=Bluem+WordPress+Plugin" class="nav-tab" target="_blank">
<span class="dashicons dashicons-editor-help"></span>
<?php esc_html_e('E-mail support', 'bluem'); ?>
</a>
</nav>
<?php
}
// Helper class for layout
/**
* @param string $requestTimestamp
* @param string $format
*
* @return string
*/
function bluem_get_formattedDate(string $requestTimestamp, string $format = 'd-m-Y H:i:s'): string
{
try {
$dateTime = new DateTime($requestTimestamp);
} catch (Exception $e) {
return '';
}
$dateTime->setTimezone(new DateTimeZone('Europe/Amsterdam'));
return $dateTime->format($format);
}