PluginProbe
Booking Calendar / 10.15.6
Booking Calendar v10.15.6
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.15.6, at core/class/wpbc-class-welcome.php

460 lines 14.4 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.15em 1.5em;"><?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.15em 1em;"
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 = wpbc_stp_wiz__is_exist_published_page_with_booking_form();
296 if ( ! empty( $wp_post_booking_absolute ) ) {
297 ?>
298 <a class="button button-secondary"
299 style="font-size: 20px;padding: 0.15em 1em;"
300 href="<?php
301 echo esc_url( $wp_post_booking_absolute ); ?>"
302 ><?php
303 esc_html_e( 'Go to page with booking form', 'booking' ); ?></a>
304 <?php
305 }
306 } ?>
307 </div>
308 <?php
309 }
310
311 public function content_whats_new() {
312
313 echo '<div class="wrap about-wrap wpbc-welcome-page">';
314
315 $this->title_section();
316
317 $this->show_go_links();
318
319 $this->maintence_section();
320
321 $this->section_9_8_css();
322
323 wpbc_welcome_section_10_15( $this );
324 wpbc_welcome_section_10_14( $this );
325 wpbc_welcome_section_10_13( $this );
326
327 $this->show_go_links();
328
329 echo '<div';
330 }
331
332
333 function expand_section_start( $section_param_arr ) {
334
335 ?>
336 <div class="clear" style="margin-top:20px;"></div><?php
337
338 if ( $section_param_arr['show_expand'] ) {
339
340 ?><a id="wpbc_show_advanced_section_link_show"
341 class="wpbc_expand_section_link"
342 href="javascript:void(0)"
343 onclick="javascript:jQuery( '.version_update_<?php
344 echo esc_attr( str_replace( array(
345 '.', ' ',
346 ), '_', $section_param_arr['version_num'] ) ); ?>' ).toggle();"
347 >+ Show changes in version update <span
348 style="font-size: 1.35em;font-weight: 600;color: #079;font-family: Consolas,Monaco,monospace;padding-left:12px;"><?php
349 echo esc_html( $section_param_arr['version_num'] ); ?></span>
350 </a>
351 <div class="version_update_<?php
352 echo esc_attr( str_replace( array(
353 '.', ' ',
354 ), '_', $section_param_arr['version_num'] ) ); ?>" style="display:none;">
355 <?php
356
357 }
358
359 ?><h2 style='font-size: 1.9em;text-align:left;'>What's New in Booking Calendar <span
360 style="font-size: 1.1em;font-weight: 600;font-family: Consolas,Monaco,monospace;padding-left: 10px;color: #5F5F5F;"
361 ><?php
362 echo esc_html( $section_param_arr['version_num'] ); ?></span></h2><?php
363
364 }
365
366
367 function expand_section_end( $section_param_arr ) {
368 if ( $section_param_arr['show_expand'] ) {
369 ?></div><?php
370 }
371 }
372
373
374 function section_img_url( $relative_path_to_img ) {
375 return esc_url( $this->asset_path . $relative_path_to_img );
376 }
377
378
379 function section_9_8_css(){
380
381 ?><style type="text/css">
382 .about-wrap.wpbc-welcome-page {
383 position: relative;
384 margin: 25px 40px 0 20px;
385 max-width: 1050px;
386 font-size: 15px;
387 clear: both;
388 }
389 .wpbc_wn_container{
390 margin: 24px auto;
391 overflow: hidden;
392 }
393 .wpbc_wn_section{
394 display: flex;
395 flex-flow: row wrap;
396 justify-content: space-between;
397 align-content: flex-start;
398 align-items: flex-start;
399 font-size: 1.05em;
400 line-height: 2rem;
401 margin: 1em 0;
402 }
403 .wpbc_wn_col{
404 flex: 1 1 50%;
405 padding: 1.5em 2em;
406 box-sizing: border-box;
407 }
408 @media screen and (max-width: 782px) {
409 .wpbc_wn_col{
410 flex: 1 1 100%;
411 }
412 }
413 .wpbc_wn_separator{
414 flex: 1 1 100%;
415 }
416 .wpbc_wn_col * {
417 margin: 0;
418 line-height: 2.2em;
419 }
420 .wpbc_wn_section > h2,
421 .wpbc_wn_section > h3{
422 margin: 0 0 0.25em;
423 font-size: 2em;
424 line-height: 2.16em;
425 font-weight: 600;
426 flex: 1 1 100%;
427 text-align: center;
428 padding:0 1.5em;
429 }
430 .wpbc_wn_section h3 {
431 font-size: 1.25em;
432 text-align: left;
433 margin: 0.25em 0 0.5em;
434 }
435 .wpbc_wn_section img{
436 border-radius: 2px;
437 box-shadow: none;
438 width: 99%;
439 margin: 0.5em 0 auto;
440 padding: 3px;
441 background: #fff;
442 border: 1px solid #ccc;
443 }
444 .wpbc_wn_container .wpbc_hr_dots {
445 height: 1px;
446 border:none;
447 border-bottom: 0.5rem dotted #a9a9a9;
448 width: 3rem;
449 margin:0 auto;
450 clear: both:;
451 display: block;
452 position: relative;
453 }
454 </style>
455 <?php
456 }
457 }
458
459 $wpbc_welcome = new WPBC_Welcome();
460