From 4c7ecb34c61607c204f394230d90372dd4f6ef2b Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 13 May 2024 13:55:18 +0200
Subject: [PATCH] Manual revert fe6438a40da3784b5b38fb662eb305977c5c93c1, was
causing performance issues.
See https://github.com/pronamic/wp-pronamic-pay-gravityforms/issues/39#issuecomment-2107127741 for details.
---
src/Extension.php | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)
diff --git a/src/Extension.php b/src/Extension.php
index df5ebbc..d416c7a 100644
--- a/src/Extension.php
+++ b/src/Extension.php
@@ -273,10 +273,8 @@ public function pre_submission( $form ) {
public function source_text( $text, Payment $payment ) {
$text = __( 'Gravity Forms', 'pronamic_ideal' ) . '
';
- $entry = $this->is_active() ? RGFormsModel::get_lead( $payment->get_source_id() ) : false;
-
$text .= sprintf(
- false === $entry ? '%2$s' : '%2$s',
+ '%2$s',
add_query_arg( [ 'pronamic_gf_lid' => $payment->get_source_id() ], admin_url( 'admin.php' ) ),
/* translators: %s: source id */
sprintf( __( 'Entry #%s', 'pronamic_ideal' ), $payment->get_source_id() )
@@ -306,18 +304,7 @@ public function source_description( $description, Payment $payment ) {
* @return string
*/
public function source_url( $url, Payment $payment ) {
- $entry = RGFormsModel::get_lead( $payment->get_source_id() );
-
- if ( false !== $entry ) {
- $url = add_query_arg(
- [
- 'pronamic_gf_lid' => $payment->get_source_id(),
- ],
- admin_url( 'admin.php' )
- );
- }
-
- return $url;
+ return \add_query_arg( 'pronamic_gf_lid', $payment->get_source_id(), \admin_url( 'admin.php' ) );
}
/**
@@ -331,10 +318,8 @@ public function source_url( $url, Payment $payment ) {
public function subscription_source_text( $text, Subscription $subscription ) {
$text = __( 'Gravity Forms', 'pronamic_ideal' ) . '
';
- $entry = $this->is_active() ? RGFormsModel::get_lead( $subscription->get_source_id() ) : false;
-
$text .= sprintf(
- false === $entry ? '%2$s' : '%2$s',
+ '%2$s',
add_query_arg( [ 'pronamic_gf_lid' => $subscription->get_source_id() ], admin_url( 'admin.php' ) ),
/* translators: %s: source id */
sprintf( __( 'Entry #%s', 'pronamic_ideal' ), $subscription->get_source_id() )
@@ -364,18 +349,7 @@ public function subscription_source_description( $description, Subscription $sub
* @return string
*/
public function subscription_source_url( $url, Subscription $subscription ) {
- $entry = RGFormsModel::get_lead( $subscription->get_source_id() );
-
- if ( false !== $entry ) {
- $url = add_query_arg(
- [
- 'pronamic_gf_lid' => $subscription->get_source_id(),
- ],
- admin_url( 'admin.php' )
- );
- }
-
- return $url;
+ return \add_query_arg( 'pronamic_gf_lid', $subscription->get_source_id(), \admin_url( 'admin.php' ) );
}
/**