PluginProbe
Booking Calendar / 10.15.7
Booking Calendar v10.15.7
11.8.3 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 All 203 releases
booking / core / admin / wpbc-dashboard.php

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

938 lines 38.2 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 ( substr( $show_version, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) ) ) === WP_BK_VERSION_NUM ) {
541 $show_version = substr( $show_version, 0, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) - 1 ) );
542 $show_version = str_replace( '.', ' ', $show_version ) . " <sup><strong style='font-size:12px;'>" . esc_attr( WP_BK_VERSION_NUM ) . "</strong></sup>";
543 }
544 return $show_version;
545 } else {
546 return WPDEV_BK_VERSION;
547 }
548 }
549
550
551 /** Dashboard Version Section */
552 function wpbc_dashboard_section_version() {
553
554
555 $version = wpbc_dashboard_info_get_version_type();
556
557 /*
558
559 Disbale hidded notice about Upgrade to higher version in paid versions
560 // FixIn: 8.0.1.6.
561 if ( ( $version !== 'free' ) && ( class_exists('wpdev_bk_multiuser') === false ) ) { ?>
562 <div class="wpbc_dashboard_section border_orrange" id="bk_upgrade_section">
563 <div style="padding:0px 10px;width:96%;">
564 <h4><?php esc_html_e('Upgrade to higher versions' , 'booking' ); ?>:</h4>
565 <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>
566 <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>
567 </div>
568 </div>
569 <div style="clear:both;"></div>
570 <?php if ( wpbc_get_ver_sufix() != '' ) { ?>
571 <script type="text/javascript">
572 jQuery(document).ready(function(){
573 jQuery('#bk_upgrade_section').animate({opacity:1},7000).fadeOut(2000);
574 });
575 </script>
576 <?php } ?>
577 <?php }
578 */
579 ?>
580 <div id="wpbc_dashboard_section_current_version" class="wpbc_dashboard_section" >
581 <span class="bk_header"><?php esc_html_e('Current version' ,'booking'); ?>:</span>
582 <table class="bk_table">
583 <?php if ( wpbc_is_this_demo() ) { ?>
584 <tr class="first">
585 <td></td>
586 <td style="font-weight: 600; text-align: left;"><?php esc_html_e('Demo' ,'booking'); ?></td>
587 </tr>
588 <?php } ?>
589 <tr class="first">
590 <td style="width:35%;text-align: right;;" class=""><?php esc_html_e('Version' ,'booking'); ?>:</td>
591 <td style="color: #e50;font-size: 13px;font-weight: 600;text-align: left;text-shadow: 0 -1px 0 #eee;;"
592 class="bk_spec_font"><?php
593 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
594 echo wpbc_dashboard_info_get_version_number();
595
596 ?></td>
597 </tr>
598 <?php if ($version != 'free') { ?>
599 <tr>
600 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Type' ,'booking'); ?>:</td>
601 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
602 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
603 echo wpbc_dashboard_info_get_version_type_readable();
604 ?></td>
605 </tr>
606 <tr>
607 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Used for' ,'booking'); ?>:</td>
608 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
609 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
610 echo wpbc_dashboard_info_get_version_type_sites();
611 ?></td>
612 </tr>
613 <?php } ?>
614 <tr>
615 <td style="width:35%;text-align: right;" class="first b"><?php esc_html_e('Release date' ,'booking'); ?>:</td>
616 <td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php
617 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
618 echo wpbc_date_localized( gmdate( 'Y-m-d', filemtime( WPBC_FILE ) ) );
619 ?></td>
620 </tr>
621 </table>
622 <div id="wpbc_dashboard_section_current_version_upgrade">
623
624 <table class="bk_table" style="border:none;">
625 <tr>
626 <td colspan="2" style="border:none;text-align:center;" class=""><?php
627 ?><?php wpbc_is_dismissed( 'wpbc_dashboard_section_current_version_upgrade' , array( 'css' => 'padding: 0 0px;' ) ); //FixIn: 8.1.3.10 ?><?php
628 if ($version == 'free') {
629 ?><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
630 } elseif ( wpbc_get_ver_sufix() != '' ) {
631 ?><a class="button-primary button" href="<?php echo esc_url( wpbc_get_settings_url() . '&tab=upgrade' ); ?>"><?php esc_html_e('Upgrade' ,'booking'); ?></a><?php
632 } else {
633 ?><a class="button-primary button" target="_blank" href="https://wpbookingcalendar.com/features/"><?php esc_html_e('Explore Premium Features' ,'booking'); ?></a><?php
634 }
635 ?></td>
636 </tr>
637 </table>
638 </div>
639 </div>
640
641 <?php
642 }
643
644
645 /** Dashboard Statistic Section */
646 function wpbc_dashboard_section_statistic( $counter ) {
647 // FixIn: 9.3.1.7.
648 $bk_admin_url = wpbc_get_bookings_url() . '&wh_approved=';
649 ?>
650 <div id='wpbc_dashboard_section_statistic'>
651 <?php
652 $is_panel_visible = wpbc_is_dismissed( 'wpbc_dashboard_section_statistic' ); // FixIn: 9.9.0.8.
653 if ( $is_panel_visible ) {
654 ?>
655 <div class="wpbc_dashboard_section bk_right">
656 <span class="bk_header"><?php esc_html_e('Statistic' ,'booking'); ?>:</span>
657 <table class="bk_table">
658 <tr>
659 <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>
660 <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>
661 </tr>
662 <tr class="first">
663 <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>
664 <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>
665 </tr>
666 <tr class="first">
667 <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>
668 <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>
669 </tr>
670 <tr>
671 <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>
672 <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>
673 </tr>
674 </table>
675 </div>
676 <div class="wpbc_dashboard_section" >
677 <span class="bk_header"><?php esc_html_e('Agenda' ,'booking'); ?>:</span>
678 <table class="bk_table">
679 <tr>
680 <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>
681 <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>
682 </tr>
683 <tr>
684 <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>
685 <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>
686 </tr>
687 <tr>
688 <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>
689 <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>
690 </tr>
691 <tr>
692 <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>
693 <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>
694 </tr>
695
696 </table>
697 </div>
698 <?php } ?>
699 </div>
700 <?php
701 }
702
703
704 // ---------------------------------------------------------------------------------------------------------------------
705 // 9.8
706 // ---------------------------------------------------------------------------------------------------------------------
707
708 /** Get Flex Dashboard */
709 function wpbc_get_flex_dashboard_info() {
710
711 ob_start();
712
713 wpbc_flex_dashboard_show();
714
715 return ob_get_clean();
716 }
717
718
719 /** Show Flex Dashboard Conatiner */
720 function wpbc_flex_dashboard_show(){
721
722 if (
723 ( ! empty( $GLOBALS['pagenow'] ) )
724 && ( is_admin() )
725 && (
726 ( 'index.php' === $GLOBALS['pagenow'] )
727 || (
728 ( 'admin.php' === $GLOBALS['pagenow'] )
729 && ( ! empty( $_GET['page'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
730 && ( 'wpbc-settings' === $_GET['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
731 && ( ( ! isset( $_GET['tab'] ) ) || ( 'general' === $_GET['tab'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
732 )
733 )
734 ) {
735
736 } else {
737 return;
738 }
739
740
741 $is_panel_visible = wpbc_is_dismissed_panel_visible( 'wpbc_dashboard_section_statistic' ); // FixIn: 9.9.0.8.
742
743 $counter = ( $is_panel_visible ) ? wpbc_db_dashboard_get_bookings_count_arr() : array();
744
745 wpbc_flex_dashboard_widget_css();
746
747 ?><div class="wpbc_flex_dashboard_container" ><?php
748
749 wpbc_flex_dashboard_section_statistic( $counter );
750
751 ?></div><?php
752
753 }
754
755
756 /**
757 * CSS for Flex Dashboard
758 * @return void
759 */
760 function wpbc_flex_dashboard_widget_css(){
761
762 ?><style type="text/css">
763 .wpbc_flex_dashboard_container{
764 display: flex;
765 flex-flow: row wrap;
766 justify-content: space-between;
767 align-items: center;
768 }
769 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item{
770 flex: 1 1 auto;
771 display: flex;
772 flex-flow: row wrap;
773 justify-content: center;
774 align-items: center;
775 margin: 0 10px;
776 line-height: 2.1em;
777 }
778 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item:first-child{
779 margin-left: 0;
780 }
781 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item:last-child{
782 margin-right:0;
783 justify-content: flex-end;
784 }
785 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number,
786 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text{
787 flex: 0 1 auto;
788 padding: 0 5px;
789 }
790 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number a,
791 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text a{
792 text-decoration: none;
793 outline:0;
794 }
795 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number span{
796 font-size: 18px;
797 font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
798 }
799 /* Colors */
800 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_new *{
801 /*color: #135e96;*/
802 }
803 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_pending *{
804 color: #E66F00;
805 }
806 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_was_made_today *{
807 color: red;
808 }
809 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_text_made_for_today *{
810 color: green;
811 }
812 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_number.wpbc_flex_dashboard_item_version_number * {
813 color: #2b6900;
814 color: #7812bd;
815 font-size: 11px;
816 text-shadow: none;
817 }
818 .wpbc_flex_dashboard_container .wpbc_flex_dashboard_item .wpbc_flex_dashboard_item_version_type * {
819 color: #8f8f8f;
820 font-size: 9px;
821 text-shadow: none;
822 }
823 </style><?php
824 }
825
826
827 /**
828 * Flex Dashboard Items
829 *
830 * @param $counter
831 *
832 * @return void
833 */
834 function wpbc_flex_dashboard_section_statistic( $counter ){
835
836 $bk_admin_url = wpbc_get_bookings_url();// . '&wh_approved=';
837
838 if ( ! empty( $counter ) ) {
839
840 // Was made today -----------------------------------------------------------------------------------------------------
841 ?>
842 <div class="wpbc_flex_dashboard_item">
843 <div class="wpbc_flex_dashboard_item_number">
844 <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' ); ?>">
845 <span><?php echo esc_html( $counter['was_made_today'] ); ?></span>
846 </a>
847 </div>
848 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_was_made_today">
849 <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="">
850 <?php esc_html_e('New booking(s) made today' ,'booking');?>
851 </a>
852 </div>
853 </div>
854 <?php
855
856 // For today ---------------------------------------------------------------------------------------------------
857 ?>
858 <div class="wpbc_flex_dashboard_item">
859 <div class="wpbc_flex_dashboard_item_number">
860 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>">
861 <span><?php echo esc_html( $counter['booking_today'] ); ?></span>
862 </a>
863 </div>
864 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_made_for_today">
865 <a href="<?php echo esc_url( $bk_admin_url.'&wh_trash=0&wh_booking_date[]=1&tab=vm_booking_listing&overwrite=1' ); ?>" class="">
866 <?php esc_html_e('Booking(s) for today' ,'booking');?>
867 </a>
868 </div>
869 </div>
870 <?php
871
872 // Pending -----------------------------------------------------------------------------------------------------
873 ?>
874 <div class="wpbc_flex_dashboard_item">
875 <div class="wpbc_flex_dashboard_item_number">
876 <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' ); ?>">
877 <span class=""><?php echo esc_html( $counter['pending'] ); ?></span>
878 </a>
879 </div>
880 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_pending">
881 <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="">
882 <?php esc_html_e('Pending booking(s)' ,'booking');?>
883 </a>
884 </div>
885 </div>
886 <?php
887
888
889 // New ---------------------------------------------------------------------------------------------------------
890 ?>
891 <div class="wpbc_flex_dashboard_item">
892 <div class="wpbc_flex_dashboard_item_number">
893 <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' ); ?>">
894 <span class=""><?php echo esc_html( $counter['new'] ); ?></span>
895 </a>
896 </div>
897 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_text_new">
898 <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' ); ?>
899 </a>
900 </div>
901 </div>
902 <?php
903 }
904
905 // Version ---------------------------------------------------------------------------------------------------------
906 ?>
907 <div class="wpbc_flex_dashboard_item">
908 <div class="wpbc_flex_dashboard_item_text wpbc_flex_dashboard_item_version_type">
909 <a href="https://wpbookingcalendar.com/faq/difference-single-developer-multi-site/#<?php
910 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
911 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 ) ) ); ?>">
912 <?php
913 if ( class_exists( 'wpdev_bk_personal' ) ) {
914 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
915 echo wpbc_dashboard_info_get_version_type_readable();
916 }
917 if ( wpbc_is_this_demo() ) {
918 echo ' (Demo)';
919 } else {
920 if ( 'free' != wpbc_dashboard_info_get_version_type() ) {
921 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
922 echo ' (' . __( 'for', 'booking' ) . ' ' . trim( wpbc_dashboard_info_get_version_type_sites() ) . ')';
923 }
924 }
925 ?>
926 </a>
927 </div>
928 <div class="wpbc_flex_dashboard_item_number wpbc_flex_dashboard_item_version_number">
929 <a href="https://wpbookingcalendar.com/changelog/#<?php
930 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
931 echo wpbc_get_slug_format( trim( wpbc_dashboard_info_get_version_type_readable() . '_' . wpbc_dashboard_info_get_version_type_sites() . '_' . WP_BK_VERSION_NUM ) ); ?>">
932 <span class=""><?php echo esc_attr(WP_BK_VERSION_NUM); ?></span>
933 </a>
934 </div>
935 </div>
936 <?php
937
938 }