@@ 57-87 (lines=31) @@ | ||
54 | /** |
|
55 | * Determines if the banner can be displayed |
|
56 | */ |
|
57 | private function can_be_displayed() { |
|
58 | if ( ! Jetpack_Recommendations::is_banner_enabled() ) { |
|
59 | return false; |
|
60 | } |
|
61 | ||
62 | // Only the dashboard and plugins pages should see the banner. |
|
63 | if ( ! in_array( get_current_screen()->id, array( 'dashboard', 'plugins' ), true ) ) { |
|
64 | return false; |
|
65 | } |
|
66 | ||
67 | if ( ! current_user_can( 'jetpack_manage_modules' ) ) { |
|
68 | return false; |
|
69 | } |
|
70 | ||
71 | if ( Jetpack_Options::get_option( 'recommendations_banner_dismissed' ) ) { |
|
72 | return false; |
|
73 | } |
|
74 | ||
75 | if ( ! in_array( |
|
76 | Jetpack_Options::get_option( 'recommendations_step', 'not-started' ), |
|
77 | array( |
|
78 | 'not-started', |
|
79 | 'site-type-question', |
|
80 | ), |
|
81 | true |
|
82 | ) ) { |
|
83 | return false; |
|
84 | } |
|
85 | ||
86 | return true; |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * Handles storing the user responses in the banner. |
@@ 57-81 (lines=25) @@ | ||
54 | /** |
|
55 | * Can we display the banner? |
|
56 | */ |
|
57 | private function can_be_displayed() { |
|
58 | if ( ! Jetpack_Wizard::can_be_displayed() ) { |
|
59 | return false; |
|
60 | } |
|
61 | ||
62 | // Only the dashboard and plugins pages should see the banner. |
|
63 | if ( ! in_array( get_current_screen()->id, array( 'dashboard', 'plugins' ), true ) ) { |
|
64 | return false; |
|
65 | } |
|
66 | ||
67 | if ( ! current_user_can( 'jetpack_manage_modules' ) ) { |
|
68 | return false; |
|
69 | } |
|
70 | ||
71 | // Kill if banner has been dismissed. |
|
72 | if ( Jetpack_Options::get_option( 'dismissed_wizard_banner' ) ) { |
|
73 | return false; |
|
74 | } |
|
75 | ||
76 | if ( ! in_array( Jetpack_Options::get_option( 'setup_wizard_status', 'not-started' ), array( 'not-started', 'intro-page' ), true ) ) { |
|
77 | return false; |
|
78 | } |
|
79 | ||
80 | return true; |
|
81 | } |
|
82 | ||
83 | /** |
|
84 | * Enqueue JavaScript files. |