PluginProbe
Additional Terms Lite for WooCommerce / 1.7.3
Additional Terms Lite for WooCommerce v1.7.3
1.7.3 1.7.2.1 trunk 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.6.3 All 35 releases
woo-additional-terms / src / Enhancements / OnBoarding.php

OnBoarding.php in Additional Terms Lite for WooCommerce 1.7.3, at src/Enhancements/OnBoarding.php

78 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The onboarding class for enhancing the new user experience.
4 *
5 * @since 1.4.0
6 *
7 * @package woo-additional-terms
8 */
9
10 namespace Woo_Additional_Terms\Enhancements;
11
12 use Woo_Additional_Terms\Helper;
13
14 /**
15 * The onboarding class.
16 */
17 class OnBoarding {
18
19 /**
20 * Rated (already) transient name.
21 *
22 * @since 1.4.0
23 *
24 * @var string
25 */
26 const OPTION_NAME = 'woo_additional_terms_onboarding';
27
28 /**
29 * Setup hooks and filters.
30 *
31 * @since 1.4.0
32 *
33 * @return void
34 */
35 public function setup() {
36
37 add_action( 'woo_additional_terms_admin_notices', array( $this, 'admin_notice' ) );
38 }
39
40 /**
41 * Display the onboarding notice.
42 *
43 * @since 1.4.0
44 *
45 * @return void
46 */
47 public function admin_notice() {
48
49 global $pagenow;
50
51 // Bail out if not on the plugins page.
52 if ( 'plugins.php' !== $pagenow ) {
53 return;
54 }
55
56 // Bail early, in case user can manage shop settings.
57 if ( ! current_user_can( 'manage_woocommerce' ) ) {
58 return;
59 }
60
61 // Bail out if the user has already dismissed the onboarding notice.
62 if ( get_site_option( self::OPTION_NAME ) ) {
63 return;
64 }
65
66 // Enqueue the assets.
67 wp_enqueue_script( 'woo-additional-terms-dismiss' );
68
69 woo_additional_terms()->service( 'template_manager' )->echo_template(
70 'notices/onboarding.php',
71 array(
72 'help_uri' => Helper\Links::docs_uri(),
73 'settings_uri' => Helper\Settings::page_uri(),
74 )
75 );
76 }
77 }
78