| @@ -14,9 +14,8 @@ | ||
| 14 | 14 | * @since 4.05 |
| 15 | 15 | * @since 6.8.4 The $filtered parameter was added. |
| 16 | 16 | * |
| 17 | 17 | * @param bool $filtered Set this to false to avoid the frm_inbox_badge filter. |
| 18 | - * | |
| 19 | 18 | * @return string |
| 20 | 19 | */ |
| 21 | 20 | public static function get_notice_count( $filtered = true ) { |
| 22 | 21 | FrmFormMigratorsHelper::maybe_add_to_inbox(); |
| @@ -25,8 +24,23 @@ | ||
| 25 | 24 | return $inbox->unread_html( $filtered ); |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | 27 | /** |
| 28 | + * @since 4.06 | |
| 29 | + * | |
| 30 | + * @return void | |
| 31 | + */ | |
| 32 | + public static function dismiss_all_button( $atts ) { | |
| 33 | + if ( empty( $atts['messages'] ) ) { | |
| 34 | + return; | |
| 35 | + } | |
| 36 | + | |
| 37 | + echo '<button class="frm-button-secondary" id="frm-dismiss-inbox" type="button">' . | |
| 38 | + esc_html__( 'Dismiss All', 'formidable' ) . | |
| 39 | + '</button>'; | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 29 | 43 | * @since 6.8 |
| 30 | 44 | * |
| 31 | 45 | * @return array |
| 32 | 46 | */ |
| @@ -31,9 +45,9 @@ | ||
| 31 | 45 | * @return array |
| 32 | 46 | */ |
| 33 | 47 | public static function get_inbox_messages() { |
| 34 | 48 | self::add_tracking_request(); |
| 35 | - self::remove_free_template_message(); | |
| 49 | + self::add_free_template_message(); | |
| 36 | 50 | |
| 37 | 51 | $inbox = new FrmInbox(); |
| 38 | 52 | $unread_messages = $inbox->get_messages(); |
| 39 | 53 | $dismissed_messages = $unread_messages; |
| @@ -54,25 +68,18 @@ | ||
| 54 | 68 | * @return void |
| 55 | 69 | */ |
| 56 | 70 | public static function dismiss_message() { |
| 57 | 71 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 58 | - FrmAppHelper::permission_check( 'frm_view_forms' ); | |
| 72 | + FrmAppHelper::permission_check( 'frm_change_settings' ); | |
| 59 | 73 | |
| 60 | 74 | $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' ); |
| 61 | - | |
| 62 | - if ( $key ) { | |
| 75 | + if ( ! empty( $key ) ) { | |
| 63 | 76 | $message = new FrmInbox(); |
| 64 | 77 | $message->dismiss( $key ); |
| 65 | - | |
| 66 | 78 | if ( $key === 'review' ) { |
| 67 | 79 | $reviews = new FrmReviews(); |
| 68 | 80 | $reviews->dismiss_review(); |
| 69 | 81 | } |
| 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 | - } | |
| 75 | 82 | } |
| 76 | 83 | |
| 77 | 84 | wp_die(); |
| 78 | 85 | } |
| @@ -83,21 +90,21 @@ | ||
| 83 | 90 | * @return void |
| 84 | 91 | */ |
| 85 | 92 | private static function add_tracking_request() { |
| 86 | 93 | $settings = FrmAppHelper::get_settings(); |
| 87 | - | |
| 88 | 94 | if ( $settings->tracking ) { |
| 89 | 95 | return; |
| 90 | 96 | } |
| 91 | 97 | |
| 92 | - $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' ); | |
| 98 | + $link = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' ); | |
| 99 | + | |
| 93 | 100 | $message = new FrmInbox(); |
| 94 | 101 | $message->add_message( |
| 95 | 102 | array( |
| 96 | 103 | 'key' => 'usage', |
| 97 | - '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 | |
| 104 | + '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>.', | |
| 98 | 105 | 'subject' => __( 'Help Formidable improve with usage tracking', 'formidable' ), |
| 99 | - '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 | |
| 106 | + '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>', | |
| 100 | 107 | 'type' => 'feedback', |
| 101 | 108 | ) |
| 102 | 109 | ); |
| 103 | 110 | } |
| @@ -108,13 +115,48 @@ | ||
| 108 | 115 | * @since 4.10.03 |
| 109 | 116 | * |
| 110 | 117 | * @return void |
| 111 | 118 | */ |
| 112 | - private static function remove_free_template_message() { | |
| 119 | + private static function add_free_template_message() { | |
| 113 | 120 | if ( FrmAppHelper::pro_is_installed() ) { |
| 114 | 121 | return; |
| 115 | 122 | } |
| 116 | 123 | |
| 124 | + $api = new FrmFormTemplateApi(); | |
| 125 | + if ( $api->has_free_access() ) { | |
| 126 | + return; | |
| 127 | + } | |
| 128 | + | |
| 129 | + $link = admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . '&free-templates=1' ); | |
| 130 | + | |
| 117 | 131 | $message = new FrmInbox(); |
| 118 | - $message->dismiss( 'free_templates' ); | |
| 132 | + $message->add_message( | |
| 133 | + array( | |
| 134 | + 'key' => 'free_templates', | |
| 135 | + 'message' => 'Add your email address to get a code for 20+ free form templates.', | |
| 136 | + 'subject' => 'Get 20+ Free Form Templates', | |
| 137 | + '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>', | |
| 138 | + 'type' => 'feedback', | |
| 139 | + ) | |
| 140 | + ); | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * @since 4.05 | |
| 145 | + * @deprecated 6.8 | |
| 146 | + * | |
| 147 | + * @return void | |
| 148 | + */ | |
| 149 | + public static function menu() { | |
| 150 | + _deprecated_function( __METHOD__, '6.8' ); | |
| 151 | + } | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * @since 4.05 | |
| 155 | + * @deprecated 6.8 | |
| 156 | + * | |
| 157 | + * @return void | |
| 158 | + */ | |
| 159 | + public static function inbox() { | |
| 160 | + _deprecated_function( __METHOD__, '6.8' ); | |
| 119 | 161 | } |
| 120 | 162 | } |