Skip to content

Commit

Permalink
Manual revert fe6438a, was causing performance issues.
Browse files Browse the repository at this point in the history
See #39 (comment) for details.
  • Loading branch information
remcotolsma committed May 13, 2024
1 parent 35d23b8 commit 4c7ecb3
Showing 1 changed file with 4 additions and 30 deletions.
34 changes: 4 additions & 30 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,8 @@ public function pre_submission( $form ) {
public function source_text( $text, Payment $payment ) {
$text = __( 'Gravity Forms', 'pronamic_ideal' ) . '<br />';

$entry = $this->is_active() ? RGFormsModel::get_lead( $payment->get_source_id() ) : false;

$text .= sprintf(
false === $entry ? '%2$s' : '<a href="%1$s">%2$s</a>',
'<a href="%1$s">%2$s</a>',
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() )
Expand Down Expand Up @@ -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' ) );
}

/**
Expand All @@ -331,10 +318,8 @@ public function source_url( $url, Payment $payment ) {
public function subscription_source_text( $text, Subscription $subscription ) {
$text = __( 'Gravity Forms', 'pronamic_ideal' ) . '<br />';

$entry = $this->is_active() ? RGFormsModel::get_lead( $subscription->get_source_id() ) : false;

$text .= sprintf(
false === $entry ? '%2$s' : '<a href="%1$s">%2$s</a>',
'<a href="%1$s">%2$s</a>',
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() )
Expand Down Expand Up @@ -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' ) );
}

/**
Expand Down

0 comments on commit 4c7ecb3

Please sign in to comment.