| @@ -24,8 +24,23 @@ | ||
| 24 | 24 | return $inbox->unread_html( $filtered ); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 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 | + /** | |
| 28 | 43 | * @since 6.8 |
| 29 | 44 | * |
| 30 | 45 | * @return array |
| 31 | 46 | */ |
| @@ -30,9 +45,9 @@ | ||
| 30 | 45 | * @return array |
| 31 | 46 | */ |
| 32 | 47 | public static function get_inbox_messages() { |
| 33 | 48 | self::add_tracking_request(); |
| 34 | - self::remove_free_template_message(); | |
| 49 | + self::add_free_template_message(); | |
| 35 | 50 | |
| 36 | 51 | $inbox = new FrmInbox(); |
| 37 | 52 | $unread_messages = $inbox->get_messages(); |
| 38 | 53 | $dismissed_messages = $unread_messages; |
| @@ -53,24 +68,18 @@ | ||
| 53 | 68 | * @return void |
| 54 | 69 | */ |
| 55 | 70 | public static function dismiss_message() { |
| 56 | 71 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 57 | - FrmAppHelper::permission_check( 'frm_view_forms' ); | |
| 72 | + FrmAppHelper::permission_check( 'frm_change_settings' ); | |
| 58 | 73 | |
| 59 | 74 | $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_text_field' ); |
| 60 | 75 | if ( ! empty( $key ) ) { |
| 61 | 76 | $message = new FrmInbox(); |
| 62 | 77 | $message->dismiss( $key ); |
| 63 | - | |
| 64 | 78 | if ( $key === 'review' ) { |
| 65 | 79 | $reviews = new FrmReviews(); |
| 66 | 80 | $reviews->dismiss_review(); |
| 67 | 81 | } |
| 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 | 82 | } |
| 74 | 83 | |
| 75 | 84 | wp_die(); |
| 76 | 85 | } |
| @@ -106,21 +115,48 @@ | ||
| 106 | 115 | * @since 4.10.03 |
| 107 | 116 | * |
| 108 | 117 | * @return void |
| 109 | 118 | */ |
| 110 | - private static function remove_free_template_message() { | |
| 111 | - if ( ! FrmAppHelper::pro_is_installed() ) { | |
| 112 | - $message = new FrmInbox(); | |
| 113 | - $message->dismiss( 'free_templates' ); | |
| 119 | + private static function add_free_template_message() { | |
| 120 | + if ( FrmAppHelper::pro_is_installed() ) { | |
| 121 | + return; | |
| 114 | 122 | } |
| 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 | + | |
| 131 | + $message = new FrmInbox(); | |
| 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 | + ); | |
| 115 | 141 | } |
| 116 | 142 | |
| 117 | 143 | /** |
| 118 | - * @since 4.06 | |
| 119 | - * @deprecated 6.16 | |
| 144 | + * @since 4.05 | |
| 145 | + * @deprecated 6.8 | |
| 120 | 146 | * |
| 121 | 147 | * @return void |
| 122 | 148 | */ |
| 123 | - public static function dismiss_all_button( $atts ) { | |
| 124 | - _deprecated_function( __METHOD__, '6.16' ); | |
| 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' ); | |
| 125 | 161 | } |
| 126 | 162 | } |