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/helpers/FrmStrpLiteLinkRedirectHelper.php +9 -7 6.26 → trunk View file →
@@ -52,9 +52,9 @@
52 52 *
53 53 * @return void
54 54 */
55 55 public function handle_error( $error_code, $charge_id = '' ) {
56 - if ( ! empty( $this->entry_id ) ) {
56 + if ( $this->entry_id ) {
57 57 $referer = FrmStrpLiteAuth::get_referer_url( $this->entry_id );
58 58 }
59 59
60 60 if ( empty( $referer ) ) {
@@ -87,10 +87,13 @@
87 87
88 88 // Let a stripe link success message get handled the same as a 3D secure redirect.
89 89 // When it shows a message, it adds a &frmstrp= param to the URL.
90 90 $redirect = FrmStrpLiteAuth::return_url( compact( 'form', 'entry' ) );
91 - $is_message_redirect = false !== strpos( $redirect, 'frmstrp=' );
91 + $is_message_redirect = str_contains( $redirect, 'frmstrp=' );
92 92
93 + // Call this before all redirects so the referer is always deleted.
94 + $referer_url = $this->get_referer_url( $entry->id );
95 +
93 96 if ( $this->url_is_external( $redirect ) || ! $is_message_redirect ) {
94 97 wp_redirect( $redirect );
95 98 die();
96 99 }
@@ -95,10 +98,8 @@
95 98 die();
96 99 }
97 100
98 101 // $redirect may not include the whole link to the form, breaking the redirect as iDEAL/Sofort have an additional redirect.
99 - $referer_url = $this->get_referer_url( $entry->id );
100 -
101 102 if ( is_string( $referer_url ) ) {
102 103 $parts = explode( '?', $redirect, 2 );
103 104
104 105 if ( 2 === count( $parts ) ) {
@@ -122,9 +123,9 @@
122 123 *
123 124 * @return bool
124 125 */
125 126 private function url_is_external( $url ) {
126 - if ( false === strpos( $url, 'http' ) ) {
127 + if ( ! str_contains( $url, 'http' ) ) {
127 128 return false;
128 129 }
129 130
130 131 $home_url = home_url();
@@ -132,9 +133,10 @@
132 133
133 134 if ( is_array( $parsed ) ) {
134 135 $home_url = $parsed['scheme'] . '://' . $parsed['host'];
135 136 }
136 - return 0 !== strpos( $url, $home_url );
137 +
138 + return ! str_starts_with( $url, $home_url );
137 139 }
138 140
139 141 /**
140 142 * Try to get the referer URL from the entry meta.
@@ -187,9 +189,9 @@
187 189 *
188 190 * @param string $url
189 191 */
190 192 private function add_intent_info_and_redirect( $url ) {
191 - if ( 0 === strpos( $this->stripe_id, 'pi_' ) ) {
193 + if ( str_starts_with( $this->stripe_id, 'pi_' ) ) {
192 194 $url = add_query_arg( 'payment_intent', $this->stripe_id, $url );
193 195 $url = add_query_arg( 'payment_intent_client_secret', $this->client_secret, $url );
194 196 } else {
195 197 $url = add_query_arg( 'setup_intent', $this->stripe_id, $url );