PluginProbe
Booking Calendar / 11.8.2
Booking Calendar v11.8.2
11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 All 202 releases
booking / core / admin / wpbc-dashboard.php

wpbc-dashboard.php in Booking Calendar 11.8.2, at core/admin/wpbc-dashboard.php

943 lines 38.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking Calendar
4 * @category Admin Panel - Dashboard functions
5 * @author wpdevelop
6 *
7 * @web-site https://wpbookingcalendar.com/
8 * @email info@wpbookingcalendar.com
9 *
10 * @modified 2016-03-16
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly
14
15
16 /**
17 * Get number of bookings for different parameters
18 *
19 * @return int[]
20 */
21 function wpbc_db_dashboard_get_bookings_count_arr(){
22
23
24 // <editor-fold defaultstate="collapsed" desc=" Get bookings for counting number of specific bookings " >
25 $my_resources = array();
26 if ( class_exists( 'wpdev_bk_multiuser' ) ) {
27 $is_superadmin = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' );
28 if ( ! $is_superadmin ) {
29
30 $bk_ids = apply_bk_filter( 'get_bk_resources_of_user', false );
31
32 if ( $bk_ids !== false ) {
33 foreach ( $bk_ids as $bk_id ) {
34 $my_resources[] = $bk_id->ID;
35 }
36 }
37 }
38 }
39 $my_resources = implode( ',', $my_resources );
40
41 global $wpdb;
42
43 $trash_bookings = ' bk.trash != 1 '; //FixIn: 6.1.1.10 - check also below usage of {$trash_bookings}
44
45 $sql_req = "SELECT DISTINCT bk.booking_id as id, dt.approved, dt.booking_date, bk.modification_date as m_date , bk.is_new as new
46 FROM {$wpdb->prefix}bookingdates as dt
47 INNER JOIN {$wpdb->prefix}booking as bk
48 ON bk.booking_id = dt.booking_id "
49 . " WHERE {$trash_bookings} " ;
50 if ($my_resources!='') $sql_req .= " AND bk.booking_type IN ({$my_resources}) ";
51
52 $sql_req .= "ORDER BY dt.booking_date" ;
53 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
54 $sql_results = $wpdb->get_results( $sql_req );
55
56 // </editor-fold>
57
58
59 // <editor-fold defaultstate="collapsed" desc=" Count bookings " >
60 $bk_array = array();
61 if ( ! empty( $sql_results ) )
62 foreach ( $sql_results as $v ) {
63
64 if ( !isset( $bk_array[$v->id] ) )
65 $bk_array[$v->id] = array(
66 'dates' => array()
67 , 'check_in_date' => array()
68 , 'check_out_date' => array()
69 , 'bk_today' => 0
70 , 'm_today' => 0
71 );
72 $bk_array[$v->id]['id'] = $v->id;
73 $bk_array[$v->id]['approved'] = $v->approved;
74 $bk_array[$v->id]['dates'][] = $v->booking_date;
75
76 if ( intval( substr( $v->booking_date, -1 ) ) == 1 ) {
77 $bk_array[$v->id]['check_in_date'][] = $v->booking_date;
78 }
79 if ( intval( substr( $v->booking_date, -1 ) ) == 2 ) {
80 $bk_array[$v->id]['check_out_date'][] = $v->booking_date;
81 }
82 $bk_array[$v->id]['m_date'] = $v->m_date; // Modification Booking date
83 $bk_array[$v->id]['new'] = $v->new;
84 if ( wpbc_is_today_date( $v->booking_date ) ) {
85 $bk_array[ $v->id ]['bk_today'] = 1;
86 }
87 if ( wpbc_is_today_date( $v->m_date ) ) {
88 $bk_array[ $v->id ]['m_today'] = 1;
89 }
90 }
91
92 $counter = array(
93 'all' => 0
94 , 'new' => 0
95 , 'pending' => 0
96 , 'approved' => 0
97 , 'booking_today' => 0
98 , 'was_made_today' => 0
99 , 'check_in_today' => 0
100 , 'check_out_today' => 0
101 , 'check_in_tomorrow' => 0
102 , 'check_out_tomorrow' => 0
103 );
104 foreach ( $bk_array as $k => $v ) {
105
106 $counter['all']++;
107 if ( $v['new'] ) {
108 $counter['new'] ++;
109 }
110 if ( $v['m_today'] ) {
111 $counter['was_made_today'] ++;
112 }
113 if ( $v['bk_today'] ) {
114 $counter['booking_today'] ++;
115 }
116 if ( $v['approved'] ) {
117 $counter['approved'] ++;
118 } else {
119 $counter['pending'] ++;
120 }
121
122
123 // Check in
124 if ( ! empty( $v['check_in_date'] ) ) {
125 foreach ( $v['check_in_date'] as $check_in ) {
126 if ( wpbc_is_today_date( $check_in ) ) {
127 $counter['check_in_today']++;
128 }
129 if ( wpbc_is_tomorrow_date( $check_in ) ) {
130 $counter['check_in_tomorrow']++;
131 }
132 }
133 } else {
134 $check_in = $v['dates'][0];
135 if ( wpbc_is_today_date( $check_in ) ) {
136 $counter['check_in_today']++;
137 }
138 if ( wpbc_is_tomorrow_date( $check_in ) ) {
139 $counter['check_in_tomorrow']++;
140 }
141 }
142 // Check out
143 if ( ! empty( $v['check_out_date'] ) ) {
144 foreach ( $v['check_out_date'] as $check_out ) {
145 if ( wpbc_is_today_date( $check_out ) ) {
146 $counter['check_out_today']++;
147 }
148 if ( wpbc_is_tomorrow_date( $check_out ) ) {
149 $counter['check_out_tomorrow']++;
150 }
151 }
152 } else {
153 $check_out = $v['dates'][ ( count( $v['dates'] ) - 1 ) ];
154 if ( wpbc_is_today_date( $check_out ) ) {
155 $counter['check_out_today']++;
156 }
157 if ( wpbc_is_tomorrow_date( $check_out ) ) {
158 $counter['check_out_tomorrow']++;
159 }
160 }
161
162 }
163 // </editor-fold>
164
165
166 return $counter;
167 }
168
169
170 ////////////////////////////////////////////////////////////////////////////////
171 // D a s h b o a r d W i d g e t
172 ////////////////////////////////////////////////////////////////////////////////
173
174 /** Setup Widget for Dashboard */
175 function wpbc_dashboard_widget_setup(){
176
177 // Check, if we have permission to show Widget ///////////////////////////
178 $is_user_activated = apply_bk_filter('multiuser_is_current_user_active', true ); // FixIn: 6.0.1.17.
179 if ( ! $is_user_activated )
180 return false;
181
182 $user_role = get_bk_option( 'booking_user_role_booking' );
183 if ( ! wpbc_is_current_user_have_this_role( $user_role ) )
184 return false;
185
186
187 // Add Booking Calendar Widget to Dashboard ///////////////////////////////
188 $bk_dashboard_widget_id = 'booking_dashboard_widget';
189 wp_add_dashboard_widget( $bk_dashboard_widget_id, sprintf( __( 'Booking Calendar', 'booking' ) ), 'wpbc_dashboard_widget_show', null );
190
191
192 // Sort Dashboard. Add Booking Calendar widget to top ///////////////////////
193 global $wp_meta_boxes;
194 $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
195 if ( isset( $normal_dashboard[$bk_dashboard_widget_id] ) ) {
196 // Backup and delete our new dashbaord widget from the end of the array
197 $example_widget_backup = array( $bk_dashboard_widget_id => $normal_dashboard[$bk_dashboard_widget_id] );
198 unset( $normal_dashboard[$bk_dashboard_widget_id] );
199 } else
200 $example_widget_backup = array();
201
202 // Sometimes, some other plugins can modify this item, so its can be not a array
203 if ( is_array( $normal_dashboard ) ) {
204 // Merge the two arrays together so our widget is at the beginning
205 if ( is_array( $normal_dashboard ) )
206 $sorted_dashboard = array_merge( $example_widget_backup, $normal_dashboard );
207 else
208 $sorted_dashboard = $example_widget_backup;
209 // Save the sorted array back into the original metaboxes
210 $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
211 }
212 }
213 add_action( 'wp_dashboard_setup', 'wpbc_dashboard_widget_setup' );
214
215
216 /** Show Booking Dashboard Widget content */
217 function wpbc_dashboard_widget_show() {
218
219 $is_panel_visible = wpbc_is_dismissed_panel_visible( 'wpbc_dashboard_section_statistic' ); // FixIn: 9.9.0.8.
220 $counter = $is_panel_visible ? wpbc_db_dashboard_get_bookings_count_arr() : array();
221
222 wpbc_dashboard_widget_css();
223
224 ?>
225 <div id="wpbc_dashboard_widget_container" ><?php
226
227
228 wpbc_dashboard_section_statistic( $counter );
229
230 ?><div style="clear:both;"></div><?php
231 wpbc_dashboard_section_version();
232
233 wpbc_dashboard_section_support();
234 ?><div style="clear:both;margin-bottom:20px;"></div><?php
235
236 wpbc_dashboard_section_news();
237
238 /*
239 ?><div style="clear:both;"></div><?php
240
241
242 wpbc_dashboard_section_video_f();
243
244 wpbc_dashboard_section_video_p();
245 */
246
247
248 ?><div style="clear:both;"></div>
249
250 </div>
251 <div style="clear:both;"></div>
252 <?php
253 }
254
255
256 /** Get Info for Dashboard */
257 function wpbc_get_dashboard_info() {
258
259 ob_start();
260
261 wpbc_dashboard_widget_show();
262
263 return ob_get_clean();
264 }
265
266
267 /** CSS for Dashboard Widget */
268 function wpbc_dashboard_widget_css() {
269
270 ?><style type="text/css">
271 #wpbc_dashboard_widget_container {
272 width:100%;
273 }
274 #wpbc_dashboard_widget_container .wpbc_dashboard_section {
275 float:left;
276 margin:0px;
277 padding:0px;
278 width:49%;
279 }
280 #wpbc_dashboard_widget_container .wpbc_dashboard_section h4 {
281 font-size: 14px;
282 font-weight: 600;
283 margin: 5px 0 15px;
284 }
285 #bk_upgrade_section p {
286 font-size: 13px;
287 line-height: 1.5em;
288 margin: 15px 0 0;
289 padding: 0;
290 }
291 #dashboard-widgets-wrap #wpbc_dashboard_widget_container .wpbc_dashboard_section {
292 width:49%;
293 }
294 #dashboard-widgets-wrap #wpbc_dashboard_widget_container .bk_right {
295 float:right
296 }
297 #dashboard-widgets-wrap #wpbc_dashboard_widget_container .border_orrange,
298 #wpbc_dashboard_widget_container .border_orrange {
299 background: #fffaf1 none repeat scroll 0 0;
300 border-left: 3px solid #eeab26;
301 clear: both;
302 margin: 5px 5px 20px;
303 padding: 10px 0;
304 width: 99%;
305 }
306 #wpbc_dashboard_widget_container .bk_header {
307 color: #555555;
308 font-size: 13px;
309 font-weight: 600;
310 line-height: 1em;
311 /* //FixIn: 8.1.3.10 */
312 padding:0 5px;
313 }
314 #wpbc_dashboard_widget_container .bk_table {
315 background:transparent;
316 /*border-bottom:none;*/
317 /*border-top:1px solid #ECECEC;*/
318 margin:6px 0 10px 6px;
319 padding:2px 10px;
320 width:95%;
321 -border-radius:4px;
322 -moz-border-radius:4px;
323 -webkit-border-radius:4px;
324 /*-moz-box-shadow:0 0 2px #C5C3C3;*/
325 /*-webkit-box-shadow:0 0 2px #C5C3C3;*/
326 /*-box-shadow:0 0 2px #C5C3C3;*/
327 border:none;
328 box-shadow:none;
329 }
330 #wpbc_dashboard_widget_container .bk_table td{
331 border-bottom:1px solid #DDDDDD;
332 line-height:19px;
333 padding:4px 0px 4px 10px;
334 font-size:13px;
335 }
336 #wpbc_dashboard_widget_container .bk_table tr td.first{
337 text-align:center;
338 padding:4px 0px;
339 }
340 #wpbc_dashboard_widget_container .bk_table tr td a {
341 text-decoration: none;
342 }
343 #wpbc_dashboard_widget_container .bk_table tr td a span{
344 font-size:18px;
345 font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
346 }
347 #wpbc_dashboard_widget_container .bk_table td.bk_spec_font a{
348 font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
349 font-size:14px;
350 }
351 #wpbc_dashboard_widget_container .bk_table td.bk_spec_font {
352 font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
353 font-size:13px;
354 }
355 #wpbc_dashboard_widget_container .bk_table td.pending a{
356 color:#E66F00;
357 }
358 #wpbc_dashboard_widget_container .bk_table td.new-bookings a{
359 color:red;
360 }
361 #wpbc_dashboard_widget_container .bk_table td.actual-bookings a{
362 color:green;
363 }
364 #bk_errror_loading {
365 text-align: center;
366 font-style: italic;
367 font-size:11px;
368 }
369 #wpbc_dashboard_widget_container .bk_table tr:last-child td {
370 border:none;
371 }
372 </style><?php
373 }
374
375
376
377
378 ////////////////////////////////////////////////////////////////////////////////
379 // S e c t i o n s
380 ////////////////////////////////////////////////////////////////////////////////
381
382 // FixIn: 8.1.3.11.
383 /** Dashboard Section - Video 1 */
384 function wpbc_dashboard_section_video_f() {
385 return;
386 ?>
387 <div id='wpbc_dashboard_section_video_f' class="wpbc_dashboard_section bk_left">
388 <span class="bk_header"><?php esc_html_e('Video guide' ,'booking'); ?> (free):</span>
389 <?php wpbc_is_dismissed( 'wpbc_dashboard_section_video_f' ); //FixIn: 8.1.3.10 ?>
390 <?php // Free ?>
391 <div style="text-align: center;margin:10px 0;"><iframe style="width:90%;height:auto;" src="https://www.youtube.com/embed/videoseries?list=PLabuVtqCh9dwLA5cpz1p2RrZOitLuVupR&amp;start=28&amp;rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
392 </div>
393 <?php
394 }
395
396 // FixIn: 8.1.3.11.
397 /** Dashboard Section - Video 2 */
398 function wpbc_dashboard_section_video_p() {
399 return;
400 ?>
401 <div id='wpbc_dashboard_section_video_p' class="wpbc_dashboard_section bk_right">
402 <?php wpbc_is_dismissed( 'wpbc_dashboard_section_video_p' ); //FixIn: 8.1.3.10 ?>
403 <span class="bk_header"><?php esc_html_e('Video guide' ,'booking'); ?> (premium):</span>
404 <?php // Premium ?>
405 <div style="text-align: center;margin:10px 0;"><iframe style="width:90%;height:auto;" src="https://www.youtube.com/embed/videoseries?list=PLabuVtqCh9dyc_EO8L_1FKJyLpBuIv21_&amp;rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
406 </div>
407 <?php
408 }
409
410 /** Dashboard Support Section */
411 function wpbc_dashboard_section_support() {
412 ?>
413 <div id="wpbc_dashboard_section_support" class="wpbc_dashboard_section bk_right">
414 <span class="bk_header"><?php esc_html_e('Support' ,'booking'); ?>:</span>
415 <?php wpbc_is_dismissed( 'wpbc_dashboard_section_support', array( 'css' => 'padding: 0 20px;' ) ); //FixIn: 8.1.3.10 ?>
416 <?php /* ?>
417 <?php // Free ?>
418 <div style="text-align: center;margin:10px 0;"><iframe style="width:90%;height:auto;" src="https://www.youtube.com/embed/videoseries?list=PLabuVtqCh9dwLA5cpz1p2RrZOitLuVupR&amp;start=28&amp;rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
419 <?php // Premium ?>
420 <div style="text-align: center;margin:10px 0;"><iframe style="width:90%;height:auto;" src="https://www.youtube.com/embed/videoseries?list=PLabuVtqCh9dyc_EO8L_1FKJyLpBuIv21_&amp;rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
421 <?php */ ?>
422 <table class="bk_table">
423 <tr class="first">
424 <td style="text-align:center;" class="bk_spec_font"><a href="<?php echo 'https://wpbookingcalendar.com/faq/#using'; //echo esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-getting-started' ), 'index.php' ) ) ); ?>"
425 ><?php esc_html_e('Getting Started' ,'booking'); ?></a>
426 </td>
427 </tr>
428 <tr>
429 <td style="text-align:center;" class="bk_spec_font"><a target="_blank" href="https://wpbookingcalendar.com/wn/"><?php esc_html_e('What\'s New' ,'booking'); ?></a></td>
430 </tr>
431 <?php if ( class_exists('wpdev_bk_personal') ){ ?>
432 <tr>
433 <td style="text-align:center;" class="bk_spec_font"><a target="_blank" href="https://wpbookingcalendar.com/request-update/"><?php esc_html_e('Request Update' ,'booking'); ?></a></td>
434 </tr>
435 <?php } ?>
436 <tr>
437 <td style="text-align:center;" class="bk_spec_font"><a target="_blank" href="https://wpbookingcalendar.com/faq/"><?php esc_html_e('FAQ' ,'booking'); ?></a></td>
438 </tr>
439 <tr>
440 <td style="text-align:center;" class="bk_spec_font"><a href="mailto:support@wpbookingcalendar.com"><?php esc_html_e('Contact email' ,'booking'); ?></a></td>
441 </tr>
442 <tr>
443 <td style="text-align:center;" class="bk_spec_font"><a target="_blank" href="https://wordpress.org/plugins/booking/"><?php esc_html_e('Rate plugin (thanks:)' ,'booking'); ?></a></td>
444 </tr>
445 </table>
446 </div>
447 <?php
448 }
449
450
451 /** Dashboard News Section */
452 function wpbc_dashboard_section_news() {
453
454 ?><div id="wpbc_dashboard_section_news"><?php
455
456 wp_nonce_field( 'wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce_dashboard", true, true ); // Nonce for Ajax
457
458 ?>
459 <div style="width:95%;border:none;clear:both;margin:10px 6px;" id="bk_news_section">
460 <div style="width: 99%;margin-right:0;" >
461 <span class="bk_header" style="padding: 0;">Booking Calendar News:</span><?php
462
463 $is_panel_visible = wpbc_is_dismissed( 'wpbc_dashboard_section_news' ); // FixIn: 10.10.3.1.
464 if ( $is_panel_visible ) {
465 ?><br/><br/>
466 <div id="bk_news" class="rssSummary"> <span style="font-size:13px;text-align:center;">Loading...</span></div>
467 <div id="ajax_bk_respond" class="rssSummary" style="display:none;"></div>
468 <script type="text/javascript">
469 jQuery.ajax({
470 url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
471 type:'POST',
472 success: function (data, textStatus){ if( textStatus == 'success' ) jQuery('#ajax_bk_respond').html( data ); },
473 error: function (XMLHttpRequest, textStatus, errorThrown){ window.status = 'Ajax sending Error status:' + textStatus; },
474 data:{
475 action: 'CHECK_BK_NEWS',
476 wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce_dashboard').value
477 }
478 });
479 </script>
480 <?php } ?>
481 </div>
482 </div>
483
484 </div>
485 <?php
486 }
487
488
489 function wpbc_dashboard_info_get_version_type(){
490 $version = 'free';
491 $version = wpbc_get_plugin_version_type();
492 if ( wpbc_is_this_demo() ) {
493 $version = 'free';
494 }
495 return $version;
496 }
497
498 function wpbc_dashboard_info_get_version_type_readable() {
499
500 $ver = wpbc_get_plugin_version_type();
501 if ( class_exists( 'wpdev_bk_multiuser' ) ) {
502 $ver = 'multiUser';
503 }
504 $ver = str_replace( '_m', ' Medium', $ver );
505 $ver = str_replace( '_l', ' Large', $ver );
506 $ver = str_replace( '_s', ' Small', $ver );
507 $ver = str_replace( 'biz', 'Business', $ver );
508 $ver = ucwords( $ver );
509 return $ver;
510 }
511
512 function wpbc_dashboard_info_get_version_type_sites() {
513
514 $json_version = wpbc_get_json_property_from_meta( 'max usage' );
515 if ( ! empty( $json_version ) ) {
516 // $json_edition = wpbc_get_json_property_from_meta( 'edition' ); if ( ! empty( $json_edition ) ) { $json_version = $json_version . ' | ' . $json_edition; }
517 return $json_version;
518 }
519
520 $v_type = '';
521 if ( false !== strpos( strtolower( WPDEV_BK_VERSION ), 'multisite' ) ) {
522 $v_type = '5';
523 } else if ( false !== strpos( strtolower( WPDEV_BK_VERSION ), 'develop' ) ) {
524 $v_type = '2';
525 }
526
527 if ( ! empty( $v_type ) ) {
528 return ' ' . $v_type . ' ' . __( 'websites', 'booking' );
529 } else {
530 return ' 1' . ' ' . __( 'website', 'booking' );
531 }
532 }
533
534 function wpbc_dashboard_info_get_version_number() {
535
536 if ( substr( WPDEV_BK_VERSION, 0, 3 ) == '11.' ) {
537
538 $show_version = substr( WPDEV_BK_VERSION, 3 );
539
540 if ( ( '' === trim( $show_version ) ) || ( '0' === trim( $show_version ) ) ) {
541 return esc_attr( WP_BK_VERSION_NUM );
542 }
543
544 if ( substr( $show_version, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) ) ) === WP_BK_VERSION_NUM ) {
545 $show_version = substr( $show_version, 0, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) - 1 ) );
546 $show_version = str_replace( '.', ' ', $show_version ) . " <sup><strong style='font-size:12px;'>" . esc_attr( WP_BK_VERSION_NUM ) . "</strong></sup>";
547 }
548 return $show_version;
549 } else {
550 return WPDEV_BK_VERSION;
551 }
552 }
553
554
555 /** Dashboard Version Section */
556 function wpbc_dashboard_section_version() {
557
558
559 $version = wpbc_dashboard_info_get_version_type();
560
561 /*
562
563 Disbale hidded notice about Upgrade to higher version in paid versions
564 // FixIn: 8.0.1.6.
565 if ( ( $version !== 'free' ) && ( class_exists('wpdev_bk_multiuser') === false ) ) { ?>
566 <div class="wpbc_dashboard_section border_orrange" id="bk_upgrade_section">
567 <div style="padding:0px 10px;width:96%;">
568 <h4><?php esc_html_e('Upgrade to higher versions' , 'booking' ); ?>:</h4>
569 <p>Check additional advanced functionality, which exist in higher versions and can be interesting for you <a href="https://wpbookingcalendar.com/features/" target="_blank">here &raquo;</a></p>
570 <p><a class="button button-primary" style="margin-top: 10px;font-weight: 600;" href="<?php echo wpbc_up_link(); ?>" target="_blank"><?php if ( wpbc_get_ver_sufix() == '' ) { esc_html_e('Purchase' ,'booking'); } else { esc_html_e('Upgrade Now' ,'booking'); } ?></a> </p>
571 </div>
572 </div>
573 <div style="clear:both;"></div>
574 <?php if ( wpbc_get_ver_sufix() != '' ) { ?>
575 <script type="text/javascript">
576 jQuery(document).ready(function(){
577 jQuery('#bk_upgrade_section').animate({opacity:1},7000).fadeOut(2000);
578 });
579 </script>
580 <?php } ?>
581 <?php }
582 */
583 ?>
584 <div id="wpbc_dashboard_section_current_version" class="wpbc_dashboard_section" >
585 <span class="bk_header"><?php esc_html_e('Current version' ,'booking'); ?>:</span>
586 <table class="bk_table">
587 <?php if ( wpbc_is_this_demo() ) { ?>
588 <tr class="first">
589 <td></td>
590 <td style="font-weight: 600; text-align: left;"><?php esc_html_e('Demo' ,'booking'); ?></td>
591 </tr>
592 <?php } ?>
593 <tr class="first">
594 <td style="width:35%;text-align: right;;" class=""><?php esc_html_e('Version' ,'booking'); ?>:</td>
595 <td style="color: #e50;font-size: 13px;font-weight: 600;text-align: left;text-shadow: 0 -1px 0 #eee;;"
596 class="bk_spec_font"><?php
597 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
598 echo wpbc_dashboard_info_get_version_number();
599
600 ?></td>
601 </tr>
602 <?php if ($version != 'free') { ?>
603 <tr>
604 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Type' ,'booking'); ?>:</td>
605 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
606 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
607 echo wpbc_dashboard_info_get_version_type_readable();
608 ?></td>
609 </tr>
610 <tr>
611 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Used for' ,'booking'); ?>:</td>
612 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
613 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
614 echo wpbc_dashboard_info_get_version_type_sites();
615 ?></td>
616 </tr>
617 <?php } ?>
618 <tr>
619 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Release date' ,'booking'); ?>:</td>
620 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
621 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
622 echo wpbc_date_localized( gmdate( 'Y-m-d', filemtime( WPBC_FILE ) ) );
623 ?></td>
624 </tr>
625 </table>
626 <div id="wpbc_dashboard_section_current_version_upgrade">
627
628 <table class="bk_table" style="border:none;">
629 <tr>
630 <td colspan="2" style="border:none;text-align:center;" class=""><?php
631 ?><?php wpbc_is_dismissed( 'wpbc_dashboard_section_current_version_upgrade' , array( 'css' => 'padding: 0 0px;' ) ); //FixIn: 8.1.3.10 ?><?php
632 if ($version == 'free') {
633 ?><a class="button-primary button" style="font-weight:600;" target="_blank" href="https://wpbookingcalendar.com/features/"><?php esc_html_e('Check Premium Features' ,'booking'); ?></a><?php
634 } elseif ( wpbc_get_ver_sufix() != '' ) {
635 ?><a class="button-primary button" href="<?php echo esc_url( wpbc_get_settings_url() . '&tab=upgrade' ); ?>"><?php esc_html_e('Upgrade' ,'booking'); ?></a><?php
636 } else {
637 ?><a class="button-primary button" target="_blank" href="https://wpbookingcalendar.com/features/"><?php esc_html_e('Explore Premium Features' ,'booking'); ?></a><?php
638 }
639 ?></td>
640 </tr>
641 </table>
642 </div>
643 </div>
644
645 <?php
646 }
647
648
649 /** Dashboard Statistic Section */
650 function wpbc_dashboard_section_statistic( $counter ) {
651 // FixIn: 9.3.1.7.
652 $bk_admin_url = wpbc_get_bookings_url() . '&wh_approved=';
653 ?>
654 <div id='wpbc_dashboard_section_statistic'>
655 <?php
656 $is_panel_visible = wpbc_is_dismissed( 'wpbc_dashboard_section_statistic' ); // FixIn: 9.9.0.8.
657 if ( $is_panel_visible ) {
658 ?>
659 <div class="wpbc_dashboard_section bk_right">
660 <span class="bk_header"><?php esc_html_e('Statistic' ,'booking'); ?>:</span>
661 <table class="bk_table">
662 <tr>
663 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>"><span><?php echo esc_html( $counter['booking_today'] ); ?></span></a> </td>
664 <td class="actual-bookings"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Bookings for today' ,'booking'); ?></a> </td>
665 </tr>
666 <tr class="first">
667 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_modification_date[]=1&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>"><span><?php echo esc_html( $counter['was_made_today'] ); ?></span></a> </td>
668 <td class="new-bookings"><a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_modification_date[]=1&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('New booking(s) made today' ,'booking'); ?></a> </td>
669 </tr>
670 <tr class="first">
671 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_what_bookings=new&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['new'] ); ?></span></a> </td>
672 <td class=""> <a href="<?php echo esc_url( $bk_admin_url.'&wh_what_bookings=new&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>"><?php esc_html_e('New (unverified) booking(s)' ,'booking'); ?></a></td>
673 </tr>
674 <tr>
675 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_approved=0&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['pending'] ); ?></span></a></td>
676 <td class="pending"><a href="<?php echo esc_url( $bk_admin_url.'&wh_approved=0&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Pending booking(s)' ,'booking'); ?></a></td>
677 </tr>
678 </table>
679 </div>
680 <div class="wpbc_dashboard_section" >
681 <span class="bk_header"><?php esc_html_e('Agenda' ,'booking'); ?>:</span>
682 <table class="bk_table">
683 <tr>
684 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=10&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['check_in_today'] ); ?></span></a></td>
685 <td class="pending"><a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=10&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Check in - Today', 'booking'); ?></a></td>
686 </tr>
687 <tr>
688 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=11&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['check_out_today'] ); ?></span></a></td>
689 <td class=""><a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=11&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Check out - Today', 'booking'); ?></a></td>
690 </tr>
691 <tr>
692 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=7&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['check_in_tomorrow'] ); ?></span></a></td>
693 <td class="new-bookings"><a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=7&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Check in - Tomorrow', 'booking'); ?></a></td>
694 </tr>
695 <tr>
696 <td class="first"> <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=8&tab=vm_booking_listing&overwrite=1' ); ?>"><span class=""><?php echo esc_html( $counter['check_out_tomorrow'] ); ?></span></a></td>
697 <td class="actual-bookings"><a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=8&tab=vm_booking_listing&overwrite=1' ); ?>" class=""><?php esc_html_e('Check out - Tomorrow', 'booking'); ?></a></td>
698 </tr>
699
700 </table>
701 </div>
702 <?php } ?>
703 </div>
704 <?php
705 }
706
707
708 // ---------------------------------------------------------------------------------------------------------------------
709 // 9.8
710 // ---------------------------------------------------------------------------------------------------------------------
711
712 /** Get Flex Dashboard */
713 function wpbc_get_flex_dashboard_info() {
714
715 ob_start();
716
717 wpbc_flex_dashboard_show();
718
719 return ob_get_clean();
720 }
721
722
723 /** Show Flex Dashboard Conatiner */
724 function wpbc_flex_dashboard_show(){
725
726 if (
727 ( ! empty( $GLOBALS['pagenow'] ) )
728 && ( is_admin() )
729 && (
730 ( 'index.php' === $GLOBALS['pagenow'] )
731 || (
732 ( 'admin.php' === $GLOBALS['pagenow'] )
733 && ( ! empty( $_GET['page'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
734 && ( 'wpbc-settings' === $_GET['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
735 && ( ( ! isset( $_GET['tab'] ) ) || ( 'general' === $_GET['tab'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
736 )
737 )
738 ) {
739
740 } else {
741 return;
742 }
743
744
745 $is_panel_visible = wpbc_is_dismissed_panel_visible( 'wpbc_dashboard_section_statistic' ); // FixIn: 9.9.0.8.
746
747 $counter = ( $is_panel_visible ) ? wpbc_db_dashboard_get_bookings_count_arr() : array();
748
749 wpbc_flex_dashboard_widget_css();
750
751 ?><div class="wpbc_flex_dashboard_container" ><?php
752
753 wpbc_flex_dashboard_section_statistic( $counter );
754
755 ?></div><?php
756
757 }
758
759
760 /**
761 * CSS for Flex Dashboard
762 * @return void
763 */
764 function wpbc_flex_dashboard_widget_css(){
765
766 ?><style type="text/css">
767 .wpbc_flex_dashboard_container{
768 display: flex;
769 flex-flow: row wrap;
770 justify-content: space-between;
771 align-items: center;
772 }
773 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item{
774 flex: 1 1 auto;
775 display: flex;
776 flex-flow: row wrap;
777 justify-content: center;
778 align-items: center;
779 margin: 0 10px;
780 line-height: 2.1em;
781 }
782 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item:first-child{
783 margin-left: 0;
784 }
785 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item:last-child{
786 margin-right:0;
787 justify-content: flex-end;
788 }
789 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number,
790 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text{
791 flex: 0 1 auto;
792 padding: 0 5px;
793 }
794 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number a,
795 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text a{
796 text-decoration: none;
797 outline:0;
798 }
799 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number span{
800 font-size: 18px;
801 font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
802 }
803 /* Colors */
804 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_new *{
805 /*color: #135e96;*/
806 }
807 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_pending *{
808 color: #E66F00;
809 }
810 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_was_made_today *{
811 color: red;
812 }
813 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_made_for_today *{
814 color: green;
815 }
816 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number.wpbc_flex_dashboard_item_version_number * {
817 color: #2b6900;
818 color: #7812bd;
819 font-size: 11px;
820 text-shadow: none;
821 }
822 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_version_type * {
823 color: #8f8f8f;
824 font-size: 9px;
825 text-shadow: none;
826 }
827 </style><?php
828 }
829
830
831 /**
832 * Flex Dashboard Items
833 *
834 * @param $counter
835 *
836 * @return void
837 */
838 function wpbc_flex_dashboard_section_statistic( $counter ){
839
840 $bk_admin_url = wpbc_get_bookings_url();// . '&wh_approved=';
841
842 if ( ! empty( $counter ) ) {
843
844 // Was made today -----------------------------------------------------------------------------------------------------
845 ?>
846 <div class="wpbc_flex_dashboard_item">
847 <div class="wpbc_flex_dashboard_item_number">
848 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_modification_date[]=1&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>">
849 <span><?php echo esc_html( $counter['was_made_today'] ); ?></span>
850 </a>
851 </div>
852 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_was_made_today">
853 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_modification_date[]=1&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>" class="">
854 <?php esc_html_e('New booking(s) made today' ,'booking');?>
855 </a>
856 </div>
857 </div>
858 <?php
859
860 // For today ---------------------------------------------------------------------------------------------------
861 ?>
862 <div class="wpbc_flex_dashboard_item">
863 <div class="wpbc_flex_dashboard_item_number">
864 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>">
865 <span><?php echo esc_html( $counter['booking_today'] ); ?></span>
866 </a>
867 </div>
868 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_made_for_today">
869 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>" class="">
870 <?php esc_html_e('Booking(s) for today' ,'booking');?>
871 </a>
872 </div>
873 </div>
874 <?php
875
876 // Pending -----------------------------------------------------------------------------------------------------
877 ?>
878 <div class="wpbc_flex_dashboard_item">
879 <div class="wpbc_flex_dashboard_item_number">
880 <a href="<?php echo esc_url( $bk_admin_url.'&wh_approved=0&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>">
881 <span class=""><?php echo esc_html( $counter['pending'] ); ?></span>
882 </a>
883 </div>
884 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_pending">
885 <a href="<?php echo esc_url( $bk_admin_url.'&wh_approved=0&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>" class="">
886 <?php esc_html_e('Pending booking(s)' ,'booking');?>
887 </a>
888 </div>
889 </div>
890 <?php
891
892
893 // New ---------------------------------------------------------------------------------------------------------
894 ?>
895 <div class="wpbc_flex_dashboard_item">
896 <div class="wpbc_flex_dashboard_item_number">
897 <a href="<?php echo esc_url( $bk_admin_url.'&wh_what_bookings=new&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>">
898 <span class=""><?php echo esc_html( $counter['new'] ); ?></span>
899 </a>
900 </div>
901 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_new">
902 <a href="<?php echo esc_url( $bk_admin_url. '&wh_what_bookings=new&wh_trash=0&wh_booking_date[]=3&tab=vm_booking_listing&overwrite=1' ); ?>"> <?php esc_html_e( 'New (unverified) booking(s)', 'booking' ); ?>
903 </a>
904 </div>
905 </div>
906 <?php
907 }
908
909 // Version ---------------------------------------------------------------------------------------------------------
910 ?>
911 <div class="wpbc_flex_dashboard_item">
912 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_version_type">
913 <a href="https://wpbookingcalendar.com/faq/difference-single-developer-multi-site/#<?php
914 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
915 echo esc_attr( wpbc_get_slug_format( trim( wpbc_dashboard_info_get_version_type_readable() . '_' . wpbc_dashboard_info_get_version_type_sites() . '_' . WP_BK_VERSION_NUM ) ) ); ?>">
916 <?php
917 if ( class_exists( 'wpdev_bk_personal' ) ) {
918 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
919 echo wpbc_dashboard_info_get_version_type_readable();
920 }
921 if ( wpbc_is_this_demo() ) {
922 echo ' (Demo)';
923 } else {
924 if ( 'free' != wpbc_dashboard_info_get_version_type() ) {
925 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
926 echo ' (' . __( 'for', 'booking' ) . ' ' . trim( wpbc_dashboard_info_get_version_type_sites() ) . ')';
927 }
928 }
929 ?>
930 </a>
931 </div>
932 <div class="wpbc_flex_dashboard_item_number wpbc_flex_dashboard_item_version_number">
933 <a href="https://wpbookingcalendar.com/changelog/#<?php
934 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
935 echo wpbc_get_slug_format( trim( wpbc_dashboard_info_get_version_type_readable() . '_' . wpbc_dashboard_info_get_version_type_sites() . '_' . WP_BK_VERSION_NUM ) ); ?>">
936 <span class=""><?php echo esc_attr(WP_BK_VERSION_NUM); ?></span>
937 </a>
938 </div>
939 </div>
940 <?php
941
942 }
943