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

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