@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html( 'Nonce verification failed.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html('Nonce verification failed.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Donors_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_register_batch_exporters() { |
85 | - if ( is_admin() ) { |
|
86 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + if (is_admin()) { |
|
86 | + do_action('give_register_batch_exporter'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
90 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Register the payments batch exporter |
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @since 1.5.2 |
122 | 122 | */ |
123 | 123 | function give_register_customers_batch_export() { |
124 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
124 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
127 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Loads the customers batch process if needed |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_include_customers_batch_processor( $class ) { |
|
138 | +function give_include_customers_batch_processor($class) { |
|
139 | 139 | |
140 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
141 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
140 | + if ('Give_Batch_Customers_Export' === $class) { |
|
141 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | * @since 1.5 |
150 | 150 | */ |
151 | 151 | function give_register_forms_batch_export() { |
152 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
152 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
153 | 153 | } |
154 | 154 | |
155 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
155 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Loads the file downloads batch process if needed |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return void |
165 | 165 | */ |
166 | -function give_include_forms_batch_processor( $class ) { |
|
166 | +function give_include_forms_batch_processor($class) { |
|
167 | 167 | |
168 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
169 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
168 | + if ('Give_Batch_Forms_Export' === $class) { |
|
169 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => esc_html( 'ID', 'give' ), |
|
45 | - 'post_name' => esc_html( 'Slug', 'give' ), |
|
46 | - 'post_title' => esc_html( 'Name', 'give' ), |
|
47 | - 'post_date' => esc_html( 'Date Created', 'give' ), |
|
48 | - 'post_author' => esc_html( 'Author', 'give' ), |
|
49 | - 'post_content' => esc_html( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => esc_html( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => esc_html( 'Status', 'give' ), |
|
52 | - 'categories' => esc_html( 'Categories', 'give' ), |
|
53 | - 'tags' => esc_html( 'Tags', 'give' ), |
|
54 | - 'give_price' => esc_html( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => esc_html( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => esc_html( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => esc_html( 'Income', 'give' ), |
|
44 | + 'ID' => esc_html('ID', 'give'), |
|
45 | + 'post_name' => esc_html('Slug', 'give'), |
|
46 | + 'post_title' => esc_html('Name', 'give'), |
|
47 | + 'post_date' => esc_html('Date Created', 'give'), |
|
48 | + 'post_author' => esc_html('Author', 'give'), |
|
49 | + 'post_content' => esc_html('Description', 'give'), |
|
50 | + 'post_excerpt' => esc_html('Excerpt', 'give'), |
|
51 | + 'post_status' => esc_html('Status', 'give'), |
|
52 | + 'categories' => esc_html('Categories', 'give'), |
|
53 | + 'tags' => esc_html('Tags', 'give'), |
|
54 | + 'give_price' => esc_html('Price', 'give'), |
|
55 | + '_thumbnail_id' => esc_html('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => esc_html('Donations', 'give'), |
|
57 | + '_give_download_earnings' => esc_html('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -86,43 +86,43 @@ discard block |
||
86 | 86 | 'paged' => $this->step |
87 | 87 | ); |
88 | 88 | |
89 | - $downloads = new WP_Query( $args ); |
|
89 | + $downloads = new WP_Query($args); |
|
90 | 90 | |
91 | - if ( $downloads->posts ) { |
|
92 | - foreach ( $downloads->posts as $download ) { |
|
91 | + if ($downloads->posts) { |
|
92 | + foreach ($downloads->posts as $download) { |
|
93 | 93 | |
94 | 94 | $row = array(); |
95 | 95 | |
96 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
96 | + foreach ($this->csv_cols() as $key => $value) { |
|
97 | 97 | |
98 | 98 | // Setup default value |
99 | - $row[ $key ] = ''; |
|
99 | + $row[$key] = ''; |
|
100 | 100 | |
101 | - if ( in_array( $key, $meta ) ) { |
|
101 | + if (in_array($key, $meta)) { |
|
102 | 102 | |
103 | - switch ( $key ) { |
|
103 | + switch ($key) { |
|
104 | 104 | |
105 | 105 | case '_thumbnail_id' : |
106 | 106 | |
107 | - $image_id = get_post_thumbnail_id( $download->ID ); |
|
108 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
107 | + $image_id = get_post_thumbnail_id($download->ID); |
|
108 | + $row[$key] = wp_get_attachment_url($image_id); |
|
109 | 109 | |
110 | 110 | break; |
111 | 111 | |
112 | 112 | case 'give_price' : |
113 | 113 | |
114 | - if ( give_has_variable_prices( $download->ID ) ) { |
|
114 | + if (give_has_variable_prices($download->ID)) { |
|
115 | 115 | |
116 | 116 | $prices = array(); |
117 | - foreach ( give_get_variable_prices( $download->ID ) as $price ) { |
|
118 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
117 | + foreach (give_get_variable_prices($download->ID) as $price) { |
|
118 | + $prices[] = $price['name'].': '.$price['amount']; |
|
119 | 119 | } |
120 | 120 | |
121 | - $row[ $key ] = implode( ' | ', $prices ); |
|
121 | + $row[$key] = implode(' | ', $prices); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $row[ $key ] = give_get_download_price( $download->ID ); |
|
125 | + $row[$key] = give_get_download_price($download->ID); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -132,54 +132,54 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | $files = array(); |
135 | - foreach ( give_get_download_files( $download->ID ) as $file ) { |
|
135 | + foreach (give_get_download_files($download->ID) as $file) { |
|
136 | 136 | $files[] = $file['file']; |
137 | 137 | } |
138 | 138 | |
139 | - $row[ $key ] = implode( ' | ', $files ); |
|
139 | + $row[$key] = implode(' | ', $files); |
|
140 | 140 | |
141 | 141 | break; |
142 | 142 | |
143 | 143 | default : |
144 | 144 | |
145 | - $row[ $key ] = get_post_meta( $download->ID, $key, true ); |
|
145 | + $row[$key] = get_post_meta($download->ID, $key, true); |
|
146 | 146 | |
147 | 147 | break; |
148 | 148 | |
149 | 149 | } |
150 | 150 | |
151 | - } elseif ( isset( $download->$key ) ) { |
|
151 | + } elseif (isset($download->$key)) { |
|
152 | 152 | |
153 | - switch ( $key ) { |
|
153 | + switch ($key) { |
|
154 | 154 | |
155 | 155 | case 'post_author' : |
156 | 156 | |
157 | - $row[ $key ] = get_the_author_meta( 'user_login', $download->post_author ); |
|
157 | + $row[$key] = get_the_author_meta('user_login', $download->post_author); |
|
158 | 158 | |
159 | 159 | break; |
160 | 160 | |
161 | 161 | default : |
162 | 162 | |
163 | - $row[ $key ] = $download->$key; |
|
163 | + $row[$key] = $download->$key; |
|
164 | 164 | |
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - } elseif ( 'tags' == $key ) { |
|
168 | + } elseif ('tags' == $key) { |
|
169 | 169 | |
170 | - $terms = get_the_terms( $download->ID, 'download_tag' ); |
|
171 | - if ( $terms ) { |
|
172 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
173 | - $row[ $key ] = implode( ' | ', $terms ); |
|
170 | + $terms = get_the_terms($download->ID, 'download_tag'); |
|
171 | + if ($terms) { |
|
172 | + $terms = wp_list_pluck($terms, 'name'); |
|
173 | + $row[$key] = implode(' | ', $terms); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | - } elseif ( 'categories' == $key ) { |
|
177 | + } elseif ('categories' == $key) { |
|
178 | 178 | |
179 | - $terms = get_the_terms( $download->ID, 'download_category' ); |
|
180 | - if ( $terms ) { |
|
181 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
182 | - $row[ $key ] = implode( ' | ', $terms ); |
|
179 | + $terms = get_the_terms($download->ID, 'download_category'); |
|
180 | + if ($terms) { |
|
181 | + $terms = wp_list_pluck($terms, 'name'); |
|
182 | + $row[$key] = implode(' | ', $terms); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
194 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
193 | + $data = apply_filters('give_export_get_data', $data); |
|
194 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
195 | 195 | |
196 | 196 | return $data; |
197 | 197 | } |
@@ -210,20 +210,20 @@ discard block |
||
210 | 210 | |
211 | 211 | $args = array( |
212 | 212 | 'post_type' => 'give_forms', |
213 | - 'posts_per_page' => - 1, |
|
213 | + 'posts_per_page' => -1, |
|
214 | 214 | 'post_status' => 'any', |
215 | 215 | 'fields' => 'ids', |
216 | 216 | ); |
217 | 217 | |
218 | - $downloads = new WP_Query( $args ); |
|
218 | + $downloads = new WP_Query($args); |
|
219 | 219 | $total = (int) $downloads->post_count; |
220 | 220 | $percentage = 100; |
221 | 221 | |
222 | - if ( $total > 0 ) { |
|
223 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
222 | + if ($total > 0) { |
|
223 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $percentage > 100 ) { |
|
226 | + if ($percentage > 100) { |
|
227 | 227 | $percentage = 100; |
228 | 228 | } |
229 | 229 |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php'; |
|
19 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-actions.php'; |
|
18 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php'; |
|
19 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-actions.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Process batch exports via ajax |
@@ -26,79 +26,79 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_do_ajax_export() { |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - parse_str( $_POST['form'], $form ); |
|
31 | + parse_str($_POST['form'], $form); |
|
32 | 32 | |
33 | 33 | $_REQUEST = $form = (array) $form; |
34 | 34 | |
35 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
36 | - die( '-2' ); |
|
35 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
36 | + die('-2'); |
|
37 | 37 | } |
38 | 38 | |
39 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
39 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
40 | 40 | |
41 | - $step = absint( $_POST['step'] ); |
|
42 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
41 | + $step = absint($_POST['step']); |
|
42 | + $class = sanitize_text_field($form['give-export-class']); |
|
43 | 43 | |
44 | - $export = new $class( $step ); |
|
44 | + $export = new $class($step); |
|
45 | 45 | |
46 | - if ( ! $export->can_export() ) { |
|
47 | - die( '-1' ); |
|
46 | + if ( ! $export->can_export()) { |
|
47 | + die('-1'); |
|
48 | 48 | } |
49 | 49 | |
50 | - if ( ! $export->is_writable ) { |
|
50 | + if ( ! $export->is_writable) { |
|
51 | 51 | $json_args = array( |
52 | 52 | 'error' => true, |
53 | - 'message' => esc_html( 'Export location or file not writable.', 'give' ) |
|
53 | + 'message' => esc_html('Export location or file not writable.', 'give') |
|
54 | 54 | ); |
55 | 55 | echo json_encode($json_args); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | - $export->set_properties( $_REQUEST ); |
|
59 | + $export->set_properties($_REQUEST); |
|
60 | 60 | |
61 | 61 | $export->pre_fetch(); |
62 | 62 | |
63 | - $ret = $export->process_step( $step ); |
|
63 | + $ret = $export->process_step($step); |
|
64 | 64 | |
65 | 65 | $percentage = $export->get_percentage_complete(); |
66 | 66 | |
67 | - if ( $ret ) { |
|
67 | + if ($ret) { |
|
68 | 68 | |
69 | 69 | $step += 1; |
70 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
70 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
71 | 71 | exit; |
72 | 72 | |
73 | - } elseif ( true === $export->is_empty ) { |
|
73 | + } elseif (true === $export->is_empty) { |
|
74 | 74 | |
75 | - echo json_encode( array( |
|
75 | + echo json_encode(array( |
|
76 | 76 | 'error' => true, |
77 | - 'message' => esc_html( 'No data found for export parameters.', 'give' ) |
|
78 | - ) ); |
|
77 | + 'message' => esc_html('No data found for export parameters.', 'give') |
|
78 | + )); |
|
79 | 79 | exit; |
80 | 80 | |
81 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
81 | + } elseif (true === $export->done && true === $export->is_void) { |
|
82 | 82 | |
83 | - $message = ! empty( $export->message ) ? $export->message : esc_html( 'Batch Processing Complete', 'give' ); |
|
84 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
83 | + $message = ! empty($export->message) ? $export->message : esc_html('Batch Processing Complete', 'give'); |
|
84 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
85 | 85 | exit; |
86 | 86 | |
87 | 87 | } else { |
88 | 88 | |
89 | - $args = array_merge( $_REQUEST, array( |
|
89 | + $args = array_merge($_REQUEST, array( |
|
90 | 90 | 'step' => $step, |
91 | 91 | 'class' => $class, |
92 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
92 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
93 | 93 | 'give_action' => 'form_batch_export', |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | - $download_url = add_query_arg( $args, admin_url() ); |
|
96 | + $download_url = add_query_arg($args, admin_url()); |
|
97 | 97 | |
98 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
98 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
99 | 99 | exit; |
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
104 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -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 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | * @global $wp_version |
25 | 25 | * @return void |
26 | 26 | */ |
27 | -function give_install( $network_wide = false ) { |
|
27 | +function give_install($network_wide = false) { |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - if ( is_multisite() && $network_wide ) { |
|
31 | + if (is_multisite() && $network_wide) { |
|
32 | 32 | |
33 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
33 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
34 | 34 | |
35 | - switch_to_blog( $blog_id ); |
|
35 | + switch_to_blog($blog_id); |
|
36 | 36 | give_run_install(); |
37 | 37 | restore_current_blog(); |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
49 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Run the Give Install process |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | give_setup_post_types(); |
63 | 63 | |
64 | 64 | // Clear the permalinks |
65 | - flush_rewrite_rules( false ); |
|
65 | + flush_rewrite_rules(false); |
|
66 | 66 | |
67 | 67 | // Add Upgraded From Option |
68 | - $current_version = get_option( 'give_version' ); |
|
69 | - if ( $current_version ) { |
|
70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
68 | + $current_version = get_option('give_version'); |
|
69 | + if ($current_version) { |
|
70 | + update_option('give_version_upgraded_from', $current_version); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Setup some default options |
74 | 74 | $options = array(); |
75 | 75 | |
76 | 76 | // Checks if the Success Page option exists AND that the page exists |
77 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
77 | + if ( ! get_post(give_get_option('success_page'))) { |
|
78 | 78 | |
79 | 79 | // Purchase Confirmation (Success) Page |
80 | 80 | $success = wp_insert_post( |
81 | 81 | array( |
82 | - 'post_title' => esc_html( 'Donation Confirmation', 'give' ), |
|
82 | + 'post_title' => esc_html('Donation Confirmation', 'give'), |
|
83 | 83 | 'post_content' => '[give_receipt]', |
84 | 84 | 'post_status' => 'publish', |
85 | 85 | 'post_author' => 1, |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Checks if the Failure Page option exists AND that the page exists |
96 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
96 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
97 | 97 | |
98 | 98 | // Failed Purchase Page |
99 | 99 | $failed = wp_insert_post( |
100 | 100 | array( |
101 | - 'post_title' => esc_html( 'Transaction Failed', 'give' ), |
|
102 | - 'post_content' => esc_html( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ), |
|
101 | + 'post_title' => esc_html('Transaction Failed', 'give'), |
|
102 | + 'post_content' => esc_html('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'), |
|
103 | 103 | 'post_status' => 'publish', |
104 | 104 | 'post_author' => 1, |
105 | 105 | 'post_type' => 'page', |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | // Checks if the History Page option exists AND that the page exists |
114 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
114 | + if ( ! get_post(give_get_option('history_page'))) { |
|
115 | 115 | // Purchase History (History) Page |
116 | 116 | $history = wp_insert_post( |
117 | 117 | array( |
118 | - 'post_title' => esc_html( 'Donation History', 'give' ), |
|
118 | + 'post_title' => esc_html('Donation History', 'give'), |
|
119 | 119 | 'post_content' => '[donation_history]', |
120 | 120 | 'post_status' => 'publish', |
121 | 121 | 'post_author' => 1, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
131 | - if ( empty( $current_version ) ) { |
|
131 | + if (empty($current_version)) { |
|
132 | 132 | $options['base_country'] = 'US'; |
133 | 133 | $options['test_mode'] = 1; |
134 | 134 | $options['currency'] = 'USD'; |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | // Populate some default values |
148 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
149 | - update_option( 'give_version', GIVE_VERSION ); |
|
148 | + update_option('give_settings', array_merge($give_options, $options)); |
|
149 | + update_option('give_version', GIVE_VERSION); |
|
150 | 150 | |
151 | 151 | //Update Version Number |
152 | - if ( $current_version ) { |
|
153 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
152 | + if ($current_version) { |
|
153 | + update_option('give_version_upgraded_from', $current_version); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Create Give roles |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $roles->add_caps(); |
160 | 160 | |
161 | 161 | $api = new Give_API(); |
162 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
162 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
163 | 163 | |
164 | 164 | // Create the customers database |
165 | 165 | @Give()->customers->create_table(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | Give()->session->use_php_sessions(); |
169 | 169 | |
170 | 170 | // Add a temporary option to note that Give pages have been created |
171 | - set_transient( '_give_installed', $options, 30 ); |
|
171 | + set_transient('_give_installed', $options, 30); |
|
172 | 172 | |
173 | - if ( ! $current_version ) { |
|
173 | + if ( ! $current_version) { |
|
174 | 174 | |
175 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
175 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
176 | 176 | |
177 | 177 | // When new upgrade routines are added, mark them as complete on fresh install |
178 | 178 | $upgrade_routines = array( |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | 'upgrade_give_offline_status' |
182 | 182 | ); |
183 | 183 | |
184 | - foreach ( $upgrade_routines as $upgrade ) { |
|
185 | - give_set_upgrade_complete( $upgrade ); |
|
184 | + foreach ($upgrade_routines as $upgrade) { |
|
185 | + give_set_upgrade_complete($upgrade); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | 189 | // Bail if activating from network, or bulk |
190 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
190 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
194 | 194 | // Add the transient to redirect |
195 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
195 | + set_transient('_give_activation_redirect', true, 30); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
199 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
199 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Network Activated New Site Setup |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | * @param int $site_id The Site ID |
213 | 213 | * @param array $meta Blog Meta |
214 | 214 | */ |
215 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
215 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
216 | 216 | |
217 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
217 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
218 | 218 | |
219 | - switch_to_blog( $blog_id ); |
|
219 | + switch_to_blog($blog_id); |
|
220 | 220 | give_install(); |
221 | 221 | restore_current_blog(); |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
227 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
228 | 228 | |
229 | 229 | |
230 | 230 | /** |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return array The tables to drop |
239 | 239 | */ |
240 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
240 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
241 | 241 | |
242 | - switch_to_blog( $blog_id ); |
|
242 | + switch_to_blog($blog_id); |
|
243 | 243 | $customers_db = new Give_DB_Customers(); |
244 | - if ( $customers_db->installed() ) { |
|
244 | + if ($customers_db->installed()) { |
|
245 | 245 | $tables[] = $customers_db->table_name; |
246 | 246 | } |
247 | 247 | restore_current_blog(); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | } |
252 | 252 | |
253 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
253 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Post-installation |
@@ -262,35 +262,35 @@ discard block |
||
262 | 262 | */ |
263 | 263 | function give_after_install() { |
264 | 264 | |
265 | - if ( ! is_admin() ) { |
|
265 | + if ( ! is_admin()) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
269 | - $give_options = get_transient( '_give_installed' ); |
|
270 | - $give_table_check = get_option( '_give_table_check', false ); |
|
269 | + $give_options = get_transient('_give_installed'); |
|
270 | + $give_table_check = get_option('_give_table_check', false); |
|
271 | 271 | |
272 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
272 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
273 | 273 | |
274 | - if ( ! @Give()->customers->installed() ) { |
|
274 | + if ( ! @Give()->customers->installed()) { |
|
275 | 275 | // Create the customers database (this ensures it creates it on multisite instances where it is network activated) |
276 | 276 | @Give()->customers->create_table(); |
277 | 277 | |
278 | - do_action( 'give_after_install', $give_options ); |
|
278 | + do_action('give_after_install', $give_options); |
|
279 | 279 | } |
280 | 280 | |
281 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
281 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | |
285 | 285 | // Delete the transient |
286 | - if ( false !== $give_options ) { |
|
287 | - delete_transient( '_give_installed' ); |
|
286 | + if (false !== $give_options) { |
|
287 | + delete_transient('_give_installed'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | -add_action( 'admin_init', 'give_after_install' ); |
|
293 | +add_action('admin_init', 'give_after_install'); |
|
294 | 294 | |
295 | 295 | |
296 | 296 | /** |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | |
306 | 306 | global $wp_roles; |
307 | 307 | |
308 | - if ( ! is_object( $wp_roles ) ) { |
|
308 | + if ( ! is_object($wp_roles)) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 | |
312 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
312 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
313 | 313 | |
314 | 314 | // Create Give plugin roles |
315 | 315 | $roles = new Give_Roles(); |
@@ -320,4 +320,4 @@ discard block |
||
320 | 320 | |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
324 | 323 | \ No newline at end of file |
324 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
325 | 325 | \ No newline at end of file |
@@ -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 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @see Give_Cron::weekly_events() |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
33 | + add_action('wp', array($this, 'schedule_Events')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function add_schedules( $schedules = array() ) { |
|
45 | + public function add_schedules($schedules = array()) { |
|
46 | 46 | // Adds once weekly to the existing schedules. |
47 | 47 | $schedules['weekly'] = array( |
48 | 48 | 'interval' => 604800, |
49 | - 'display' => esc_html( 'Once Weekly', 'easy-digital-downloads' ) |
|
49 | + 'display' => esc_html('Once Weekly', 'easy-digital-downloads') |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | private function weekly_events() { |
75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | private function daily_events() { |
88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -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 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', esc_html( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', esc_html('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', esc_html( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', esc_html('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', esc_html( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', esc_html('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', esc_html( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', esc_html('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,50 +107,50 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | 128 | /* translators: %s: payment id */ |
129 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
130 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
131 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
129 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html('New Donation - Payment #%s', 'give'), $payment_id)); |
|
130 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
131 | + $subject = give_do_email_tags($subject, $payment_id); |
|
132 | 132 | |
133 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
134 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
133 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
134 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
135 | 135 | //$headers .= "MIME-Version: 1.0\r\n"; |
136 | 136 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
137 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
137 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
138 | 138 | |
139 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
139 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
140 | 140 | |
141 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
141 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
142 | 142 | |
143 | 143 | $emails = Give()->emails; |
144 | - $emails->__set( 'from_name', $from_name ); |
|
145 | - $emails->__set( 'from_email', $from_email ); |
|
146 | - $emails->__set( 'headers', $headers ); |
|
147 | - $emails->__set( 'heading', esc_html( 'New Donation!', 'give' ) ); |
|
144 | + $emails->__set('from_name', $from_name); |
|
145 | + $emails->__set('from_email', $from_email); |
|
146 | + $emails->__set('headers', $headers); |
|
147 | + $emails->__set('heading', esc_html('New Donation!', 'give')); |
|
148 | 148 | |
149 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
149 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
153 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | function give_get_admin_notice_emails() { |
164 | 164 | global $give_options; |
165 | 165 | |
166 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
167 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
166 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
167 | + $emails = array_map('trim', explode("\n", $emails)); |
|
168 | 168 | |
169 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
169 | + return apply_filters('give_admin_notice_emails', $emails); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return mixed |
180 | 180 | */ |
181 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
181 | +function give_admin_notices_disabled($payment_id = 0) { |
|
182 | 182 | |
183 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
183 | + $retval = give_get_option('disable_admin_notices'); |
|
184 | 184 | |
185 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
185 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function give_get_default_donation_notification_email() { |
197 | 197 | |
198 | - $default_email_body = esc_html( 'Hi there,', 'give' ) . "\n\n" . esc_html( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
199 | - $default_email_body .= '<strong>' . esc_html( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . esc_html( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . esc_html( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
202 | - $default_email_body .= '<strong>' . esc_html( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
203 | - $default_email_body .= esc_html( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
198 | + $default_email_body = esc_html('Hi there,', 'give')."\n\n".esc_html('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
199 | + $default_email_body .= '<strong>'.esc_html('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.esc_html('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.esc_html('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
202 | + $default_email_body .= '<strong>'.esc_html('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
203 | + $default_email_body .= esc_html('Thank you,', 'give')."\n\n".'{sitename}'; |
|
204 | 204 | |
205 | - $custom_message = give_get_option( 'donation_notification' ); |
|
206 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
205 | + $custom_message = give_get_option('donation_notification'); |
|
206 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
207 | 207 | |
208 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
208 | + return apply_filters('give_default_donation_notification_email', $message); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -219,26 +219,26 @@ discard block |
||
219 | 219 | */ |
220 | 220 | function give_get_default_donation_receipt_email() { |
221 | 221 | |
222 | - $default_email_body = esc_html( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= esc_html( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . esc_html( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . esc_html( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . esc_html( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . esc_html( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . esc_html( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . esc_html( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . esc_html( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = esc_html('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= esc_html('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.esc_html('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.esc_html('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.esc_html('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.esc_html('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.esc_html('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.esc_html('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.esc_html('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | |
233 | 233 | $default_email_body .= "\n\n"; |
234 | - $default_email_body .= esc_html( 'Sincerely,', 'give' ); |
|
235 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
234 | + $default_email_body .= esc_html('Sincerely,', 'give'); |
|
235 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
236 | 236 | |
237 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
237 | + $custom_message = give_get_option('donation_receipt'); |
|
238 | 238 | |
239 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
239 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
240 | 240 | |
241 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
241 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,19 +250,19 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return array $email_names |
252 | 252 | */ |
253 | -function give_get_email_names( $user_info ) { |
|
253 | +function give_get_email_names($user_info) { |
|
254 | 254 | $email_names = array(); |
255 | - $user_info = maybe_unserialize( $user_info ); |
|
255 | + $user_info = maybe_unserialize($user_info); |
|
256 | 256 | |
257 | 257 | $email_names['fullname'] = ''; |
258 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
259 | - $user_data = get_userdata( $user_info['id'] ); |
|
258 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
259 | + $user_data = get_userdata($user_info['id']); |
|
260 | 260 | $email_names['name'] = $user_info['first_name']; |
261 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
261 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
262 | 262 | $email_names['username'] = $user_data->user_login; |
263 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
263 | + } elseif (isset($user_info['first_name'])) { |
|
264 | 264 | $email_names['name'] = $user_info['first_name']; |
265 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
265 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
266 | 266 | $email_names['username'] = $user_info['first_name']; |
267 | 267 | } else { |
268 | 268 | $email_names['name'] = $user_info['email']; |
@@ -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 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a purchase receipt while editing a payment |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Purchase Receipt. (This can be done from the Payment History page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html( 'You do not have permission to edit payment records.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html('You do not have permission to edit payment records.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -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 | /** |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string $message Fully formatted message |
56 | 56 | */ |
57 | -function give_email_preview_template_tags( $message ) { |
|
57 | +function give_email_preview_template_tags($message) { |
|
58 | 58 | |
59 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
59 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
60 | 60 | |
61 | 61 | $gateway = 'PayPal'; |
62 | 62 | |
63 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
63 | + $receipt_id = strtolower(md5(uniqid())); |
|
64 | 64 | |
65 | - $notes = esc_html( 'These are some sample notes added to a donation.', 'give' ); |
|
65 | + $notes = esc_html('These are some sample notes added to a donation.', 'give'); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - esc_html( 'View the receipt in your browser', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + esc_html('View the receipt in your browser', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{price}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', 'Sample Donation Form Title', $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{product_notes}', $notes, $message ); |
|
87 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
88 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{price}', $price, $message); |
|
82 | + $message = str_replace('{donation}', 'Sample Donation Form Title', $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{product_notes}', $notes, $message); |
|
87 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
88 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | * @since 1.0 |
101 | 101 | * @return array|bool |
102 | 102 | */ |
103 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
103 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
104 | 104 | |
105 | -function give_email_template_preview( $array ) { |
|
105 | +function give_email_template_preview($array) { |
|
106 | 106 | |
107 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
107 | + if ( ! current_user_can('manage_give_settings')) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | $custom_field = array( |
111 | - 'name' => esc_html( 'Preview Email', 'give' ), |
|
112 | - 'desc' => esc_html( 'Click the buttons to preview emails.', 'give' ), |
|
111 | + 'name' => esc_html('Preview Email', 'give'), |
|
112 | + 'desc' => esc_html('Click the buttons to preview emails.', 'give'), |
|
113 | 113 | 'id' => 'give_email_preview_buttons', |
114 | 114 | 'type' => 'email_preview_buttons' |
115 | 115 | ); |
116 | - array_splice( $array, 5, 0, array( $custom_field ) ); |
|
116 | + array_splice($array, 5, 0, array($custom_field)); |
|
117 | 117 | |
118 | 118 | return $array; // splice in at position 3; |
119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | function give_email_preview_buttons_callback() { |
130 | 130 | ob_start(); |
131 | 131 | ?> |
132 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
133 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
132 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
133 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_test_email', |
135 | 135 | 'give-message' => 'sent-test-email' |
136 | - ) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
136 | + )), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
137 | 137 | <?php |
138 | 138 | echo ob_get_clean(); |
139 | 139 | } |
@@ -146,27 +146,27 @@ discard block |
||
146 | 146 | */ |
147 | 147 | function give_display_email_template_preview() { |
148 | 148 | |
149 | - if ( empty( $_GET['give_action'] ) ) { |
|
149 | + if (empty($_GET['give_action'])) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
153 | + if ('preview_email' !== $_GET['give_action']) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
157 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
157 | + if ( ! current_user_can('manage_give_settings')) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - Give()->emails->heading = esc_html( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = esc_html('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) ); |
|
163 | + echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array()))); |
|
164 | 164 | |
165 | 165 | exit; |
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'template_redirect', 'give_display_email_template_preview' ); |
|
169 | +add_action('template_redirect', 'give_display_email_template_preview'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Email Template Body |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string $email_body Body of the email |
180 | 180 | */ |
181 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
181 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
182 | 182 | |
183 | 183 | global $give_options; |
184 | 184 | |
185 | 185 | $default_email_body = give_get_default_donation_receipt_email(); |
186 | 186 | |
187 | - $email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body; |
|
187 | + $email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body; |
|
188 | 188 | |
189 | - $email_body = wpautop( $email ); |
|
189 | + $email_body = wpautop($email); |
|
190 | 190 | |
191 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
191 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
192 | 192 | |
193 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
193 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -206,41 +206,41 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return string $email_body Body of the email |
208 | 208 | */ |
209 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
209 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
210 | 210 | global $give_options; |
211 | 211 | |
212 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
213 | - $email = give_get_payment_user_email( $payment_id ); |
|
212 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
213 | + $email = give_get_payment_user_email($payment_id); |
|
214 | 214 | |
215 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
216 | - $user_data = get_userdata( $user_info['id'] ); |
|
215 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
216 | + $user_data = get_userdata($user_info['id']); |
|
217 | 217 | $name = $user_data->display_name; |
218 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
219 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
218 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
219 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
220 | 220 | } else { |
221 | 221 | $name = $email; |
222 | 222 | } |
223 | 223 | |
224 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
224 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
225 | 225 | |
226 | - $default_email_body = esc_html( 'Hello', 'give' ) . "\n\n" . esc_html( 'A donation has been made', 'give' ) . ".\n\n"; |
|
226 | + $default_email_body = esc_html('Hello', 'give')."\n\n".esc_html('A donation has been made', 'give').".\n\n"; |
|
227 | 227 | $default_email_body .= sprintf( |
228 | 228 | /* translators: %s: form plural label */ |
229 | - esc_html( '%s sold:', 'give' ), |
|
229 | + esc_html('%s sold:', 'give'), |
|
230 | 230 | give_get_forms_label_plural() |
231 | - ) . "\n\n"; |
|
231 | + )."\n\n"; |
|
232 | 232 | |
233 | - $default_email_body .= esc_html( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
234 | - $default_email_body .= esc_html( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
235 | - $default_email_body .= esc_html( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n"; |
|
233 | + $default_email_body .= esc_html('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
234 | + $default_email_body .= esc_html('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
235 | + $default_email_body .= esc_html('Payment Method: ', 'give')." ".$gateway."\n\n"; |
|
236 | 236 | |
237 | - $default_email_body .= esc_html( 'Thank you', 'give' ); |
|
237 | + $default_email_body .= esc_html('Thank you', 'give'); |
|
238 | 238 | |
239 | - $email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body; |
|
239 | + $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body; |
|
240 | 240 | |
241 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
241 | + $email_body = give_do_email_tags($email, $payment_id); |
|
242 | 242 | |
243 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
243 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | * @since 1.0 |
254 | 254 | */ |
255 | 255 | function give_render_receipt_in_browser() { |
256 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
257 | - wp_die( esc_html( 'Missing donation payment key.', 'give' ), esc_html( 'Error', 'give' ) ); |
|
256 | + if ( ! isset($_GET['payment_key'])) { |
|
257 | + wp_die(esc_html('Missing donation payment key.', 'give'), esc_html('Error', 'give')); |
|
258 | 258 | } |
259 | 259 | |
260 | - $key = urlencode( $_GET['payment_key'] ); |
|
260 | + $key = urlencode($_GET['payment_key']); |
|
261 | 261 | |
262 | 262 | ob_start(); |
263 | 263 | //Disallows caching of the page |
264 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
264 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
265 | 265 | header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
266 | 266 | header("Cache-Control: post-check=0, pre-check=0", false); |
267 | 267 | header("Pragma: no-cache"); // HTTP/1.0 |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | <!DOCTYPE html> |
271 | 271 | <html lang="en"> |
272 | 272 | <head> |
273 | - <title><?php esc_html_e( 'Donation Receipt', 'give' ); ?></title> |
|
273 | + <title><?php esc_html_e('Donation Receipt', 'give'); ?></title> |
|
274 | 274 | <meta charset="utf-8" /> |
275 | 275 | |
276 | 276 | <!-- Further disallowing of caching of this page --> |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | |
285 | 285 | <?php wp_head(); ?> |
286 | 286 | </head> |
287 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
287 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
288 | 288 | |
289 | 289 | <div id="give_receipt_wrapper"> |
290 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
291 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
292 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
290 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
291 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
292 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
293 | 293 | </div> |
294 | 294 | |
295 | 295 | <?php wp_footer(); ?> |
@@ -300,4 +300,4 @@ discard block |
||
300 | 300 | die(); |
301 | 301 | } |
302 | 302 | |
303 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
303 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function __construct() { |
81 | 81 | |
82 | - if ( 'none' === $this->get_template() ) { |
|
82 | + if ('none' === $this->get_template()) { |
|
83 | 83 | $this->html = false; |
84 | 84 | } |
85 | 85 | |
86 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
87 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
86 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
87 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - public function __set( $key, $value ) { |
|
96 | + public function __set($key, $value) { |
|
97 | 97 | $this->$key = $value; |
98 | 98 | } |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | */ |
105 | 105 | public function get_from_name() { |
106 | - if ( ! $this->from_name ) { |
|
107 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
106 | + if ( ! $this->from_name) { |
|
107 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
108 | 108 | } |
109 | 109 | |
110 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
110 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | 118 | public function get_from_address() { |
119 | - if ( ! $this->from_address ) { |
|
120 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
119 | + if ( ! $this->from_address) { |
|
120 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
121 | 121 | } |
122 | 122 | |
123 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
123 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | 131 | public function get_content_type() { |
132 | - if ( ! $this->content_type && $this->html ) { |
|
133 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
134 | - } else if ( ! $this->html ) { |
|
132 | + if ( ! $this->content_type && $this->html) { |
|
133 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
134 | + } else if ( ! $this->html) { |
|
135 | 135 | $this->content_type = 'text/plain'; |
136 | 136 | } |
137 | 137 | |
138 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
138 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * @since 1.0 |
145 | 145 | */ |
146 | 146 | public function get_headers() { |
147 | - if ( ! $this->headers ) { |
|
147 | + if ( ! $this->headers) { |
|
148 | 148 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
149 | 149 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
150 | 150 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
151 | 151 | } |
152 | 152 | |
153 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
153 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_templates() { |
162 | 162 | $templates = array( |
163 | - 'default' => esc_html( 'Default Template', 'give' ), |
|
164 | - 'none' => esc_html( 'No template, plain text only', 'give' ) |
|
163 | + 'default' => esc_html('Default Template', 'give'), |
|
164 | + 'none' => esc_html('No template, plain text only', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_email_templates', $templates ); |
|
167 | + return apply_filters('give_email_templates', $templates); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @since 1.0 |
174 | 174 | */ |
175 | 175 | public function get_template() { |
176 | - if ( ! $this->template ) { |
|
177 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
176 | + if ( ! $this->template) { |
|
177 | + $this->template = give_get_option('email_template', 'default'); |
|
178 | 178 | } |
179 | 179 | |
180 | - return apply_filters( 'give_email_template', $this->template ); |
|
180 | + return apply_filters('give_email_template', $this->template); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @since 1.0 |
187 | 187 | */ |
188 | 188 | public function get_heading() { |
189 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
189 | + return apply_filters('give_email_heading', $this->heading); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return mixed |
198 | 198 | */ |
199 | - public function parse_tags( $content ) { |
|
199 | + public function parse_tags($content) { |
|
200 | 200 | return $content; |
201 | 201 | } |
202 | 202 | |
@@ -205,36 +205,36 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - public function build_email( $message ) { |
|
208 | + public function build_email($message) { |
|
209 | 209 | |
210 | - if ( false === $this->html ) { |
|
211 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
210 | + if (false === $this->html) { |
|
211 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
212 | 212 | } |
213 | 213 | |
214 | - $message = $this->text_to_html( $message ); |
|
214 | + $message = $this->text_to_html($message); |
|
215 | 215 | |
216 | 216 | ob_start(); |
217 | 217 | |
218 | - give_get_template_part( 'emails/header', $this->get_template(), true ); |
|
218 | + give_get_template_part('emails/header', $this->get_template(), true); |
|
219 | 219 | |
220 | - do_action( 'give_email_header', $this ); |
|
220 | + do_action('give_email_header', $this); |
|
221 | 221 | |
222 | - if ( has_action( 'give_email_template_' . $this->get_template() ) ) { |
|
223 | - do_action( 'give_email_template_' . $this->get_template() ); |
|
222 | + if (has_action('give_email_template_'.$this->get_template())) { |
|
223 | + do_action('give_email_template_'.$this->get_template()); |
|
224 | 224 | } else { |
225 | - give_get_template_part( 'emails/body', $this->get_template(), true ); |
|
225 | + give_get_template_part('emails/body', $this->get_template(), true); |
|
226 | 226 | } |
227 | 227 | |
228 | - do_action( 'give_email_body', $this ); |
|
228 | + do_action('give_email_body', $this); |
|
229 | 229 | |
230 | - give_get_template_part( 'emails/footer', $this->get_template(), true ); |
|
230 | + give_get_template_part('emails/footer', $this->get_template(), true); |
|
231 | 231 | |
232 | - do_action( 'give_email_footer', $this ); |
|
232 | + do_action('give_email_footer', $this); |
|
233 | 233 | |
234 | 234 | $body = ob_get_clean(); |
235 | - $message = str_replace( '{email}', $message, $body ); |
|
235 | + $message = str_replace('{email}', $message, $body); |
|
236 | 236 | |
237 | - return apply_filters( 'give_email_message', $message, $this ); |
|
237 | + return apply_filters('give_email_message', $message, $this); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -247,26 +247,26 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return bool |
249 | 249 | */ |
250 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
250 | + public function send($to, $subject, $message, $attachments = '') { |
|
251 | 251 | |
252 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
253 | - _doing_it_wrong( __FUNCTION__, esc_html( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
252 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
253 | + _doing_it_wrong(__FUNCTION__, esc_html('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
254 | 254 | |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | |
258 | - do_action( 'give_email_send_before', $this ); |
|
258 | + do_action('give_email_send_before', $this); |
|
259 | 259 | |
260 | - $subject = $this->parse_tags( $subject ); |
|
261 | - $message = $this->parse_tags( $message ); |
|
260 | + $subject = $this->parse_tags($subject); |
|
261 | + $message = $this->parse_tags($message); |
|
262 | 262 | |
263 | - $message = $this->build_email( $message ); |
|
263 | + $message = $this->build_email($message); |
|
264 | 264 | |
265 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
265 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
266 | 266 | |
267 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
267 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
268 | 268 | |
269 | - do_action( 'give_email_send_after', $this ); |
|
269 | + do_action('give_email_send_after', $this); |
|
270 | 270 | |
271 | 271 | return $sent; |
272 | 272 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * @since 1.0 |
279 | 279 | */ |
280 | 280 | public function send_before() { |
281 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
282 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
283 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
281 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
282 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
283 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * @since 1.0 |
290 | 290 | */ |
291 | 291 | public function send_after() { |
292 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
293 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
294 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
292 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
293 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
294 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
295 | 295 | |
296 | 296 | // Reset heading to an empty string |
297 | 297 | $this->heading = ''; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | - public function text_to_html( $message ) { |
|
305 | + public function text_to_html($message) { |
|
306 | 306 | |
307 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
308 | - $message = wpautop( $message ); |
|
307 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
308 | + $message = wpautop($message); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $message; |