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/FrmTransLiteCRUDController.php +10 -10 6.25 → trunk View file →
@@ -12,13 +12,15 @@
12 12 /**
13 13 * Show a table of either payments for subscriptions.
14 14 *
15 15 * @param int $id
16 + *
16 17 * @return void
17 18 */
18 19 public static function show( $id = 0 ) {
19 20 if ( ! $id ) {
20 21 $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
22 +
21 23 if ( ! $id ) {
22 24 wp_die( esc_html__( 'Please select a payment to view', 'formidable' ) );
23 25 }
24 26 }
@@ -56,8 +58,9 @@
56 58 }
57 59
58 60 /**
59 61 * @param int $id
62 + *
60 63 * @return object|null
61 64 */
62 65 private static function get_payment_row( $id ) {
63 66 global $wpdb;
@@ -64,9 +67,9 @@
64 67
65 68 $table_name = self::table_name();
66 69
67 70 // @codingStandardsIgnoreStart
68 - $payment = $wpdb->get_row(
71 + return $wpdb->get_row(
69 72 $wpdb->prepare(
70 73 "SELECT
71 74 p.*, e.user_id
72 75 FROM `{$wpdb->prefix}frm_{$table_name}` p
@@ -75,10 +78,8 @@
75 78 $id
76 79 )
77 80 );
78 81 // @codingStandardsIgnoreEnd
79 -
80 - return $payment;
81 82 }
82 83
83 84 /**
84 85 * Handle routing for deleting a payment.
@@ -113,13 +114,9 @@
113 114 $allowed = array( 'payments', 'subscriptions' );
114 115 $default = reset( $allowed );
115 116 $name = FrmAppHelper::get_param( 'type', $default, 'get', 'sanitize_text_field' );
116 117
117 - if ( ! in_array( $name, $allowed, true ) ) {
118 - $name = $default;
119 - }
120 -
121 - return $name;
118 + return in_array( $name, $allowed, true ) ? $name : $default;
122 119 }
123 120
124 121 /**
125 122 * @return FrmTransLitePayment|FrmTransLiteSubscription
@@ -124,8 +121,11 @@
124 121 /**
125 122 * @return FrmTransLitePayment|FrmTransLiteSubscription
126 123 */
127 124 private static function the_class() {
128 - $class_name = self::table_name() === 'subscriptions' ? 'FrmTransLiteSubscription' : 'FrmTransLitePayment';
129 - return new $class_name();
125 + if ( self::table_name() === 'subscriptions' ) {
126 + return new FrmTransLiteSubscription();
127 + }
128 +
129 + return new FrmTransLitePayment();
130 130 }
131 131 }