PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
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 10.10, at core/admin/wpbc-dashboard.php

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