/var/www/html_de/wp-content/plugins/yaymail/includes/Helper/WooLatepoint.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
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
<?php

namespace YayMail\Helper;

defined'ABSPATH' ) || exit;


class 
WooLatepoint {
    protected static 
$instance null;
    public static function 
getInstance() {
        if ( 
null == self::$instance ) {
            
self::$instance = new self();
        }
        return 
self::$instance;
    }
    private function 
__construct() {}
    public static function 
wooLatepointBookingDetail$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
ob_start();
            
$path YAYMAIL_PLUGIN_PATH 'views/templates/emails/LatePoint/SampleTemplate/latepoint-booking-detail.php';
            include 
$path;
            
$html ob_get_contents();
            
ob_end_clean();
            return 
$html;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items $order->get_items();
                
ob_start();
                
$path YAYMAIL_PLUGIN_PATH 'views/templates/emails/LatePoint/latepoint-booking-detail.php';
                include 
$path;
                
$html ob_get_contents();
                
ob_end_clean();
                return 
$html;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }

    public static function 
wooLatepointCalendarStartDate$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_calendar_start_date  '<ul class="yaymail-woo-latepoint-list-calendar-start-date">';
            
$list_calendar_start_date .= '<li>' date_i18nwc_date_format(), current_time'Y-m-d' ) ) . '</li>';
            
$list_calendar_start_date .= '</ul>';
            return 
$list_calendar_start_date;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items              $order->get_items();
                
$list_calendar_start_date '<ul class="yaymail-woo-latepoint-list-calendar-start-date">';
                foreach ( 
$order_items as $item ) {
                    
$data                wc_get_order_item_meta$item->get_id(), TECHXELA_WOOCOMMERCE_LATEPOINT_ORDER_ITEM_META_KEY );
                    
$calendar_start_date = isset( $data['restrictions']['calendar_start_date'] ) ? $data['restrictions']['calendar_start_date'] : null;
                    if ( empty( 
$calendar_start_date ) ) {
                        return 
null;
                    }
                    
$list_calendar_start_date .= '<li>' date_i18nwc_date_format(), strtotime$calendar_start_date ) ) . '</li>';
                }
                
$list_calendar_start_date .= '</ul>';
                return 
$list_calendar_start_date;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }

    
//WooCommerce for LatePoint
    
public static function wooLatepointSelectedTotalAttendees$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_total_attendies">';
            
$list_attributes .= '<li>' '</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_total_attendies' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }

    public static function 
wooLatepointCaption$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-caption">';
            
$list_attributes .= '<li>caption</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'caption' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }

    public static function 
wooLatepointBgColor$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-bg_color">';
            
$list_attributes .= '<li>bg_color</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'bg_color' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointTextColor$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-text_color">';
            
$list_attributes .= '<li>text_color</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'text_color' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointFontSize$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-font_size">';
            
$list_attributes .= '<li>font_size</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'font_size' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointBorder$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-border">';
            
$list_attributes .= '<li>border</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'border' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointBorderRadius$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-border_radius">';
            
$list_attributes .= '<li>border_radius</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'border_radius' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointMargin$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-margin">';
            
$list_attributes .= '<li>margin</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'margin' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointPaddings$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-padding">';
            
$list_attributes .= '<li>padding</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'padding' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointCss$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-css">';
            
$list_attributes .= '<li>css</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'css' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointShowLocations$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-show_locations">';
            
$list_attributes .= '<li>show_locations</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'show_locations' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointShowAgents$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-show_agents">';
            
$list_attributes .= '<li>show_agents</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'show_agents' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointShowServices$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-show_services">';
            
$list_attributes .= '<li>show_services</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'show_services' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointShowServiceCategories$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-show_service_categories">';
            
$list_attributes .= '<li>show_service_categories</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'show_service_categories' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointSelectedLocation$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_location">';
            
$list_attributes .= '<li>selected_location</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_location' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointSelectedAgent$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_agent">';
            
$list_attributes .= '<li>selected_agent</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_agent' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointSelectedService$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_service">';
            
$list_attributes .= '<li>' '</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_service' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointSelectedServiceCategory$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_service_category">';
            
$list_attributes .= '<li>' '</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_service_category' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointSelectedDuration$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-selected_duration">';
            
$list_attributes .= '<li>' '</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'selected_duration' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointHideSidePanel$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-hide_side_panel">';
            
$list_attributes .= '<li>hide_side_panel</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'hide_side_panel' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    public static function 
wooLatepointHideSummary$args$order$sent_to_admin ) {
        if ( 
null === $order ) {
            
$list_attributes  '<ul class="yaymail-woo-latepoint-hide_summary">';
            
$list_attributes .= '<li>hide_summary</li>';
            
$list_attributes .= '</ul>';
            return 
$list_attributes;
        } else {
            if ( 
method_exists$order'get_items' ) ) {
                
$order_items                 $order->get_items();
                
$valueRestrictionsAttributes self::getRestrictionsAttributes$order_items'hide_summary' );
                return 
$valueRestrictionsAttributes;
            } else {
                
// Handle error: $order object doesn't have get_items() method
                
return null;
            }
        }
    }
    
/**
     * It takes the order items and the value of the attribute you want to display, and returns a list of
     * the attributes
     *
     * @param order_items This is the array of order items.
     * @param value The name of the attribute you want to display.
     *
     * @return A list of attributes.
     */
    
public static function getRestrictionsAttributes$order_items$value ) {
        
$list_attributes '<ul class="yaymail-woo-latepoint-selected-' $value '">';
        
$attributes      $value;
        foreach ( 
$order_items as $item ) {
            
$data            wc_get_order_item_meta$item->get_id(), TECHXELA_WOOCOMMERCE_LATEPOINT_ORDER_ITEM_META_KEY );
            
$data_attributes = isset( $data['restrictions'][ $attributes ] ) ? $data['restrictions'][ $attributes ] : null;
            if ( empty( 
$data_attributes ) ) {
                return 
null;
            }
            
$list_attributes .= '<li>' $data_attributes '</li>';
        }
        
$list_attributes .= '</ul>';
        return 
$list_attributes;
    }
}