@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return string $message Fully formatted message |
| 43 | 43 | */ |
| 44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
| 45 | - return give_do_email_tags( $message, $payment_id ); |
|
| 44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
| 45 | + return give_do_email_tags($message, $payment_id); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -56,45 +56,45 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return string $message Fully formatted message |
| 58 | 58 | */ |
| 59 | -function give_email_preview_template_tags( $message ) { |
|
| 59 | +function give_email_preview_template_tags($message) { |
|
| 60 | 60 | |
| 61 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
| 61 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
| 62 | 62 | |
| 63 | 63 | $gateway = 'PayPal'; |
| 64 | 64 | |
| 65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
| 65 | + $receipt_id = strtolower(md5(uniqid())); |
|
| 66 | 66 | |
| 67 | - $payment_id = rand( 1, 100 ); |
|
| 67 | + $payment_id = rand(1, 100); |
|
| 68 | 68 | |
| 69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
| 69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
| 70 | 70 | $receipt_link = sprintf( |
| 71 | 71 | '<a href="%1$s">%2$s</a>', |
| 72 | 72 | $receipt_link_url, |
| 73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
| 73 | + esc_html__('View the receipt in your browser »', 'give') |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | // Set user. |
| 77 | 77 | $user = wp_get_current_user(); |
| 78 | 78 | |
| 79 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
| 80 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
| 81 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
| 82 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
| 83 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
| 84 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
| 85 | - $message = str_replace( '{amount}', $price, $message ); |
|
| 86 | - $message = str_replace( '{price}', $price, $message ); |
|
| 87 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
| 88 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
| 89 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
| 90 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
| 91 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
| 92 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
| 93 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
| 94 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
| 95 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
| 96 | - |
|
| 97 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
| 79 | + $message = str_replace('{name}', $user->display_name, $message); |
|
| 80 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
| 81 | + $message = str_replace('{username}', $user->user_login, $message); |
|
| 82 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
| 83 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
| 84 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
| 85 | + $message = str_replace('{amount}', $price, $message); |
|
| 86 | + $message = str_replace('{price}', $price, $message); |
|
| 87 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
| 88 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
| 89 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
| 90 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
| 91 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
| 92 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
| 93 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
| 94 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
| 95 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
| 96 | + |
|
| 97 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -106,23 +106,23 @@ discard block |
||
| 106 | 106 | * @since 1.0 |
| 107 | 107 | * @return array|bool |
| 108 | 108 | */ |
| 109 | -function give_email_template_preview( $array ) { |
|
| 109 | +function give_email_template_preview($array) { |
|
| 110 | 110 | |
| 111 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 111 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | 114 | $custom_field = array( |
| 115 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
| 116 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
| 115 | + 'name' => esc_html__('Preview Email', 'give'), |
|
| 116 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
| 117 | 117 | 'id' => 'give_email_preview_buttons', |
| 118 | 118 | 'type' => 'email_preview_buttons' |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
| 121 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
| 125 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * Output Email Template Preview Buttons. |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | function give_email_preview_buttons_callback() { |
| 135 | 135 | ob_start(); |
| 136 | 136 | ?> |
| 137 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
| 138 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
| 137 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
| 138 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
| 139 | 139 | 'give_action' => 'send_test_email', |
| 140 | 140 | 'give-message' => 'sent-test-email', |
| 141 | 141 | 'tag' => 'emails' |
| 142 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
| 142 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
| 143 | 143 | <?php |
| 144 | 144 | echo ob_get_clean(); |
| 145 | 145 | } |
@@ -152,46 +152,46 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function give_display_email_template_preview() { |
| 154 | 154 | |
| 155 | - if ( empty( $_GET['give_action'] ) ) { |
|
| 155 | + if (empty($_GET['give_action'])) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
| 159 | + if ('preview_email' !== $_GET['give_action']) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 163 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
| 168 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
| 168 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
| 169 | 169 | |
| 170 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
| 170 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
| 171 | 171 | |
| 172 | 172 | echo give_get_preview_email_header(); |
| 173 | 173 | |
| 174 | 174 | //Are we previewing an actual payment? |
| 175 | - if ( ! empty( $payment_id ) ) { |
|
| 175 | + if ( ! empty($payment_id)) { |
|
| 176 | 176 | |
| 177 | - $content = give_get_email_body_content( $payment_id ); |
|
| 177 | + $content = give_get_email_body_content($payment_id); |
|
| 178 | 178 | |
| 179 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
| 179 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
| 180 | 180 | |
| 181 | 181 | } else { |
| 182 | 182 | |
| 183 | 183 | //No payment ID, use sample preview content |
| 184 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
| 184 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
| 188 | - echo Give()->emails->build_email( $preview_content ); |
|
| 188 | + echo Give()->emails->build_email($preview_content); |
|
| 189 | 189 | |
| 190 | 190 | exit; |
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
| 194 | +add_action('init', 'give_display_email_template_preview'); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Email Template Body. |
@@ -203,18 +203,18 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return string $email_body Body of the email |
| 205 | 205 | */ |
| 206 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
| 206 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
| 207 | 207 | |
| 208 | 208 | $default_email_body = give_get_default_donation_receipt_email(); |
| 209 | 209 | |
| 210 | - $email_content = give_get_option( 'donation_receipt' ); |
|
| 211 | - $email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
| 210 | + $email_content = give_get_option('donation_receipt'); |
|
| 211 | + $email_content = ($email_content) ? stripslashes($email_content) : $default_email_body; |
|
| 212 | 212 | |
| 213 | - $email_body = wpautop( $email_content ); |
|
| 213 | + $email_body = wpautop($email_content); |
|
| 214 | 214 | |
| 215 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
| 215 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
| 216 | 216 | |
| 217 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
| 217 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -227,36 +227,36 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return string $email_body Body of the email |
| 229 | 229 | */ |
| 230 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
| 230 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
| 231 | 231 | |
| 232 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
| 233 | - $email = give_get_payment_user_email( $payment_id ); |
|
| 232 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
| 233 | + $email = give_get_payment_user_email($payment_id); |
|
| 234 | 234 | |
| 235 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
| 236 | - $user_data = get_userdata( $user_info['id'] ); |
|
| 235 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
| 236 | + $user_data = get_userdata($user_info['id']); |
|
| 237 | 237 | $name = $user_data->display_name; |
| 238 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
| 239 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 238 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
| 239 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
| 240 | 240 | } else { |
| 241 | 241 | $name = $email; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $gateway = give_get_gateway_admin_label( give_get_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
| 244 | + $gateway = give_get_gateway_admin_label(give_get_meta($payment_id, '_give_payment_gateway', true)); |
|
| 245 | 245 | |
| 246 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
| 247 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
| 248 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
| 249 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
| 250 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
| 251 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
| 252 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
| 246 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
| 247 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
| 248 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
| 249 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
| 250 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n"; |
|
| 251 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
| 252 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
| 253 | 253 | |
| 254 | - $email = give_get_option( 'donation_notification' ); |
|
| 255 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
| 254 | + $email = give_get_option('donation_notification'); |
|
| 255 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
| 256 | 256 | |
| 257 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
| 257 | + $email_body = give_do_email_tags($email, $payment_id); |
|
| 258 | 258 | |
| 259 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
| 259 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -269,19 +269,19 @@ discard block |
||
| 269 | 269 | * @since 1.0 |
| 270 | 270 | */ |
| 271 | 271 | function give_render_receipt_in_browser() { |
| 272 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
| 273 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 272 | + if ( ! isset($_GET['payment_key'])) { |
|
| 273 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $key = urlencode( $_GET['payment_key'] ); |
|
| 276 | + $key = urlencode($_GET['payment_key']); |
|
| 277 | 277 | |
| 278 | 278 | ob_start(); |
| 279 | 279 | //Disallows caching of the page |
| 280 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
| 281 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
| 282 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
| 283 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
| 284 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
| 280 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 281 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
| 282 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
| 283 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
| 284 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
| 285 | 285 | ?> |
| 286 | 286 | <!DOCTYPE html> |
| 287 | 287 | <html lang="en"> |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @since 1.0 |
| 294 | 294 | */ |
| 295 | - do_action( 'give_receipt_head' ); |
|
| 295 | + do_action('give_receipt_head'); |
|
| 296 | 296 | ?> |
| 297 | 297 | </head> |
| 298 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
| 298 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
| 299 | 299 | |
| 300 | 300 | <div id="give_receipt_wrapper"> |
| 301 | 301 | <?php |
@@ -304,16 +304,16 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @since 1.0 |
| 306 | 306 | */ |
| 307 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
| 307 | + do_action('give_render_receipt_in_browser_before'); |
|
| 308 | 308 | |
| 309 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
| 309 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
| 310 | 310 | |
| 311 | 311 | /** |
| 312 | 312 | * Fires in the receipt template after the content. |
| 313 | 313 | * |
| 314 | 314 | * @since 1.0 |
| 315 | 315 | */ |
| 316 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
| 316 | + do_action('give_render_receipt_in_browser_after'); |
|
| 317 | 317 | ?> |
| 318 | 318 | </div> |
| 319 | 319 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @since 1.0 |
| 325 | 325 | */ |
| 326 | - do_action( 'give_receipt_footer' ); |
|
| 326 | + do_action('give_receipt_footer'); |
|
| 327 | 327 | ?> |
| 328 | 328 | </body> |
| 329 | 329 | </html> |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | die(); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
| 335 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -347,29 +347,29 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | //Payment receipt switcher |
| 349 | 349 | $payment_count = give_count_payments()->publish; |
| 350 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
| 350 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
| 351 | 351 | |
| 352 | - if ( $payment_count <= 0 ) { |
|
| 352 | + if ($payment_count <= 0) { |
|
| 353 | 353 | return false; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | //Get payments. |
| 357 | - $payments = new Give_Payments_Query( array( |
|
| 357 | + $payments = new Give_Payments_Query(array( |
|
| 358 | 358 | 'number' => 100 |
| 359 | - ) ); |
|
| 359 | + )); |
|
| 360 | 360 | $payments = $payments->get_payments(); |
| 361 | 361 | $options = array(); |
| 362 | 362 | |
| 363 | 363 | //Provide nice human readable options. |
| 364 | - if ( $payments ) { |
|
| 365 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
| 366 | - foreach ( $payments as $payment ) { |
|
| 364 | + if ($payments) { |
|
| 365 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
| 366 | + foreach ($payments as $payment) { |
|
| 367 | 367 | |
| 368 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
| 368 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
| 369 | 369 | |
| 370 | 370 | } |
| 371 | 371 | } else { |
| 372 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
| 372 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | //Start constructing HTML output. |
@@ -382,16 +382,16 @@ discard block |
||
| 382 | 382 | var selected_trans = transactions.options[transactions.selectedIndex]; |
| 383 | 383 | console.log(selected_trans); |
| 384 | 384 | if (selected_trans){ |
| 385 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
| 385 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
| 386 | 386 | window.location = url_string; |
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | </script>'; |
| 390 | 390 | |
| 391 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
| 391 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
| 392 | 392 | |
| 393 | 393 | //The select field with 100 latest transactions |
| 394 | - $transaction_header .= Give()->html->select( array( |
|
| 394 | + $transaction_header .= Give()->html->select(array( |
|
| 395 | 395 | 'name' => 'preview_email_payment_id', |
| 396 | 396 | 'selected' => $payment_id, |
| 397 | 397 | 'id' => 'give_preview_email_payment_id', |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | 'select_atts' => 'onchange="change_preview()">', |
| 402 | 402 | 'show_option_all' => false, |
| 403 | 403 | 'show_option_none' => false |
| 404 | - ) ); |
|
| 404 | + )); |
|
| 405 | 405 | |
| 406 | 406 | //Closing tag |
| 407 | 407 | $transaction_header .= '</div>'; |
| 408 | 408 | |
| 409 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
| 409 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
| 410 | 410 | |
| 411 | 411 | } |
| 412 | 412 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | function give_receipt_head_content() { |
| 421 | 421 | |
| 422 | 422 | //Title. |
| 423 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
| 423 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
| 424 | 424 | |
| 425 | 425 | //Meta. |
| 426 | 426 | $output .= '<meta charset="utf-8"/> |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | <meta name="robots" content="noindex, nofollow"/>'; |
| 435 | 435 | |
| 436 | 436 | //CSS |
| 437 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
| 437 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
| 438 | 438 | |
| 439 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
| 439 | + echo apply_filters('give_receipt_head_content', $output); |
|
| 440 | 440 | |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
| 444 | 443 | \ No newline at end of file |
| 444 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
| 445 | 445 | \ No newline at end of file |
@@ -6,16 +6,16 @@ discard block |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } // Exit if accessed directly. |
| 12 | 12 | |
| 13 | 13 | // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
| 14 | -$body = " |
|
| 14 | +$body = " |
|
| 15 | 15 | background-color: #f6f6f6; |
| 16 | 16 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
| 17 | 17 | "; |
| 18 | -$wrapper = " |
|
| 18 | +$wrapper = " |
|
| 19 | 19 | width:100%; |
| 20 | 20 | -webkit-text-size-adjust:none !important; |
| 21 | 21 | margin:0; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | text-align: center; |
| 43 | 43 | vertical-align:middle; |
| 44 | 44 | "; |
| 45 | -$body_content = " |
|
| 45 | +$body_content = " |
|
| 46 | 46 | border-radius:3px !important; |
| 47 | 47 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
| 48 | 48 | "; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | line-height:150%; |
| 54 | 54 | text-align:left; |
| 55 | 55 | "; |
| 56 | -$header_content_h1 = " |
|
| 56 | +$header_content_h1 = " |
|
| 57 | 57 | color: #000000; |
| 58 | 58 | margin:0; |
| 59 | 59 | padding: 28px 24px; |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | font-weight: 500; |
| 64 | 64 | line-height: 1.2; |
| 65 | 65 | "; |
| 66 | -$header_img = give_get_option( 'email_logo', '' ); |
|
| 66 | +$header_img = give_get_option('email_logo', ''); |
|
| 67 | 67 | ?> |
| 68 | 68 | <!DOCTYPE html> |
| 69 | 69 | <html> |
| 70 | 70 | <head> |
| 71 | 71 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 72 | - <title><?php echo get_bloginfo( 'name' ); ?></title> |
|
| 72 | + <title><?php echo get_bloginfo('name'); ?></title> |
|
| 73 | 73 | </head> |
| 74 | 74 | <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>"> |
| 75 | 75 | <div style="<?php echo $wrapper; ?>"> |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | <tr> |
| 78 | 78 | <td align="center" valign="top"> |
| 79 | 79 | <?php |
| 80 | - if ( ! empty( $header_img ) ) : ?> |
|
| 80 | + if ( ! empty($header_img)) : ?> |
|
| 81 | 81 | <div id="template_header_image"> |
| 82 | - <?php echo '<p style="margin-top:0;"><img style="' . $template_image . '" src="' . esc_url( $header_img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>'; ?> |
|
| 82 | + <?php echo '<p style="margin-top:0;"><img style="'.$template_image.'" src="'.esc_url($header_img).'" alt="'.get_bloginfo('name').'" /></p>'; ?> |
|
| 83 | 83 | </div> |
| 84 | 84 | <?php endif; ?> |
| 85 | 85 | <table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>"> |