PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.4
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 5.4.4, at classes/controllers/FrmInboxController.php

132 lines 3.9 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 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
19 /**
20 * @since 4.05
21 */
22 private static function get_notice_count() {
23 FrmFormMigratorsHelper::maybe_add_to_inbox();
24
25 $inbox = new FrmInbox();
26 return $inbox->unread_html();
27 }
28
29 /**
30 * @since 4.06
31 */
32 public static function dismiss_all_button( $atts ) {
33 if ( empty( $atts['messages'] ) ) {
34 return;
35 }
36
37 echo '<button class="button-secondary frm-button-secondary" id="frm-dismiss-inbox" type="button">' .
38 esc_html__( 'Dismiss All', 'formidable' ) .
39 '</button>';
40 }
41
42 /**
43 * @since 4.05
44 */
45 public static function inbox() {
46 FrmAppHelper::include_svg();
47 self::add_tracking_request();
48 self::add_free_template_message();
49
50 $inbox = new FrmInbox();
51 $messages = $inbox->get_messages( 'filter' );
52 $messages = array_reverse( $messages );
53 $user = wp_get_current_user();
54
55 wp_enqueue_script( 'frm-ac', FrmAppHelper::plugin_url() . '/js/ac.js', array(), FrmAppHelper::plugin_version(), true );
56
57 include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' );
58 }
59
60 /**
61 * @since 4.05
62 */
63 public static function dismiss_message() {
64 check_ajax_referer( 'frm_ajax', 'nonce' );
65 FrmAppHelper::permission_check( 'frm_change_settings' );
66
67 $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' );
68 if ( ! empty( $key ) ) {
69 $message = new FrmInbox();
70 $message->dismiss( $key );
71 if ( $key === 'review' ) {
72 $reviews = new FrmReviews();
73 $reviews->dismiss_review();
74 }
75 }
76
77 wp_die();
78 }
79
80 /**
81 * @since 4.05
82 */
83 private static function add_tracking_request() {
84 $settings = FrmAppHelper::get_settings();
85 if ( $settings->tracking ) {
86 return;
87 }
88
89 $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
90
91 $message = new FrmInbox();
92 $message->add_message(
93 array(
94 'key' => 'usage',
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>.',
96 'subject' => __( 'Help Formidable improve with usage tracking', 'formidable' ),
97 '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>',
98 'type' => 'feedback',
99 )
100 );
101 }
102
103 /**
104 * Adds free template design.
105 *
106 * @since 4.10.03
107 */
108 private static function add_free_template_message() {
109 if ( FrmAppHelper::pro_is_installed() ) {
110 return;
111 }
112
113 $api = new FrmFormTemplateApi();
114 if ( $api->has_free_access() ) {
115 return;
116 }
117
118 $link = admin_url( 'admin.php?page=formidable&triggerNewFormModal=1&free-templates=1' );
119
120 $message = new FrmInbox();
121 $message->add_message(
122 array(
123 'key' => 'free_templates',
124 'message' => 'Add your email address to get a code for 10+ free form templates.',
125 'subject' => 'Get 10+ Free Form Templates',
126 '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>',
127 'type' => 'feedback',
128 )
129 );
130 }
131 }
132