PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.23
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.23
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 +42 -57 6.5.36.23 View file →
@@ -8,58 +8,44 @@
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 + * @return string
15 19 */
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() {
20 + public static function get_notice_count( $filtered = true ) {
25 21 FrmFormMigratorsHelper::maybe_add_to_inbox();
26 22
27 23 $inbox = new FrmInbox();
28 - return $inbox->unread_html();
24 + return $inbox->unread_html( $filtered );
29 25 }
30 26
31 27 /**
32 - * @since 4.06
28 + * @since 6.8
33 29 *
34 - * @return void
30 + * @return array
35 31 */
36 - public static function dismiss_all_button( $atts ) {
37 - if ( empty( $atts['messages'] ) ) {
38 - return;
39 - }
32 + public static function get_inbox_messages() {
33 + self::add_tracking_request();
34 + self::remove_free_template_message();
40 35
41 - echo '<button class="frm-button-secondary" id="frm-dismiss-inbox" type="button">' .
42 - esc_html__( 'Dismiss All', 'formidable' ) .
43 - '</button>';
44 - }
36 + $inbox = new FrmInbox();
37 + $unread_messages = $inbox->get_messages();
38 + $dismissed_messages = $unread_messages;
45 39
46 - /**
47 - * @since 4.05
48 - *
49 - * @return void
50 - */
51 - public static function inbox() {
52 - FrmAppHelper::include_svg();
53 - self::add_tracking_request();
54 - self::add_free_template_message();
40 + $inbox->filter_messages( $unread_messages, 'filter' );
41 + $inbox->filter_messages( $dismissed_messages, 'dismissed' );
55 42
56 - $inbox = new FrmInbox();
57 - $messages = $inbox->get_messages( 'filter' );
58 - $messages = array_reverse( $messages );
59 - $user = wp_get_current_user();
60 -
61 - include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' );
43 + return array(
44 + 'unread' => array_reverse( $unread_messages ),
45 + 'dismissed' => array_reverse( $dismissed_messages ),
46 + 'user' => wp_get_current_user(),
47 + );
62 48 }
63 49
64 50 /**
65 51 * @since 4.05
@@ -67,18 +53,24 @@
67 53 * @return void
68 54 */
69 55 public static function dismiss_message() {
70 56 check_ajax_referer( 'frm_ajax', 'nonce' );
71 - FrmAppHelper::permission_check( 'frm_change_settings' );
57 + FrmAppHelper::permission_check( 'frm_view_forms' );
72 58
73 59 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
74 60 if ( ! empty( $key ) ) {
75 61 $message = new FrmInbox();
76 62 $message->dismiss( $key );
63 +
77 64 if ( $key === 'review' ) {
78 65 $reviews = new FrmReviews();
79 66 $reviews->dismiss_review();
80 67 }
68 +
69 + if ( $key === 'onboarding_wizard' ) {
70 + // Delete the skipped option or the inbox message will continue to get added.
71 + delete_option( FrmOnboardingWizardController::ONBOARDING_SKIPPED_OPTION );
72 + }
81 73 }
82 74
83 75 wp_die();
84 76 }
@@ -114,28 +106,21 @@
114 106 * @since 4.10.03
115 107 *
116 108 * @return void
117 109 */
118 - private static function add_free_template_message() {
119 - if ( FrmAppHelper::pro_is_installed() ) {
120 - return;
110 + private static function remove_free_template_message() {
111 + if ( ! FrmAppHelper::pro_is_installed() ) {
112 + $message = new FrmInbox();
113 + $message->dismiss( 'free_templates' );
121 114 }
115 + }
122 116
123 - $api = new FrmFormTemplateApi();
124 - if ( $api->has_free_access() ) {
125 - return;
126 - }
127 -
128 - $link = admin_url( 'admin.php?page=formidable&triggerNewFormModal=1&free-templates=1' );
129 -
130 - $message = new FrmInbox();
131 - $message->add_message(
132 - array(
133 - 'key' => 'free_templates',
134 - 'message' => 'Add your email address to get a code for 10+ free form templates.',
135 - 'subject' => 'Get 10+ Free Form Templates',
136 - '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>',
137 - 'type' => 'feedback',
138 - )
139 - );
117 + /**
118 + * @since 4.06
119 + * @deprecated 6.16
120 + *
121 + * @return void
122 + */
123 + public static function dismiss_all_button( $atts ) {
124 + _deprecated_function( __METHOD__, '6.16' );
140 125 }
141 126 }