PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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 +57 -42 6.256.7 View file →
@@ -8,44 +8,58 @@
8 8 */
9 9 class FrmInboxController {
10 10
11 11 /**
12 - * Get the HTML for the inbox notice.
12 + * @since 4.05
13 13 *
14 + * @return void
15 + */
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 + /**
14 22 * @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 - * @return string
19 23 */
20 - public static function get_notice_count( $filtered = true ) {
24 + private static function get_notice_count() {
21 25 FrmFormMigratorsHelper::maybe_add_to_inbox();
22 26
23 27 $inbox = new FrmInbox();
24 - return $inbox->unread_html( $filtered );
28 + return $inbox->unread_html();
25 29 }
26 30
27 31 /**
28 - * @since 6.8
32 + * @since 4.06
29 33 *
30 - * @return array
34 + * @return void
31 35 */
32 - public static function get_inbox_messages() {
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 53 self::add_tracking_request();
34 - self::remove_free_template_message();
54 + self::add_free_template_message();
35 55
36 - $inbox = new FrmInbox();
37 - $unread_messages = $inbox->get_messages();
38 - $dismissed_messages = $unread_messages;
56 + $inbox = new FrmInbox();
57 + $messages = $inbox->get_messages( 'filter' );
58 + $messages = array_reverse( $messages );
59 + $user = wp_get_current_user();
39 60
40 - $inbox->filter_messages( $unread_messages, 'filter' );
41 - $inbox->filter_messages( $dismissed_messages, 'dismissed' );
42 -
43 - return array(
44 - 'unread' => array_reverse( $unread_messages ),
45 - 'dismissed' => array_reverse( $dismissed_messages ),
46 - 'user' => wp_get_current_user(),
47 - );
61 + include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' );
48 62 }
49 63
50 64 /**
51 65 * @since 4.05
@@ -53,24 +67,18 @@
53 67 * @return void
54 68 */
55 69 public static function dismiss_message() {
56 70 check_ajax_referer( 'frm_ajax', 'nonce' );
57 - FrmAppHelper::permission_check( 'frm_view_forms' );
71 + FrmAppHelper::permission_check( 'frm_change_settings' );
58 72
59 73 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
60 74 if ( ! empty( $key ) ) {
61 75 $message = new FrmInbox();
62 76 $message->dismiss( $key );
63 -
64 77 if ( $key === 'review' ) {
65 78 $reviews = new FrmReviews();
66 79 $reviews->dismiss_review();
67 80 }
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 - }
73 81 }
74 82
75 83 wp_die();
76 84 }
@@ -106,21 +114,28 @@
106 114 * @since 4.10.03
107 115 *
108 116 * @return void
109 117 */
110 - private static function remove_free_template_message() {
111 - if ( ! FrmAppHelper::pro_is_installed() ) {
112 - $message = new FrmInbox();
113 - $message->dismiss( 'free_templates' );
118 + private static function add_free_template_message() {
119 + if ( FrmAppHelper::pro_is_installed() ) {
120 + return;
114 121 }
115 - }
116 122
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' );
123 + $api = new FrmFormTemplateApi();
124 + if ( $api->has_free_access() ) {
125 + return;
126 + }
127 +
128 + $link = admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . '&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 20+ free form templates.',
135 + 'subject' => 'Get 20+ 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 + );
125 140 }
126 141 }