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
formidable / classes / controllers / FrmInboxController.php

FrmInboxController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.7, at classes/controllers/FrmInboxController.php

142 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 4.05
8 */
9 class FrmInboxController {
10
11 /**
12 * @since 4.05
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 /**
22 * @since 4.05
23 */
24 private static function get_notice_count() {
25 FrmFormMigratorsHelper::maybe_add_to_inbox();
26
27 $inbox = new FrmInbox();
28 return $inbox->unread_html();
29 }
30
31 /**
32 * @since 4.06
33 *
34 * @return void
35 */
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();
53 self::add_tracking_request();
54 self::add_free_template_message();
55
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' );
62 }
63
64 /**
65 * @since 4.05
66 *
67 * @return void
68 */
69 public static function dismiss_message() {
70 check_ajax_referer( 'frm_ajax', 'nonce' );
71 FrmAppHelper::permission_check( 'frm_change_settings' );
72
73 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
74 if ( ! empty( $key ) ) {
75 $message = new FrmInbox();
76 $message->dismiss( $key );
77 if ( $key === 'review' ) {
78 $reviews = new FrmReviews();
79 $reviews->dismiss_review();
80 }
81 }
82
83 wp_die();
84 }
85
86 /**
87 * @since 4.05
88 *
89 * @return void
90 */
91 private static function add_tracking_request() {
92 $settings = FrmAppHelper::get_settings();
93 if ( $settings->tracking ) {
94 return;
95 }
96
97 $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
98
99 $message = new FrmInbox();
100 $message->add_message(
101 array(
102 'key' => 'usage',
103 '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>.',
104 'subject' => __( 'Help Formidable improve with usage tracking', 'formidable' ),
105 '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>',
106 'type' => 'feedback',
107 )
108 );
109 }
110
111 /**
112 * Adds free template design.
113 *
114 * @since 4.10.03
115 *
116 * @return void
117 */
118 private static function add_free_template_message() {
119 if ( FrmAppHelper::pro_is_installed() ) {
120 return;
121 }
122
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 );
140 }
141 }
142