Skip to content

Commit

Permalink
Merge branch 'release/1.8.18' into release/2.0
Browse files Browse the repository at this point in the history
* release/1.8.18:
  Removed code for deprecated in browser receipt functionality #2483
  Use new link for raw URL rather than deprecated browser link #2483
  Hide the first multi-level remove button to prevent admins from creating forms without any levels when set to multi-level - Resolves #2451
  Strict email

# Conflicts:
#	includes/emails/class-give-email-tags.php
  • Loading branch information
DevinWalker committed Dec 14, 2017
2 parents 0bf4f18 + 66c169e commit 7ab05ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 112 deletions.
2 changes: 1 addition & 1 deletion assets/js/frontend/give-donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ jQuery(function ($) {
function update_billing_state_field() {
var $this = $(this),
$form = $this.parents('form');
if ('card_state' != $this.attr('id')) {
if ('card_state' !== $this.attr('id')) {

//Disable the State field until updated
$form.find('#card_state').empty().append('<option value="1">' + give_global_vars.general_loading + '</option>').prop('disabled', true);
Expand Down
5 changes: 5 additions & 0 deletions assets/scss/admin/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ ASIDE
}
}

// Hide first row remove button for multi-level.
#_give_donation_levels_field .give-row:nth-of-type(2) .give-remove {
display: none !important;
}

//-------------------------------------
// Metabox Tabs
//-------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions includes/emails/class-give-email-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,7 @@ function give_get_receipt_url( $payment_id ) {
if ( $payment_id ) {
$receipt_url = esc_url( add_query_arg( array(
'payment_key' => give_get_payment_key( $payment_id ),
'give_action' => 'view_receipt',
), home_url() ) );
), give_get_history_page_uri() ) );
}

return $receipt_url;
Expand Down
110 changes: 1 addition & 109 deletions includes/emails/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,82 +143,6 @@ function give_email_preview_buttons_callback( $field ) {
}


/**
* Render Receipt in the Browser.
*
* A link is added to the Donation Receipt to view the email in the browser and
* this function renders the Donation Receipt in the browser. It overrides the
* Donation Receipt template and provides its only styling.
*
* @since 1.0
*/
function give_render_receipt_in_browser() {
if ( ! isset( $_GET['payment_key'] ) ) {
wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
}

$key = urlencode( $_GET['payment_key'] );

ob_start();
//Disallows caching of the page
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
header( "Cache-Control: post-check=0, pre-check=0", false );
header( "Pragma: no-cache" ); // HTTP/1.0
header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
/**
* Fires in the receipt HEAD.
*
* @since 1.0
*/
do_action( 'give_receipt_head' );
?>
</head>
<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">

<div id="give_receipt_wrapper">
<?php
/**
* Fires in the receipt template before the content.
*
* @since 1.0
*/
do_action( 'give_render_receipt_in_browser_before' );

echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );

/**
* Fires in the receipt template after the content.
*
* @since 1.0
*/
do_action( 'give_render_receipt_in_browser_after' );
?>
</div>

<?php
/**
* Fires in the receipt footer.
*
* @since 1.0
*/
do_action( 'give_receipt_footer' );
?>
</body>
</html>
<?php
echo ob_get_clean();
die();
}

add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );


/**
* Give Preview Email Header.
*
Expand Down Expand Up @@ -305,36 +229,4 @@ function change_preview(){

return apply_filters( 'give_preview_email_receipt_header', $transaction_header );

}


/**
* Give Receipt Head Content
*
* @since 1.6
* @return string
*/
function give_receipt_head_content() {

//Title.
$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';

//Meta.
$output .= '<meta charset="utf-8"/>
<!-- Further disallowing of caching of this page -->
<meta charset="utf-8"/>
<meta http-equiv="cache-control" content="max-age=0"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="expires" content="Tue, 23 Oct 1977 05:00:00 PST"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta name="robots" content="noindex, nofollow"/>';

//CSS
$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';

echo apply_filters( 'give_receipt_head_content', $output );

}

add_action( 'give_receipt_head', 'give_receipt_head_content' );
}

0 comments on commit 7ab05ce

Please sign in to comment.