PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.9.9
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.9.9
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 2 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
455 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
38 // Generate nonce
39 $nonce = wp_create_nonce('calendly_nonce');
40
41 // Add nonce as a parameter to the URL
42 $nonce_param = "&_nonce=$nonce";
43
44 $calendly_connect_url = $authorize_url."?calendly_status=connect,_nonce=$nonce";
45 $calendly_sync_url = $authorize_url."?calendly_status=connect,_nonce=$nonce";
46
47 $calendly_disconnect_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=disconnect'.$nonce_param;
48
49 if ($currentTimestamp < $expirationTime) {
50 $calendly_connect_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=connect'.$nonce_param;
51 $calendly_sync_url = '/wp-admin/admin.php?page=embedpress&page_type=calendly&calendly_status=sync'.$nonce_param;
52
53 if (isset($_GET['calendly_status']) && $_GET['calendly_status'] == 'connect') {
54 update_option('is_calendly_connected', true);
55 }
56 }
57
58 if (isset($_GET['calendly_status']) && $_GET['calendly_status'] == 'disconnect') {
59 update_option('is_calendly_connected', '');
60 }
61
62 $is_calendly_connected = get_option('is_calendly_connected');
63
64 if (!is_embedpress_pro_active()) {
65 $invtitees_list = [
66 'e84408fc-d58a-421a-bf65-5efeefa182b0' => [
67 'collection' => [
68 0 => [
69 'name' => 'John Smith'
70 ]
71 ]
72 ],
73 'caf8a25a-4021-48ef-9322-2487b239bbef' => [
74 'collection' => [
75 0 => [
76 'name' => 'Emily Johnson'
77 ]
78 ]
79 ],
80 '9756459c-443e-4366-a147-98dc8b5aa09f' => [
81 'collection' => [
82 0 => [
83 'name' => 'Michael Davis'
84 ]
85 ]
86 ],
87 'ebc4b1fe-2d19-4079-bac9-1988588717f8' => [
88 'collection' => [
89 0 => [
90 'name' => 'Sarah Wilson'
91 ]
92 ]
93 ],
94 '232ab5df-50fb-4f16-a887-a00a2922c758' => [
95 'collection' => [
96 0 => [
97 'name' => 'David Brown'
98 ]
99 ]
100 ],
101 ];
102
103 $scheduled_events = [
104 'collection' => [
105 [
106 'uri' => 'https://api.calendly.com/scheduled_events/e84408fc-d58a-421a-bf65-5efeefa182b0',
107 'name' => 'Coffee with John',
108 'start_time' => '2034-08-24T03:30:00.000000Z',
109 'end_time' => '2034-08-24T03:45:00.000000Z',
110 'status' => 'active',
111 ],
112 [
113 'uri' => 'https://api.calendly.com/scheduled_events/caf8a25a-4021-48ef-9322-2487b239bbef',
114 'name' => 'Coffee with John',
115 'start_time' => '2030-08-31T03:00:00.000000Z',
116 'end_time' => '2030-08-31T03:15:00.000000Z',
117 'status' => 'canceled',
118 ],
119 [
120 'uri' => 'https://api.calendly.com/scheduled_events/9756459c-443e-4366-a147-98dc8b5aa09f',
121 'name' => 'Coffee with John',
122 'start_time' => '2024-09-04T09:00:00.000000Z',
123 'end_time' => '2024-09-04T09:15:00.000000Z',
124 'status' => 'active',
125 ],
126 [
127 'uri' => 'https://api.calendly.com/scheduled_events/ebc4b1fe-2d19-4079-bac9-1988588717f8',
128 'name' => 'Coffee with John',
129 'start_time' => '2023-09-05T03:00:00.000000Z',
130 'end_time' => '2023-09-05T03:15:00.000000Z',
131 'status' => 'active',
132 ],
133 [
134 'uri' => 'https://api.calendly.com/scheduled_events/232ab5df-50fb-4f16-a887-a00a2922c758',
135 'name' => 'Town Hall Meeting',
136 'start_time' => '2023-09-06T03:00:00.000000Z',
137 'end_time' => '2023-09-06T03:15:00.000000Z',
138 'status' => 'active',
139 ],
140 ]
141 ];
142
143 $event_types = [
144 'collection' => [
145 [
146 'scheduling_url' => 'https://calendly.com/akash-mia/30min',
147 'name' => '30 Minute Meeting',
148 'active' => true,
149 'color' => '#8247f5'
150 ],
151 [
152 'scheduling_url' => 'https://calendly.com/akash-mia/coffee-with-john-doe',
153 'name' => 'Coffee with John',
154 'active' => true,
155 'color' => '#e55cff'
156 ],
157 [
158 'scheduling_url' => 'https://calendly.com/akash-mia/asia-cup-2023',
159 'name' => 'Asia Cup 2023',
160 'active' => false,
161 'color' => '#ccf000'
162 ],
163 [
164 'scheduling_url' => 'https://calendly.com/akash-mia/dailly-stand-up-meeting',
165 'name' => 'Dailly Stand-up meeting',
166 'active' => false,
167 'color' => '#ffa600'
168 ],
169 [
170 'scheduling_url' => 'https://calendly.com/akash-mia/icc-mega-event',
171 'name' => 'ICC Mega Event',
172 'active' => true,
173 'color' => '#0ae8f0'
174 ],
175 [
176 'scheduling_url' => 'https://calendly.com/akash-mia/wpdeveloper-team-meeting',
177 'name' => 'WPDeveloper Team meeting',
178 'active' => false,
179 'color' => '#8247f5'
180 ],
181 ]
182 ];
183 } else if (is_embedpress_pro_active() && !$is_calendly_connected) {
184 $invtitees_list = [];
185 $scheduled_events = [];
186 $event_types = [];
187
188 }
189
190 ?>
191
192 <div class="embedpress_calendly_settings background__white radius-25 p40">
193 <h3 class="calendly-settings-title"><?php esc_html_e("Calendly Settings", "embedpress"); ?></h3>
194 <div class="calendly-embedpress-authorize-button">
195
196 <div class="calendly-connector-container">
197 <div class="account-wrap full-width-layout">
198
199 <?php if (!empty($is_calendly_connected)) : ?>
200 <div title="<?php echo esc_attr__('Calendly already connected', 'embedpress'); ?>">
201 <a href="<?php echo esc_url($calendly_disconnect_url); ?>" class="calendly-connect-button calendly-connected">
202 <img class="embedpress-calendly-icon" src="<?php echo EMBEDPRESS_SETTINGS_ASSETS_URL; ?>img/calendly.svg" alt="calendly">
203 <?php echo esc_html__('Disconnect', 'embedpress'); ?>
204 </a>
205 </div>
206 <?php else : ?>
207 <a href="<?php echo esc_url($calendly_connect_url); ?>" class="calendly-connect-button" target="_self" title="Connect with Calendly">
208 <img class="embedpress-calendly-icon" src="<?php echo EMBEDPRESS_SETTINGS_ASSETS_URL; ?>img/calendly.svg" alt="calendly">
209 <?php echo esc_html__('Connect with Calendly', 'embedpress'); ?>
210 </a>
211 <?php endif; ?>
212 </div>
213 <?php if ($is_calendly_connected && is_embedpress_pro_active()) : ?>
214 <div class="calendly-sync-button">
215 <a href="<?php echo esc_url($calendly_sync_url); ?>" class="calendly-connect-button" target="_self" title="Sync new calendly data">
216 <span class="dashicons dashicons-update-alt emcs-dashicon"></span><?php echo esc_html__('Sync', 'embedpress'); ?>
217 </a>
218 </div>
219 <?php endif; ?>
220 </div>
221 <div class="tab-container">
222 <div class="calendly-Event-button tab active-tab" onclick="showTab('event-types')">Event Types</div>
223 <!-- Scheduled Events Tab -->
224 <div class="calendly-Scheduled-button tab" onclick="showTab('scheduled-events')">Scheduled Events</div>
225 </div>
226
227 </div>
228
229 <!-- Event Types Content -->
230 <div class="tab-content active" id="event-types">
231 <div class="event-type-list">
232 <div class="event-type-group-list">
233 <div class="event-type-group-list-item user-item">
234
235 <div class="list-header">
236 <?php if ($is_calendly_connected) : ?>
237 <?php if (!empty($avatarUrl)) : ?>
238 <div class="calendly-profile-avatar">
239 <img src="<?php echo esc_url($avatarUrl); ?>" alt="<?php echo esc_attr($name); ?>">
240 </div>
241 <?php endif; ?>
242 <div class="calendly-user">
243 <div class="KF8rYwhNst0H6JyJ1_kq">
244 <span>
245 <p style="color: currentcolor;"><?php echo esc_html($name); ?></p>
246 </span>
247 </div>
248 <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url($schedulingUrl); ?>">
249 <span><?php echo esc_html($schedulingUrl); ?></span>
250 </a>
251 </div>
252 <?php else : ?>
253 <?php echo esc_html__('Events', 'embedpress'); ?>
254 <?php endif; ?>
255 </div>
256 <div class="calendly-data<?php if (!is_embedpress_pro_active()) : echo '-placeholder';
257 endif; ?>">
258
259 <div class="event-type-card-list">
260 <?php
261 if (is_array($event_types) && isset($event_types['collection']) && count($event_types['collection']) > 0) :
262 foreach ($event_types['collection'] as $item) :
263 $status = 'In-active';
264 if (!empty($item['active'])) {
265 $status = 'Active';
266 }
267 ?>
268 <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']); ?>;">
269 <div class="event-type-card">
270 <div class="event-type-card-top">
271 <h2><?php echo esc_html($item['name']); ?></h2>
272 <p>30 mins, One-on-One</p>
273 <a target="_blank" href="<?php echo esc_url($item['scheduling_url']); ?>"><?php echo esc_html__('View booking page', 'embedpress'); ?></a>
274 </div>
275 <div class="event-type-card-bottom">
276 <div class="calendly-event-copy-link" data-event-link="<?php echo esc_url($item['scheduling_url']); ?>">
277 <svg width="40" height="40" viewBox="0 0 0.75 0.75" fill="none" xmlns="http://www.w3.org/2000/svg">
278 <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>
279 <span><?php echo esc_html__('Copy link', 'embedpress'); ?></span>
280 </div>
281 <div class="event-status <?php echo esc_attr($status); ?>">
282 <?php echo esc_html($status); ?>
283 </div>
284 </div>
285 </div>
286
287 </div>
288 <?php
289 endforeach;
290 elseif (is_embedpress_pro_active() && !$is_calendly_connected) :
291 echo esc_html__('Please connect with calendly', 'embedpress');
292 elseif (is_embedpress_pro_active() && $is_calendly_connected && isset($event_types['collection']) && count($event_types['collection']) < 1) :
293 echo esc_html__('Calendly has no events.', 'embedpress');
294 endif;
295
296 ?>
297 </div>
298
299 <?php if (!is_embedpress_pro_active()) : ?>
300 <div class="overlay">
301 <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>
302 </div>
303 <?php endif; ?>
304 </div>
305 </div>
306 </div>
307
308 </div>
309 </div>
310
311 <!-- Scheduled Events Content -->
312 <div class="tab-content" id="scheduled-events">
313
314 <div class="calendly-day-list">
315 <div class="calendly-data<?php if (!is_embedpress_pro_active()) : echo '-placeholder';
316 endif; ?>">
317 <table class="rwd-table" cellspacing="0">
318 <tbody>
319 <tr>
320 <th>Date & Time</th>
321 <th>Event Type</th>
322 <th>Attendee</th>
323 <th>Scheduled</th>
324 <th>Status</th>
325 </tr>
326 <?php
327 $index = 0;
328 $current_datetime = new DateTime(); // Get the current date and time
329
330 $upcoming_events = [];
331 $past_events = [];
332
333 if (is_array($scheduled_events) && isset($scheduled_events['collection']) && count($scheduled_events) > 0) {
334 foreach ($scheduled_events['collection'] as $event) {
335 $uuid = getCalendlyUuid($event['uri']);
336
337
338 $name = isset($invtitees_list[$uuid]['collection'][$index]['name']) ? $invtitees_list[$uuid]['collection'][$index]['name'] : null;
339
340 // Convert event start and end times to DateTime objects
341 $start_time = new DateTime($event['start_time']);
342 $end_time = new DateTime($event['end_time']);
343
344 // Check if the event is in the past or upcoming
345 $is_past_event = $end_time < $current_datetime;
346
347 // Categorize events into upcoming and past
348 if ($is_past_event) {
349 $past_events[] = [
350 'event' => $event,
351 'name' => $name,
352 ];
353 } else {
354 $upcoming_events[] = [
355 'event' => $event,
356 'name' => $name,
357 ];
358 }
359 }
360 }
361
362 // Sort upcoming events by start time
363 usort($upcoming_events, function ($a, $b) {
364 return strtotime($a['event']['start_time']) - strtotime($b['event']['start_time']);
365 });
366
367 // Sort past events by start time in descending order
368 usort($past_events, function ($a, $b) {
369 return strtotime($b['event']['start_time']) - strtotime($a['event']['start_time']);
370 });
371
372 // Merge upcoming and past events for display
373 $sorted_events = array_merge($upcoming_events, $past_events);
374
375
376 if (is_array($sorted_events) && count($sorted_events) > 0) :
377 foreach ($sorted_events as $event_data) :
378 $event = $event_data['event'];
379 $name = $event_data['name'];
380
381 // Convert event start and end times to DateTime objects
382 $start_time = new DateTime($event['start_time']);
383 $end_time = new DateTime($event['end_time']);
384
385 // Check if the event is in the past or upcoming
386 $is_past_event = $end_time < $current_datetime;
387 ?>
388
389 <tr>
390 <td class="event-time">
391 <small><?php echo esc_html(date('D, j M Y', strtotime($event['start_time']))); ?><br></small>
392 <?php echo esc_html(date('h:ia', strtotime($event['start_time'])) . ' - ' . date('h:ia', strtotime($event['end_time']))); ?>
393 </td>
394 <td class="event-info">
395 <?php echo esc_html($event['name']); ?>
396 </td>
397 <td class="attendee">
398 <?php echo esc_html($name); ?>
399 </td>
400 <td class="event-action">
401 <?php echo $is_past_event ? 'Past' : 'Upcoming'; ?>
402 </td>
403 <td class="scheduled-status">
404 <?php echo esc_html( ucfirst($event['status']) ); ?>
405 </td>
406 </tr>
407
408 <?php endforeach;
409 endif; ?>
410
411 </tbody>
412 </table>
413
414 <?php
415 if (is_embedpress_pro_active() && !$is_calendly_connected) :
416 echo '<br>' . esc_html__('Please connect with calendly', 'embedpress');
417 elseif (is_embedpress_pro_active() && $is_calendly_connected && count($sorted_events) < 1) :
418 echo esc_html__('Calendly has no schedule.', 'embedpress');
419 endif;
420 ?>
421
422 <?php if (!is_embedpress_pro_active()) : ?>
423 <div class="overlay">
424 <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>
425 </div>
426 <?php endif; ?>
427 </div>
428 </div>
429 </div>
430
431 <script>
432 // JavaScript function to switch between tabs
433 function showTab(tabId) {
434 const tabs = document.querySelectorAll('.tab');
435 const tabContents = document.querySelectorAll('.tab-content');
436
437 // Hide all tab contents
438 tabContents.forEach(content => {
439 content.classList.remove('active');
440 });
441
442 // Deactivate all tabs
443 tabs.forEach(tab => {
444 tab.classList.remove('active-tab');
445 });
446
447 // Activate the selected tab
448 document.getElementById(tabId).classList.add('active');
449 event.currentTarget.classList.add('active-tab');
450 }
451 </script>
452
453
454
455 </div>