PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.32
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.32
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 +37 -62 6.36.32 View file →
@@ -8,60 +8,45 @@
8 8 */
9 9 class FrmInboxController {
10 10
11 11 /**
12 + * Get the HTML for the inbox notice.
13 + *
12 14 * @since 4.05
15 + * @since 6.8.4 The $filtered parameter was added.
13 16 *
14 - * @return void
17 + * @param bool $filtered Set this to false to avoid the frm_inbox_badge filter.
18 + *
19 + * @return string
15 20 */
16 - public static function menu() {
17 - $unread = self::get_notice_count();
18 - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Inbox', 'formidable' ), __( 'Inbox', 'formidable' ) . $unread, 'frm_change_settings', 'formidable-inbox', 'FrmInboxController::inbox' );
19 - }
20 -
21 - /**
22 - * @since 4.05
23 - */
24 - private static function get_notice_count() {
21 + public static function get_notice_count( $filtered = true ) {
25 22 FrmFormMigratorsHelper::maybe_add_to_inbox();
26 23
27 24 $inbox = new FrmInbox();
28 - return $inbox->unread_html();
25 + return $inbox->unread_html( $filtered );
29 26 }
30 27
31 28 /**
32 - * @since 4.06
29 + * @since 6.8
33 30 *
34 - * @return void
31 + * @return array
35 32 */
36 - public static function dismiss_all_button( $atts ) {
37 - if ( empty( $atts['messages'] ) ) {
38 - return;
39 - }
40 -
41 - echo '<button class="frm-button-secondary" id="frm-dismiss-inbox" type="button">' .
42 - esc_html__( 'Dismiss All', 'formidable' ) .
43 - '</button>';
44 - }
45 -
46 - /**
47 - * @since 4.05
48 - *
49 - * @return void
50 - */
51 - public static function inbox() {
52 - FrmAppHelper::include_svg();
33 + public static function get_inbox_messages() {
53 34 self::add_tracking_request();
54 - self::add_free_template_message();
35 + self::remove_free_template_message();
55 36
56 - $inbox = new FrmInbox();
57 - $messages = $inbox->get_messages( 'filter' );
58 - $messages = array_reverse( $messages );
59 - $user = wp_get_current_user();
37 + $inbox = new FrmInbox();
38 + $unread_messages = $inbox->get_messages();
39 + $dismissed_messages = $unread_messages;
60 40
61 - wp_enqueue_script( 'frm-ac', FrmAppHelper::plugin_url() . '/js/ac.js', array(), FrmAppHelper::plugin_version(), true );
41 + $inbox->filter_messages( $unread_messages, 'filter' );
42 + $inbox->filter_messages( $dismissed_messages, 'dismissed' );
62 43
63 - include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' );
44 + return array(
45 + 'unread' => array_reverse( $unread_messages ),
46 + 'dismissed' => array_reverse( $dismissed_messages ),
47 + 'user' => wp_get_current_user(),
48 + );
64 49 }
65 50
66 51 /**
67 52 * @since 4.05
@@ -69,18 +54,25 @@
69 54 * @return void
70 55 */
71 56 public static function dismiss_message() {
72 57 check_ajax_referer( 'frm_ajax', 'nonce' );
73 - FrmAppHelper::permission_check( 'frm_change_settings' );
58 + FrmAppHelper::permission_check( 'frm_view_forms' );
74 59
75 60 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
76 - if ( ! empty( $key ) ) {
61 +
62 + if ( $key ) {
77 63 $message = new FrmInbox();
78 64 $message->dismiss( $key );
65 +
79 66 if ( $key === 'review' ) {
80 67 $reviews = new FrmReviews();
81 68 $reviews->dismiss_review();
82 69 }
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 + }
83 75 }
84 76
85 77 wp_die();
86 78 }
@@ -90,22 +82,20 @@
90 82 *
91 83 * @return void
92 84 */
93 85 private static function add_tracking_request() {
94 - $settings = FrmAppHelper::get_settings();
95 - if ( $settings->tracking ) {
86 + if ( FrmAppHelper::get_settings()->tracking ) {
96 87 return;
97 88 }
98 89
99 - $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
100 -
90 + $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
101 91 $message = new FrmInbox();
102 92 $message->add_message(
103 93 array(
104 94 'key' => 'usage',
105 - '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>.',
95 + '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>.', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
106 96 'subject' => __( 'Help Formidable improve with usage tracking', 'formidable' ),
107 - '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>',
97 + '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>', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
108 98 'type' => 'feedback',
109 99 )
110 100 );
111 101 }
@@ -116,28 +106,13 @@
116 106 * @since 4.10.03
117 107 *
118 108 * @return void
119 109 */
120 - private static function add_free_template_message() {
110 + private static function remove_free_template_message() {
121 111 if ( FrmAppHelper::pro_is_installed() ) {
122 112 return;
123 113 }
124 114
125 - $api = new FrmFormTemplateApi();
126 - if ( $api->has_free_access() ) {
127 - return;
128 - }
129 -
130 - $link = admin_url( 'admin.php?page=formidable&triggerNewFormModal=1&free-templates=1' );
131 -
132 115 $message = new FrmInbox();
133 - $message->add_message(
134 - array(
135 - 'key' => 'free_templates',
136 - 'message' => 'Add your email address to get a code for 10+ free form templates.',
137 - 'subject' => 'Get 10+ Free Form Templates',
138 - 'cta' => '<a href="#" class="frm-button-secondary frm_inbox_dismiss">Dismiss</a> <a href="' . esc_url( $link ) . '" class="button-primary frm-button-primary">Get Now</a>',
139 - 'type' => 'feedback',
140 - )
141 - );
116 + $message->dismiss( 'free_templates' );
142 117 }
143 118 }