abstract-email-notification.php
8 years ago
ajax-handler.php
8 years ago
backward-compatibility.php
8 years ago
class-donation-receipt-email.php
8 years ago
class-donor-register-email.php
8 years ago
class-email-access-email.php
8 years ago
class-email-notification-table.php
8 years ago
class-email-notification-util.php
8 years ago
class-email-notifications.php
8 years ago
class-email-setting-field.php
8 years ago
class-new-donation-email.php
8 years ago
class-new-donor-register-email.php
8 years ago
class-new-offline-donation-email.php
8 years ago
class-offline-donation-instruction-email.php
8 years ago
filters.php
8 years ago
filters.php
72 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Filter for Email Notification |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Classes/Emails |
| 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 2.0 |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Add extra row actions to email notification table. |
| 14 | * |
| 15 | * @since 2.0 |
| 16 | * |
| 17 | * @param array $row_actions |
| 18 | * @param Give_Email_Notification $email |
| 19 | * |
| 20 | * @return array |
| 21 | */ |
| 22 | function give_email_notification_row_actions_callback( $row_actions, $email ) { |
| 23 | if( Give_Email_Notification_Util::is_email_preview( $email ) ) { |
| 24 | $preview_link = sprintf( |
| 25 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 26 | wp_nonce_url( |
| 27 | add_query_arg( |
| 28 | array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ), |
| 29 | home_url() |
| 30 | ), 'give-preview-email' |
| 31 | ), |
| 32 | __( 'Preview', 'give' ) |
| 33 | ); |
| 34 | |
| 35 | $send_preview_email_link = sprintf( |
| 36 | '<a href="%1$s">%2$s</a>', |
| 37 | wp_nonce_url( |
| 38 | add_query_arg( array( |
| 39 | 'give_action' => 'send_preview_email', |
| 40 | 'email_type' => $email->config['id'], |
| 41 | 'give-message' => 'sent-test-email', |
| 42 | ) ), 'give-send-preview-email' ), |
| 43 | __( 'Send test email', 'give' ) |
| 44 | ); |
| 45 | |
| 46 | $row_actions['email_preview'] = $preview_link; |
| 47 | $row_actions['send_preview_email'] = $send_preview_email_link; |
| 48 | } |
| 49 | |
| 50 | return $row_actions; |
| 51 | } |
| 52 | add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 ); |
| 53 | |
| 54 | /** |
| 55 | * This help to decode all email template tags. |
| 56 | * |
| 57 | * @since 2.0 |
| 58 | * |
| 59 | * @param string $message |
| 60 | * @param Give_Emails $email_obj |
| 61 | * |
| 62 | * @return string |
| 63 | */ |
| 64 | function give_decode_email_tags( $message, $email_obj ) { |
| 65 | if ( ! empty( $email_obj->tag_args ) ) { |
| 66 | $message = give_do_email_tags( $message, $email_obj->tag_args ); |
| 67 | } |
| 68 | |
| 69 | return $message; |
| 70 | } |
| 71 | |
| 72 | add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 ); |