PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
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 / class / wpbc-class-welcome.php

wpbc-class-welcome.php in Booking Calendar 10.10, at core/class/wpbc-class-welcome.php

651 lines 20.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Welcome Page Class
4 * Shows a feature overview for the new version (major).
5 * Adapted from code in EDD (Copyright (c) 2012, Pippin Williamson) and WP.
6 * @version 2.0.0
7 */
8
9 // Exit if accessed directly.
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 require_once WPBC_PLUGIN_DIR . '/core/class/welcome_current.php';
15
16 class WPBC_Welcome {
17
18 /**
19 * Minimum capability, such as 'read' or 'manage_options'
20 * @var string
21 */
22 public $minimum_capability = 'read';
23
24 /**
25 * Path to images.
26 * @var string
27 */
28 public $asset_path = ( true ) ? 'https://wpbookingcalendar.com/assets/' : 'http://beta/assets/';
29
30
31 /**
32 * Constructor
33 */
34 public function __construct() {
35
36 add_action( 'admin_menu', array( $this, 'admin_menus' ) );
37
38 add_action( 'admin_init', array( $this, 'welcome' ) );
39
40 add_action( 'load-dashboard_page_wpbc-about', array( $this, 'wpbc_define_page_title_about' ) );
41 }
42
43 public function wpbc_define_page_title_about() { // FixIn: 9.6.2.12.
44 global $title;
45 if ( ! isset( $title ) ) {
46 $title = 'Welcome to Booking Calendar';
47 }
48 }
49
50 private function css() {
51
52 ?><style type="text/css">
53 .feature-section.three-col,
54 .feature-section.two-col {
55 display: flex;
56 flex-direction: row;
57 justify-content: space-between;
58 align-items: flex-start;
59 }
60 .feature-section.two-col .col.col-1{
61 width:100%;
62 }
63 .feature-section.two-col .col.col-2{
64 width: 70%;
65 padding: 0 0 0 7%;
66 box-sizing: border-box;
67 }
68 @media (max-width: 782px) {
69 /* iPad mini and all iPhones and other Mobile Devices */
70 .feature-section.three-col,
71 .feature-section.two-col {
72 display: block;
73 }
74 }
75
76 /* Welcome Page ***************************************************************/
77 .wpbc-welcome-page .about-text {
78 margin-right:0px;
79 margin-bottom:0px;
80 min-height: 50px;
81 }
82 .wpbc-welcome-page .wpbc-section-image {
83 border:none;
84 box-shadow: 0 1px 3px #777777;
85 }
86 .wpbc-welcome-page .versions {
87 color: #999999;
88 font-size: 12px;
89 font-style: normal;
90 margin: 0;
91 text-align: right;
92 text-shadow: 0 -1px 0 #EEEEEE;
93 }
94 .wpbc-welcome-page .versions a,
95 .wpbc-welcome-page .versions a:hover{
96 color: #999;
97 text-decoration:none;
98 }
99 .wpbc-welcome-page .update-nag {
100 border-color: #E3C58E;
101 border-radius: 5px;
102 -moz-border-radius: 5px;
103 -webkit-border-radius: 5px;
104 box-shadow: 0 1px 3px #EEEEEE;
105 color: #998877;
106 font-size: 12px;
107 font-weight: 600;
108 margin: 15px 0 0;
109 width:90%;
110 }
111 .wpbc-welcome-page .feature-section {
112 margin-top:20px;
113 border:none;
114 }
115 .wpbc-welcome-page .feature-section div {
116 line-height: 1.5em;
117 }
118 .about-wrap.wpbc-welcome-page .feature-section .last-feature {
119 margin-right:0;
120 }
121 .about-wrap.wpbc-welcome-page .changelog {
122 margin-bottom: 10px;
123 }
124 .about-wrap.wpbc-welcome-page .feature-section h4 {
125 font-size: 1.2em;
126 margin-bottom: 0.6em;
127 margin-left: 0;
128 margin-right: 0;
129 margin-top: 1.4em;
130 }
131 .about-wrap.wpbc-welcome-page .feature-section {
132 overflow-x: hidden;
133 overflow-y: hidden;
134 padding-bottom: 20px;
135 }
136 .about-wrap.wpbc-welcome-page [class$="-col"]{
137 align-items: initial;
138 }
139 @media (max-width: 782px) { /* iPad mini and all iPhones and other Mobile Devices */
140 .wpbc-welcome-page .feature-section.one-col > div,
141 .wpbc-welcome-page .feature-section.three-col > div,
142 .wpbc-welcome-page .feature-section.two-col > div {
143 border-bottom: none;
144 margin:0px !important;
145 }
146 .wpbc-welcome-page .feature-section img{
147 /*width:98% !important;*/
148 /*margin:0 1% !important;*/
149 margin:0!important;
150 width: auto !important;
151 max-height: 285px;
152 overflow: hidden;
153 }
154 .about-wrap.wpbc-welcome-page .feature-section div.col {
155 display:block;
156 float:none;
157 width: 100% !important;
158 padding: 0;
159 }
160 }
161 .wpbc-welcome-page li.big_numbers::marker{
162 font-size:1.2em;
163 font-weight: 600;
164 line-height: 2.1em;
165 }
166
167 </style><?php
168 }
169 // SUPPORT /////////////////////////////////////////////////////////////////
170
171 public function show_separator() {
172 ?><div class="clear" style="height:1px;border-bottom:1px solid #DFDFDF;"></div><?php
173 }
174
175
176 public function show_header( $text = '', $header_type = 'h3', $style = '' ) {
177 echo '<', esc_attr( $header_type );
178 if ( ! empty( $style ) ) {
179 echo " style='" . esc_attr( $style ) . "'";
180 }
181 echo '>';
182 echo wp_kses_post( wpbc_replace_to_strong_symbols( $text ) );
183 echo '</', esc_attr( $header_type ), '>';
184 }
185
186
187 public function show_col_section( $sections_array = array() ) {
188
189 $columns_num = count( $sections_array );
190
191 if ( isset( $sections_array['h3'] ) ) {
192 $columns_num --;
193 }
194 if ( isset( $sections_array['h2'] ) ) {
195 $columns_num --;
196 }
197 ?>
198 <div class="changelog"><?php
199
200 if ( isset( $sections_array['h3'] ) ) {
201 echo "<h3>" . wp_kses_post( wpbc_replace_to_strong_symbols( $sections_array['h3'] ) ) . "</h3>";
202 unset( $sections_array['h3'] );
203 }
204 if ( isset( $sections_array['h2'] ) ) {
205 echo "<h2>" . wp_kses_post( wpbc_replace_to_strong_symbols( $sections_array['h2'] ) ) . "</h2>";
206 unset( $sections_array['h2'] );
207 }
208
209 ?>
210 <div class="feature-section <?php
211 if ( $columns_num == 2 ) {
212 echo ' two-col';
213 }
214 if ( $columns_num == 3 ) {
215 echo ' three-col';
216 } ?>">
217 <?php
218 foreach ( $sections_array as $section_key => $section ) {
219 $col_num = ( $section_key + 1 );
220 if ( $columns_num == $col_num ) {
221 $is_last_feature = ' last-feature ';
222 } else {
223 $is_last_feature = '';
224 }
225
226 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
227 echo "<div class='col col-{$col_num}{$is_last_feature}'>";
228
229 if ( isset( $section['header'] ) ) {
230 echo "<h4>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['header'] ) ) . "</h4>";
231 }
232 if ( isset( $section['h4'] ) ) {
233 echo "<h4>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h4'] ) ) . "</h4>";
234 }
235 if ( isset( $section['h3'] ) ) {
236 echo "<h3>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h3'] ) ) . "</h3>";
237 }
238 if ( isset( $section['h2'] ) ) {
239 echo "<h2>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h2'] ) ) . "</h2>";
240 }
241 if ( isset( $section['text'] ) ) {
242 echo wp_kses_post( wpbc_replace_to_strong_symbols( $section['text'] ) );
243 }
244 if ( isset( $section['img'] ) ) {
245
246 $is_full_link = strpos( $section['img'], 'http' );
247 if ( false === $is_full_link ) {
248 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
249 echo '<img src="' . esc_url( $this->asset_path . $section['img'] ) . '" ';
250 } else {
251 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
252 echo '<img src="' . esc_url( $section['img'] ) . '" ';
253 }
254 if ( isset( $section['img_style'] ) ) {
255 echo ' style="' . esc_attr( $section['img_style'] ) . '" ';
256 }
257 echo ' class="wpbc-section-image" />';
258 }
259
260 echo "</div>";
261 }
262 ?>
263 </div>
264 </div>
265 <?php
266 }
267
268
269 public function get_img( $img, $img_style = '' ) {
270
271 $is_full_link = strpos( $img, 'http' );
272 if ( false === $is_full_link ) {
273 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
274 $img_result = '<img src="' . esc_url( $this->asset_path . $img ) . '" ';
275 } else {
276 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
277 $img_result = '<img src="' . esc_url( $img ) . '" ';
278 }
279
280 if ( ! empty( $img_style ) ) {
281 $img_result .= ' style="' . esc_attr( $img_style ) . '" ';
282 }
283 $img_result .= ' class="wpbc-section-image" />';
284
285 return $img_result;
286 }
287
288 // -----------------------------------------------------------------------------------------------------------------
289 // Menu
290 public function admin_menus() {
291 // What's New.
292 add_dashboard_page( sprintf( 'Welcome to Booking Calendar' ), sprintf( 'What\'s New' ), $this->minimum_capability, 'wpbc-about', array( $this, 'content_whats_new' ) );
293 remove_submenu_page( 'index.php', 'wpbc-about' );
294 }
295
296 // Head.
297 public function admin_head() {
298 remove_submenu_page( 'index.php', 'wpbc-about' );
299 //remove_submenu_page( 'index.php', 'wpbc-getting-started' );
300 //remove_submenu_page( 'index.php', 'wpbc-about-premium' );
301 }
302
303 // Title
304 public function title_section() {
305
306 list( $display_version ) = explode( '-', WPDEV_BK_VERSION );
307 //$display_version = WP_BK_VERSION_NUM;
308 ?>
309 <h1><?php echo wp_kses_post( sprintf( 'Welcome to Booking Calendar %s', $display_version ) ); ?></h1>
310 <div class="about-text"><?php
311 echo ( 'Booking Calendar is ready to receive and manage bookings from your visitors!' );
312 ?></div>
313
314
315 <h2 class="nav-tab-wrapper">
316 <?php
317 $is_about_tab_active = $is_about_premium_tab_active = $is_getting_started_tab_active = '';
318 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
319 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-about' ) )
320 $is_about_tab_active = ' nav-tab-active ';
321 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
322 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-about-premium' ) )
323 $is_about_premium_tab_active = ' nav-tab-active ';
324 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
325 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-getting-started' ) )
326 $is_getting_started_tab_active = ' nav-tab-active ';
327 ?>
328 <a class="nav-tab<?php echo esc_attr( $is_about_tab_active ); ?>" href="<?php echo esc_url( admin_url( add_query_arg( array(
329 'page' => 'wpbc-about' ), 'index.php' ) ) ); ?>">
330 <?php echo( "What's New" ); ?>
331 <a class="nav-tab<?php echo esc_attr( $is_getting_started_tab_active ); ?>" href="https://wpbookingcalendar.com/faq/#using">
332 <?php echo( "Get Started" ); ?>
333 </a><a class="nav-tab<?php echo esc_attr( $is_about_premium_tab_active ); ?>" href="https://wpbookingcalendar.com/features/">
334 <?php echo( "Get even more functionality" ); // echo( "Even more Premium Features" ); ?>
335 </a>
336 </h2>
337 <?php
338 }
339
340 /**
341 * Maintenance section
342 */
343 public function maintence_section() {
344
345 if ( ! ( ( defined( 'WP_BK_MINOR_UPDATE' ) ) && ( WP_BK_MINOR_UPDATE ) ) ) {
346 return;
347 }
348
349 list( $display_version ) = explode( '-', WPDEV_BK_VERSION );
350 ?>
351 <div class="changelog point-releases" style="margin-top: 45px;">
352 <h3><?php
353 echo( "Maintenance Release" ); ?></h3>
354 <p><strong><?php
355 echo wp_kses_post( sprintf( 'Version %s', $display_version ) ); ?></strong> <?php
356 echo 'addressed some minor issues and improvement in functionality'; ?>.
357 <?php
358 echo wp_kses_post( sprintf( 'For more information, see %sthe release notes%s', '<a href="https://wpbookingcalendar.com/changelog/" target="_blank">', '</a>' ) ); ?>
359 .
360 </p>
361 </div>
362 <?php
363 }
364
365 // Start
366 public function welcome() {
367
368 $booking_activation_process = get_bk_option( 'booking_activation_process' );
369 if ( $booking_activation_process == 'On' )
370 return;
371
372 // Bail if no activation redirect transient is set
373 if ( ! get_transient( '_booking_activation_redirect' ) ) { // $.
374 return;
375 }
376
377 // Delete the redirect transient
378 delete_transient( '_booking_activation_redirect' );
379
380 // Bail if DEMO or activating from network, or bulk, or within an iFrame.
381
382 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
383 if ( wpbc_is_this_demo() || is_network_admin() || isset( $_GET[ 'activate-multi' ] ) || defined( 'IFRAME_REQUEST' ) )
384 return;
385
386 // Set mark, that we already redirected to About screen //FixIn: 5.4.5
387 $redirect_for_version = get_bk_option( 'booking_activation_redirect_for_version' );
388 if ( $redirect_for_version == WP_BK_VERSION_NUM )
389 return;
390 else
391 update_bk_option( 'booking_activation_redirect_for_version', WP_BK_VERSION_NUM );
392
393 wp_safe_redirect( admin_url( 'index.php?page=wpbc-about' ) );
394 exit;
395 }
396
397
398 // CONTENT /////////////////////////////////////////////////////////////////
399
400 public function content_whats_new() {
401
402 //$this->css();
403 if(0){
404 ?>
405 <style type="text/css">
406 .feature-section.two-col {
407 display: flex;
408 flex-direction: row;
409 justify-content: space-between;
410 align-items: flex-start;
411 }
412 .feature-section.two-col .col.col-1{
413 width:100%;
414 }
415 .feature-section.two-col .col.col-2{
416 width: 70%;
417 padding: 0 0 0 7%;
418 box-sizing: border-box;
419 }
420 @media (max-width: 782px) {
421 /* iPad mini and all iPhones and other Mobile Devices */
422 .feature-section.two-col {
423 display: block;
424 }
425 }
426
427 .wpbc-changelog-list ul {
428 list-style: outside;
429 }
430 .wpbc-changelog-list ul li{
431 margin-bottom: 0.5em;
432 line-height: 1.5em;
433 }
434 .wpbc-changelog-list ul li strong{
435 padding:0 5px;
436 }
437 .wpbc_expand_section_link,
438 a.wpbc_expand_section_link:hover,
439 a.wpbc_expand_section_link:focus {
440 color:#21759b;
441 cursor: pointer;
442 outline: 0;
443 border:none;
444 border-bottom:1px dashed #21759B;
445 text-decoration: none;
446 }
447 </style><?php
448 }
449 ?>
450 <div class="wrap about-wrap wpbc-welcome-page">
451
452 <?php $this->title_section(); ?>
453
454 <table class="about-text" style="margin-bottom:-40px;height:auto;font-size:1em;width:100%;" >
455 <tr>
456 <td>
457 <?php list( $display_version ) = explode( '-', WPDEV_BK_VERSION ); ?>
458 <!--Thank you for updating to the latest version. <strong><code><?php echo esc_html( $display_version ); ?></code></strong>
459 <br/>Booking Calendar has become more polished, powerful and easy to use than ever before.-->
460 </td>
461 <!--td style="width:10%">
462 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-getting-started' ), 'index.php' ) ) ); ?>"
463 style="float: right; height: 36px; line-height: 34px;"
464 class="button-primary"
465 >&nbsp;<strong>Get Started</strong> <span style="font-size: 20px;line-height: 18px;padding-left: 5px;">&rsaquo;&rsaquo;&rsaquo;</span>
466 </a>
467 </td-->
468 </tr>
469 </table>
470 <?php
471
472 $this->maintence_section();
473
474 $this->section_9_8_css();
475
476 wpbc_welcome_section_10_10( $this );
477
478 wpbc_welcome_section_10_9( $this );
479
480 wpbc_welcome_section_10_8( $this );
481
482 wpbc_welcome_section_10_7( $this );
483
484 wpbc_welcome_section_10_6( $this );
485
486 wpbc_welcome_section_10_5( $this );
487
488 wpbc_welcome_section_10_4( $this );
489
490 wpbc_welcome_section_10_3( $this );
491
492 wpbc_welcome_section_10_2( $this );
493
494 wpbc_welcome_section_10_1( $this );
495
496 wpbc_welcome_section_10_0( $this );
497
498 wpbc_welcome_section_9_9( $this );
499
500 wpbc_welcome_section_9_8( $this );
501
502 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
503 // Footer
504 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
505 ?>
506 <table class="about-text" style="margin-bottom:30px;height:auto;font-size:1em;width:100%;" >
507 <tr>
508 <td>
509
510 </td>
511 <!--td style="width:10%">
512 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-getting-started' ), 'index.php' ) ) ); ?>"
513 style="float: right; height: 36px; line-height: 34px;"
514 class="button-primary"
515 >&nbsp;<strong>Get Started</strong> <span style="font-size: 20px;line-height: 18px;padding-left: 5px;">&rsaquo;&rsaquo;&rsaquo;</span>
516 </a>
517 </td-->
518 </tr>
519 </table>
520
521 </div><?php
522 }
523
524
525 function expand_section_start( $section_param_arr ) {
526
527 ?>
528 <div class="clear" style="margin-top:20px;"></div><?php
529
530 if ( $section_param_arr['show_expand'] ) {
531
532 ?><a id="wpbc_show_advanced_section_link_show"
533 class="wpbc_expand_section_link"
534 href="javascript:void(0)"
535 onclick="javascript:jQuery( '.version_update_<?php
536 echo esc_attr( str_replace( array(
537 '.', ' ',
538 ), '_', $section_param_arr['version_num'] ) ); ?>' ).toggle();"
539 >+ Show changes in version update <span
540 style="font-size: 1.35em;font-weight: 600;color: #079;font-family: Consolas,Monaco,monospace;padding-left:12px;"><?php
541 echo esc_html( $section_param_arr['version_num'] ); ?></span>
542 </a>
543 <div class="version_update_<?php
544 echo esc_attr( str_replace( array(
545 '.', ' ',
546 ), '_', $section_param_arr['version_num'] ) ); ?>" style="display:none;">
547 <?php
548
549 }
550
551 ?><h2 style='font-size: 1.9em;text-align:left;'>What's New in Booking Calendar <span
552 style="font-size: 1.1em;font-weight: 600;font-family: Consolas,Monaco,monospace;padding-left: 10px;color: #5F5F5F;"
553 ><?php
554 echo esc_html( $section_param_arr['version_num'] ); ?></span></h2><?php
555
556 }
557
558
559 function expand_section_end( $section_param_arr ) {
560 if ( $section_param_arr['show_expand'] ) {
561 ?></div><?php
562 }
563 }
564
565
566 function section_img_url( $relative_path_to_img ) {
567 return esc_url( $this->asset_path . $relative_path_to_img );
568 }
569
570
571 function section_9_8_css(){
572
573 ?><style type="text/css">
574 .about-wrap.wpbc-welcome-page {
575 position: relative;
576 margin: 25px 40px 0 20px;
577 max-width: 1050px;
578 font-size: 15px;
579 clear: both;
580 }
581 .wpbc_wn_container{
582 margin: 24px auto;
583 overflow: hidden;
584 }
585 .wpbc_wn_section{
586 display: flex;
587 flex-flow: row wrap;
588 justify-content: space-between;
589 align-content: flex-start;
590 align-items: flex-start;
591 font-size: 1.05em;
592 line-height: 2rem;
593 margin: 1em 0;
594 }
595 .wpbc_wn_col{
596 flex: 1 1 50%;
597 padding: 1.5em 2em;
598 box-sizing: border-box;
599 }
600 @media screen and (max-width: 782px) {
601 .wpbc_wn_col{
602 flex: 1 1 100%;
603 }
604 }
605 .wpbc_wn_separator{
606 flex: 1 1 100%;
607 }
608 .wpbc_wn_col * {
609 margin: 0;
610 line-height: 2.2em;
611 }
612 .wpbc_wn_section > h2,
613 .wpbc_wn_section > h3{
614 margin: 0 0 0.25em;
615 font-size: 2em;
616 line-height: 2.16em;
617 font-weight: 600;
618 flex: 1 1 100%;
619 text-align: center;
620 padding:0 1.5em;
621 }
622 .wpbc_wn_section h3 {
623 font-size: 1.25em;
624 text-align: left;
625 margin: 0.25em 0 0.5em;
626 }
627 .wpbc_wn_section img{
628 border-radius: 2px;
629 box-shadow: none;
630 width: 99%;
631 margin: 0.5em 0 auto;
632 padding: 3px;
633 background: #fff;
634 border: 1px solid #ccc;
635 }
636 .wpbc_wn_container .wpbc_hr_dots {
637 height: 1px;
638 border:none;
639 border-bottom: 0.5rem dotted #a9a9a9;
640 width: 3rem;
641 margin:0 auto;
642 clear: both:;
643 display: block;
644 position: relative;
645 }
646 </style>
647 <?php
648 }
649 }
650
651 $wpbc_welcome = new WPBC_Welcome();