PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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
← All changes | stripe/controllers/FrmTransLiteListsController.php +61 -18 6.5 → trunk View file →
@@ -8,15 +8,18 @@
8 8 /**
9 9 * @return void
10 10 */
11 11 public static function add_list_hooks() {
12 - $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . '_page_formidable-payments_columns';
13 - add_filter( $hook_name, __CLASS__ . '::payment_columns' );
14 - add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
12 + $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
13 + $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns';
14 +
15 + add_filter( $hook_name, self::class . '::payment_columns' );
16 + add_filter( 'screen_options_show_screen', self::class . '::remove_screen_options', 10, 2 );
15 17 }
16 18
17 19 /**
18 20 * @param array $columns
21 + *
19 22 * @return array
20 23 */
21 24 public static function payment_columns( $columns = array() ) {
22 25 add_screen_option(
@@ -63,12 +66,12 @@
63 66 $columns = $columns + $add_columns;
64 67
65 68 $columns['status'] = esc_html__( 'Status', 'formidable' );
66 69 $columns['created_at'] = esc_html__( 'Date', 'formidable' );
70 + $columns['paysys'] = esc_html__( 'Processor', 'formidable' );
67 71
68 - $paypal_is_active = class_exists( 'FrmPaymentsController', false );
69 - if ( $paypal_is_active ) {
70 - $columns['paysys'] = esc_html__( 'Processor', 'formidable' );
72 + if ( 'bulk_delete' !== FrmAppHelper::simple_get( 'action' ) && ! class_exists( 'FrmTransListHelper' ) && class_exists( 'FrmPaymentsListHelper' ) ) {
73 + $columns['mode'] = esc_html__( 'Mode', 'formidable' );
71 74 }
72 75
73 76 return $columns;
74 77 }
@@ -77,8 +80,13 @@
77 80 * Prevent the "screen options" tab from showing when
78 81 * viewing a payment or subscription
79 82 *
80 83 * @since 6.5
84 + *
85 + * @param bool $show_screen Whether to show the screen options tab.
86 + * @param object $screen The current screen.
87 + *
88 + * @return bool
81 89 */
82 90 public static function remove_screen_options( $show_screen, $screen ) {
83 91 if ( ! in_array( FrmAppHelper::simple_get( 'action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
84 92 return $show_screen;
@@ -83,11 +91,17 @@
83 91 if ( ! in_array( FrmAppHelper::simple_get( 'action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
84 92 return $show_screen;
85 93 }
86 94
87 - $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
95 + $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
96 + $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
97 +
98 + if ( $unread_count ) {
99 + $menu_name .= '-' . $unread_count;
100 + }
101 +
88 102 if ( $screen->id === $menu_name . '_page_formidable-payments' ) {
89 - $show_screen = false;
103 + return false;
90 104 }
91 105
92 106 return $show_screen;
93 107 }
@@ -95,11 +109,37 @@
95 109 /**
96 110 * Handle payment/subscription list routing.
97 111 *
98 112 * @param string $action
113 + *
99 114 * @return void
100 115 */
101 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 +
102 142 self::display_list();
103 143 }
104 144
105 145 /**
@@ -106,8 +146,9 @@
106 146 * @return array
107 147 */
108 148 public static function list_page_params() {
109 149 $values = array();
150 +
110 151 foreach ( array(
111 152 'id' => '',
112 153 'paged' => 1,
113 154 'form' => '',
@@ -124,31 +165,31 @@
124 165 /**
125 166 * Display a list.
126 167 *
127 168 * @param array $response
169 + *
128 170 * @return void
129 171 */
130 172 public static function display_list( $response = array() ) {
131 173 FrmAppHelper::include_svg();
132 174
133 - $defaults = array(
175 + $defaults = array(
134 176 'errors' => array(),
135 177 'message' => '',
136 178 );
137 - $response = array_merge( $defaults, $response );
138 - $errors = $response['errors'];
139 - $message = $response['message'];
140 -
179 + $response = array_merge( $defaults, $response );
180 + $errors = $response['errors'];
181 + $message = $response['message'];
141 182 $wp_list_table = new FrmTransLiteListHelper( self::list_page_params() );
183 + $pagenum = $wp_list_table->get_pagenum();
142 184
143 - $pagenum = $wp_list_table->get_pagenum();
144 -
145 185 $wp_list_table->prepare_items();
146 186
147 187 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
188 +
148 189 if ( $pagenum > $total_pages && $total_pages > 0 ) {
149 - // if the current page is higher than the total pages,
150 - // reset it and prepare again to get the right entries
190 + // If the current page is higher than the total pages,
191 + // reset it and prepare again to get the right entries.
151 192 $_GET['paged'] = $total_pages;
152 193 $_REQUEST['paged'] = $total_pages;
153 194 $pagenum = $wp_list_table->get_pagenum();
154 195 $wp_list_table->prepare_items();
@@ -160,12 +201,14 @@
160 201 /**
161 202 * @param mixed $save
162 203 * @param string $option
163 204 * @param int $value
205 + *
206 + * @return mixed
164 207 */
165 208 public static function save_per_page( $save, $option, $value ) {
166 209 if ( $option === 'formidable_page_formidable_payments_per_page' ) {
167 - $save = absint( $value );
210 + return absint( $value );
168 211 }
169 212 return $save;
170 213 }
171 214 }