PluginProbe
Additional Terms Lite for WooCommerce / 1.6.0
Additional Terms Lite for WooCommerce v1.6.0
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.6.0, at src/Enhancements/OnBoarding.php

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