PluginProbe
Booking Calendar / 11.3
Booking Calendar v11.3
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 11.3, at core/class/wpbc-class-welcome.php

467 lines 14.7 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 * Constructor
32 */
33 public function __construct() {
34
35 add_action( 'admin_menu', array( $this, 'admin_menus' ) );
36
37 add_action( 'admin_init', array( $this, 'welcome' ) );
38
39 add_action( 'load-dashboard_page_wpbc-about', array( $this, 'wpbc_define_page_title_about' ) );
40 }
41
42 public function wpbc_define_page_title_about() { // FixIn: 9.6.2.12.
43 global $title;
44 if ( ! isset( $title ) ) {
45 $title = 'Welcome to Booking Calendar';
46 }
47 }
48
49 public function show_separator() {
50 echo '<div class="clear" style="height:1px;border-bottom:1px solid #DFDFDF;"></div>';
51 }
52
53 public function show_header( $text = '', $header_type = 'h3', $style = '' ) {
54 echo '<', esc_attr( $header_type );
55 if ( ! empty( $style ) ) {
56 echo " style='" . esc_attr( $style ) . "'";
57 }
58 echo '>';
59 echo wp_kses_post( wpbc_replace_to_strong_symbols( $text ) );
60 echo '</', esc_attr( $header_type ), '>';
61 }
62
63 public function show_col_section( $sections_array = array() ) {
64
65 $columns_num = count( $sections_array );
66
67 if ( isset( $sections_array['h3'] ) ) {
68 $columns_num --;
69 }
70 if ( isset( $sections_array['h2'] ) ) {
71 $columns_num --;
72 }
73 ?>
74 <div class="changelog"><?php
75
76 if ( isset( $sections_array['h3'] ) ) {
77 echo "<h3>" . wp_kses_post( wpbc_replace_to_strong_symbols( $sections_array['h3'] ) ) . "</h3>";
78 unset( $sections_array['h3'] );
79 }
80 if ( isset( $sections_array['h2'] ) ) {
81 echo "<h2>" . wp_kses_post( wpbc_replace_to_strong_symbols( $sections_array['h2'] ) ) . "</h2>";
82 unset( $sections_array['h2'] );
83 }
84
85 ?>
86 <div class="feature-section <?php
87 if ( $columns_num == 2 ) {
88 echo ' two-col';
89 }
90 if ( $columns_num == 3 ) {
91 echo ' three-col';
92 } ?>">
93 <?php
94 foreach ( $sections_array as $section_key => $section ) {
95 $col_num = ( $section_key + 1 );
96 if ( $columns_num == $col_num ) {
97 $is_last_feature = ' last-feature ';
98 } else {
99 $is_last_feature = '';
100 }
101
102 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
103 echo "<div class='col col-{$col_num}{$is_last_feature}'>";
104
105 if ( isset( $section['header'] ) ) {
106 echo "<h4>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['header'] ) ) . "</h4>";
107 }
108 if ( isset( $section['h4'] ) ) {
109 echo "<h4>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h4'] ) ) . "</h4>";
110 }
111 if ( isset( $section['h3'] ) ) {
112 echo "<h3>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h3'] ) ) . "</h3>";
113 }
114 if ( isset( $section['h2'] ) ) {
115 echo "<h2>" . wp_kses_post( wpbc_replace_to_strong_symbols( $section['h2'] ) ) . "</h2>";
116 }
117 if ( isset( $section['text'] ) ) {
118 echo wp_kses_post( wpbc_replace_to_strong_symbols( $section['text'] ) );
119 }
120 if ( isset( $section['img'] ) ) {
121
122 $is_full_link = strpos( $section['img'], 'http' );
123 if ( false === $is_full_link ) {
124 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
125 echo '<img src="' . esc_url( $this->asset_path . $section['img'] ) . '" ';
126 } else {
127 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
128 echo '<img src="' . esc_url( $section['img'] ) . '" ';
129 }
130 if ( isset( $section['img_style'] ) ) {
131 echo ' style="' . esc_attr( $section['img_style'] ) . '" ';
132 }
133 echo ' class="wpbc-section-image" />';
134 }
135
136 echo "</div>";
137 }
138 ?>
139 </div>
140 </div>
141 <?php
142 }
143
144 public function get_img( $img, $img_style = '' ) {
145
146 $is_full_link = strpos( $img, 'http' );
147 if ( false === $is_full_link ) {
148 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
149 $img_result = '<img src="' . esc_url( $this->asset_path . $img ) . '" ';
150 } else {
151 // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
152 $img_result = '<img src="' . esc_url( $img ) . '" ';
153 }
154
155 if ( ! empty( $img_style ) ) {
156 $img_result .= ' style="' . esc_attr( $img_style ) . '" ';
157 }
158 $img_result .= ' class="wpbc-section-image" />';
159
160 return $img_result;
161 }
162
163 // -----------------------------------------------------------------------------------------------------------------
164 // Menu
165 public function admin_menus() {
166 // What's New.
167 add_dashboard_page( sprintf( 'Welcome to Booking Calendar' ), sprintf( 'What\'s New' ), $this->minimum_capability, 'wpbc-about', array( $this, 'content_whats_new' ) );
168 remove_submenu_page( 'index.php', 'wpbc-about' );
169 }
170
171 // Head.
172 public function admin_head() {
173 remove_submenu_page( 'index.php', 'wpbc-about' );
174 }
175
176 // Title
177 public function title_section() {
178
179 list( $display_version ) = explode( '-', WPDEV_BK_VERSION );
180 //$display_version = WP_BK_VERSION_NUM;
181 ?>
182 <h1><?php echo wp_kses_post( sprintf( 'Welcome to Booking Calendar %s', $display_version ) ); ?></h1>
183 <div class="about-text"><?php
184 echo ( 'Booking Calendar is ready to receive and manage bookings from your visitors!' );
185 ?></div>
186
187
188 <h2 class="nav-tab-wrapper">
189 <?php
190 $is_about_tab_active = $is_about_premium_tab_active = $is_getting_started_tab_active = '';
191 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
192 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-about' ) )
193 $is_about_tab_active = ' nav-tab-active ';
194 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
195 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-about-premium' ) )
196 $is_about_premium_tab_active = ' nav-tab-active ';
197 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
198 if ( ( isset( $_GET[ 'page' ] ) ) && ( $_GET[ 'page' ] == 'wpbc-getting-started' ) )
199 $is_getting_started_tab_active = ' nav-tab-active ';
200 ?>
201 <a class="nav-tab<?php echo esc_attr( $is_about_tab_active ); ?>" href="<?php echo esc_url( admin_url( add_query_arg( array(
202 'page' => 'wpbc-about' ), 'index.php' ) ) ); ?>">
203 <?php echo( "What's New" ); ?>
204 <a class="nav-tab<?php echo esc_attr( $is_getting_started_tab_active ); ?>" href="https://wpbookingcalendar.com/faq/#using">
205 <?php echo( "Get Started" ); ?>
206 </a><a class="nav-tab<?php echo esc_attr( $is_about_premium_tab_active ); ?>" href="https://wpbookingcalendar.com/features/">
207 <?php echo( "Get even more functionality" ); // echo( "Even more Premium Features" ); ?>
208 </a>
209 </h2>
210 <?php
211 }
212
213 /**
214 * Maintenance section
215 */
216 public function maintence_section() {
217
218 if ( ! ( ( defined( 'WP_BK_MINOR_UPDATE' ) ) && ( WP_BK_MINOR_UPDATE ) ) ) {
219 return;
220 }
221
222 list( $display_version ) = explode( '-', WPDEV_BK_VERSION );
223 ?>
224 <div class="changelog point-releases" style="margin: 40px 0 50px;">
225 <h3><?php
226 echo( "Maintenance Release" ); ?></h3>
227 <p><strong><?php
228 echo wp_kses_post( sprintf( 'Version %s', $display_version ) ); ?></strong> <?php
229 echo 'addressed some minor issues and improvement in functionality'; ?>.
230 <?php
231 echo wp_kses_post( sprintf( 'For more information, see %sthe release notes%s', '<a href="https://wpbookingcalendar.com/changelog/" target="_blank">', '</a>' ) ); ?>
232 .
233 </p>
234 </div>
235 <?php
236 }
237
238 // Start
239 public function welcome() {
240
241 $booking_activation_process = get_bk_option( 'booking_activation_process' );
242 if ( $booking_activation_process == 'On' )
243 return;
244
245 // Bail if no activation redirect transient is set
246 if ( ! get_transient( '_booking_activation_redirect' ) ) { // $.
247 return;
248 }
249
250 // Delete the redirect transient
251 delete_transient( '_booking_activation_redirect' );
252
253 // Bail if DEMO or activating from network, or bulk, or within an iFrame.
254
255 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
256 if ( wpbc_is_this_demo() || is_network_admin() || isset( $_GET[ 'activate-multi' ] ) || defined( 'IFRAME_REQUEST' ) )
257 return;
258
259 // Set mark, that we already redirected to About screen //FixIn: 5.4.5
260 $redirect_for_version = get_bk_option( 'booking_activation_redirect_for_version' );
261 if ( $redirect_for_version == WP_BK_VERSION_NUM )
262 return;
263 else
264 update_bk_option( 'booking_activation_redirect_for_version', WP_BK_VERSION_NUM );
265
266 wp_safe_redirect( admin_url( 'index.php?page=wpbc-about' ) );
267 exit;
268 }
269
270
271 // CONTENT /////////////////////////////////////////////////////////////////
272
273 public function show_go_links() {
274 ?>
275 <div style="display: flex;flex-flow: row wrap;justify-content: center;gap: 2em;margin: 3em 0 1em;">
276 <a class="button button-primary"
277 href="<?php
278 echo esc_url( wpbc_get_bookings_url() . '&tab=vm_booking_listing' ); ?>"
279 style="font-size: 20px;padding: 0 1em;height: 44px;line-height: 40px;"><?php
280 esc_html_e( 'Go to Booking Admin Panel', 'booking' ); ?></a>
281 <?php
282 $wpbc_starter_pages = function_exists( 'wpbc_get_published_activation_booking_pages' ) ? wpbc_get_published_activation_booking_pages() : array();
283 if ( ! empty( $wpbc_starter_pages ) ) {
284 foreach ( $wpbc_starter_pages as $wpbc_starter_page ) {
285 ?>
286 <a class="button button-secondary"
287 style="font-size: 20px;padding: 0 1em;height: 44px;line-height: 40px;"
288 href="<?php
289 echo esc_url( $wpbc_starter_page['url'] ); ?>"
290 ><?php
291 echo esc_html( $wpbc_starter_page['button_title'] ); ?></a>
292 <?php
293 }
294 } else {
295 $wp_post_booking_absolute = function_exists( 'wpbc_stp_wiz__is_exist_published_page_with_booking_form' )
296 ? wpbc_stp_wiz__is_exist_published_page_with_booking_form()
297 : false;
298 if ( ! empty( $wp_post_booking_absolute ) ) {
299 ?>
300 <a class="button button-secondary"
301 style="font-size: 20px;padding: 0 1em;height: 44px;line-height: 40px;"
302 href="<?php
303 echo esc_url( $wp_post_booking_absolute ); ?>"
304 ><?php
305 esc_html_e( 'Go to page with booking form', 'booking' ); ?></a>
306 <?php
307 }
308 } ?>
309 </div>
310 <?php
311 }
312
313 public function content_whats_new() {
314
315 echo '<div class="wrap about-wrap wpbc-welcome-page">';
316
317 $this->title_section();
318
319 $this->show_go_links();
320
321 $this->maintence_section();
322
323 $this->section_9_8_css();
324
325 wpbc_welcome_section_11_3( $this );
326 wpbc_welcome_section_11_2( $this );
327 wpbc_welcome_section_11_1( $this );
328 wpbc_welcome_section_11_0( $this );
329 wpbc_welcome_section_10_15( $this );
330 wpbc_welcome_section_10_14( $this );
331 wpbc_welcome_section_10_13( $this );
332
333 $this->show_go_links();
334
335 echo '<div';
336 }
337
338
339 function expand_section_start( $section_param_arr ) {
340
341 ?>
342 <div class="clear" style="margin-top:20px;"></div><?php
343
344 if ( $section_param_arr['show_expand'] ) {
345
346 ?><a id="wpbc_show_advanced_section_link_show"
347 class="wpbc_expand_section_link"
348 href="javascript:void(0)"
349 onclick="javascript:jQuery( '.version_update_<?php
350 echo esc_attr( str_replace( array(
351 '.', ' ',
352 ), '_', $section_param_arr['version_num'] ) ); ?>' ).toggle();"
353 >+ Show changes in version update <span
354 style="font-size: 1.35em;font-weight: 600;color: #079;font-family: Consolas,Monaco,monospace;padding-left:12px;"><?php
355 echo esc_html( $section_param_arr['version_num'] ); ?></span>
356 </a>
357 <div class="version_update_<?php
358 echo esc_attr( str_replace( array(
359 '.', ' ',
360 ), '_', $section_param_arr['version_num'] ) ); ?>" style="display:none;">
361 <?php
362
363 }
364
365 ?><h2 style='font-size: 1.9em;text-align:left;'>What's New in Booking Calendar <span
366 style="font-size: 1.1em;font-weight: 600;font-family: Consolas,Monaco,monospace;padding-left: 10px;color: #5F5F5F;"
367 ><?php
368 echo esc_html( $section_param_arr['version_num'] ); ?></span></h2><?php
369
370 }
371
372
373 function expand_section_end( $section_param_arr ) {
374 if ( $section_param_arr['show_expand'] ) {
375 ?></div><?php
376 }
377 }
378
379
380 function section_img_url( $relative_path_to_img ) {
381
382 return esc_url( $this->asset_path . $relative_path_to_img );
383 }
384
385
386 function section_9_8_css(){
387
388 ?><style type="text/css">
389 .about-wrap.wpbc-welcome-page {
390 position: relative;
391 margin: 25px 40px 0 20px;
392 max-width: 1050px;
393 font-size: 15px;
394 clear: both;
395 }
396 .wpbc_wn_container{
397 margin: 24px auto;
398 overflow: hidden;
399 }
400 .wpbc_wn_section{
401 display: flex;
402 flex-flow: row wrap;
403 justify-content: space-between;
404 align-content: flex-start;
405 align-items: flex-start;
406 font-size: 1.05em;
407 line-height: 2rem;
408 margin: 1em 0;
409 }
410 .wpbc_wn_col{
411 flex: 1 1 50%;
412 padding: 1.5em 2em;
413 box-sizing: border-box;
414 }
415 @media screen and (max-width: 782px) {
416 .wpbc_wn_col{
417 flex: 1 1 100%;
418 }
419 }
420 .wpbc_wn_separator{
421 flex: 1 1 100%;
422 }
423 .wpbc_wn_col * {
424 margin: 0;
425 line-height: 2.2em;
426 }
427 .wpbc_wn_section > h2,
428 .wpbc_wn_section > h3{
429 margin: 0 0 0.25em;
430 font-size: 2em;
431 line-height: 2.16em;
432 font-weight: 600;
433 flex: 1 1 100%;
434 text-align: center;
435 padding:0 1.5em;
436 }
437 .wpbc_wn_section h3 {
438 font-size: 1.25em;
439 text-align: left;
440 margin: 0.25em 0 0.5em;
441 }
442 .wpbc_wn_section img{
443 border-radius: 2px;
444 box-shadow: none;
445 width: 99%;
446 margin: 0.5em 0 auto;
447 padding: 3px;
448 background: #fff;
449 border: 1px solid #ccc;
450 }
451 .wpbc_wn_container .wpbc_hr_dots {
452 height: 1px;
453 border:none;
454 border-bottom: 0.5rem dotted #a9a9a9;
455 width: 3rem;
456 margin:0 auto;
457 clear: both:;
458 display: block;
459 position: relative;
460 }
461 </style>
462 <?php
463 }
464 }
465
466 $wpbc_welcome = new WPBC_Welcome();
467