PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.9.7
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.9.7
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Ends / Back / Settings / templates / calendly.php
embedpress / EmbedPress / Ends / Back / Settings / templates Last commit date
partials 2 years ago ads.php 2 years ago calendly.php 2 years ago custom-logo.php 2 years ago dailymotion.php 4 years ago elements.php 2 years ago general.php 2 years ago go-premium.php 2 years ago google-calendar.php 2 years ago license.php 5 years ago main-template.php 5 years ago opensea.php 3 years ago premium.php 2 years ago shortcode.php 2 years ago soundcloud.php 4 years ago sources.php 2 years ago spotify.php 4 years ago twitch.php 4 years ago vimeo.php 3 years ago wistia.php 4 years ago youtube.php 3 years ago
calendly.php
446 lines
1 <?php
2 /*
3 * It will be customzed for OpenSea
4 * All undefined vars comes from 'render_settings_page' method
5 * */
6
7 $authorize_url = 'https://auth.calendly.com/oauth/authorize?client_id=RVIzKSKamm_V88B9Z7yB2fr4JBd7Bqbdi_VQ5rlji2I&response_type=code&redirect_uri=https://api.embedpress.com/calendly.php&state=' . admin_url('admin.php');
8
9
10 $user_info = !empty(get_option('calendly_user_info')) ? get_option('calendly_user_info') : [];
11 $event_types = !empty(get_option('calendly_event_types')) ? get_option('calendly_event_types') : [];
12 $scheduled_events = !empty(get_option('calendly_scheduled_events')) ? get_option('calendly_scheduled_events') : [];
13 $invtitees_list = !empty(get_option('calendly_invitees_list')) ? get_option('calendly_invitees_list') : [];
14
15 $avatarUrl = !empty($user_info['resource']['avatar_url']) ? $user_info['resource']['avatar_url'] : '';
16 $name = !empty($user_info['resource']['name']) ? $user_info['resource']['name'] : ' ';
17 $schedulingUrl = !empty($user_info['resource']['scheduling_url']) ? $user_info['resource']['scheduling_url'] : '';
18
19 if (!function_exists('getCalendlyUuid')) {
20 function getCalendlyUuid($url)
21 {
22 $pattern = '/\/([0-9a-fA-F-]+)$/';
23 if (preg_match($pattern, $url, $matches)) {
24 $uuid = $matches[1];
25 return $uuid;
26 }
27 return '';
28 }
29 }
30
31
32
33 $calendly_tokens = get_option('calendly_tokens');
34 $expirationTime = is_array($calendly_tokens) ? ($calendly_tokens['created_at'] ?? 0) + ($calendly_tokens['expires_in'] ?? 0) : 0;
35 $currentTimestamp = time();
36
37 $calendly_connect_url = $authorize_url;
38 $calendly_sync_url = $authorize_url;
39 $calendly_disconnect_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=disconnect';
40
41 if ($currentTimestamp < $expirationTime) {
42 $calendly_connect_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=connect';
43 $calendly_sync_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=sync';
44
45 if (isset($_GET['calendly_status']) && $_GET['calendly_status'] == 'connect') {
46 update_option('is_calendly_connected', true);
47 }
48 }
49
50 if (isset($_GET['calendly_status']) && $_GET['calendly_status'] == 'disconnect') {
51 update_option('is_calendly_connected', '');
52 }
53
54 $is_calendly_connected = get_option('is_calendly_connected');
55
56 if (!is_embedpress_pro_active()) {
57 $invtitees_list = [
58 'e84408fc-d58a-421a-bf65-5efeefa182b0' => [
59 'collection' => [
60 0 => [
61 'name' => 'John Smith'
62 ]
63 ]
64 ],
65 'caf8a25a-4021-48ef-9322-2487b239bbef' => [
66 'collection' => [
67 0 => [
68 'name' => 'Emily Johnson'
69 ]
70 ]
71 ],
72 '9756459c-443e-4366-a147-98dc8b5aa09f' => [
73 'collection' => [
74 0 => [
75 'name' => 'Michael Davis'
76 ]
77 ]
78 ],
79 'ebc4b1fe-2d19-4079-bac9-1988588717f8' => [
80 'collection' => [
81 0 => [
82 'name' => 'Sarah Wilson'
83 ]
84 ]
85 ],
86 '232ab5df-50fb-4f16-a887-a00a2922c758' => [
87 'collection' => [
88 0 => [
89 'name' => 'David Brown'
90 ]
91 ]
92 ],
93 ];
94
95 $scheduled_events = [
96 'collection' => [
97 [
98 'uri' => 'https://api.calendly.com/scheduled_events/e84408fc-d58a-421a-bf65-5efeefa182b0',
99 'name' => 'Coffee with John',
100 'start_time' => '2034-08-24T03:30:00.000000Z',
101 'end_time' => '2034-08-24T03:45:00.000000Z',
102 'status' => 'active',
103 ],
104 [
105 'uri' => 'https://api.calendly.com/scheduled_events/caf8a25a-4021-48ef-9322-2487b239bbef',
106 'name' => 'Coffee with John',
107 'start_time' => '2030-08-31T03:00:00.000000Z',
108 'end_time' => '2030-08-31T03:15:00.000000Z',
109 'status' => 'canceled',
110 ],
111 [
112 'uri' => 'https://api.calendly.com/scheduled_events/9756459c-443e-4366-a147-98dc8b5aa09f',
113 'name' => 'Coffee with John',
114 'start_time' => '2024-09-04T09:00:00.000000Z',
115 'end_time' => '2024-09-04T09:15:00.000000Z',
116 'status' => 'active',
117 ],
118 [
119 'uri' => 'https://api.calendly.com/scheduled_events/ebc4b1fe-2d19-4079-bac9-1988588717f8',
120 'name' => 'Coffee with John',
121 'start_time' => '2023-09-05T03:00:00.000000Z',
122 'end_time' => '2023-09-05T03:15:00.000000Z',
123 'status' => 'active',
124 ],
125 [
126 'uri' => 'https://api.calendly.com/scheduled_events/232ab5df-50fb-4f16-a887-a00a2922c758',
127 'name' => 'Town Hall Meeting',
128 'start_time' => '2023-09-06T03:00:00.000000Z',
129 'end_time' => '2023-09-06T03:15:00.000000Z',
130 'status' => 'active',
131 ],
132 ]
133 ];
134
135 $event_types = [
136 'collection' => [
137 [
138 'scheduling_url' => 'https://calendly.com/akash-mia/30min',
139 'name' => '30 Minute Meeting',
140 'active' => true,
141 'color' => '#8247f5'
142 ],
143 [
144 'scheduling_url' => 'https://calendly.com/akash-mia/coffee-with-john-doe',
145 'name' => 'Coffee with John',
146 'active' => true,
147 'color' => '#e55cff'
148 ],
149 [
150 'scheduling_url' => 'https://calendly.com/akash-mia/asia-cup-2023',
151 'name' => 'Asia Cup 2023',
152 'active' => false,
153 'color' => '#ccf000'
154 ],
155 [
156 'scheduling_url' => 'https://calendly.com/akash-mia/dailly-stand-up-meeting',
157 'name' => 'Dailly Stand-up meeting',
158 'active' => false,
159 'color' => '#ffa600'
160 ],
161 [
162 'scheduling_url' => 'https://calendly.com/akash-mia/icc-mega-event',
163 'name' => 'ICC Mega Event',
164 'active' => true,
165 'color' => '#0ae8f0'
166 ],
167 [
168 'scheduling_url' => 'https://calendly.com/akash-mia/wpdeveloper-team-meeting',
169 'name' => 'WPDeveloper Team meeting',
170 'active' => false,
171 'color' => '#8247f5'
172 ],
173 ]
174 ];
175 } else if (is_embedpress_pro_active() && !$is_calendly_connected) {
176 $invtitees_list = [];
177 $scheduled_events = [];
178 $event_types = [];
179 }
180
181 ?>
182
183 <div class="embedpress_calendly_settings background__white radius-25 p40">
184 <h3 class="calendly-settings-title"><?php esc_html_e("Calendly Settings", "embedpress"); ?></h3>
185 <div class="calendly-embedpress-authorize-button">
186
187 <div class="calendly-connector-container">
188 <div class="account-wrap full-width-layout">
189
190 <?php if (!empty($is_calendly_connected)) : ?>
191 <div title="<?php echo esc_attr__('Calendly already connected', 'embedpress'); ?>">
192 <a href="<?php echo esc_url($calendly_disconnect_url); ?>" class="calendly-connect-button calendly-connected">
193 <img class="embedpress-calendly-icon" src="<?php echo EMBEDPRESS_SETTINGS_ASSETS_URL; ?>img/calendly.svg" alt="calendly">
194 <?php echo esc_html__('Disconnect', 'embedpress'); ?>
195 </a>
196 </div>
197 <?php else : ?>
198 <a href="<?php echo esc_url($calendly_connect_url); ?>" class="calendly-connect-button" target="_self" title="Connect with Calendly">
199 <img class="embedpress-calendly-icon" src="<?php echo EMBEDPRESS_SETTINGS_ASSETS_URL; ?>img/calendly.svg" alt="calendly">
200 <?php echo esc_html__('Connect with Calendly', 'embedpress'); ?>
201 </a>
202 <?php endif; ?>
203 </div>
204 <?php if ($is_calendly_connected && is_embedpress_pro_active()) : ?>
205 <div class="calendly-sync-button">
206 <a href="<?php echo esc_url($calendly_sync_url); ?>" class="calendly-connect-button" target="_self" title="Sync new calendly data">
207 <span class="dashicons dashicons-update-alt emcs-dashicon"></span><?php echo esc_html__('Sync', 'embedpress'); ?>
208 </a>
209 </div>
210 <?php endif; ?>
211 </div>
212 <div class="tab-container">
213 <div class="calendly-Event-button tab active-tab" onclick="showTab('event-types')">Event Types</div>
214 <!-- Scheduled Events Tab -->
215 <div class="calendly-Scheduled-button tab" onclick="showTab('scheduled-events')">Scheduled Events</div>
216 </div>
217
218 </div>
219
220 <!-- Event Types Content -->
221 <div class="tab-content active" id="event-types">
222 <div class="event-type-list">
223 <div class="event-type-group-list">
224 <div class="event-type-group-list-item user-item">
225
226 <div class="list-header">
227 <?php if ($is_calendly_connected) : ?>
228 <?php if (!empty($avatarUrl)) : ?>
229 <div class="calendly-profile-avatar">
230 <img src="<?php echo esc_url($avatarUrl); ?>" alt="<?php echo esc_attr($name); ?>">
231 </div>
232 <?php endif; ?>
233 <div class="calendly-user">
234 <div class="KF8rYwhNst0H6JyJ1_kq">
235 <span>
236 <p style="color: currentcolor;"><?php echo esc_html($name); ?></p>
237 </span>
238 </div>
239 <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url($schedulingUrl); ?>">
240 <span><?php echo esc_html($schedulingUrl); ?></span>
241 </a>
242 </div>
243 <?php else : ?>
244 <?php echo esc_html__('Events', 'embedpress'); ?>
245 <?php endif; ?>
246 </div>
247 <div class="calendly-data<?php if (!is_embedpress_pro_active()) : echo '-placeholder';
248 endif; ?>">
249
250 <div class="event-type-card-list">
251 <?php
252 if (is_array($event_types) && isset($event_types['collection']) && count($event_types['collection']) > 0) :
253 foreach ($event_types['collection'] as $item) :
254 $status = 'In-active';
255 if (!empty($item['active'])) {
256 $status = 'Active';
257 }
258 ?>
259 <div class="event-type-card-list-item" data-event-status="<?php echo esc_attr($status); ?>" style="--calendly-event-color: <?php echo esc_attr($item['color']); ?>;">
260 <div class="event-type-card">
261 <div class="event-type-card-top">
262 <h2><?php echo esc_html($item['name']); ?></h2>
263 <p>30 mins, One-on-One</p>
264 <a target="_blank" href="<?php echo esc_url($item['scheduling_url']); ?>"><?php echo esc_html__('View booking page', 'embedpress'); ?></a>
265 </div>
266 <div class="event-type-card-bottom">
267 <div class="calendly-event-copy-link" data-event-link="<?php echo esc_url($item['scheduling_url']); ?>">
268 <svg width="40" height="40" viewBox="0 0 0.75 0.75" fill="none" xmlns="http://www.w3.org/2000/svg">
269 <path fill-rule="evenodd" clip-rule="evenodd" d="M0.05 0.476a0.076 0.076 0 0 0 0.076 0.074H0.2V0.5H0.126A0.026 0.026 0 0 1 0.1 0.474V0.124A0.026 0.026 0 0 1 0.126 0.098h0.35a0.026 0.026 0 0 1 0.026 0.026V0.2H0.276A0.076 0.076 0 0 0 0.2 0.276v0.35A0.076 0.076 0 0 0 0.276 0.7h0.35A0.076 0.076 0 0 0 0.702 0.624V0.274A0.076 0.076 0 0 0 0.626 0.2H0.55V0.126A0.076 0.076 0 0 0 0.476 0.05H0.126a0.076 0.076 0 0 0 -0.076 0.076v0.35Zm0.2 -0.2A0.026 0.026 0 0 1 0.276 0.25h0.35a0.026 0.026 0 0 1 0.026 0.026v0.35a0.026 0.026 0 0 1 -0.026 0.026H0.276A0.026 0.026 0 0 1 0.25 0.626V0.276Z" fill="#3664ae" /></svg>
270 <span><?php echo esc_html__('Copy link', 'embedpress'); ?></span>
271 </div>
272 <div class="event-status <?php echo esc_attr($status); ?>">
273 <?php echo esc_html($status); ?>
274 </div>
275 </div>
276 </div>
277
278 </div>
279 <?php
280 endforeach;
281 elseif (is_embedpress_pro_active() && !$is_calendly_connected) :
282 echo esc_html__('Please connect with calendly', 'embedpress');
283 elseif (is_embedpress_pro_active() && $is_calendly_connected && isset($event_types['collection']) && count($event_types['collection']) < 1) :
284 echo esc_html__('Calendly has no events.', 'embedpress');
285 endif;
286
287 ?>
288 </div>
289
290 <?php if (!is_embedpress_pro_active()) : ?>
291 <div class="overlay">
292 <a href="<?php echo esc_url('https://wpdeveloper.com/in/upgrade-embedpress'); ?>" class="overlay-button" target="_blank"><?php echo esc_html__('Get PRO to Unlock', 'embedpress'); ?></a>
293 </div>
294 <?php endif; ?>
295 </div>
296 </div>
297 </div>
298
299 </div>
300 </div>
301
302 <!-- Scheduled Events Content -->
303 <div class="tab-content" id="scheduled-events">
304
305 <div class="calendly-day-list">
306 <div class="calendly-data<?php if (!is_embedpress_pro_active()) : echo '-placeholder';
307 endif; ?>">
308 <table class="rwd-table" cellspacing="0">
309 <tbody>
310 <tr>
311 <th>Date & Time</th>
312 <th>Event Type</th>
313 <th>Attendee</th>
314 <th>Scheduled</th>
315 <th>Status</th>
316 </tr>
317 <?php
318 $index = 0;
319 $current_datetime = new DateTime(); // Get the current date and time
320
321 $upcoming_events = [];
322 $past_events = [];
323
324 if (is_array($scheduled_events) && isset($scheduled_events['collection']) && count($scheduled_events) > 0) {
325 foreach ($scheduled_events['collection'] as $event) {
326 $uuid = getCalendlyUuid($event['uri']);
327
328
329 $name = $invtitees_list[$uuid]['collection'][$index]['name'];
330
331 // Convert event start and end times to DateTime objects
332 $start_time = new DateTime($event['start_time']);
333 $end_time = new DateTime($event['end_time']);
334
335 // Check if the event is in the past or upcoming
336 $is_past_event = $end_time < $current_datetime;
337
338 // Categorize events into upcoming and past
339 if ($is_past_event) {
340 $past_events[] = [
341 'event' => $event,
342 'name' => $name,
343 ];
344 } else {
345 $upcoming_events[] = [
346 'event' => $event,
347 'name' => $name,
348 ];
349 }
350 }
351 }
352
353 // Sort upcoming events by start time
354 usort($upcoming_events, function ($a, $b) {
355 return strtotime($a['event']['start_time']) - strtotime($b['event']['start_time']);
356 });
357
358 // Sort past events by start time in descending order
359 usort($past_events, function ($a, $b) {
360 return strtotime($b['event']['start_time']) - strtotime($a['event']['start_time']);
361 });
362
363 // Merge upcoming and past events for display
364 $sorted_events = array_merge($upcoming_events, $past_events);
365
366
367 if (is_array($sorted_events) && count($sorted_events) > 0) :
368 foreach ($sorted_events as $event_data) :
369 $event = $event_data['event'];
370 $name = $event_data['name'];
371
372 // Convert event start and end times to DateTime objects
373 $start_time = new DateTime($event['start_time']);
374 $end_time = new DateTime($event['end_time']);
375
376 // Check if the event is in the past or upcoming
377 $is_past_event = $end_time < $current_datetime;
378 ?>
379
380 <tr>
381 <td class="event-time">
382 <small><?php echo esc_html(date('D, j M Y', strtotime($event['start_time']))); ?><br></small>
383 <?php echo esc_html(date('h:ia', strtotime($event['start_time'])) . ' - ' . date('h:ia', strtotime($event['end_time']))); ?>
384 </td>
385 <td class="event-info">
386 <?php echo esc_html($event['name']); ?>
387 </td>
388 <td class="attendee">
389 <?php echo esc_html($name); ?>
390 </td>
391 <td class="event-action">
392 <?php echo $is_past_event ? 'Past' : 'Upcoming'; ?>
393 </td>
394 <td class="scheduled-status">
395 <?php echo esc_html( ucfirst($event['status']) ); ?>
396 </td>
397 </tr>
398
399 <?php endforeach;
400 endif; ?>
401
402 </tbody>
403 </table>
404
405 <?php
406 if (is_embedpress_pro_active() && !$is_calendly_connected) :
407 echo '<br>' . esc_html__('Please connect with calendly', 'embedpress');
408 elseif (is_embedpress_pro_active() && $is_calendly_connected && count($sorted_events) < 1) :
409 echo esc_html__('Calendly has no schedule.', 'embedpress');
410 endif;
411 ?>
412
413 <?php if (!is_embedpress_pro_active()) : ?>
414 <div class="overlay">
415 <a href="<?php echo esc_url('https://wpdeveloper.com/in/upgrade-embedpress'); ?>" class="overlay-button" target="_blank"><?php echo esc_html__('Get PRO to Unlock', 'embedpress'); ?></a>
416 </div>
417 <?php endif; ?>
418 </div>
419 </div>
420 </div>
421
422 <script>
423 // JavaScript function to switch between tabs
424 function showTab(tabId) {
425 const tabs = document.querySelectorAll('.tab');
426 const tabContents = document.querySelectorAll('.tab-content');
427
428 // Hide all tab contents
429 tabContents.forEach(content => {
430 content.classList.remove('active');
431 });
432
433 // Deactivate all tabs
434 tabs.forEach(tab => {
435 tab.classList.remove('active-tab');
436 });
437
438 // Activate the selected tab
439 document.getElementById(tabId).classList.add('active');
440 event.currentTarget.classList.add('active-tab');
441 }
442 </script>
443
444
445
446 </div>