PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmInboxController.php +75 -44 6.265.0 View file →
@@ -8,71 +8,90 @@
8 8 */
9 9 class FrmInboxController {
10 10
11 11 /**
12 - * Get the HTML for the inbox notice.
13 - *
14 12 * @since 4.05
15 - * @since 6.8.4 The $filtered parameter was added.
16 - *
17 - * @param bool $filtered Set this to false to avoid the frm_inbox_badge filter.
18 - *
19 - * @return string
20 13 */
21 - public static function get_notice_count( $filtered = true ) {
14 + public static function menu() {
15 + $unread = self::get_notice_count();
16 + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Inbox', 'formidable' ), __( 'Inbox', 'formidable' ) . $unread, 'frm_change_settings', 'formidable-inbox', 'FrmInboxController::inbox' );
17 +
18 + self::maybe_add_old_css_message();
19 + }
20 +
21 + /**
22 + * @since 4.05
23 + */
24 + private static function get_notice_count() {
22 25 FrmFormMigratorsHelper::maybe_add_to_inbox();
23 26
24 27 $inbox = new FrmInbox();
25 - return $inbox->unread_html( $filtered );
28 + return $inbox->unread_html();
26 29 }
27 30
31 + private static function maybe_add_old_css_message() {
32 + $frm_settings = FrmAppHelper::get_settings();
33 + if ( $frm_settings->old_css ) {
34 + $inbox = new FrmInbox();
35 + $inbox->add_message(
36 + array(
37 + 'key' => 'old_css',
38 + 'subject' => 'The option to disable CSS Grids for form layouts is being removed.',
39 + 'message' => 'We\'ve got some awesome form layout features coming soon. These new layouts will require CSS grids, and will not be supported in Internet Explorer. If a visitor views your forms in IE, a single field will show in each row.<br><br>We recommend enabling CSS Grids in Global Settings and then checking your form layouts.',
40 + 'cta' => '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '" class="button-primary frm-button-primary">' . esc_html__( 'Go to Global Settings', 'formidable' ) . '</a>',
41 + 'icon' => 'frm_report_problem_icon',
42 + 'type' => 'news',
43 + )
44 + );
45 + }
46 + }
47 +
28 48 /**
29 - * @since 6.8
30 - *
31 - * @return array
49 + * @since 4.06
32 50 */
33 - public static function get_inbox_messages() {
51 + public static function dismiss_all_button( $atts ) {
52 + if ( empty( $atts['messages'] ) ) {
53 + return;
54 + }
55 +
56 + echo '<button class="button-secondary frm-button-secondary" id="frm-dismiss-inbox" type="button">' .
57 + esc_html__( 'Dismiss All', 'formidable' ) .
58 + '</button>';
59 + }
60 +
61 + /**
62 + * @since 4.05
63 + */
64 + public static function inbox() {
65 + FrmAppHelper::include_svg();
34 66 self::add_tracking_request();
35 - self::remove_free_template_message();
67 + self::add_free_template_message();
36 68
37 - $inbox = new FrmInbox();
38 - $unread_messages = $inbox->get_messages();
39 - $dismissed_messages = $unread_messages;
69 + $inbox = new FrmInbox();
70 + $messages = $inbox->get_messages( 'filter' );
71 + $messages = array_reverse( $messages );
72 + $user = wp_get_current_user();
40 73
41 - $inbox->filter_messages( $unread_messages, 'filter' );
42 - $inbox->filter_messages( $dismissed_messages, 'dismissed' );
74 + wp_enqueue_script( 'frm-ac', FrmAppHelper::plugin_url() . '/js/ac.js', array(), FrmAppHelper::plugin_version(), true );
43 75
44 - return array(
45 - 'unread' => array_reverse( $unread_messages ),
46 - 'dismissed' => array_reverse( $dismissed_messages ),
47 - 'user' => wp_get_current_user(),
48 - );
76 + include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' );
49 77 }
50 78
51 79 /**
52 80 * @since 4.05
53 - *
54 - * @return void
55 81 */
56 82 public static function dismiss_message() {
57 83 check_ajax_referer( 'frm_ajax', 'nonce' );
58 - FrmAppHelper::permission_check( 'frm_view_forms' );
84 + FrmAppHelper::permission_check( 'frm_change_settings' );
59 85
60 86 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
61 -
62 87 if ( ! empty( $key ) ) {
63 88 $message = new FrmInbox();
64 89 $message->dismiss( $key );
65 -
66 90 if ( $key === 'review' ) {
67 91 $reviews = new FrmReviews();
68 92 $reviews->dismiss_review();
69 93 }
70 -
71 - if ( $key === 'onboarding_wizard' ) {
72 - // Delete the skipped option or the inbox message will continue to get added.
73 - delete_option( FrmOnboardingWizardController::ONBOARDING_SKIPPED_OPTION );
74 - }
75 94 }
76 95
77 96 wp_die();
78 97 }
@@ -78,14 +97,11 @@
78 97 }
79 98
80 99 /**
81 100 * @since 4.05
82 - *
83 - * @return void
84 101 */
85 102 private static function add_tracking_request() {
86 103 $settings = FrmAppHelper::get_settings();
87 -
88 104 if ( $settings->tracking ) {
89 105 return;
90 106 }
91 107
@@ -96,9 +112,9 @@
96 112 array(
97 113 'key' => 'usage',
98 114 'message' => 'Gathering usage data allows us to improve Formidable. Your forms will be considered as we evaluate new features, judge the quality of an update, or determine if an improvement makes sense. You can always visit the <a href="' . esc_url( $link ) . '">Global Settings</a> and choose to stop sharing data. <a href="https://formidableforms.com/knowledgebase/global-settings-overview/#kb-usage-tracking" target="_blank" rel="noopener noreferrer">Read more about what data we collect</a>.',
99 115 'subject' => __( 'Help Formidable improve with usage tracking', 'formidable' ),
100 - 'cta' => '<a href="#" class="frm-button-secondary frm_inbox_dismiss">Dismiss</a> <a href="' . esc_url( $link ) . '" class="button-primary frm-button-primary frm_inbox_dismiss">Activate usage tracking</a>',
116 + 'cta' => '<a href="#" class="button-secondary frm-button-secondary frm_inbox_dismiss">Dismiss</a> <a href="' . esc_url( $link ) . '" class="button-primary frm-button-primary frm_inbox_dismiss">Activate usage tracking</a>',
101 117 'type' => 'feedback',
102 118 )
103 119 );
104 120 }
@@ -106,14 +122,29 @@
106 122 /**
107 123 * Adds free template design.
108 124 *
109 125 * @since 4.10.03
110 - *
111 - * @return void
112 126 */
113 - private static function remove_free_template_message() {
114 - if ( ! FrmAppHelper::pro_is_installed() ) {
115 - $message = new FrmInbox();
116 - $message->dismiss( 'free_templates' );
127 + private static function add_free_template_message() {
128 + if ( FrmAppHelper::pro_is_installed() ) {
129 + return;
117 130 }
131 +
132 + $api = new FrmFormTemplateApi();
133 + if ( $api->has_free_access() ) {
134 + return;
135 + }
136 +
137 + $link = admin_url( 'admin.php?page=formidable&triggerNewFormModal=1&free-templates=1' );
138 +
139 + $message = new FrmInbox();
140 + $message->add_message(
141 + array(
142 + 'key' => 'free_templates',
143 + 'message' => 'Add your email address to get a code for 10+ free form templates.',
144 + 'subject' => 'Get 10+ Free Form Templates',
145 + 'cta' => '<a href="#" class="button-secondary frm-button-secondary frm_inbox_dismiss">Dismiss</a> <a href="' . esc_url( $link ) . '" class="button-primary frm-button-primary">Get Now</a>',
146 + 'type' => 'feedback',
147 + )
148 + );
118 149 }
119 150 }