@@ -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 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX. |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | 41 | |
42 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok. |
|
42 | + $post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok. |
|
43 | 43 | |
44 | - if ( isset( $post_data['give_payment_mode'] ) ) { |
|
44 | + if (isset($post_data['give_payment_mode'])) { |
|
45 | 45 | |
46 | - $form_id_prefix = ! empty( $post_data['give_form_id_prefix'] ) ? $post_data['give_form_id_prefix'] : ''; |
|
46 | + $form_id_prefix = ! empty($post_data['give_form_id_prefix']) ? $post_data['give_form_id_prefix'] : ''; |
|
47 | 47 | |
48 | 48 | $args = array( |
49 | 49 | 'id_prefix' => $form_id_prefix, |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.7 |
56 | 56 | */ |
57 | - do_action( 'give_donation_form', $post_data['give_form_id'], $args ); |
|
57 | + do_action('give_donation_form', $post_data['give_form_id'], $args); |
|
58 | 58 | |
59 | 59 | exit(); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
64 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
63 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
64 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Create wp nonce using Ajax call. |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | function give_donation_form_nonce() { |
76 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
76 | + if (isset($_POST['give_form_id'])) { |
|
77 | 77 | |
78 | 78 | // Get donation form id. |
79 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
79 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
80 | 80 | |
81 | 81 | // Send nonce json data. |
82 | - wp_send_json_success( wp_create_nonce( "give_donation_form_nonce_{$form_id}" ) ); |
|
82 | + wp_send_json_success(wp_create_nonce("give_donation_form_nonce_{$form_id}")); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | -add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
87 | -add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
86 | +add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
87 | +add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | /** |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | function __give_donation_form_reset_all_nonce() { |
99 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
99 | + if (isset($_POST['give_form_id'])) { |
|
100 | 100 | |
101 | 101 | // Get donation form id. |
102 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
102 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
103 | 103 | |
104 | 104 | $data = array( |
105 | - 'give_form_hash' => wp_create_nonce( "give_donation_form_nonce_{$form_id}" ), |
|
106 | - 'give_form_user_register_hash' => wp_create_nonce( "give_form_create_user_nonce_{$form_id}" ) |
|
105 | + 'give_form_hash' => wp_create_nonce("give_donation_form_nonce_{$form_id}"), |
|
106 | + 'give_form_user_register_hash' => wp_create_nonce("give_form_create_user_nonce_{$form_id}") |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | /** |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | * @since 2.2.0 |
113 | 113 | * |
114 | 114 | */ |
115 | - $data = apply_filters( 'give_donation_form_reset_all_nonce_data', $data ); |
|
115 | + $data = apply_filters('give_donation_form_reset_all_nonce_data', $data); |
|
116 | 116 | |
117 | 117 | // Send nonce json data. |
118 | - wp_send_json_success( $data ); |
|
118 | + wp_send_json_success($data); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | wp_send_json_error(); |
122 | 122 | } |
123 | 123 | |
124 | -add_action( 'wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
125 | -add_action( 'wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
124 | +add_action('wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
125 | +add_action('wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Sets an error within the donation form if no gateways are enabled. |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | function give_no_gateway_error() { |
136 | 136 | $gateways = give_get_enabled_payment_gateways(); |
137 | 137 | |
138 | - if ( empty( $gateways ) ) { |
|
139 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
138 | + if (empty($gateways)) { |
|
139 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
140 | 140 | } else { |
141 | - give_unset_error( 'no_gateways' ); |
|
141 | + give_unset_error('no_gateways'); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -add_action( 'init', 'give_no_gateway_error' ); |
|
145 | +add_action('init', 'give_no_gateway_error'); |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false, // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
66 | + public function search_box($text, $input_id) { |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function get_columns() { |
78 | 78 | $columns = array( |
79 | - 'ID' => __( 'Log ID', 'give' ), |
|
80 | - 'date' => __( 'Date', 'give' ), |
|
81 | - 'details' => __( 'Process Details', 'give' ), |
|
79 | + 'ID' => __('Log ID', 'give'), |
|
80 | + 'date' => __('Date', 'give'), |
|
81 | + 'details' => __('Process Details', 'give'), |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | return $columns; |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return string Column Name |
97 | 97 | */ |
98 | - public function column_default( $item, $column_name ) { |
|
99 | - switch ( $column_name ) { |
|
98 | + public function column_default($item, $column_name) { |
|
99 | + switch ($column_name) { |
|
100 | 100 | case 'ID': |
101 | 101 | return sprintf( |
102 | 102 | '<span class="give-item-label give-item-label-gray">%1$s</span> %2$s', |
103 | - esc_attr( $item[ $column_name ] ), |
|
104 | - esc_attr( $item['title'] ) |
|
103 | + esc_attr($item[$column_name]), |
|
104 | + esc_attr($item['title']) |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | default: |
108 | - return esc_attr( $item[ $column_name ] ); |
|
108 | + return esc_attr($item[$column_name]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function column_details( $item ) { |
|
123 | - echo Give()->tooltips->render_link( array( |
|
124 | - 'label' => __( 'View Update Log', 'give' ), |
|
122 | + public function column_details($item) { |
|
123 | + echo Give()->tooltips->render_link(array( |
|
124 | + 'label' => __('View Update Log', 'give'), |
|
125 | 125 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
126 | 126 | 'link' => "#TB_inline?width=640&inlineId=log-details-{$item['ID']}", |
127 | 127 | 'attributes' => array( |
128 | 128 | 'class' => 'thickbox give-error-log-details-link button button-small', |
129 | 129 | ), |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | ?> |
132 | - <div id="log-details-<?php echo esc_attr( $item['ID'] ); ?>" style="display:none;"> |
|
132 | + <div id="log-details-<?php echo esc_attr($item['ID']); ?>" style="display:none;"> |
|
133 | 133 | <?php |
134 | 134 | |
135 | 135 | // Print Log Content, if not empty. |
136 | - if ( ! empty( $item['log_content'] ) ) { |
|
136 | + if ( ! empty($item['log_content'])) { |
|
137 | 137 | echo sprintf( |
138 | 138 | '<p><pre>%1$s</pre></div>', |
139 | - esc_html( $item['log_content'] ) |
|
139 | + esc_html($item['log_content']) |
|
140 | 140 | ); |
141 | 141 | } |
142 | 142 | ?> |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param string $which |
159 | 159 | */ |
160 | - protected function display_tablenav( $which ) { |
|
161 | - if ( 'top' === $which ) { |
|
162 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
160 | + protected function display_tablenav($which) { |
|
161 | + if ('top' === $which) { |
|
162 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
163 | 163 | } |
164 | 164 | ?> |
165 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
165 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
166 | 166 | |
167 | 167 | <div class="alignleft actions bulkactions"> |
168 | - <?php $this->bulk_actions( $which ); ?> |
|
168 | + <?php $this->bulk_actions($which); ?> |
|
169 | 169 | </div> |
170 | 170 | <?php |
171 | - $this->extra_tablenav( $which ); |
|
172 | - $this->pagination( $which ); |
|
171 | + $this->extra_tablenav($which); |
|
172 | + $this->pagination($which); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <br class="clear"/> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return int Current page number |
187 | 187 | */ |
188 | 188 | public function get_paged() { |
189 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
189 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return void |
201 | 201 | */ |
202 | - function bulk_actions( $which = '' ) { |
|
202 | + function bulk_actions($which = '') { |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | 'posts_per_page' => $this->per_page, |
220 | 220 | ); |
221 | 221 | |
222 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
222 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
223 | 223 | |
224 | - if ( $logs ) { |
|
225 | - foreach ( $logs as $log ) { |
|
224 | + if ($logs) { |
|
225 | + foreach ($logs as $log) { |
|
226 | 226 | |
227 | 227 | $logs_data[] = array( |
228 | 228 | 'ID' => $log->ID, |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | $columns = $this->get_columns(); |
255 | 255 | $hidden = array(); // No hidden columns |
256 | 256 | $sortable = $this->get_sortable_columns(); |
257 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
257 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
258 | 258 | $this->items = $this->get_logs(); |
259 | - $total_items = Give()->logs->get_log_count( 0, 'update' ); |
|
259 | + $total_items = Give()->logs->get_log_count(0, 'update'); |
|
260 | 260 | |
261 | - $this->set_pagination_args( array( |
|
261 | + $this->set_pagination_args(array( |
|
262 | 262 | 'total_items' => $total_items, |
263 | 263 | 'per_page' => $this->per_page, |
264 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
265 | - ) ); |
|
264 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
265 | + )); |
|
266 | 266 | } |
267 | 267 | } |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | 'class' => 'tools-form-dropdown-recount-form-select', |
58 | 58 | 'name' => 'form_id', |
59 | 59 | 'chosen' => true, |
60 | - 'placeholder' => __( 'Select Form', 'give' ), |
|
60 | + 'placeholder' => __('Select Form', 'give'), |
|
61 | 61 | ); |
62 | - echo Give()->html->forms_dropdown( $args ); |
|
62 | + echo Give()->html->forms_dropdown($args); |
|
63 | 63 | ?> |
64 | 64 | </span> |
65 | 65 | |
66 | 66 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
67 | 67 | <label for="delete-import-donors"> |
68 | 68 | <?php |
69 | - echo Give()->html->checkbox( array( 'name' => 'delete-import-donors' ) ); |
|
70 | - esc_html_e( 'Delete imported WordPress users', 'give' ); |
|
69 | + echo Give()->html->checkbox(array('name' => 'delete-import-donors')); |
|
70 | + esc_html_e('Delete imported WordPress users', 'give'); |
|
71 | 71 | ?> |
72 | 72 | </label> |
73 | 73 | </span> |
74 | 74 | |
75 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
75 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
76 | 76 | |
77 | 77 | <br/> |
78 | 78 | |
79 | 79 | <span class="give-recount-stats-descriptions"> |
80 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
81 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
82 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
83 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
80 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
81 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
82 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
83 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
84 | 84 | <?php |
85 | 85 | /** |
86 | 86 | * Fires in the recount stats description area. |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @since 1.5 |
91 | 91 | */ |
92 | - do_action( 'give_recount_tool_descriptions' ); |
|
92 | + do_action('give_recount_tool_descriptions'); |
|
93 | 93 | ?> |
94 | - <span id="delete-test-transactions"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
95 | - <span id="reset-stats"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
94 | + <span id="delete-test-transactions"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
95 | + <span id="reset-stats"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
96 | 96 | </span> |
97 | 97 | |
98 | 98 | <span class="spinner"></span> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.5 |
108 | 108 | */ |
109 | - do_action( 'give_tools_recount_forms' ); |
|
109 | + do_action('give_tools_recount_forms'); |
|
110 | 110 | ?> |
111 | 111 | </div><!-- .inside --> |
112 | 112 | </div><!-- .postbox --> |
@@ -117,4 +117,4 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @since 1.5 |
119 | 119 | */ |
120 | -do_action( 'give_tools_recount_stats_after' ); |
|
120 | +do_action('give_tools_recount_stats_after'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * |
72 | 72 | * } |
73 | 73 | */ |
74 | - public function add( $args ) { |
|
75 | - __give_211_bc_email_template_tag_param( $args, func_get_args() ); |
|
74 | + public function add($args) { |
|
75 | + __give_211_bc_email_template_tag_param($args, func_get_args()); |
|
76 | 76 | |
77 | - if ( is_callable( $args['func'] ) ) { |
|
78 | - $this->tags[ $args['tag'] ] = array( |
|
77 | + if (is_callable($args['func'])) { |
|
78 | + $this->tags[$args['tag']] = array( |
|
79 | 79 | 'tag' => $args['tag'], |
80 | 80 | 'desc' => $args['desc'], |
81 | 81 | 'func' => $args['func'], |
82 | - 'context' => give_check_variable( $args['context'], 'empty', 'general' ), |
|
82 | + 'context' => give_check_variable($args['context'], 'empty', 'general'), |
|
83 | 83 | 'is_admin' => (bool) $args['is_admin'], // Introduced in 2.2.1 |
84 | 84 | 'description' => $args['desc'], // deprecated in 2.2.1 |
85 | 85 | 'function' => $args['func'], // deprecated in 2.2.1 |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param string $tag Email tag to remove hook from |
96 | 96 | */ |
97 | - public function remove( $tag ) { |
|
98 | - unset( $this->tags[ $tag ] ); |
|
97 | + public function remove($tag) { |
|
98 | + unset($this->tags[$tag]); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return bool |
109 | 109 | */ |
110 | - public function email_tag_exists( $tag ) { |
|
111 | - return array_key_exists( $tag, $this->tags ); |
|
110 | + public function email_tag_exists($tag) { |
|
111 | + return array_key_exists($tag, $this->tags); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array |
124 | 124 | */ |
125 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
125 | + public function get_tags($context_type = 'all', $field = '') { |
|
126 | 126 | $tags = $this->tags; |
127 | 127 | |
128 | - if ( 'all' !== $context_type ) { |
|
128 | + if ('all' !== $context_type) { |
|
129 | 129 | $tags = array(); |
130 | 130 | |
131 | - foreach ( $this->tags as $tag ) { |
|
132 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
131 | + foreach ($this->tags as $tag) { |
|
132 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - $tags[ $tag['tag'] ] = $tag; |
|
136 | + $tags[$tag['tag']] = $tag; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
141 | - $tags = wp_list_pluck( $tags, $field ); |
|
140 | + if ( ! empty($tags) && ! empty($field)) { |
|
141 | + $tags = wp_list_pluck($tags, $field); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $tags; |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return string Content with email tags filtered out. |
158 | 158 | */ |
159 | - public function do_tags( $content, $tag_args ) { |
|
159 | + public function do_tags($content, $tag_args) { |
|
160 | 160 | |
161 | 161 | // Check if there is at least one tag added. |
162 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
162 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
163 | 163 | return $content; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $this->tag_args = $tag_args; |
167 | 167 | |
168 | - $new_content = preg_replace_callback( '/{([A-z0-9\-\_]+)}/s', array( $this, 'do_tag' ), $content ); |
|
168 | + $new_content = preg_replace_callback('/{([A-z0-9\-\_]+)}/s', array($this, 'do_tag'), $content); |
|
169 | 169 | |
170 | 170 | $this->tag_args = null; |
171 | 171 | |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return mixed |
183 | 183 | */ |
184 | - public function do_tag( $m ) { |
|
184 | + public function do_tag($m) { |
|
185 | 185 | |
186 | 186 | // Get tag |
187 | 187 | $tag = $m[1]; |
188 | 188 | |
189 | 189 | // Return tag if tag not set |
190 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
190 | + if ( ! $this->email_tag_exists($tag)) { |
|
191 | 191 | return $m[0]; |
192 | 192 | } |
193 | 193 | |
194 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
194 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | } |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @param array $args Email template tag argument |
206 | 206 | * Check Give_Email_Template_Tags::add function description for more information |
207 | 207 | */ |
208 | -function give_add_email_tag( $args ) { |
|
209 | - __give_211_bc_email_template_tag_param( $args, func_get_args() ); |
|
208 | +function give_add_email_tag($args) { |
|
209 | + __give_211_bc_email_template_tag_param($args, func_get_args()); |
|
210 | 210 | |
211 | - Give()->email_tags->add( $args ); |
|
211 | + Give()->email_tags->add($args); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param string $tag Email tag to remove hook from |
220 | 220 | */ |
221 | -function give_remove_email_tag( $tag ) { |
|
222 | - Give()->email_tags->remove( $tag ); |
|
221 | +function give_remove_email_tag($tag) { |
|
222 | + Give()->email_tags->remove($tag); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return bool |
233 | 233 | */ |
234 | -function give_email_tag_exists( $tag ) { |
|
235 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
234 | +function give_email_tag_exists($tag) { |
|
235 | + return Give()->email_tags->email_tag_exists($tag); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | $email_tags = give_get_email_tags(); |
260 | 260 | |
261 | 261 | ob_start(); |
262 | - if ( count( $email_tags ) > 0 ) : ?> |
|
262 | + if (count($email_tags) > 0) : ?> |
|
263 | 263 | <div class="give-email-tags-wrap"> |
264 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
264 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
265 | 265 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
266 | 266 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['desc']; ?> |
267 | 267 | </span> |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return string Content with email tags filtered out. |
288 | 288 | */ |
289 | -function give_do_email_tags( $content, $tag_args ) { |
|
289 | +function give_do_email_tags($content, $tag_args) { |
|
290 | 290 | // Backward compatibility < 2.0 |
291 | - if ( ! is_array( $tag_args ) && is_numeric( $tag_args ) ) { |
|
292 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
291 | + if ( ! is_array($tag_args) && is_numeric($tag_args)) { |
|
292 | + $tag_args = array('payment_id' => $tag_args); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $email_tags = Give()->email_tags instanceof Give_Email_Template_Tags |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | : new Give_Email_Template_Tags(); |
298 | 298 | |
299 | 299 | // Replace all tags |
300 | - $content = $email_tags->do_tags( $content, $tag_args ); |
|
300 | + $content = $email_tags->do_tags($content, $tag_args); |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Filter the filtered content text. |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @since 1.0 |
306 | 306 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
307 | 307 | */ |
308 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
308 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
309 | 309 | |
310 | 310 | // Return content |
311 | 311 | return $content; |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 1.0 |
326 | 326 | */ |
327 | - do_action( 'give_add_email_tags' ); |
|
327 | + do_action('give_add_email_tags'); |
|
328 | 328 | } |
329 | 329 | |
330 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
330 | +add_action('init', 'give_load_email_tags', - 999); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | /** |
@@ -342,67 +342,67 @@ discard block |
||
342 | 342 | /* Donation Payment */ |
343 | 343 | array( |
344 | 344 | 'tag' => 'donation', |
345 | - 'desc' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
345 | + 'desc' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
346 | 346 | 'func' => 'give_email_tag_donation', |
347 | 347 | 'context' => 'donation', |
348 | 348 | ), |
349 | 349 | array( |
350 | 350 | 'tag' => 'amount', |
351 | - 'desc' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
351 | + 'desc' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
352 | 352 | 'func' => 'give_email_tag_amount', |
353 | 353 | 'context' => 'donation', |
354 | 354 | ), |
355 | 355 | array( |
356 | 356 | 'tag' => 'price', |
357 | - 'desc' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
357 | + 'desc' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
358 | 358 | 'func' => 'give_email_tag_price', |
359 | 359 | 'context' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | 362 | 'tag' => 'billing_address', |
363 | - 'desc' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
363 | + 'desc' => esc_html__('The donor\'s billing address.', 'give'), |
|
364 | 364 | 'func' => 'give_email_tag_billing_address', |
365 | 365 | 'context' => 'donation', |
366 | 366 | ), |
367 | 367 | array( |
368 | 368 | 'tag' => 'date', |
369 | - 'desc' => esc_html__( 'The date of the donation.', 'give' ), |
|
369 | + 'desc' => esc_html__('The date of the donation.', 'give'), |
|
370 | 370 | 'func' => 'give_email_tag_date', |
371 | 371 | 'context' => 'donation', |
372 | 372 | ), |
373 | 373 | array( |
374 | 374 | 'tag' => 'payment_id', |
375 | - 'desc' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
375 | + 'desc' => esc_html__('The unique ID number for this donation.', 'give'), |
|
376 | 376 | 'func' => 'give_email_tag_payment_id', |
377 | 377 | 'context' => 'donation', |
378 | 378 | ), |
379 | 379 | array( |
380 | 380 | 'tag' => 'payment_method', |
381 | - 'desc' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
381 | + 'desc' => esc_html__('The method of payment used for this donation.', 'give'), |
|
382 | 382 | 'func' => 'give_email_tag_payment_method', |
383 | 383 | 'context' => 'donation', |
384 | 384 | ), |
385 | 385 | array( |
386 | 386 | 'tag' => 'payment_total', |
387 | - 'desc' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
387 | + 'desc' => esc_html__('The payment total for this donation.', 'give'), |
|
388 | 388 | 'func' => 'give_email_tag_payment_total', |
389 | 389 | 'context' => 'donation', |
390 | 390 | ), |
391 | 391 | array( |
392 | 392 | 'tag' => 'receipt_id', |
393 | - 'desc' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
393 | + 'desc' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
394 | 394 | 'func' => 'give_email_tag_receipt_id', |
395 | 395 | 'context' => 'donation', |
396 | 396 | ), |
397 | 397 | array( |
398 | 398 | 'tag' => 'receipt_link', |
399 | - 'desc' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
399 | + 'desc' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
400 | 400 | 'func' => 'give_email_tag_receipt_link', |
401 | 401 | 'context' => 'donation', |
402 | 402 | ), |
403 | 403 | array( |
404 | 404 | 'tag' => 'receipt_link_url', |
405 | - 'desc' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
405 | + 'desc' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
406 | 406 | 'func' => 'give_email_tag_receipt_link_url', |
407 | 407 | 'context' => 'donation', |
408 | 408 | ), |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | /* Donation Form */ |
411 | 411 | array( |
412 | 412 | 'tag' => 'form_title', |
413 | - 'desc' => esc_html__( 'The donation form name.', 'give' ), |
|
413 | + 'desc' => esc_html__('The donation form name.', 'give'), |
|
414 | 414 | 'func' => 'give_email_tag_form_title', |
415 | 415 | 'context' => 'form', |
416 | 416 | ), |
@@ -418,37 +418,37 @@ discard block |
||
418 | 418 | /* Donor */ |
419 | 419 | array( |
420 | 420 | 'tag' => 'name', |
421 | - 'desc' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
421 | + 'desc' => esc_html__('The donor\'s first name.', 'give'), |
|
422 | 422 | 'func' => 'give_email_tag_first_name', |
423 | 423 | 'context' => 'donor', |
424 | 424 | ), |
425 | 425 | array( |
426 | 426 | 'tag' => 'fullname', |
427 | - 'desc' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
427 | + 'desc' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
428 | 428 | 'func' => 'give_email_tag_fullname', |
429 | 429 | 'context' => 'donor', |
430 | 430 | ), |
431 | 431 | array( |
432 | 432 | 'tag' => 'username', |
433 | - 'desc' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
433 | + 'desc' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
434 | 434 | 'func' => 'give_email_tag_username', |
435 | 435 | 'context' => 'donor', |
436 | 436 | ), |
437 | 437 | array( |
438 | 438 | 'tag' => 'company_name', |
439 | - 'desc' => esc_html__( 'Company name.', 'give' ), |
|
439 | + 'desc' => esc_html__('Company name.', 'give'), |
|
440 | 440 | 'func' => 'give_email_tag_company_name', |
441 | 441 | 'context' => 'donation', |
442 | 442 | ), |
443 | 443 | array( |
444 | 444 | 'tag' => 'user_email', |
445 | - 'desc' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
445 | + 'desc' => esc_html__('The donor\'s email address.', 'give'), |
|
446 | 446 | 'func' => 'give_email_tag_user_email', |
447 | 447 | 'context' => 'donor', |
448 | 448 | ), |
449 | 449 | array( |
450 | 450 | 'tag' => 'email_access_link', |
451 | - 'desc' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
451 | + 'desc' => esc_html__('The donor\'s email access link.', 'give'), |
|
452 | 452 | 'func' => 'give_email_tag_email_access_link', |
453 | 453 | 'context' => 'donor', |
454 | 454 | ), |
@@ -456,35 +456,35 @@ discard block |
||
456 | 456 | /* General */ |
457 | 457 | array( |
458 | 458 | 'tag' => 'sitename', |
459 | - 'desc' => esc_html__( 'The name of your site.', 'give' ), |
|
459 | + 'desc' => esc_html__('The name of your site.', 'give'), |
|
460 | 460 | 'func' => 'give_email_tag_sitename', |
461 | 461 | 'context' => 'general', |
462 | 462 | ), |
463 | 463 | |
464 | 464 | array( |
465 | 465 | 'tag' => 'reset_password_link', |
466 | - 'desc' => esc_html__( 'The reset password link for user.', 'give' ), |
|
466 | + 'desc' => esc_html__('The reset password link for user.', 'give'), |
|
467 | 467 | 'func' => 'give_email_tag_reset_password_link', |
468 | 468 | 'context' => 'general', |
469 | 469 | ), |
470 | 470 | |
471 | 471 | array( |
472 | 472 | 'tag' => 'admin_email', |
473 | - 'desc' => esc_html__( 'The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give' ), |
|
473 | + 'desc' => esc_html__('The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give'), |
|
474 | 474 | 'func' => 'give_email_admin_email', |
475 | 475 | 'context' => 'general', |
476 | 476 | ), |
477 | 477 | |
478 | 478 | array( |
479 | 479 | 'tag' => 'site_url', |
480 | - 'desc' => esc_html__( 'The website URL.', 'give' ), |
|
480 | + 'desc' => esc_html__('The website URL.', 'give'), |
|
481 | 481 | 'func' => 'give_email_site_url', |
482 | 482 | 'context' => 'general', |
483 | 483 | ), |
484 | 484 | |
485 | 485 | array( |
486 | 486 | 'tag' => 'offline_mailing_address', |
487 | - 'desc' => esc_html__( 'The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give' ), |
|
487 | + 'desc' => esc_html__('The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give'), |
|
488 | 488 | 'func' => 'give_email_offline_mailing_address', |
489 | 489 | 'context' => 'general', |
490 | 490 | ), |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | ); |
493 | 493 | |
494 | 494 | // Apply give_email_tags filter |
495 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
495 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
496 | 496 | |
497 | 497 | // Add email tags |
498 | - foreach ( $email_tags as $email_tag ) { |
|
499 | - give_add_email_tag( $email_tag ); |
|
498 | + foreach ($email_tags as $email_tag) { |
|
499 | + give_add_email_tag($email_tag); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | } |
503 | 503 | |
504 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
504 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
505 | 505 | |
506 | 506 | |
507 | 507 | /** |
@@ -513,24 +513,24 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @return string $firstname |
515 | 515 | */ |
516 | -function give_email_tag_first_name( $tag_args ) { |
|
516 | +function give_email_tag_first_name($tag_args) { |
|
517 | 517 | $user_info = array(); |
518 | 518 | $firstname = ''; |
519 | 519 | |
520 | 520 | // Backward compatibility. |
521 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
521 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
522 | 522 | |
523 | - switch ( true ) { |
|
524 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
525 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
526 | - $email_names = give_get_email_names( $donor_info ); |
|
523 | + switch (true) { |
|
524 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
525 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
526 | + $email_names = give_get_email_names($donor_info); |
|
527 | 527 | $firstname = $email_names['name']; |
528 | 528 | |
529 | 529 | break; |
530 | 530 | |
531 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
531 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
532 | 532 | $firstname = Give()->donor_meta->get_meta( |
533 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
533 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
534 | 534 | '_give_donor_first_name', |
535 | 535 | true |
536 | 536 | ); |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @since 2.0 |
543 | 543 | */ |
544 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
545 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
544 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
545 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
546 | 546 | break; |
547 | 547 | } |
548 | 548 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @param string $firstname |
555 | 555 | * @param array $tag_args |
556 | 556 | */ |
557 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
557 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
558 | 558 | |
559 | 559 | return $firstname; |
560 | 560 | } |
@@ -568,21 +568,21 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return string $fullname |
570 | 570 | */ |
571 | -function give_email_tag_fullname( $tag_args ) { |
|
571 | +function give_email_tag_fullname($tag_args) { |
|
572 | 572 | $fullname = ''; |
573 | 573 | |
574 | 574 | // Backward compatibility. |
575 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
575 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
576 | 576 | |
577 | - switch ( true ) { |
|
578 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
579 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
580 | - $email_names = give_get_email_names( $donor_info ); |
|
577 | + switch (true) { |
|
578 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
579 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
580 | + $email_names = give_get_email_names($donor_info); |
|
581 | 581 | $fullname = $email_names['fullname']; |
582 | 582 | break; |
583 | 583 | |
584 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
585 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
584 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
585 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | /** |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @since 2.0 |
592 | 592 | */ |
593 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
594 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
593 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
594 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
595 | 595 | break; |
596 | 596 | } |
597 | 597 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @param string $fullname |
604 | 604 | * @param array $tag_args |
605 | 605 | */ |
606 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
606 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
607 | 607 | |
608 | 608 | return $fullname; |
609 | 609 | } |
@@ -617,21 +617,21 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @return string username. |
619 | 619 | */ |
620 | -function give_email_tag_username( $tag_args ) { |
|
620 | +function give_email_tag_username($tag_args) { |
|
621 | 621 | $username = ''; |
622 | 622 | |
623 | 623 | // Backward compatibility. |
624 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
624 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
625 | 625 | |
626 | - switch ( true ) { |
|
627 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
628 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
629 | - $email_names = give_get_email_names( $donor_info ); |
|
626 | + switch (true) { |
|
627 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
628 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
629 | + $email_names = give_get_email_names($donor_info); |
|
630 | 630 | $username = $email_names['username']; |
631 | 631 | break; |
632 | 632 | |
633 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
634 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
633 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
634 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
635 | 635 | $username = $user_info->user_login; |
636 | 636 | break; |
637 | 637 | |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | * |
641 | 641 | * @since 2.0 |
642 | 642 | */ |
643 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
644 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
645 | - $user_info = get_user_by( 'id', $user_id ); |
|
643 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
644 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
645 | + $user_info = get_user_by('id', $user_id); |
|
646 | 646 | $username = $user_info->user_login; |
647 | 647 | } |
648 | 648 | break; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * @param string $username |
657 | 657 | * @param array $tag_args |
658 | 658 | */ |
659 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
659 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
660 | 660 | |
661 | 661 | return $username; |
662 | 662 | } |
@@ -670,19 +670,19 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @return string user_email |
672 | 672 | */ |
673 | -function give_email_tag_user_email( $tag_args ) { |
|
673 | +function give_email_tag_user_email($tag_args) { |
|
674 | 674 | $email = ''; |
675 | 675 | |
676 | 676 | // Backward compatibility. |
677 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
677 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
678 | 678 | |
679 | - switch ( true ) { |
|
680 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
681 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
679 | + switch (true) { |
|
680 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
681 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
682 | 682 | break; |
683 | 683 | |
684 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
685 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
684 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
685 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
686 | 686 | $email = $user_info->user_email; |
687 | 687 | break; |
688 | 688 | |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @since 2.0 |
693 | 693 | */ |
694 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
695 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
694 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
695 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
696 | 696 | break; |
697 | 697 | } |
698 | 698 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $email |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
707 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
708 | 708 | |
709 | 709 | return $email; |
710 | 710 | } |
@@ -718,22 +718,22 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string billing_address |
720 | 720 | */ |
721 | -function give_email_tag_billing_address( $tag_args ) { |
|
721 | +function give_email_tag_billing_address($tag_args) { |
|
722 | 722 | $address = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
730 | 730 | |
731 | 731 | $billing_address = array(); |
732 | 732 | $billing_address['street_address'] = ''; |
733 | 733 | $billing_address['street_address'] .= $donation_address['line1']; |
734 | 734 | |
735 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
736 | - $billing_address['street_address'] .= "\n" . $donation_address['line2']; |
|
735 | + if ( ! empty($donation_address['line2'])) { |
|
736 | + $billing_address['street_address'] .= "\n".$donation_address['line2']; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | $billing_address['city'] = $donation_address['city']; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $billing_address['postal_code'] = $donation_address['zip']; |
742 | 742 | $billing_address['country'] = $donation_address['country']; |
743 | 743 | |
744 | - $address = give_get_formatted_address( $billing_address ); |
|
744 | + $address = give_get_formatted_address($billing_address); |
|
745 | 745 | |
746 | 746 | break; |
747 | 747 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @param string $address |
755 | 755 | * @param array $tag_args |
756 | 756 | */ |
757 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
757 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
758 | 758 | |
759 | 759 | return $address; |
760 | 760 | } |
@@ -768,15 +768,15 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @return string $date Post Date. |
770 | 770 | */ |
771 | -function give_email_tag_date( $tag_args ) { |
|
771 | +function give_email_tag_date($tag_args) { |
|
772 | 772 | $date = ''; |
773 | 773 | |
774 | 774 | // Backward compatibility. |
775 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
775 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
776 | 776 | |
777 | - switch ( true ) { |
|
778 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
779 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
777 | + switch (true) { |
|
778 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
779 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
780 | 780 | break; |
781 | 781 | } |
782 | 782 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * @param string $date |
789 | 789 | * @param array $tag_args |
790 | 790 | */ |
791 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
791 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
792 | 792 | |
793 | 793 | return $date; |
794 | 794 | } |
@@ -802,16 +802,16 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @return string amount |
804 | 804 | */ |
805 | -function give_email_tag_amount( $tag_args ) { |
|
805 | +function give_email_tag_amount($tag_args) { |
|
806 | 806 | $amount = ''; |
807 | 807 | |
808 | 808 | // Backward compatibility. |
809 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
809 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
810 | 810 | |
811 | - switch ( true ) { |
|
812 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
813 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
814 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
811 | + switch (true) { |
|
812 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
813 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
814 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
815 | 815 | break; |
816 | 816 | } |
817 | 817 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | * @param string $amount |
824 | 824 | * @param array $tag_args |
825 | 825 | */ |
826 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
826 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
827 | 827 | |
828 | 828 | return $amount; |
829 | 829 | } |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @return string price |
839 | 839 | */ |
840 | -function give_email_tag_price( $tag_args ) { |
|
841 | - return give_email_tag_amount( $tag_args ); |
|
840 | +function give_email_tag_price($tag_args) { |
|
841 | + return give_email_tag_amount($tag_args); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
@@ -850,15 +850,15 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @return int payment_id |
852 | 852 | */ |
853 | -function give_email_tag_payment_id( $tag_args ) { |
|
853 | +function give_email_tag_payment_id($tag_args) { |
|
854 | 854 | $payment_id = ''; |
855 | 855 | |
856 | 856 | // Backward compatibility. |
857 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
857 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
858 | 858 | |
859 | - switch ( true ) { |
|
860 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
861 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
859 | + switch (true) { |
|
860 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
861 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
862 | 862 | break; |
863 | 863 | } |
864 | 864 | |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | * @param string $payment_id |
871 | 871 | * @param array $tag_args |
872 | 872 | */ |
873 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
873 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | * |
883 | 883 | * @return string receipt_id |
884 | 884 | */ |
885 | -function give_email_tag_receipt_id( $tag_args ) { |
|
885 | +function give_email_tag_receipt_id($tag_args) { |
|
886 | 886 | $receipt_id = ''; |
887 | 887 | |
888 | 888 | // Backward compatibility. |
889 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
889 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
890 | 890 | |
891 | - switch ( true ) { |
|
892 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
893 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
891 | + switch (true) { |
|
892 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
893 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
894 | 894 | break; |
895 | 895 | } |
896 | 896 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | * @param string $receipt_id |
903 | 903 | * @param array $tag_args |
904 | 904 | */ |
905 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
905 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | /** |
@@ -914,21 +914,21 @@ discard block |
||
914 | 914 | * |
915 | 915 | * @return string $form_title |
916 | 916 | */ |
917 | -function give_email_tag_donation( $tag_args ) { |
|
917 | +function give_email_tag_donation($tag_args) { |
|
918 | 918 | $donation_form_title = ''; |
919 | 919 | |
920 | 920 | // Backward compatibility. |
921 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
921 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
922 | 922 | |
923 | - switch ( true ) { |
|
924 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
925 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
923 | + switch (true) { |
|
924 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
925 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
926 | 926 | $separator = $level_title ? '-' : ''; |
927 | 927 | $donation_form_title = strip_tags( |
928 | 928 | give_check_variable( |
929 | 929 | give_get_donation_form_title( |
930 | 930 | $tag_args['payment_id'], |
931 | - array( 'separator' => $separator ) |
|
931 | + array('separator' => $separator) |
|
932 | 932 | ), |
933 | 933 | 'empty', |
934 | 934 | '' |
@@ -961,15 +961,15 @@ discard block |
||
961 | 961 | * |
962 | 962 | * @return string $form_title |
963 | 963 | */ |
964 | -function give_email_tag_form_title( $tag_args ) { |
|
964 | +function give_email_tag_form_title($tag_args) { |
|
965 | 965 | $donation_form_title = ''; |
966 | 966 | |
967 | 967 | // Backward compatibility. |
968 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
968 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
969 | 969 | |
970 | - switch ( true ) { |
|
971 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
972 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
970 | + switch (true) { |
|
971 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
972 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
973 | 973 | break; |
974 | 974 | } |
975 | 975 | |
@@ -998,15 +998,15 @@ discard block |
||
998 | 998 | * |
999 | 999 | * @return string $company_name |
1000 | 1000 | */ |
1001 | -function give_email_tag_company_name( $tag_args ) { |
|
1001 | +function give_email_tag_company_name($tag_args) { |
|
1002 | 1002 | $company_name = ''; |
1003 | 1003 | |
1004 | 1004 | // Backward compatibility. |
1005 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1005 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1006 | 1006 | |
1007 | - switch ( true ) { |
|
1008 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1009 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
1007 | + switch (true) { |
|
1008 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1009 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
1010 | 1010 | break; |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1034,18 +1034,18 @@ discard block |
||
1034 | 1034 | * |
1035 | 1035 | * @return string gateway |
1036 | 1036 | */ |
1037 | -function give_email_tag_payment_method( $tag_args ) { |
|
1037 | +function give_email_tag_payment_method($tag_args) { |
|
1038 | 1038 | $payment_method = ''; |
1039 | 1039 | |
1040 | 1040 | // Backward compatibility. |
1041 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1041 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1042 | 1042 | |
1043 | 1043 | // Backward compatibility. |
1044 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1044 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1045 | 1045 | |
1046 | - switch ( true ) { |
|
1047 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1048 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
1046 | + switch (true) { |
|
1047 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1048 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
1049 | 1049 | break; |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1076,15 +1076,15 @@ discard block |
||
1076 | 1076 | * |
1077 | 1077 | * @return string |
1078 | 1078 | */ |
1079 | -function give_email_tag_payment_total( $tag_args ) { |
|
1079 | +function give_email_tag_payment_total($tag_args) { |
|
1080 | 1080 | $payment_total = ''; |
1081 | 1081 | |
1082 | 1082 | // Backward compatibility. |
1083 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1083 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1084 | 1084 | |
1085 | - switch ( true ) { |
|
1086 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1087 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1085 | + switch (true) { |
|
1086 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1087 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1088 | 1088 | break; |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1112,11 +1112,11 @@ discard block |
||
1112 | 1112 | * |
1113 | 1113 | * @return string |
1114 | 1114 | */ |
1115 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1116 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1115 | +function give_email_tag_sitename($tag_args = array()) { |
|
1116 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1117 | 1117 | |
1118 | 1118 | // Backward compatibility. |
1119 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1119 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * Filter the {sitename} email template tag output. |
@@ -1142,21 +1142,21 @@ discard block |
||
1142 | 1142 | * |
1143 | 1143 | * @return string receipt_link |
1144 | 1144 | */ |
1145 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1145 | +function give_email_tag_receipt_link($tag_args) { |
|
1146 | 1146 | // Backward compatibility. |
1147 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1147 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1148 | 1148 | |
1149 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1149 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1150 | 1150 | |
1151 | 1151 | // Bailout. |
1152 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1152 | + if (give_get_option('email_template') === 'none') { |
|
1153 | 1153 | return $receipt_url; |
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | $receipt_url = esc_url( |
1157 | 1157 | add_query_arg( |
1158 | 1158 | array( |
1159 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1159 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1160 | 1160 | ), give_get_history_page_uri() |
1161 | 1161 | ) |
1162 | 1162 | ); |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $formatted = sprintf( |
1165 | 1165 | '<a href="%1$s">%2$s</a>', |
1166 | 1166 | $receipt_url, |
1167 | - __( 'View it in your browser »', 'give' ) |
|
1167 | + __('View it in your browser »', 'give') |
|
1168 | 1168 | ); |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1193,11 +1193,11 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string receipt_url |
1195 | 1195 | */ |
1196 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1196 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1197 | 1197 | // Backward compatibility. |
1198 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1198 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1199 | 1199 | |
1200 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1200 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * Filter the {receipt_link_url} email template tag output. |
@@ -1224,14 +1224,14 @@ discard block |
||
1224 | 1224 | * |
1225 | 1225 | * @return string |
1226 | 1226 | */ |
1227 | -function give_get_receipt_url( $payment_id ) { |
|
1227 | +function give_get_receipt_url($payment_id) { |
|
1228 | 1228 | $receipt_url = ''; |
1229 | 1229 | |
1230 | - if ( $payment_id ) { |
|
1230 | + if ($payment_id) { |
|
1231 | 1231 | $receipt_url = esc_url( |
1232 | 1232 | add_query_arg( |
1233 | 1233 | array( |
1234 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1234 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1235 | 1235 | ), give_get_history_page_uri() |
1236 | 1236 | ) |
1237 | 1237 | ); |
@@ -1250,22 +1250,22 @@ discard block |
||
1250 | 1250 | * |
1251 | 1251 | * @return string |
1252 | 1252 | */ |
1253 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1253 | +function give_email_tag_email_access_link($tag_args) { |
|
1254 | 1254 | $donor_id = 0; |
1255 | 1255 | $donor = array(); |
1256 | 1256 | $email_access_link = ''; |
1257 | 1257 | |
1258 | 1258 | // Backward compatibility. |
1259 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1259 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1260 | 1260 | |
1261 | - switch ( true ) { |
|
1262 | - case ! empty( $tag_args['donor_id'] ): |
|
1261 | + switch (true) { |
|
1262 | + case ! empty($tag_args['donor_id']): |
|
1263 | 1263 | $donor_id = $tag_args['donor_id']; |
1264 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1264 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1265 | 1265 | break; |
1266 | 1266 | |
1267 | - case ! empty( $tag_args['user_id'] ): |
|
1268 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1267 | + case ! empty($tag_args['user_id']): |
|
1268 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1269 | 1269 | $donor_id = $donor->id; |
1270 | 1270 | break; |
1271 | 1271 | |
@@ -1274,11 +1274,11 @@ discard block |
||
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | // Set email access link if donor exist. |
1277 | - if ( $donor_id ) { |
|
1278 | - $verify_key = wp_generate_password( 20, false ); |
|
1277 | + if ($donor_id) { |
|
1278 | + $verify_key = wp_generate_password(20, false); |
|
1279 | 1279 | |
1280 | 1280 | // Generate a new verify key |
1281 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1281 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1282 | 1282 | // update verify key in email tags. |
1283 | 1283 | $tag_args['verify_key'] = $verify_key; |
1284 | 1284 | |
@@ -1293,28 +1293,28 @@ discard block |
||
1293 | 1293 | ); |
1294 | 1294 | |
1295 | 1295 | // Add Payment Key to email access url, if it exists. |
1296 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1296 | + if ( ! empty($_GET['payment_key'])) { |
|
1297 | 1297 | $access_url = add_query_arg( |
1298 | 1298 | array( |
1299 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1299 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1300 | 1300 | ), |
1301 | 1301 | $access_url |
1302 | 1302 | ); |
1303 | 1303 | } |
1304 | 1304 | |
1305 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1305 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1306 | 1306 | $email_access_link = sprintf( |
1307 | 1307 | '<a href="%1$s" target="_blank">%2$s</a>', |
1308 | - esc_url( $access_url ), |
|
1309 | - __( 'View your donation history »', 'give' ) |
|
1308 | + esc_url($access_url), |
|
1309 | + __('View your donation history »', 'give') |
|
1310 | 1310 | ); |
1311 | 1311 | |
1312 | 1312 | } else { |
1313 | 1313 | |
1314 | 1314 | $email_access_link = sprintf( |
1315 | 1315 | '%1$s: %2$s', |
1316 | - __( 'View your donation history', 'give' ), |
|
1317 | - esc_url( $access_url ) |
|
1316 | + __('View your donation history', 'give'), |
|
1317 | + esc_url($access_url) |
|
1318 | 1318 | ); |
1319 | 1319 | } |
1320 | 1320 | } |
@@ -1346,23 +1346,23 @@ discard block |
||
1346 | 1346 | * |
1347 | 1347 | * @return array |
1348 | 1348 | */ |
1349 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1350 | - if ( ! is_array( $tag_args ) ) { |
|
1351 | - switch ( true ) { |
|
1352 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1353 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1349 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1350 | + if ( ! is_array($tag_args)) { |
|
1351 | + switch (true) { |
|
1352 | + case ('give_payment' === get_post_type($tag_args)): |
|
1353 | + $tag_args = array('payment_id' => $tag_args); |
|
1354 | 1354 | break; |
1355 | 1355 | |
1356 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1357 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1356 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1357 | + $tag_args = array('user_id' => $tag_args); |
|
1358 | 1358 | break; |
1359 | 1359 | |
1360 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1361 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1360 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1361 | + $tag_args = array('donor_id' => $tag_args); |
|
1362 | 1362 | break; |
1363 | 1363 | |
1364 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1365 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1364 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1365 | + $tag_args = array('user_id' => $tag_args); |
|
1366 | 1366 | break; |
1367 | 1367 | } |
1368 | 1368 | } |
@@ -1380,29 +1380,29 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @since 2.2.1 |
1382 | 1382 | */ |
1383 | -function __give_211_bc_email_template_tag_param( &$args, $func_args = array() ) { |
|
1383 | +function __give_211_bc_email_template_tag_param(&$args, $func_args = array()) { |
|
1384 | 1384 | |
1385 | 1385 | /** |
1386 | 1386 | * This is for backward-compatibility, i.e.; if the parameters are |
1387 | 1387 | * still passed as 4 separate arguments instead of 1 single array. |
1388 | 1388 | */ |
1389 | - if ( ! is_array( $args ) ) { |
|
1389 | + if ( ! is_array($args)) { |
|
1390 | 1390 | $args = array( |
1391 | - 'tag' => isset( $func_args[0] ) ? $func_args[0] : '', |
|
1392 | - 'desc' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1393 | - 'func' => isset( $func_args[2] ) ? $func_args[2] : '', |
|
1394 | - 'context' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1391 | + 'tag' => isset($func_args[0]) ? $func_args[0] : '', |
|
1392 | + 'desc' => isset($func_args[1]) ? $func_args[1] : '', |
|
1393 | + 'func' => isset($func_args[2]) ? $func_args[2] : '', |
|
1394 | + 'context' => isset($func_args[3]) ? $func_args[3] : '', |
|
1395 | 1395 | 'is_admin' => false, |
1396 | 1396 | ); |
1397 | 1397 | } else { |
1398 | 1398 | |
1399 | 1399 | // This is for backward compatibility. Use 'desc' instead of 'description'. |
1400 | - if ( array_key_exists( 'description', $args ) ) { |
|
1400 | + if (array_key_exists('description', $args)) { |
|
1401 | 1401 | $args['desc'] = $args['description']; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | // This is for backward compatibility. Use 'func' instead of 'function'. |
1405 | - if ( array_key_exists( 'function', $args ) ) { |
|
1405 | + if (array_key_exists('function', $args)) { |
|
1406 | 1406 | $args['func'] = $args['function']; |
1407 | 1407 | } |
1408 | 1408 | |
@@ -1429,36 +1429,36 @@ discard block |
||
1429 | 1429 | * |
1430 | 1430 | * @return array |
1431 | 1431 | */ |
1432 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1432 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1433 | 1433 | |
1434 | 1434 | $reset_password_url = ''; |
1435 | 1435 | |
1436 | - switch ( true ) { |
|
1437 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1438 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1436 | + switch (true) { |
|
1437 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1438 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1439 | 1439 | break; |
1440 | 1440 | |
1441 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1442 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1441 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1442 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1443 | 1443 | break; |
1444 | 1444 | |
1445 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1446 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1445 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1446 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1447 | 1447 | break; |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1450 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1451 | 1451 | // Generate link, if Email content type is html. |
1452 | 1452 | $reset_password_link = sprintf( |
1453 | 1453 | '<a href="%1$s" target="_blank">%2$s</a>', |
1454 | - esc_url( $reset_password_url ), |
|
1455 | - __( 'Reset your password »', 'give' ) |
|
1454 | + esc_url($reset_password_url), |
|
1455 | + __('Reset your password »', 'give') |
|
1456 | 1456 | ); |
1457 | 1457 | } else { |
1458 | 1458 | $reset_password_link = sprintf( |
1459 | 1459 | '%1$s: %2$s', |
1460 | - __( 'Reset your password', 'give' ), |
|
1461 | - esc_url( $reset_password_url ) |
|
1460 | + __('Reset your password', 'give'), |
|
1461 | + esc_url($reset_password_url) |
|
1462 | 1462 | ); |
1463 | 1463 | } |
1464 | 1464 | |
@@ -1487,21 +1487,21 @@ discard block |
||
1487 | 1487 | * |
1488 | 1488 | * @return mixed|string |
1489 | 1489 | */ |
1490 | -function give_get_reset_password_url( $user_id ) { |
|
1490 | +function give_get_reset_password_url($user_id) { |
|
1491 | 1491 | $reset_password_url = ''; |
1492 | 1492 | |
1493 | 1493 | // Proceed further only, if user_id exists. |
1494 | - if ( $user_id ) { |
|
1494 | + if ($user_id) { |
|
1495 | 1495 | |
1496 | 1496 | // Get User Object Details. |
1497 | - $user = get_user_by( 'ID', $user_id ); |
|
1497 | + $user = get_user_by('ID', $user_id); |
|
1498 | 1498 | |
1499 | 1499 | // Prepare Reset Password URL. |
1500 | 1500 | $reset_password_url = esc_url( |
1501 | 1501 | add_query_arg( |
1502 | 1502 | array( |
1503 | 1503 | 'action' => 'rp', |
1504 | - 'key' => get_password_reset_key( $user ), |
|
1504 | + 'key' => get_password_reset_key($user), |
|
1505 | 1505 | 'login' => $user->user_login, |
1506 | 1506 | ), wp_login_url() |
1507 | 1507 | ) |
@@ -1520,15 +1520,15 @@ discard block |
||
1520 | 1520 | */ |
1521 | 1521 | function give_email_admin_email() { |
1522 | 1522 | |
1523 | - $admin_email = give_get_option( 'contact_admin_email' ); |
|
1523 | + $admin_email = give_get_option('contact_admin_email'); |
|
1524 | 1524 | |
1525 | - if ( empty( $admin_email ) ) { |
|
1526 | - give_delete_option( 'contact_admin_email' ); |
|
1525 | + if (empty($admin_email)) { |
|
1526 | + give_delete_option('contact_admin_email'); |
|
1527 | 1527 | } |
1528 | 1528 | |
1529 | - return ( ! empty( $admin_email ) ) |
|
1529 | + return ( ! empty($admin_email)) |
|
1530 | 1530 | ? $admin_email |
1531 | - : get_bloginfo( 'admin_email' ); |
|
1531 | + : get_bloginfo('admin_email'); |
|
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | /** |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | * @return string |
1540 | 1540 | */ |
1541 | 1541 | function give_email_site_url() { |
1542 | - return get_bloginfo( 'url' ); |
|
1542 | + return get_bloginfo('url'); |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | |
@@ -1551,10 +1551,10 @@ discard block |
||
1551 | 1551 | * @return string |
1552 | 1552 | */ |
1553 | 1553 | function give_email_offline_mailing_address() { |
1554 | - $offline_address = give_get_option( 'contact_offline_mailing_address' ); |
|
1554 | + $offline_address = give_get_option('contact_offline_mailing_address'); |
|
1555 | 1555 | |
1556 | - if ( false === $offline_address ) { |
|
1557 | - return sprintf( ' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo( 'sitename' ) ); |
|
1556 | + if (false === $offline_address) { |
|
1557 | + return sprintf(' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo('sitename')); |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | return $offline_address; |
@@ -1572,97 +1572,97 @@ discard block |
||
1572 | 1572 | * |
1573 | 1573 | * @return mixed |
1574 | 1574 | */ |
1575 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1576 | - preg_match_all( '/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches ); |
|
1575 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1576 | + preg_match_all('/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches); |
|
1577 | 1577 | |
1578 | - if ( ! empty( $matches[0] ) ) { |
|
1578 | + if ( ! empty($matches[0])) { |
|
1579 | 1579 | $search = $replace = array(); |
1580 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1581 | - if ( in_array( $meta_tag, $search ) ) { |
|
1580 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1581 | + if (in_array($meta_tag, $search)) { |
|
1582 | 1582 | continue; |
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | $search[] = $meta_tag; |
1586 | 1586 | |
1587 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1588 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1589 | - $meta_tag = current( $meta_tag_arr ); |
|
1587 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1588 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1589 | + $meta_tag = current($meta_tag_arr); |
|
1590 | 1590 | |
1591 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1592 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1593 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1591 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1592 | + $type = current(explode('_', $meta_tag, 2)); |
|
1593 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1594 | 1594 | |
1595 | - switch ( $type ) { |
|
1595 | + switch ($type) { |
|
1596 | 1596 | case 'donation': |
1597 | 1597 | // Bailout. |
1598 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1598 | + if ( ! isset($tag_args['payment_id'])) { |
|
1599 | 1599 | $replace[] = ''; |
1600 | 1600 | continue; |
1601 | 1601 | } |
1602 | 1602 | |
1603 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1603 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1604 | 1604 | |
1605 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1605 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1606 | 1606 | $replace[] = $meta_data; |
1607 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1608 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1607 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1608 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | break; |
1612 | 1612 | |
1613 | 1613 | case 'form': |
1614 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1614 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1615 | 1615 | |
1616 | 1616 | // Bailout. |
1617 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1618 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1617 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1618 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1622 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1621 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1622 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1623 | 1623 | $replace[] = $meta_data; |
1624 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1625 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1624 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1625 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1626 | 1626 | } |
1627 | 1627 | break; |
1628 | 1628 | |
1629 | 1629 | case 'donor': |
1630 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1630 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1631 | 1631 | |
1632 | 1632 | // Bailout. |
1633 | - if ( ! $donor_id ) { |
|
1634 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1635 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1636 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1637 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1633 | + if ( ! $donor_id) { |
|
1634 | + if (isset($tag_args['payment_id'])) { |
|
1635 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1636 | + } elseif (isset($tag_args['user_id'])) { |
|
1637 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1638 | 1638 | } |
1639 | 1639 | } |
1640 | 1640 | |
1641 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1641 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1642 | 1642 | |
1643 | - if ( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1644 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1643 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1644 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1647 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1648 | 1648 | $replace[] = $meta_data; |
1649 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1650 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1649 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1650 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1651 | 1651 | } |
1652 | 1652 | |
1653 | 1653 | break; |
1654 | 1654 | |
1655 | 1655 | default: |
1656 | - $replace[] = end( $search ); |
|
1656 | + $replace[] = end($search); |
|
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | |
1660 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1661 | - $content = str_replace( $search, $replace, $content ); |
|
1660 | + if ( ! empty($search) && ! empty($replace)) { |
|
1661 | + $content = str_replace($search, $replace, $content); |
|
1662 | 1662 | } |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | return $content; |
1666 | 1666 | } |
1667 | 1667 | |
1668 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1668 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |
@@ -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 | |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | 27 | |
28 | - $get_data = give_clean( $_GET ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
28 | + $get_data = give_clean($_GET); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
29 | 29 | |
30 | - $_get_action = ! empty( $get_data['give_action'] ) ? $get_data['give_action'] : null; |
|
30 | + $_get_action = ! empty($get_data['give_action']) ? $get_data['give_action'] : null; |
|
31 | 31 | |
32 | 32 | // Add backward compatibility to give-action param ( $_GET ). |
33 | - if ( empty( $_get_action ) ) { |
|
34 | - $_get_action = ! empty( $get_data['give-action'] ) ? $get_data['give-action'] : null; |
|
33 | + if (empty($_get_action)) { |
|
34 | + $_get_action = ! empty($get_data['give-action']) ? $get_data['give-action'] : null; |
|
35 | 35 | } |
36 | 36 | |
37 | - if ( isset( $_get_action ) ) { |
|
37 | + if (isset($_get_action)) { |
|
38 | 38 | /** |
39 | 39 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
40 | 40 | * |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param array $_GET Array of HTTP GET variables. |
44 | 44 | */ |
45 | - do_action( "give_{$_get_action}", $get_data ); |
|
45 | + do_action("give_{$_get_action}", $get_data); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | } |
49 | 49 | |
50 | -add_action( 'init', 'give_get_actions' ); |
|
50 | +add_action('init', 'give_get_actions'); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Hooks Give actions, when present in the $_POST super global. Every give_action |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function give_post_actions() { |
62 | 62 | |
63 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
63 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
64 | 64 | |
65 | - $_post_action = ! empty( $post_data['give_action'] ) ? $post_data['give_action'] : null; |
|
65 | + $_post_action = ! empty($post_data['give_action']) ? $post_data['give_action'] : null; |
|
66 | 66 | |
67 | 67 | // Add backward compatibility to give-action param ( $_POST ). |
68 | - if ( empty( $_post_action ) ) { |
|
69 | - $_post_action = ! empty( $post_data['give-action'] ) ? $post_data['give-action'] : null; |
|
68 | + if (empty($_post_action)) { |
|
69 | + $_post_action = ! empty($post_data['give-action']) ? $post_data['give-action'] : null; |
|
70 | 70 | } |
71 | 71 | |
72 | - if ( isset( $_post_action ) ) { |
|
72 | + if (isset($_post_action)) { |
|
73 | 73 | /** |
74 | 74 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
75 | 75 | * |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param array $_POST Array of HTTP POST variables. |
79 | 79 | */ |
80 | - do_action( "give_{$_post_action}", $post_data ); |
|
80 | + do_action("give_{$_post_action}", $post_data); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'init', 'give_post_actions' ); |
|
85 | +add_action('init', 'give_post_actions'); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Connect WordPress user with Donor. |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return void |
96 | 96 | */ |
97 | -function give_connect_donor_to_wpuser( $user_id, $user_data ) { |
|
97 | +function give_connect_donor_to_wpuser($user_id, $user_data) { |
|
98 | 98 | /* @var Give_Donor $donor */ |
99 | - $donor = new Give_Donor( $user_data['user_email'] ); |
|
99 | + $donor = new Give_Donor($user_data['user_email']); |
|
100 | 100 | |
101 | 101 | // Validate donor id and check if do nor is already connect to wp user or not. |
102 | - if ( $donor->id && ! $donor->user_id ) { |
|
102 | + if ($donor->id && ! $donor->user_id) { |
|
103 | 103 | |
104 | 104 | // Update donor user_id. |
105 | - if ( $donor->update( array( 'user_id' => $user_id ) ) ) { |
|
106 | - $donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id ); |
|
107 | - $donor->add_note( $donor_note ); |
|
105 | + if ($donor->update(array('user_id' => $user_id))) { |
|
106 | + $donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id); |
|
107 | + $donor->add_note($donor_note); |
|
108 | 108 | |
109 | 109 | // Update user_id meta in payments. |
110 | 110 | // if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 ); |
|
120 | +add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @param $data |
129 | 129 | */ |
130 | -function give_donor_batch_export_complete( $data ) { |
|
130 | +function give_donor_batch_export_complete($data) { |
|
131 | 131 | // Remove donor ids cache. |
132 | 132 | if ( |
133 | - isset( $data['class'] ) |
|
133 | + isset($data['class']) |
|
134 | 134 | && 'Give_Batch_Donors_Export' === $data['class'] |
135 | - && ! empty( $data['forms'] ) |
|
136 | - && isset( $data['give_export_option']['query_id'] ) |
|
135 | + && ! empty($data['forms']) |
|
136 | + && isset($data['give_export_option']['query_id']) |
|
137 | 137 | ) { |
138 | - Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) ); |
|
138 | + Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id'])); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' ); |
|
142 | +add_action('give_file_export_complete', 'give_donor_batch_export_complete'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Print css for wordpress setting pages. |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | /* @var WP_Screen $screen */ |
151 | 151 | $screen = get_current_screen(); |
152 | 152 | |
153 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
153 | + if ( ! ($screen instanceof WP_Screen)) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
157 | - switch ( true ) { |
|
158 | - case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ): |
|
157 | + switch (true) { |
|
158 | + case ('plugins' === $screen->base || 'plugins-network' === $screen->base): |
|
159 | 159 | ?> |
160 | 160 | <style> |
161 | 161 | tr.active.update + tr.give-addon-notice-tr td { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | -add_action( 'admin_head', 'give_admin_quick_css' ); |
|
195 | +add_action('admin_head', 'give_admin_quick_css'); |
|
196 | 196 | |
197 | 197 | |
198 | 198 | /** |
@@ -204,31 +204,31 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return void |
206 | 206 | */ |
207 | -function give_set_donation_levels_max_min_amount( $form_id ) { |
|
207 | +function give_set_donation_levels_max_min_amount($form_id) { |
|
208 | 208 | if ( |
209 | - ( 'set' === $_POST['_give_price_option'] ) || |
|
210 | - ( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) || |
|
211 | - ! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) ) |
|
209 | + ('set' === $_POST['_give_price_option']) || |
|
210 | + (in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) || |
|
211 | + ! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount')) |
|
212 | 212 | ) { |
213 | 213 | // Delete old meta. |
214 | - give_delete_meta( $form_id, '_give_levels_minimum_amount' ); |
|
215 | - give_delete_meta( $form_id, '_give_levels_maximum_amount' ); |
|
214 | + give_delete_meta($form_id, '_give_levels_minimum_amount'); |
|
215 | + give_delete_meta($form_id, '_give_levels_maximum_amount'); |
|
216 | 216 | |
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | 220 | // Sanitize donation level amounts. |
221 | - $donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts ); |
|
221 | + $donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts); |
|
222 | 222 | |
223 | - $min_amount = min( $donation_levels_amounts ); |
|
224 | - $max_amount = max( $donation_levels_amounts ); |
|
223 | + $min_amount = min($donation_levels_amounts); |
|
224 | + $max_amount = max($donation_levels_amounts); |
|
225 | 225 | |
226 | 226 | // Set Minimum and Maximum amount for Multi Level Donation Forms. |
227 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 ); |
|
228 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 ); |
|
227 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0); |
|
228 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0); |
|
229 | 229 | } |
230 | 230 | |
231 | -add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 ); |
|
231 | +add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30); |
|
232 | 232 | |
233 | 233 | |
234 | 234 | /** |
@@ -238,23 +238,23 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param int $payment_id |
240 | 240 | */ |
241 | -function _give_save_donor_billing_address( $payment_id ) { |
|
242 | - $donor_id = absint( give_get_payment_donor_id( $payment_id )); |
|
241 | +function _give_save_donor_billing_address($payment_id) { |
|
242 | + $donor_id = absint(give_get_payment_donor_id($payment_id)); |
|
243 | 243 | |
244 | 244 | // Bailout |
245 | - if ( ! $donor_id ) { |
|
245 | + if ( ! $donor_id) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | 249 | |
250 | 250 | /* @var Give_Donor $donor */ |
251 | - $donor = new Give_Donor( $donor_id ); |
|
251 | + $donor = new Give_Donor($donor_id); |
|
252 | 252 | |
253 | 253 | // Save address. |
254 | - $donor->add_address( 'billing[]', give_get_donation_address( $payment_id ) ); |
|
254 | + $donor->add_address('billing[]', give_get_donation_address($payment_id)); |
|
255 | 255 | } |
256 | 256 | |
257 | -add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 ); |
|
257 | +add_action('give_complete_donation', '_give_save_donor_billing_address', 9999); |
|
258 | 258 | |
259 | 259 | |
260 | 260 | /** |
@@ -264,26 +264,26 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @param array $args |
266 | 266 | */ |
267 | -function give_update_log_form_id( $args ) { |
|
268 | - $new_form_id = absint( $args[0] ); |
|
269 | - $payment_id = absint( $args[1] ); |
|
270 | - $logs = Give()->logs->get_logs( $payment_id ); |
|
267 | +function give_update_log_form_id($args) { |
|
268 | + $new_form_id = absint($args[0]); |
|
269 | + $payment_id = absint($args[1]); |
|
270 | + $logs = Give()->logs->get_logs($payment_id); |
|
271 | 271 | |
272 | 272 | // Bailout. |
273 | - if ( empty( $logs ) ) { |
|
273 | + if (empty($logs)) { |
|
274 | 274 | return; |
275 | 275 | } |
276 | 276 | |
277 | 277 | /* @var object $log */ |
278 | - foreach ( $logs as $log ) { |
|
279 | - Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id ); |
|
278 | + foreach ($logs as $log) { |
|
279 | + Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // Delete cache. |
283 | 283 | Give()->logs->delete_cache(); |
284 | 284 | } |
285 | 285 | |
286 | -add_action( 'give_update_log_form_id', 'give_update_log_form_id' ); |
|
286 | +add_action('give_update_log_form_id', 'give_update_log_form_id'); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Verify addon dependency before addon update |
@@ -295,25 +295,25 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return WP_Error |
297 | 297 | */ |
298 | -function __give_verify_addon_dependency_before_update( $error, $hook_extra ) { |
|
298 | +function __give_verify_addon_dependency_before_update($error, $hook_extra) { |
|
299 | 299 | // Bailout. |
300 | 300 | if ( |
301 | - is_wp_error( $error ) |
|
302 | - || ! array_key_exists( 'plugin', $hook_extra ) |
|
301 | + is_wp_error($error) |
|
302 | + || ! array_key_exists('plugin', $hook_extra) |
|
303 | 303 | ) { |
304 | 304 | return $error; |
305 | 305 | } |
306 | 306 | |
307 | - $plugin_base = strtolower( $hook_extra['plugin'] ); |
|
308 | - $licensed_addon = array_map( 'strtolower', Give_License::get_licensed_addons() ); |
|
307 | + $plugin_base = strtolower($hook_extra['plugin']); |
|
308 | + $licensed_addon = array_map('strtolower', Give_License::get_licensed_addons()); |
|
309 | 309 | |
310 | 310 | // Skip if not a Give addon. |
311 | - if ( ! in_array( $plugin_base, $licensed_addon ) ) { |
|
311 | + if ( ! in_array($plugin_base, $licensed_addon)) { |
|
312 | 312 | return $error; |
313 | 313 | } |
314 | 314 | |
315 | - $plugin_base = strtolower( $plugin_base ); |
|
316 | - $plugin_slug = str_replace( '.php', '', basename( $plugin_base ) ); |
|
315 | + $plugin_base = strtolower($plugin_base); |
|
316 | + $plugin_slug = str_replace('.php', '', basename($plugin_base)); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Filter the addon readme.txt url |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | $plugin_slug |
327 | 327 | ); |
328 | 328 | |
329 | - $parser = new Give_Readme_Parser( $url ); |
|
329 | + $parser = new Give_Readme_Parser($url); |
|
330 | 330 | $give_min_version = $parser->requires_at_least(); |
331 | 331 | |
332 | 332 | |
333 | - if ( version_compare( GIVE_VERSION, $give_min_version, '<' ) ) { |
|
333 | + if (version_compare(GIVE_VERSION, $give_min_version, '<')) { |
|
334 | 334 | return new WP_Error( |
335 | 335 | 'Give_Addon_Update_Error', |
336 | 336 | sprintf( |
337 | - __( 'Give version %s is required to update this add-on.', 'give' ), |
|
337 | + __('Give version %s is required to update this add-on.', 'give'), |
|
338 | 338 | $give_min_version |
339 | 339 | ) |
340 | 340 | ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return $error; |
344 | 344 | } |
345 | 345 | |
346 | -add_filter( 'upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2 ); |
|
346 | +add_filter('upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2); |
|
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Function to add suppress_filters param if WPML add-on is activated. |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return array WP query argument for Total Goal. |
356 | 356 | */ |
357 | -function __give_wpml_total_goal_shortcode_agrs( $args ) { |
|
357 | +function __give_wpml_total_goal_shortcode_agrs($args) { |
|
358 | 358 | $args['suppress_filters'] = true; |
359 | 359 | |
360 | 360 | return $args; |
@@ -389,19 +389,19 @@ discard block |
||
389 | 389 | * @since 2.1.4 |
390 | 390 | */ |
391 | 391 | function give_add_support_for_wpml() { |
392 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
393 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
392 | + if ( ! function_exists('is_plugin_active')) { |
|
393 | + include_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
397 | - if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) { |
|
397 | + if (is_plugin_active('sitepress-multilingual-cms/sitepress.php')) { |
|
398 | 398 | |
399 | - add_filter( 'give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs' ); |
|
399 | + add_filter('give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs'); |
|
400 | 400 | |
401 | 401 | // @see https://wpml.org/forums/topic/problem-with-query-filter-in-get_posts-function/#post-271309 |
402 | - add_action( 'give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99 ); |
|
403 | - add_action( 'give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99 ); |
|
402 | + add_action('give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99); |
|
403 | + add_action('give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | -add_action( 'give_init', 'give_add_support_for_wpml', 1000 ); |
|
407 | +add_action('give_init', 'give_add_support_for_wpml', 1000); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | * @uses api_request() |
119 | 119 | * |
120 | 120 | * @param array $_transient_data Update array build by WordPress. |
121 | - * @return array Modified update array with custom plugin data. |
|
121 | + * @return stdClass Modified update array with custom plugin data. |
|
122 | 122 | */ |
123 | 123 | public function check_update( $_transient_data ) { |
124 | 124 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined('ABSPATH')) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | * @param string $_plugin_file Path to the plugin file. |
34 | 34 | * @param array $_api_data Optional data to send with API calls. |
35 | 35 | */ |
36 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
36 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
37 | 37 | |
38 | 38 | global $edd_plugin_data, $edd_plugin_url_available; |
39 | 39 | |
40 | - $this->api_url = trailingslashit( $_api_url ); |
|
40 | + $this->api_url = trailingslashit($_api_url); |
|
41 | 41 | |
42 | 42 | $this->api_data = $_api_data; |
43 | - $this->name = plugin_basename( $_plugin_file ); |
|
44 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
43 | + $this->name = plugin_basename($_plugin_file); |
|
44 | + $this->slug = basename($_plugin_file, '.php'); |
|
45 | 45 | $this->version = $_api_data['version']; |
46 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
47 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
48 | - $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
46 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
47 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
48 | + $this->cache_key = 'edd_sl_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
49 | 49 | |
50 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
50 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Fires after the $edd_plugin_data is setup. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param array $edd_plugin_data Array of EDD SL plugin data. |
58 | 58 | */ |
59 | - do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data ); |
|
59 | + do_action('post_edd_sl_plugin_updater_setup', $edd_plugin_data); |
|
60 | 60 | |
61 | 61 | // Set up hooks. |
62 | 62 | $this->init(); |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function init() { |
74 | 74 | |
75 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
76 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
77 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
78 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
79 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
75 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
76 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
77 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
78 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
79 | + add_action('admin_init', array($this, 'show_changelog')); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
@@ -93,25 +93,25 @@ discard block |
||
93 | 93 | * @param array $_transient_data Update array build by WordPress. |
94 | 94 | * @return array Modified update array with custom plugin data. |
95 | 95 | */ |
96 | - public function check_update( $_transient_data ) { |
|
96 | + public function check_update($_transient_data) { |
|
97 | 97 | |
98 | 98 | global $pagenow; |
99 | 99 | |
100 | - if ( ! is_object( $_transient_data ) ) { |
|
100 | + if ( ! is_object($_transient_data)) { |
|
101 | 101 | $_transient_data = new stdClass(); |
102 | 102 | } |
103 | 103 | |
104 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
104 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
105 | 105 | return $_transient_data; |
106 | 106 | } |
107 | 107 | |
108 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
108 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
109 | 109 | return $_transient_data; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $version_info = $this->get_cached_version_info(); |
113 | 113 | |
114 | - if ( false === $version_info ) { |
|
114 | + if (false === $version_info) { |
|
115 | 115 | $version_info = $this->api_request( |
116 | 116 | 'plugin_latest_version', array( |
117 | 117 | 'slug' => $this->slug, |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | ) |
120 | 120 | ); |
121 | 121 | |
122 | - $this->set_version_info_cache( $version_info ); |
|
122 | + $this->set_version_info_cache($version_info); |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
126 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
126 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
127 | 127 | |
128 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
128 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
129 | 129 | |
130 | - $_transient_data->response[ $this->name ] = $version_info; |
|
130 | + $_transient_data->response[$this->name] = $version_info; |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | 134 | $_transient_data->last_checked = time(); |
135 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
135 | + $_transient_data->checked[$this->name] = $this->version; |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
@@ -145,36 +145,36 @@ discard block |
||
145 | 145 | * @param string $file |
146 | 146 | * @param array $plugin |
147 | 147 | */ |
148 | - public function show_update_notification( $file, $plugin ) { |
|
148 | + public function show_update_notification($file, $plugin) { |
|
149 | 149 | |
150 | - if ( is_network_admin() ) { |
|
150 | + if (is_network_admin()) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
154 | + if ( ! current_user_can('update_plugins')) { |
|
155 | 155 | return; |
156 | 156 | } |
157 | 157 | |
158 | - if ( ! is_multisite() ) { |
|
158 | + if ( ! is_multisite()) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if ( $this->name != $file ) { |
|
162 | + if ($this->name != $file) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | 166 | // Remove our filter on the site transient |
167 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
167 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
168 | 168 | |
169 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
169 | + $update_cache = get_site_transient('update_plugins'); |
|
170 | 170 | |
171 | - $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
|
171 | + $update_cache = is_object($update_cache) ? $update_cache : new stdClass(); |
|
172 | 172 | |
173 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
173 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
174 | 174 | |
175 | 175 | $version_info = $this->get_cached_version_info(); |
176 | 176 | |
177 | - if ( false === $version_info ) { |
|
177 | + if (false === $version_info) { |
|
178 | 178 | $version_info = $this->api_request( |
179 | 179 | 'plugin_latest_version', array( |
180 | 180 | 'slug' => $this->slug, |
@@ -182,65 +182,65 @@ discard block |
||
182 | 182 | ) |
183 | 183 | ); |
184 | 184 | |
185 | - $this->set_version_info_cache( $version_info ); |
|
185 | + $this->set_version_info_cache($version_info); |
|
186 | 186 | } |
187 | 187 | |
188 | - if ( ! is_object( $version_info ) ) { |
|
188 | + if ( ! is_object($version_info)) { |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
192 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
193 | 193 | |
194 | - $update_cache->response[ $this->name ] = $version_info; |
|
194 | + $update_cache->response[$this->name] = $version_info; |
|
195 | 195 | |
196 | 196 | } |
197 | 197 | |
198 | 198 | $update_cache->last_checked = time(); |
199 | - $update_cache->checked[ $this->name ] = $this->version; |
|
199 | + $update_cache->checked[$this->name] = $this->version; |
|
200 | 200 | |
201 | - set_site_transient( 'update_plugins', $update_cache ); |
|
201 | + set_site_transient('update_plugins', $update_cache); |
|
202 | 202 | |
203 | 203 | } else { |
204 | 204 | |
205 | - $version_info = $update_cache->response[ $this->name ]; |
|
205 | + $version_info = $update_cache->response[$this->name]; |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
209 | 209 | // Restore our filter |
210 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
210 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
211 | 211 | |
212 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
212 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
213 | 213 | |
214 | 214 | // build a plugin list row, with update notification |
215 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
215 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
216 | 216 | // <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
217 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
217 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
218 | 218 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
219 | 219 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
220 | 220 | |
221 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
221 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
222 | 222 | |
223 | - if ( empty( $version_info->download_link ) ) { |
|
223 | + if (empty($version_info->download_link)) { |
|
224 | 224 | printf( |
225 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ), |
|
226 | - esc_html( $version_info->name ), |
|
227 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
228 | - esc_html( $version_info->new_version ), |
|
225 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'), |
|
226 | + esc_html($version_info->name), |
|
227 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
228 | + esc_html($version_info->new_version), |
|
229 | 229 | '</a>' |
230 | 230 | ); |
231 | 231 | } else { |
232 | 232 | printf( |
233 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ), |
|
234 | - esc_html( $version_info->name ), |
|
235 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
236 | - esc_html( $version_info->new_version ), |
|
233 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'), |
|
234 | + esc_html($version_info->name), |
|
235 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
236 | + esc_html($version_info->new_version), |
|
237 | 237 | '</a>', |
238 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">', |
|
238 | + '<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">', |
|
239 | 239 | '</a>' |
240 | 240 | ); |
241 | 241 | } |
242 | 242 | |
243 | - do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); |
|
243 | + do_action("in_plugin_update_message-{$file}", $plugin, $version_info); |
|
244 | 244 | |
245 | 245 | echo '</div></td></tr>'; |
246 | 246 | } |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | * @param object $_args |
257 | 257 | * @return object $_data |
258 | 258 | */ |
259 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
259 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
260 | 260 | |
261 | - if ( $_action != 'plugin_information' ) { |
|
261 | + if ($_action != 'plugin_information') { |
|
262 | 262 | |
263 | 263 | return $_data; |
264 | 264 | |
265 | 265 | } |
266 | 266 | |
267 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
267 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
268 | 268 | |
269 | 269 | return $_data; |
270 | 270 | |
@@ -279,20 +279,20 @@ discard block |
||
279 | 279 | ), |
280 | 280 | ); |
281 | 281 | |
282 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
282 | + $cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
283 | 283 | |
284 | 284 | // Get the transient where we store the api request for this plugin for 24 hours |
285 | - $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
|
285 | + $edd_api_request_transient = $this->get_cached_version_info($cache_key); |
|
286 | 286 | |
287 | 287 | // If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
288 | - if ( empty( $edd_api_request_transient ) ) { |
|
288 | + if (empty($edd_api_request_transient)) { |
|
289 | 289 | |
290 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
290 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
291 | 291 | |
292 | 292 | // Expires in 3 hours |
293 | - $this->set_version_info_cache( $api_response, $cache_key ); |
|
293 | + $this->set_version_info_cache($api_response, $cache_key); |
|
294 | 294 | |
295 | - if ( false !== $api_response ) { |
|
295 | + if (false !== $api_response) { |
|
296 | 296 | $_data = $api_response; |
297 | 297 | } |
298 | 298 | } else { |
@@ -300,20 +300,20 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
303 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
303 | + if (isset($_data->sections) && ! is_array($_data->sections)) { |
|
304 | 304 | $new_sections = array(); |
305 | - foreach ( $_data->sections as $key => $value ) { |
|
306 | - $new_sections[ $key ] = $value; |
|
305 | + foreach ($_data->sections as $key => $value) { |
|
306 | + $new_sections[$key] = $value; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | $_data->sections = $new_sections; |
310 | 310 | } |
311 | 311 | |
312 | 312 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
313 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
313 | + if (isset($_data->banners) && ! is_array($_data->banners)) { |
|
314 | 314 | $new_banners = array(); |
315 | - foreach ( $_data->banners as $key => $value ) { |
|
316 | - $new_banners[ $key ] = $value; |
|
315 | + foreach ($_data->banners as $key => $value) { |
|
316 | + $new_banners[$key] = $value; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | $_data->banners = $new_banners; |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | * @param string $url |
330 | 330 | * @return object $array |
331 | 331 | */ |
332 | - public function http_request_args( $args, $url ) { |
|
332 | + public function http_request_args($args, $url) { |
|
333 | 333 | |
334 | 334 | $verify_ssl = $this->verify_ssl(); |
335 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
335 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
336 | 336 | $args['sslverify'] = $verify_ssl; |
337 | 337 | } |
338 | 338 | return $args; |
@@ -350,30 +350,30 @@ discard block |
||
350 | 350 | * @param array $_data Parameters for the API action. |
351 | 351 | * @return false|object |
352 | 352 | */ |
353 | - private function api_request( $_action, $_data ) { |
|
353 | + private function api_request($_action, $_data) { |
|
354 | 354 | |
355 | 355 | global $wp_version; |
356 | 356 | |
357 | - $data = array_merge( $this->api_data, $_data ); |
|
357 | + $data = array_merge($this->api_data, $_data); |
|
358 | 358 | |
359 | - if ( $data['slug'] != $this->slug ) { |
|
359 | + if ($data['slug'] != $this->slug) { |
|
360 | 360 | return; |
361 | 361 | } |
362 | 362 | |
363 | - if ( $this->api_url == trailingslashit( home_url() ) ) { |
|
363 | + if ($this->api_url == trailingslashit(home_url())) { |
|
364 | 364 | return false; // Don't allow a plugin to ping itself |
365 | 365 | } |
366 | 366 | |
367 | 367 | $api_params = array( |
368 | 368 | 'edd_action' => 'get_version', |
369 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
370 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
371 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
372 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
369 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
370 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
371 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
372 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
373 | 373 | 'slug' => $data['slug'], |
374 | 374 | 'author' => $data['author'], |
375 | 375 | 'url' => home_url(), |
376 | - 'beta' => ! empty( $data['beta'] ), |
|
376 | + 'beta' => ! empty($data['beta']), |
|
377 | 377 | ); |
378 | 378 | |
379 | 379 | $verify_ssl = $this->verify_ssl(); |
@@ -385,22 +385,22 @@ discard block |
||
385 | 385 | ) |
386 | 386 | ); |
387 | 387 | |
388 | - if ( ! is_wp_error( $request ) ) { |
|
389 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
388 | + if ( ! is_wp_error($request)) { |
|
389 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( $request && isset( $request->sections ) ) { |
|
393 | - $request->sections = maybe_unserialize( $request->sections ); |
|
392 | + if ($request && isset($request->sections)) { |
|
393 | + $request->sections = maybe_unserialize($request->sections); |
|
394 | 394 | } else { |
395 | 395 | $request = false; |
396 | 396 | } |
397 | 397 | |
398 | - if ( $request && isset( $request->banners ) ) { |
|
399 | - $request->banners = maybe_unserialize( $request->banners ); |
|
398 | + if ($request && isset($request->banners)) { |
|
399 | + $request->banners = maybe_unserialize($request->banners); |
|
400 | 400 | } |
401 | 401 | |
402 | - if ( ! empty( $request->sections ) ) { |
|
403 | - foreach ( $request->sections as $key => $section ) { |
|
402 | + if ( ! empty($request->sections)) { |
|
403 | + foreach ($request->sections as $key => $section) { |
|
404 | 404 | $request->$key = (array) $section; |
405 | 405 | } |
406 | 406 | } |
@@ -412,37 +412,37 @@ discard block |
||
412 | 412 | |
413 | 413 | global $edd_plugin_data; |
414 | 414 | |
415 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
415 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
416 | 416 | return; |
417 | 417 | } |
418 | 418 | |
419 | - if ( empty( $_REQUEST['plugin'] ) ) { |
|
419 | + if (empty($_REQUEST['plugin'])) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | - if ( empty( $_REQUEST['slug'] ) ) { |
|
423 | + if (empty($_REQUEST['slug'])) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
427 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
428 | - wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
427 | + if ( ! current_user_can('update_plugins')) { |
|
428 | + wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403)); |
|
429 | 429 | } |
430 | 430 | |
431 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
432 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
433 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
434 | - $version_info = $this->get_cached_version_info( $cache_key ); |
|
431 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
432 | + $beta = ! empty($data['beta']) ? true : false; |
|
433 | + $cache_key = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info'); |
|
434 | + $version_info = $this->get_cached_version_info($cache_key); |
|
435 | 435 | |
436 | - if ( false === $version_info ) { |
|
436 | + if (false === $version_info) { |
|
437 | 437 | |
438 | 438 | $api_params = array( |
439 | 439 | 'edd_action' => 'get_version', |
440 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
441 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
440 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
441 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
442 | 442 | 'slug' => $_REQUEST['slug'], |
443 | 443 | 'author' => $data['author'], |
444 | 444 | 'url' => home_url(), |
445 | - 'beta' => ! empty( $data['beta'] ), |
|
445 | + 'beta' => ! empty($data['beta']), |
|
446 | 446 | ); |
447 | 447 | |
448 | 448 | $verify_ssl = $this->verify_ssl(); |
@@ -454,61 +454,61 @@ discard block |
||
454 | 454 | ) |
455 | 455 | ); |
456 | 456 | |
457 | - if ( ! is_wp_error( $request ) ) { |
|
458 | - $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
|
457 | + if ( ! is_wp_error($request)) { |
|
458 | + $version_info = json_decode(wp_remote_retrieve_body($request)); |
|
459 | 459 | } |
460 | 460 | |
461 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
462 | - $version_info->sections = maybe_unserialize( $version_info->sections ); |
|
461 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
462 | + $version_info->sections = maybe_unserialize($version_info->sections); |
|
463 | 463 | } else { |
464 | 464 | $version_info = false; |
465 | 465 | } |
466 | 466 | |
467 | - if ( ! empty( $version_info ) ) { |
|
468 | - foreach ( $version_info->sections as $key => $section ) { |
|
467 | + if ( ! empty($version_info)) { |
|
468 | + foreach ($version_info->sections as $key => $section) { |
|
469 | 469 | $version_info->$key = (array) $section; |
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | - $this->set_version_info_cache( $version_info, $cache_key ); |
|
473 | + $this->set_version_info_cache($version_info, $cache_key); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 | |
477 | - if ( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
478 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
477 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
478 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | exit; |
482 | 482 | } |
483 | 483 | |
484 | - public function get_cached_version_info( $cache_key = '' ) { |
|
484 | + public function get_cached_version_info($cache_key = '') { |
|
485 | 485 | |
486 | - if ( empty( $cache_key ) ) { |
|
486 | + if (empty($cache_key)) { |
|
487 | 487 | $cache_key = $this->cache_key; |
488 | 488 | } |
489 | 489 | |
490 | - $cache = get_option( $cache_key ); |
|
490 | + $cache = get_option($cache_key); |
|
491 | 491 | |
492 | - if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
492 | + if (empty($cache['timeout']) || time() > $cache['timeout']) { |
|
493 | 493 | return false; // Cache is expired |
494 | 494 | } |
495 | 495 | |
496 | - return json_decode( $cache['value'] ); |
|
496 | + return json_decode($cache['value']); |
|
497 | 497 | |
498 | 498 | } |
499 | 499 | |
500 | - public function set_version_info_cache( $value = '', $cache_key = '' ) { |
|
500 | + public function set_version_info_cache($value = '', $cache_key = '') { |
|
501 | 501 | |
502 | - if ( empty( $cache_key ) ) { |
|
502 | + if (empty($cache_key)) { |
|
503 | 503 | $cache_key = $this->cache_key; |
504 | 504 | } |
505 | 505 | |
506 | 506 | $data = array( |
507 | - 'timeout' => strtotime( '+3 hours', time() ), |
|
508 | - 'value' => json_encode( $value ), |
|
507 | + 'timeout' => strtotime('+3 hours', time()), |
|
508 | + 'value' => json_encode($value), |
|
509 | 509 | ); |
510 | 510 | |
511 | - update_option( $cache_key, $data, 'no' ); |
|
511 | + update_option($cache_key, $data, 'no'); |
|
512 | 512 | |
513 | 513 | } |
514 | 514 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * @return bool |
520 | 520 | */ |
521 | 521 | private function verify_ssl() { |
522 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
522 | + return (bool) apply_filters('edd_sl_api_request_verify_ssl', true, $this); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | |
40 | 40 | // Exit if accessed directly. |
41 | -if ( ! defined( 'ABSPATH' ) ) { |
|
41 | +if ( ! defined('ABSPATH')) { |
|
42 | 42 | exit; |
43 | 43 | } |
44 | 44 | |
45 | -if ( ! class_exists( 'Give' ) ) : |
|
45 | +if ( ! class_exists('Give')) : |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Main Give Class |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return Give |
280 | 280 | */ |
281 | 281 | public static function instance() { |
282 | - if ( is_null( self::$_instance ) ) { |
|
282 | + if (is_null(self::$_instance)) { |
|
283 | 283 | self::$_instance = new self(); |
284 | 284 | } |
285 | 285 | |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function __construct() { |
293 | 293 | // PHP version |
294 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
295 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
294 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
295 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | // Bailout: Need minimum php version to load plugin. |
299 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
300 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
299 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
300 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
301 | 301 | |
302 | 302 | return; |
303 | 303 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $this->includes(); |
307 | 307 | $this->init_hooks(); |
308 | 308 | |
309 | - do_action( 'give_loaded' ); |
|
309 | + do_action('give_loaded'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | * @since 1.8.9 |
316 | 316 | */ |
317 | 317 | private function init_hooks() { |
318 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
319 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
318 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
319 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
320 | 320 | |
321 | 321 | // Set up localization on init Hook. |
322 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
322 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @since 1.8.9 |
337 | 337 | */ |
338 | - do_action( 'before_give_init' ); |
|
338 | + do_action('before_give_init'); |
|
339 | 339 | |
340 | 340 | // Set up localization. |
341 | 341 | $this->load_textdomain(); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @since 1.8.7 |
372 | 372 | */ |
373 | - do_action( 'give_init', $this ); |
|
373 | + do_action('give_init', $this); |
|
374 | 374 | |
375 | 375 | } |
376 | 376 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function __clone() { |
389 | 389 | // Cloning instances of the class is forbidden. |
390 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
390 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function __wakeup() { |
402 | 402 | // Unserializing instances of the class is forbidden. |
403 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
403 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -414,33 +414,33 @@ discard block |
||
414 | 414 | private function setup_constants() { |
415 | 415 | |
416 | 416 | // Plugin version |
417 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
418 | - define( 'GIVE_VERSION', '2.2.4' ); |
|
417 | + if ( ! defined('GIVE_VERSION')) { |
|
418 | + define('GIVE_VERSION', '2.2.4'); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | // Plugin Root File |
422 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
423 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
422 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
423 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | // Plugin Folder Path |
427 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
428 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
427 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
428 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | // Plugin Folder URL |
432 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
433 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
432 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
433 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | // Plugin Basename aka: "give/give.php" |
437 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
438 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
437 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
438 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | // Make sure CAL_GREGORIAN is defined |
442 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
443 | - define( 'CAL_GREGORIAN', 1 ); |
|
442 | + if ( ! defined('CAL_GREGORIAN')) { |
|
443 | + define('CAL_GREGORIAN', 1); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
@@ -458,170 +458,170 @@ discard block |
||
458 | 458 | /** |
459 | 459 | * Load libraries. |
460 | 460 | */ |
461 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
462 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
461 | + if ( ! class_exists('WP_Async_Request')) { |
|
462 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
463 | 463 | } |
464 | 464 | |
465 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
466 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
465 | + if ( ! class_exists('WP_Background_Process')) { |
|
466 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | /** |
470 | 470 | * Load plugin files |
471 | 471 | */ |
472 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
474 | 474 | $give_options = give_get_settings(); |
475 | 475 | |
476 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php'; |
|
490 | - |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
509 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php'; |
|
512 | - |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
523 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
533 | - |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
536 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
537 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
540 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
541 | - |
|
542 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
543 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
547 | - |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
554 | - |
|
555 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php'; |
|
558 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php'; |
|
561 | - |
|
562 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
563 | - |
|
564 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
565 | - |
|
566 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
567 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php'; |
|
490 | + |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
509 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php'; |
|
512 | + |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
523 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
533 | + |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
536 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
537 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
540 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
541 | + |
|
542 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
543 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
547 | + |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
554 | + |
|
555 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php'; |
|
558 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php'; |
|
561 | + |
|
562 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
563 | + |
|
564 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
565 | + |
|
566 | + if (defined('WP_CLI') && WP_CLI) { |
|
567 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
568 | 568 | } |
569 | 569 | |
570 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
571 | - |
|
572 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
576 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
578 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
580 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
583 | - |
|
584 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
586 | - |
|
587 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
590 | - |
|
591 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
592 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php'; |
|
593 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
594 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
595 | - |
|
596 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
597 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
598 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
599 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
600 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
601 | - |
|
602 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
603 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
604 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
605 | - |
|
606 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
607 | - |
|
608 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
609 | - |
|
610 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
611 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
612 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
613 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
614 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
615 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
616 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
617 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
618 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
619 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
620 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
621 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
570 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
571 | + |
|
572 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
576 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
578 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
580 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
583 | + |
|
584 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
586 | + |
|
587 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
590 | + |
|
591 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
592 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php'; |
|
593 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
595 | + |
|
596 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
597 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
598 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
599 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
600 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
601 | + |
|
602 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
603 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
604 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
605 | + |
|
606 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
607 | + |
|
608 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
609 | + |
|
610 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
611 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
612 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
613 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
614 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
615 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
616 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
617 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
618 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
619 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
620 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
621 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
622 | 622 | }// End if(). |
623 | 623 | |
624 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
624 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
625 | 625 | |
626 | 626 | } |
627 | 627 | |
@@ -636,16 +636,16 @@ discard block |
||
636 | 636 | public function load_textdomain() { |
637 | 637 | |
638 | 638 | // Set filter for Give's languages directory |
639 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
640 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
639 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
640 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
641 | 641 | |
642 | 642 | // Traditional WordPress plugin locale filter. |
643 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
644 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
643 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
644 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
645 | 645 | |
646 | - unload_textdomain( 'give' ); |
|
647 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
648 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
646 | + unload_textdomain('give'); |
|
647 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
648 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
649 | 649 | |
650 | 650 | } |
651 | 651 | |
@@ -658,21 +658,21 @@ discard block |
||
658 | 658 | */ |
659 | 659 | public function minimum_phpversion_notice() { |
660 | 660 | // Bailout. |
661 | - if ( ! is_admin() ) { |
|
661 | + if ( ! is_admin()) { |
|
662 | 662 | return; |
663 | 663 | } |
664 | 664 | |
665 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
666 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
667 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
668 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
669 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
670 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
671 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
665 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
666 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
667 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
668 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
669 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
670 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
671 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
672 | 672 | |
673 | 673 | echo sprintf( |
674 | 674 | '<div class="notice notice-error">%1$s</div>', |
675 | - wp_kses_post( $notice_desc ) |
|
675 | + wp_kses_post($notice_desc) |
|
676 | 676 | ); |
677 | 677 | } |
678 | 678 |
@@ -11,7 +11,7 @@ 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 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Constructor. |
48 | 48 | */ |
49 | - public function __construct( $_step = 1 ) { |
|
50 | - parent::__construct( $_step ); |
|
49 | + public function __construct($_step = 1) { |
|
50 | + parent::__construct($_step); |
|
51 | 51 | |
52 | 52 | $this->is_writable = true; |
53 | 53 | } |
@@ -61,32 +61,32 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function get_data() { |
63 | 63 | |
64 | - if ( $this->step == 1 ) { |
|
65 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
64 | + if ($this->step == 1) { |
|
65 | + $this->delete_data('give_temp_recount_earnings'); |
|
66 | 66 | } |
67 | 67 | |
68 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
68 | + $total = get_option('give_temp_recount_earnings', false); |
|
69 | 69 | |
70 | - if ( false === $total ) { |
|
70 | + if (false === $total) { |
|
71 | 71 | $total = (float) 0; |
72 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
72 | + $this->store_data('give_temp_recount_earnings', $total); |
|
73 | 73 | } |
74 | 74 | |
75 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
75 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
76 | 76 | |
77 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
77 | + $args = apply_filters('give_recount_earnings_args', array( |
|
78 | 78 | 'number' => $this->per_step, |
79 | 79 | 'page' => $this->step, |
80 | 80 | 'status' => $accepted_statuses, |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | - $payments = give_get_payments( $args ); |
|
83 | + $payments = give_get_payments($args); |
|
84 | 84 | |
85 | - if ( ! empty( $payments ) ) { |
|
85 | + if ( ! empty($payments)) { |
|
86 | 86 | |
87 | - foreach ( $payments as $payment ) { |
|
87 | + foreach ($payments as $payment) { |
|
88 | 88 | // Get the payment amount. |
89 | - $payment_amount = give_get_meta( $payment->ID, '_give_payment_total', true ); |
|
89 | + $payment_amount = give_get_meta($payment->ID, '_give_payment_total', true); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Filter the payment amount. |
@@ -95,28 +95,28 @@ discard block |
||
95 | 95 | */ |
96 | 96 | $donation_amount = apply_filters( |
97 | 97 | 'give_donation_amount', |
98 | - give_format_amount( $payment_amount, array( 'donation_id' => $payment->ID ) ), |
|
98 | + give_format_amount($payment_amount, array('donation_id' => $payment->ID)), |
|
99 | 99 | $payment->total, |
100 | 100 | $payment->ID, |
101 | - array( 'type' => 'stats', 'currency' => false, 'amount' => false ) |
|
101 | + array('type' => 'stats', 'currency' => false, 'amount' => false) |
|
102 | 102 | ); |
103 | 103 | |
104 | - $total += (float) give_maybe_sanitize_amount( $donation_amount ); |
|
104 | + $total += (float) give_maybe_sanitize_amount($donation_amount); |
|
105 | 105 | } |
106 | 106 | |
107 | - if ( $total < 0 ) { |
|
107 | + if ($total < 0) { |
|
108 | 108 | $totals = 0; |
109 | 109 | } |
110 | 110 | |
111 | - $total = round( $total, give_get_price_decimals() ); |
|
111 | + $total = round($total, give_get_price_decimals()); |
|
112 | 112 | |
113 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
113 | + $this->store_data('give_temp_recount_earnings', $total); |
|
114 | 114 | |
115 | 115 | return true; |
116 | 116 | |
117 | 117 | } |
118 | 118 | |
119 | - update_option( 'give_earnings_total', $total, false ); |
|
119 | + update_option('give_earnings_total', $total, false); |
|
120 | 120 | |
121 | 121 | return false; |
122 | 122 | |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function get_percentage_complete() { |
132 | 132 | |
133 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
133 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
134 | 134 | |
135 | - if ( false === $total ) { |
|
136 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
135 | + if (false === $total) { |
|
136 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
137 | 137 | |
138 | - $counts = give_count_payments( $args ); |
|
139 | - $total = absint( $counts->publish ); |
|
140 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
138 | + $counts = give_count_payments($args); |
|
139 | + $total = absint($counts->publish); |
|
140 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
141 | 141 | |
142 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
142 | + $this->store_data('give_recount_earnings_total', $total); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $percentage = 100; |
146 | 146 | |
147 | - if ( $total > 0 ) { |
|
148 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
147 | + if ($total > 0) { |
|
148 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
149 | 149 | } |
150 | 150 | |
151 | - if ( $percentage > 100 ) { |
|
151 | + if ($percentage > 100) { |
|
152 | 152 | $percentage = 100; |
153 | 153 | } |
154 | 154 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @param array $request The Form Data passed into the batch processing |
164 | 164 | */ |
165 | - public function set_properties( $request ) { |
|
165 | + public function set_properties($request) { |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function process_step() { |
175 | 175 | |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $had_data = $this->get_data(); |
181 | 181 | |
182 | - if ( $had_data ) { |
|
182 | + if ($had_data) { |
|
183 | 183 | $this->done = false; |
184 | 184 | |
185 | 185 | return true; |
186 | 186 | } else { |
187 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
188 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
187 | + $this->delete_data('give_recount_earnings_total'); |
|
188 | + $this->delete_data('give_temp_recount_earnings'); |
|
189 | 189 | $this->done = true; |
190 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
190 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
191 | 191 | |
192 | 192 | return false; |
193 | 193 | } |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return mixed Returns the data from the database |
226 | 226 | */ |
227 | - private function get_stored_data( $key ) { |
|
227 | + private function get_stored_data($key) { |
|
228 | 228 | global $wpdb; |
229 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
229 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
230 | 230 | |
231 | - if ( empty( $value ) ) { |
|
231 | + if (empty($value)) { |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | |
235 | - $maybe_json = json_decode( $value ); |
|
236 | - if ( ! is_null( $maybe_json ) ) { |
|
237 | - $value = json_decode( $value, true ); |
|
235 | + $maybe_json = json_decode($value); |
|
236 | + if ( ! is_null($maybe_json)) { |
|
237 | + $value = json_decode($value, true); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | return $value; |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return void |
252 | 252 | */ |
253 | - private function store_data( $key, $value ) { |
|
253 | + private function store_data($key, $value) { |
|
254 | 254 | global $wpdb; |
255 | 255 | |
256 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
256 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
257 | 257 | |
258 | 258 | $data = array( |
259 | 259 | 'option_name' => $key, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | '%s', |
268 | 268 | ); |
269 | 269 | |
270 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
270 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - private function delete_data( $key ) { |
|
282 | + private function delete_data($key) { |
|
283 | 283 | global $wpdb; |
284 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
284 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | } |
@@ -10,13 +10,13 @@ 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 | |
17 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <?php $localized_date_format = give_get_localized_date_format_to_js(); ?> |
178 | 178 | <p> |
179 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
180 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
179 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
180 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
181 | 181 | </p> |
182 | 182 | </div> |
183 | 183 | |
184 | 184 | <div class="give-admin-box-inside"> |
185 | 185 | <p> |
186 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
187 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
186 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
187 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
189 | 189 | </p> |
190 | 190 | </div> |
191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param int $payment_id Payment id. |
201 | 201 | */ |
202 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
202 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <div class="give-order-payment give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
208 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
209 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
207 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
208 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
209 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
210 | 210 | </p> |
211 | 211 | </div> |
212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param int $payment_id Payment id. |
220 | 220 | */ |
221 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
221 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
222 | 222 | ?> |
223 | 223 | |
224 | 224 | </div> |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param int $payment_id Payment id. |
238 | 238 | */ |
239 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
239 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <div id="major-publishing-actions"> |
243 | 243 | <div id="publishing-action"> |
244 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
244 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
245 | 245 | <?php |
246 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
246 | + if (give_is_payment_complete($payment_id)) { |
|
247 | 247 | $url = add_query_arg( |
248 | 248 | array( |
249 | 249 | 'give-action' => 'email_links', |
250 | 250 | 'purchase_id' => $payment_id, |
251 | 251 | ), |
252 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ) |
|
252 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | echo sprintf( |
256 | 256 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
257 | - esc_url( $url ), |
|
258 | - esc_html__( 'Resend Receipt', 'give' ) |
|
257 | + esc_url($url), |
|
258 | + esc_html__('Resend Receipt', 'give') |
|
259 | 259 | ); |
260 | 260 | } |
261 | 261 | ?> |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param int $payment_id Payment id. |
272 | 272 | */ |
273 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
273 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
274 | 274 | ?> |
275 | 275 | |
276 | 276 | </div> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | <div id="give-order-details" class="postbox give-order-data"> |
283 | 283 | |
284 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
284 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
285 | 285 | |
286 | 286 | <div class="inside"> |
287 | 287 | <div class="give-admin-box"> |
@@ -294,30 +294,30 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param int $payment_id Payment id. |
296 | 296 | */ |
297 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
297 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
298 | 298 | |
299 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
300 | - if ( $gateway ) : |
|
299 | + $gateway = give_get_payment_gateway($payment_id); |
|
300 | + if ($gateway) : |
|
301 | 301 | ?> |
302 | 302 | <div class="give-order-gateway give-admin-box-inside"> |
303 | 303 | <p> |
304 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
305 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
304 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
305 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
306 | 306 | </p> |
307 | 307 | </div> |
308 | 308 | <?php endif; ?> |
309 | 309 | |
310 | 310 | <div class="give-order-payment-key give-admin-box-inside"> |
311 | 311 | <p> |
312 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
313 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
312 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
313 | + <?php echo give_get_payment_key($payment_id); ?> |
|
314 | 314 | </p> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="give-order-ip give-admin-box-inside"> |
318 | 318 | <p> |
319 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
320 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
319 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
320 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
321 | 321 | </p> |
322 | 322 | </div> |
323 | 323 | |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | // Display the transaction ID present. |
326 | 326 | // The transaction ID is the charge ID from the gateway. |
327 | 327 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
328 | - if ( $transaction_id != $payment_id ) : ?> |
|
328 | + if ($transaction_id != $payment_id) : ?> |
|
329 | 329 | <div class="give-order-tx-id give-admin-box-inside"> |
330 | 330 | <p> |
331 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
332 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
331 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
332 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
333 | 333 | </p> |
334 | 334 | </div> |
335 | 335 | <?php endif; ?> |
336 | 336 | |
337 | 337 | <div class="give-admin-box-inside"> |
338 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
339 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
338 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
339 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
340 | 340 | </p> |
341 | 341 | </div> |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param int $payment_id Payment id. |
350 | 350 | */ |
351 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
351 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
352 | 352 | ?> |
353 | 353 | |
354 | 354 | </div> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param int $payment_id Payment id. |
370 | 370 | */ |
371 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
371 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
372 | 372 | ?> |
373 | 373 | |
374 | 374 | </div> |
@@ -388,31 +388,31 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @param int $payment_id Payment id. |
390 | 390 | */ |
391 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
391 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
392 | 392 | ?> |
393 | 393 | |
394 | 394 | <?php $column_count = 'columns-3'; ?> |
395 | 395 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
396 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
396 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
397 | 397 | |
398 | 398 | <div class="inside"> |
399 | 399 | |
400 | 400 | <div class="column-container"> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
403 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
404 | 404 | <?php |
405 | - if ( $payment_meta['form_id'] ) : |
|
405 | + if ($payment_meta['form_id']) : |
|
406 | 406 | printf( |
407 | 407 | '<a href="%1$s">%2$s</a>', |
408 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
408 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
409 | 409 | $payment_meta['form_id'] |
410 | 410 | ); |
411 | 411 | endif; |
412 | 412 | ?> |
413 | 413 | </p> |
414 | 414 | <p> |
415 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
415 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
416 | 416 | <?php |
417 | 417 | echo Give()->html->forms_dropdown( |
418 | 418 | array( |
@@ -428,21 +428,21 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | <div class="column"> |
430 | 430 | <p> |
431 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
432 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
431 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
432 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
433 | 433 | </p> |
434 | 434 | <p> |
435 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
435 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
436 | 436 | <span class="give-donation-level"> |
437 | 437 | <?php |
438 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
439 | - if ( empty( $var_prices ) ) { |
|
440 | - _e( 'n/a', 'give' ); |
|
438 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
439 | + if (empty($var_prices)) { |
|
440 | + _e('n/a', 'give'); |
|
441 | 441 | } else { |
442 | 442 | $prices_atts = array(); |
443 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
444 | - foreach ( $variable_prices as $variable_price ) { |
|
445 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
443 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
444 | + foreach ($variable_prices as $variable_price) { |
|
445 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | // Variable price dropdown options. |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | 'name' => 'give-variable-price', |
452 | 452 | 'chosen' => true, |
453 | 453 | 'show_option_all' => '', |
454 | - 'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ), |
|
455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
454 | + 'show_option_none' => ('' === $payment->price_id ? __('None', 'give') : ''), |
|
455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
456 | 456 | 'selected' => $payment->price_id, |
457 | 457 | ); |
458 | 458 | // Render variable prices select tag html. |
459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | </span> |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | </div> |
465 | 465 | <div class="column"> |
466 | 466 | <p> |
467 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
468 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
467 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
468 | + <?php echo give_donation_amount($payment, true); ?> |
|
469 | 469 | </p> |
470 | 470 | |
471 | - <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ): ?> |
|
471 | + <?php if (give_is_anonymous_donation_field_enabled($payment->form_id)): ?> |
|
472 | 472 | <div> |
473 | - <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong> |
|
473 | + <strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong> |
|
474 | 474 | <ul class="give-radio-inline"> |
475 | 475 | <li> |
476 | 476 | <label> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | name="give_anonymous_donation" |
479 | 479 | value="1" |
480 | 480 | type="radio" |
481 | - <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
482 | - ><?php _e( 'Yes', 'give' ); ?> |
|
481 | + <?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
482 | + ><?php _e('Yes', 'give'); ?> |
|
483 | 483 | </label> |
484 | 484 | </li> |
485 | 485 | <li> |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | name="give_anonymous_donation" |
489 | 489 | value="0" |
490 | 490 | type="radio" |
491 | - <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
492 | - ><?php _e( 'No', 'give' ); ?> |
|
491 | + <?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
492 | + ><?php _e('No', 'give'); ?> |
|
493 | 493 | </label> |
494 | 494 | </li> |
495 | 495 | </ul> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @param int $payment_id Payment id. |
508 | 508 | */ |
509 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
509 | + do_action('give_donation_details_thead_before', $payment_id); |
|
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * |
519 | 519 | * @param int $payment_id Payment id. |
520 | 520 | */ |
521 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
521 | + do_action('give_donation_details_thead_after', $payment_id); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @param int $payment_id Payment id. |
531 | 531 | */ |
532 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
532 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @param int $payment_id Payment id. |
542 | 542 | */ |
543 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
543 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
544 | 544 | ?> |
545 | 545 | </p> |
546 | 546 | </div> |
@@ -560,66 +560,66 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @param int $payment_id Payment id. |
562 | 562 | */ |
563 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
563 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
564 | 564 | ?> |
565 | 565 | |
566 | 566 | <div id="give-donor-details" class="postbox"> |
567 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
567 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
568 | 568 | |
569 | 569 | <div class="inside"> |
570 | 570 | |
571 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
571 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
572 | 572 | |
573 | 573 | <div class="column-container donor-info"> |
574 | 574 | <div class="column"> |
575 | 575 | <p> |
576 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
576 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
577 | 577 | <?php |
578 | - if ( ! empty( $donor->id ) ) { |
|
578 | + if ( ! empty($donor->id)) { |
|
579 | 579 | printf( |
580 | 580 | '<a href="%1$s">%2$s</a>', |
581 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ), |
|
582 | - intval( $donor->id ) |
|
581 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)), |
|
582 | + intval($donor->id) |
|
583 | 583 | ); |
584 | 584 | } |
585 | 585 | ?> |
586 | - <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
586 | + <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span> |
|
587 | 587 | </p> |
588 | 588 | <p> |
589 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
590 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
589 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
590 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
591 | 591 | </p> |
592 | 592 | </div> |
593 | 593 | <div class="column"> |
594 | 594 | <p> |
595 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
595 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
596 | 596 | <?php |
597 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
598 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
597 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
598 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
599 | 599 | |
600 | 600 | // Check whether the donor name and WP_User name is same or not. |
601 | - if ( $donor_billing_name !== $donor_name ) { |
|
601 | + if ($donor_billing_name !== $donor_name) { |
|
602 | 602 | echo sprintf( |
603 | 603 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
604 | - esc_html( $donor_billing_name ), |
|
605 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
606 | - esc_html( $donor_name ) |
|
604 | + esc_html($donor_billing_name), |
|
605 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
606 | + esc_html($donor_name) |
|
607 | 607 | ); |
608 | 608 | } else { |
609 | - echo esc_html( $donor_name ); |
|
609 | + echo esc_html($donor_name); |
|
610 | 610 | } |
611 | 611 | ?> |
612 | 612 | </p> |
613 | 613 | <p> |
614 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
614 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
615 | 615 | <?php |
616 | 616 | // Show Donor donation email first and Primary email on parenthesis if not match both email. |
617 | - echo hash_equals( $donor->email, $payment->email ) |
|
617 | + echo hash_equals($donor->email, $payment->email) |
|
618 | 618 | ? $payment->email |
619 | 619 | : sprintf( |
620 | 620 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
621 | 621 | $payment->email, |
622 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
622 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
623 | 623 | $donor->email |
624 | 624 | ); |
625 | 625 | ?> |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | </div> |
628 | 628 | <div class="column"> |
629 | 629 | <p> |
630 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
630 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
631 | 631 | <?php |
632 | 632 | echo Give()->html->donor_dropdown( |
633 | 633 | array( |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | ?> |
639 | 639 | </p> |
640 | 640 | <p> |
641 | - <?php if ( ! empty( $company_name ) ) { |
|
641 | + <?php if ( ! empty($company_name)) { |
|
642 | 642 | ?> |
643 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
643 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
644 | 644 | <?php |
645 | 645 | echo $company_name; |
646 | 646 | } ?> |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | <div class="column-container new-donor" style="display: none"> |
652 | 652 | <div class="column"> |
653 | 653 | <p> |
654 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
654 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
655 | 655 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
656 | 656 | </p> |
657 | 657 | </div> |
658 | 658 | <div class="column"> |
659 | 659 | <p> |
660 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
660 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
661 | 661 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
662 | 662 | </p> |
663 | 663 | </div> |
664 | 664 | <div class="column"> |
665 | 665 | <p> |
666 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
666 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
667 | 667 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
668 | 668 | </p> |
669 | 669 | </div> |
@@ -671,9 +671,9 @@ discard block |
||
671 | 671 | <p> |
672 | 672 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
673 | 673 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
674 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
674 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
675 | 675 | <br> |
676 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
676 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
677 | 677 | </p> |
678 | 678 | </div> |
679 | 679 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param array $payment_meta Payment meta. |
689 | 689 | * @param array $user_info User information. |
690 | 690 | */ |
691 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
691 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * Fires on the donation details page, in the donor-details metabox. |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @param int $payment_id Payment id. |
699 | 699 | */ |
700 | - do_action( 'give_payment_view_details', $payment_id ); |
|
700 | + do_action('give_payment_view_details', $payment_id); |
|
701 | 701 | ?> |
702 | 702 | |
703 | 703 | </div> |
@@ -713,11 +713,11 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @param int $payment_id Payment id. |
715 | 715 | */ |
716 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
716 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
717 | 717 | ?> |
718 | 718 | |
719 | 719 | <div id="give-billing-details" class="postbox"> |
720 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
720 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
721 | 721 | |
722 | 722 | <div class="inside"> |
723 | 723 | |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | <div class="data column-container"> |
728 | 728 | |
729 | 729 | <?php |
730 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
730 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
731 | 731 | |
732 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
732 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
733 | 733 | |
734 | 734 | // Get the country list that does not have any states init. |
735 | 735 | $no_states_country = give_no_states_country_list(); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | |
738 | 738 | <div class="row"> |
739 | 739 | <div id="give-order-address-country-wrap"> |
740 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
740 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
741 | 741 | <?php |
742 | 742 | echo Give()->html->select( |
743 | 743 | array( |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | 'show_option_all' => false, |
748 | 748 | 'show_option_none' => false, |
749 | 749 | 'chosen' => true, |
750 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
751 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
750 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
751 | + 'data' => array('search-type' => 'no_ajax'), |
|
752 | 752 | ) |
753 | 753 | ); |
754 | 754 | ?> |
@@ -757,35 +757,35 @@ discard block |
||
757 | 757 | |
758 | 758 | <div class="row"> |
759 | 759 | <div class="give-wrap-address-line1"> |
760 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
761 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
760 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
761 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | |
765 | 765 | <div class="row"> |
766 | 766 | <div class="give-wrap-address-line2"> |
767 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
768 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
767 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
768 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
769 | 769 | </div> |
770 | 770 | </div> |
771 | 771 | |
772 | 772 | <div class="row"> |
773 | 773 | <div class="give-wrap-address-city"> |
774 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
775 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
774 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
775 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
776 | 776 | </div> |
777 | 777 | </div> |
778 | 778 | |
779 | 779 | <?php |
780 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
780 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
781 | 781 | ?> |
782 | 782 | <div class="row"> |
783 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
784 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
785 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
783 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
784 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
785 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
786 | 786 | <?php |
787 | - $states = give_get_states( $address['country'] ); |
|
788 | - if ( ! empty( $states ) ) { |
|
787 | + $states = give_get_states($address['country']); |
|
788 | + if ( ! empty($states)) { |
|
789 | 789 | echo Give()->html->select( |
790 | 790 | array( |
791 | 791 | 'options' => $states, |
@@ -794,23 +794,23 @@ discard block |
||
794 | 794 | 'show_option_all' => false, |
795 | 795 | 'show_option_none' => false, |
796 | 796 | 'chosen' => true, |
797 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
798 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
797 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
798 | + 'data' => array('search-type' => 'no_ajax'), |
|
799 | 799 | ) |
800 | 800 | ); |
801 | 801 | } else { |
802 | 802 | ?> |
803 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
803 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
804 | 804 | <?php |
805 | 805 | } |
806 | 806 | ?> |
807 | 807 | </div> |
808 | 808 | </div> |
809 | 809 | |
810 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
810 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
811 | 811 | <div class="give-wrap-address-zip"> |
812 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
813 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
812 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
813 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
814 | 814 | </div> |
815 | 815 | </div> |
816 | 816 | </div> |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | * |
830 | 830 | * @param int $payment_id Payment id. |
831 | 831 | */ |
832 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
832 | + do_action('give_payment_billing_details', $payment_id); |
|
833 | 833 | ?> |
834 | 834 | |
835 | 835 | </div> |
@@ -845,34 +845,34 @@ discard block |
||
845 | 845 | * |
846 | 846 | * @param int $payment_id Payment id. |
847 | 847 | */ |
848 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
848 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
849 | 849 | ?> |
850 | 850 | |
851 | 851 | <div id="give-payment-notes" class="postbox"> |
852 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
852 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
853 | 853 | |
854 | 854 | <div class="inside"> |
855 | 855 | <div id="give-payment-notes-inner"> |
856 | 856 | <?php |
857 | - $notes = give_get_payment_notes( $payment_id ); |
|
858 | - if ( ! empty( $notes ) ) { |
|
857 | + $notes = give_get_payment_notes($payment_id); |
|
858 | + if ( ! empty($notes)) { |
|
859 | 859 | $no_notes_display = ' style="display:none;"'; |
860 | - foreach ( $notes as $note ) : |
|
860 | + foreach ($notes as $note) : |
|
861 | 861 | |
862 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
862 | + echo give_get_payment_note_html($note, $payment_id); |
|
863 | 863 | |
864 | 864 | endforeach; |
865 | 865 | } else { |
866 | 866 | $no_notes_display = ''; |
867 | 867 | } |
868 | 868 | |
869 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
869 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
870 | 870 | ?> |
871 | 871 | </div> |
872 | 872 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
873 | 873 | |
874 | 874 | <div class="give-clearfix"> |
875 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
875 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
876 | 876 | </div> |
877 | 877 | |
878 | 878 | </div> |
@@ -888,18 +888,18 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @param int $payment_id Payment id. |
890 | 890 | */ |
891 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
891 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
892 | 892 | ?> |
893 | 893 | |
894 | - <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?> |
|
894 | + <?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?> |
|
895 | 895 | <div id="give-payment-donor-comment" class="postbox"> |
896 | - <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3> |
|
896 | + <h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3> |
|
897 | 897 | |
898 | 898 | <div class="inside"> |
899 | 899 | <div id="give-payment-donor-comment-inner"> |
900 | 900 | <p> |
901 | 901 | <?php |
902 | - $donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id ); |
|
902 | + $donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id); |
|
903 | 903 | |
904 | 904 | echo sprintf( |
905 | 905 | '<input type="hidden" name="give_comment_id" value="%s">', |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | echo sprintf( |
910 | 910 | '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>', |
911 | - __( 'Add a comment', 'give' ), |
|
911 | + __('Add a comment', 'give'), |
|
912 | 912 | $donor_comment instanceof WP_Comment ? $donor_comment->comment_content : '' |
913 | 913 | ); |
914 | 914 | ?> |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * |
930 | 930 | * @param int $payment_id Payment id. |
931 | 931 | */ |
932 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
932 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
933 | 933 | ?> |
934 | 934 | |
935 | 935 | </div> |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | * |
952 | 952 | * @param int $payment_id Payment id. |
953 | 953 | */ |
954 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
954 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
955 | 955 | |
956 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
956 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
957 | 957 | ?> |
958 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
958 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
959 | 959 | <input type="hidden" name="give_action" value="update_payment_details"/> |
960 | 960 | </form> |
961 | 961 | <?php |
@@ -966,6 +966,6 @@ discard block |
||
966 | 966 | * |
967 | 967 | * @param int $payment_id Payment id. |
968 | 968 | */ |
969 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
969 | + do_action('give_view_donation_details_after', $payment_id); |
|
970 | 970 | ?> |
971 | 971 | </div><!-- /.wrap --> |