| @@ -9,20 +9,10 @@ | ||
| 9 | 9 | class FrmInboxController { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @since 4.05 |
| 13 | - * | |
| 14 | - * @return void | |
| 15 | 13 | */ |
| 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() { | |
| 14 | + public static function get_notice_count() { | |
| 25 | 15 | FrmFormMigratorsHelper::maybe_add_to_inbox(); |
| 26 | 16 | |
| 27 | 17 | $inbox = new FrmInbox(); |
| 28 | 18 | return $inbox->unread_html(); |
| @@ -43,25 +33,28 @@ | ||
| 43 | 33 | '</button>'; |
| 44 | 34 | } |
| 45 | 35 | |
| 46 | 36 | /** |
| 47 | - * @since 4.05 | |
| 37 | + * @since 6.8 | |
| 48 | 38 | * |
| 49 | - * @return void | |
| 39 | + * @return array | |
| 50 | 40 | */ |
| 51 | - public static function inbox() { | |
| 52 | - FrmAppHelper::include_svg(); | |
| 41 | + public static function get_inbox_messages() { | |
| 53 | 42 | self::add_tracking_request(); |
| 54 | 43 | self::add_free_template_message(); |
| 55 | 44 | |
| 56 | - $inbox = new FrmInbox(); | |
| 57 | - $messages = $inbox->get_messages( 'filter' ); | |
| 58 | - $messages = array_reverse( $messages ); | |
| 59 | - $user = wp_get_current_user(); | |
| 45 | + $inbox = new FrmInbox(); | |
| 46 | + $unread_messages = $inbox->get_messages(); | |
| 47 | + $dismissed_messages = $unread_messages; | |
| 60 | 48 | |
| 61 | - wp_enqueue_script( 'frm-ac', FrmAppHelper::plugin_url() . '/js/ac.js', array(), FrmAppHelper::plugin_version(), true ); | |
| 49 | + $inbox->filter_messages( $unread_messages, 'filter' ); | |
| 50 | + $inbox->filter_messages( $dismissed_messages, 'dismissed' ); | |
| 62 | 51 | |
| 63 | - include( FrmAppHelper::plugin_path() . '/classes/views/inbox/list.php' ); | |
| 52 | + return array( | |
| 53 | + 'unread' => array_reverse( $unread_messages ), | |
| 54 | + 'dismissed' => array_reverse( $dismissed_messages ), | |
| 55 | + 'user' => wp_get_current_user(), | |
| 56 | + ); | |
| 64 | 57 | } |
| 65 | 58 | |
| 66 | 59 | /** |
| 67 | 60 | * @since 4.05 |
| @@ -126,18 +119,39 @@ | ||
| 126 | 119 | if ( $api->has_free_access() ) { |
| 127 | 120 | return; |
| 128 | 121 | } |
| 129 | 122 | |
| 130 | - $link = admin_url( 'admin.php?page=formidable&triggerNewFormModal=1&free-templates=1' ); | |
| 123 | + $link = admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . '&free-templates=1' ); | |
| 131 | 124 | |
| 132 | 125 | $message = new FrmInbox(); |
| 133 | 126 | $message->add_message( |
| 134 | 127 | array( |
| 135 | 128 | 'key' => 'free_templates', |
| 136 | - 'message' => 'Add your email address to get a code for 10+ free form templates.', | |
| 137 | - 'subject' => 'Get 10+ Free Form Templates', | |
| 129 | + 'message' => 'Add your email address to get a code for 20+ free form templates.', | |
| 130 | + 'subject' => 'Get 20+ Free Form Templates', | |
| 138 | 131 | '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>', |
| 139 | 132 | 'type' => 'feedback', |
| 140 | 133 | ) |
| 141 | 134 | ); |
| 142 | 135 | } |
| 136 | + | |
| 137 | + /** | |
| 138 | + * @since 4.05 | |
| 139 | + * @deprecated 6.8 | |
| 140 | + * | |
| 141 | + * @return void | |
| 142 | + */ | |
| 143 | + public static function menu() { | |
| 144 | + _deprecated_function( __METHOD__, '6.8' ); | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * @since 4.05 | |
| 149 | + * @deprecated 6.8 | |
| 150 | + * | |
| 151 | + * @return void | |
| 152 | + */ | |
| 153 | + public static function inbox() { | |
| 154 | + _deprecated_function( __METHOD__, '6.8' ); | |
| 155 | + } | |
| 156 | + | |
| 143 | 157 | } |