| @@ -8,12 +8,8 @@ | ||
| 8 | 8 | /** |
| 9 | 9 | * @return void |
| 10 | 10 | */ |
| 11 | 11 | public static function add_list_hooks() { |
| 12 | - if ( FrmTransLiteAppHelper::should_fallback_to_paypal() ) { | |
| 13 | - return; | |
| 14 | - } | |
| 15 | - | |
| 16 | 12 | $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); |
| 17 | 13 | $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns'; |
| 18 | 14 | |
| 19 | 15 | add_filter( $hook_name, self::class . '::payment_columns' ); |
| @@ -71,10 +67,13 @@ | ||
| 71 | 67 | |
| 72 | 68 | $columns['status'] = esc_html__( 'Status', 'formidable' ); |
| 73 | 69 | $columns['created_at'] = esc_html__( 'Date', 'formidable' ); |
| 74 | 70 | $columns['paysys'] = esc_html__( 'Processor', 'formidable' ); |
| 75 | - $columns['mode'] = esc_html__( 'Mode', 'formidable' ); | |
| 76 | 71 | |
| 72 | + if ( 'bulk_delete' !== FrmAppHelper::simple_get( 'action' ) && ! class_exists( 'FrmTransListHelper' ) && class_exists( 'FrmPaymentsListHelper' ) ) { | |
| 73 | + $columns['mode'] = esc_html__( 'Mode', 'formidable' ); | |
| 74 | + } | |
| 75 | + | |
| 77 | 76 | return $columns; |
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | /** |
| @@ -92,10 +91,9 @@ | ||
| 92 | 91 | if ( ! in_array( FrmAppHelper::simple_get( 'action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) { |
| 93 | 92 | return $show_screen; |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | - $menu_name = sanitize_title( FrmAppHelper::get_menu_name() ); | |
| 97 | - | |
| 95 | + $menu_name = sanitize_title( FrmAppHelper::get_menu_name() ); | |
| 98 | 96 | $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); |
| 99 | 97 | |
| 100 | 98 | if ( $unread_count ) { |
| 101 | 99 | $menu_name .= '-' . $unread_count; |
| @@ -101,9 +99,9 @@ | ||
| 101 | 99 | $menu_name .= '-' . $unread_count; |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | if ( $screen->id === $menu_name . '_page_formidable-payments' ) { |
| 105 | - $show_screen = false; | |
| 103 | + return false; | |
| 106 | 104 | } |
| 107 | 105 | |
| 108 | 106 | return $show_screen; |
| 109 | 107 | } |
| @@ -115,8 +113,33 @@ | ||
| 115 | 113 | * |
| 116 | 114 | * @return void |
| 117 | 115 | */ |
| 118 | 116 | public static function route( $action ) { |
| 117 | + if ( 'coupons' === $action ) { | |
| 118 | + FrmAppHelper::permission_check( 'frm_change_settings' ); | |
| 119 | + | |
| 120 | + include FrmTransLiteAppHelper::plugin_path() . '/views/lists/coupons.php'; | |
| 121 | + return; | |
| 122 | + } | |
| 123 | + | |
| 124 | + // Show no-payments placeholder if payments table doesn't exist. | |
| 125 | + if ( ! FrmTransLiteAppHelper::payments_table_exists() ) { | |
| 126 | + include FrmTransLiteAppHelper::plugin_path() . '/views/lists/no-payments.php'; | |
| 127 | + return; | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * @since 6.27 | |
| 132 | + * | |
| 133 | + * @param bool $route_handled | |
| 134 | + * @param string $action | |
| 135 | + */ | |
| 136 | + $route_handled = apply_filters( 'frm_trans_lite_route', false, $action ); | |
| 137 | + | |
| 138 | + if ( $route_handled ) { | |
| 139 | + return; | |
| 140 | + } | |
| 141 | + | |
| 119 | 142 | self::display_list(); |
| 120 | 143 | } |
| 121 | 144 | |
| 122 | 145 | /** |
| @@ -148,26 +171,24 @@ | ||
| 148 | 171 | */ |
| 149 | 172 | public static function display_list( $response = array() ) { |
| 150 | 173 | FrmAppHelper::include_svg(); |
| 151 | 174 | |
| 152 | - $defaults = array( | |
| 175 | + $defaults = array( | |
| 153 | 176 | 'errors' => array(), |
| 154 | 177 | 'message' => '', |
| 155 | 178 | ); |
| 156 | - $response = array_merge( $defaults, $response ); | |
| 157 | - $errors = $response['errors']; | |
| 158 | - $message = $response['message']; | |
| 159 | - | |
| 179 | + $response = array_merge( $defaults, $response ); | |
| 180 | + $errors = $response['errors']; | |
| 181 | + $message = $response['message']; | |
| 160 | 182 | $wp_list_table = new FrmTransLiteListHelper( self::list_page_params() ); |
| 183 | + $pagenum = $wp_list_table->get_pagenum(); | |
| 161 | 184 | |
| 162 | - $pagenum = $wp_list_table->get_pagenum(); | |
| 163 | - | |
| 164 | 185 | $wp_list_table->prepare_items(); |
| 165 | 186 | |
| 166 | 187 | $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
| 167 | 188 | |
| 168 | 189 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
| 169 | - // if the current page is higher than the total pages, | |
| 190 | + // If the current page is higher than the total pages, | |
| 170 | 191 | // reset it and prepare again to get the right entries. |
| 171 | 192 | $_GET['paged'] = $total_pages; |
| 172 | 193 | $_REQUEST['paged'] = $total_pages; |
| 173 | 194 | $pagenum = $wp_list_table->get_pagenum(); |
| @@ -185,9 +206,9 @@ | ||
| 185 | 206 | * @return mixed |
| 186 | 207 | */ |
| 187 | 208 | public static function save_per_page( $save, $option, $value ) { |
| 188 | 209 | if ( $option === 'formidable_page_formidable_payments_per_page' ) { |
| 189 | - $save = absint( $value ); | |
| 210 | + return absint( $value ); | |
| 190 | 211 | } |
| 191 | 212 | return $save; |
| 192 | 213 | } |
| 193 | 214 | } |