@@ -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,48 +25,48 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | -function give_update_payment_details( $data ) { |
|
| 28 | +function give_update_payment_details($data) { |
|
| 29 | 29 | |
| 30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
| 31 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 31 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
| 34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
| 35 | 35 | |
| 36 | 36 | // Retrieve the payment ID. |
| 37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
| 37 | + $payment_id = absint($data['give_payment_id']); |
|
| 38 | 38 | |
| 39 | 39 | /* @var Give_Payment $payment */ |
| 40 | - $payment = new Give_Payment( $payment_id ); |
|
| 40 | + $payment = new Give_Payment($payment_id); |
|
| 41 | 41 | |
| 42 | 42 | $status = $data['give-payment-status']; |
| 43 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 44 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 43 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 44 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 45 | 45 | |
| 46 | 46 | // Restrict to our high and low. |
| 47 | - if ( $hour > 23 ) { |
|
| 47 | + if ($hour > 23) { |
|
| 48 | 48 | $hour = 23; |
| 49 | - } elseif ( $hour < 0 ) { |
|
| 49 | + } elseif ($hour < 0) { |
|
| 50 | 50 | $hour = 00; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 53 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 54 | 54 | |
| 55 | 55 | // Restrict to our high and low. |
| 56 | - if ( $minute > 59 ) { |
|
| 56 | + if ($minute > 59) { |
|
| 57 | 57 | $minute = 59; |
| 58 | - } elseif ( $minute < 0 ) { |
|
| 58 | + } elseif ($minute < 0) { |
|
| 59 | 59 | $minute = 00; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
| 62 | + $address = give_clean($data['give-payment-address'][0]); |
|
| 63 | 63 | |
| 64 | 64 | $curr_total = $payment->total; |
| 65 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
| 66 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 65 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
| 66 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 67 | 67 | |
| 68 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
| 69 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
| 68 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
| 69 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Fires before updating edited donation. |
@@ -76,71 +76,71 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @param int $payment_id The ID of the payment. |
| 78 | 78 | */ |
| 79 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
| 79 | + do_action('give_update_edited_donation', $payment_id); |
|
| 80 | 80 | |
| 81 | 81 | $payment->date = $date; |
| 82 | 82 | $updated = $payment->save(); |
| 83 | 83 | |
| 84 | - if ( 0 === $updated ) { |
|
| 85 | - wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 84 | + if (0 === $updated) { |
|
| 85 | + wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $donor_changed = false; |
| 89 | 89 | |
| 90 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
| 90 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
| 91 | 91 | |
| 92 | - $email = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
| 93 | - $first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : ''; |
|
| 94 | - $last_name = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : ''; |
|
| 95 | - $names = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
| 92 | + $email = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
| 93 | + $first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : ''; |
|
| 94 | + $last_name = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : ''; |
|
| 95 | + $names = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
| 96 | 96 | |
| 97 | - if ( empty( $email ) || empty( $first_name ) ) { |
|
| 98 | - wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 97 | + if (empty($email) || empty($first_name)) { |
|
| 98 | + wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $donor = new Give_Donor( $email ); |
|
| 102 | - if ( empty( $donor->id ) ) { |
|
| 103 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
| 104 | - $user_id = email_exists( $email ); |
|
| 105 | - if ( false !== $user_id ) { |
|
| 101 | + $donor = new Give_Donor($email); |
|
| 102 | + if (empty($donor->id)) { |
|
| 103 | + $donor_data = array('name' => $names, 'email' => $email); |
|
| 104 | + $user_id = email_exists($email); |
|
| 105 | + if (false !== $user_id) { |
|
| 106 | 106 | $donor_data['user_id'] = $user_id; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( ! $donor->create( $donor_data ) ) { |
|
| 109 | + if ( ! $donor->create($donor_data)) { |
|
| 110 | 110 | // Failed to create the new donor, assume the previous donor. |
| 111 | 111 | $donor_changed = false; |
| 112 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 113 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
| 112 | + $donor = new Give_Donor($curr_donor_id); |
|
| 113 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Create and Update Donor First Name and Last Name in Meta Fields. |
| 118 | - $donor->update_meta( '_give_donor_first_name', $first_name ); |
|
| 119 | - $donor->update_meta( '_give_donor_last_name', $last_name ); |
|
| 118 | + $donor->update_meta('_give_donor_first_name', $first_name); |
|
| 119 | + $donor->update_meta('_give_donor_last_name', $last_name); |
|
| 120 | 120 | |
| 121 | 121 | $new_donor_id = $donor->id; |
| 122 | 122 | |
| 123 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 123 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 124 | 124 | |
| 125 | 125 | $donor_changed = true; |
| 126 | 126 | |
| 127 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
| 127 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
| 128 | 128 | |
| 129 | - $donor = new Give_Donor( $new_donor_id ); |
|
| 129 | + $donor = new Give_Donor($new_donor_id); |
|
| 130 | 130 | $email = $donor->email; |
| 131 | 131 | $names = $donor->name; |
| 132 | 132 | |
| 133 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 133 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 134 | 134 | |
| 135 | 135 | $donor_changed = true; |
| 136 | 136 | |
| 137 | 137 | } else { |
| 138 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 138 | + $donor = new Give_Donor($curr_donor_id); |
|
| 139 | 139 | $email = $donor->email; |
| 140 | 140 | $names = $donor->name; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( $donor_changed ) { |
|
| 143 | + if ($donor_changed) { |
|
| 144 | 144 | |
| 145 | 145 | // Setup first and last name from input values. |
| 146 | 146 | $first_name = $donor->get_first_name(); |
@@ -150,26 +150,26 @@ discard block |
||
| 150 | 150 | $payment->last_name = $last_name; |
| 151 | 151 | |
| 152 | 152 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
| 153 | - $previous_donor->remove_payment( $payment_id, false ); |
|
| 154 | - $donor->attach_payment( $payment_id, false ); |
|
| 153 | + $previous_donor->remove_payment($payment_id, false); |
|
| 154 | + $donor->attach_payment($payment_id, false); |
|
| 155 | 155 | |
| 156 | - if ( 'publish' == $status ) { |
|
| 156 | + if ('publish' == $status) { |
|
| 157 | 157 | |
| 158 | 158 | // Reduce previous user donation count and amount. |
| 159 | 159 | $previous_donor->decrease_donation_count(); |
| 160 | - $previous_donor->decrease_value( $curr_total ); |
|
| 160 | + $previous_donor->decrease_value($curr_total); |
|
| 161 | 161 | |
| 162 | 162 | // If donation was completed adjust stats of new donors. |
| 163 | 163 | $donor->increase_purchase_count(); |
| 164 | - $donor->increase_value( $new_total ); |
|
| 164 | + $donor->increase_value($new_total); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $payment->customer_id = $donor->id; |
| 168 | 168 | } else { |
| 169 | 169 | |
| 170 | - if ( 'publish' === $status ) { |
|
| 170 | + if ('publish' === $status) { |
|
| 171 | 171 | // Update user donation stat. |
| 172 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
| 172 | + $donor->update_donation_value($curr_total, $new_total); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | $payment->total = $new_total; |
| 181 | 181 | |
| 182 | 182 | // Check for payment notes. |
| 183 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 183 | + if ( ! empty($data['give-payment-note'])) { |
|
| 184 | 184 | |
| 185 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 186 | - give_insert_payment_note( $payment_id, $note ); |
|
| 185 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 186 | + give_insert_payment_note($payment_id, $note); |
|
| 187 | 187 | |
| 188 | 188 | } |
| 189 | 189 | |
@@ -191,17 +191,17 @@ discard block |
||
| 191 | 191 | $payment->status = $status; |
| 192 | 192 | |
| 193 | 193 | // Adjust total store earnings if the payment total has been changed. |
| 194 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 194 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 195 | 195 | |
| 196 | - if ( $new_total > $curr_total ) { |
|
| 196 | + if ($new_total > $curr_total) { |
|
| 197 | 197 | // Increase if our new total is higher. |
| 198 | 198 | $difference = $new_total - $curr_total; |
| 199 | - give_increase_total_earnings( $difference ); |
|
| 199 | + give_increase_total_earnings($difference); |
|
| 200 | 200 | |
| 201 | - } elseif ( $curr_total > $new_total ) { |
|
| 201 | + } elseif ($curr_total > $new_total) { |
|
| 202 | 202 | // Decrease if our new total is lower. |
| 203 | 203 | $difference = $curr_total - $new_total; |
| 204 | - give_decrease_total_earnings( $difference ); |
|
| 204 | + give_decrease_total_earnings($difference); |
|
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -209,55 +209,55 @@ discard block |
||
| 209 | 209 | $payment->save(); |
| 210 | 210 | |
| 211 | 211 | // Get new give form ID. |
| 212 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
| 213 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 212 | + $new_form_id = absint($data['give-payment-form-select']); |
|
| 213 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 214 | 214 | |
| 215 | 215 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 216 | 216 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 217 | 217 | // Check if user want to transfer current payment to new give form id. |
| 218 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
| 218 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
| 219 | 219 | |
| 220 | 220 | // Get new give form title. |
| 221 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 221 | + $new_form_title = get_the_title($new_form_id); |
|
| 222 | 222 | |
| 223 | 223 | // Update payment give form meta data. |
| 224 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 225 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 224 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 225 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 226 | 226 | |
| 227 | 227 | // Update price id payment metadata. |
| 228 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 229 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 228 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 229 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // If donation was completed, adjust stats of forms. |
| 233 | - if ( 'publish' == $status ) { |
|
| 233 | + if ('publish' == $status) { |
|
| 234 | 234 | |
| 235 | 235 | // Decrease sale of old give form. For other payment status. |
| 236 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 236 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 237 | 237 | $current_form->decrease_sales(); |
| 238 | - $current_form->decrease_earnings( $curr_total, $payment->ID ); |
|
| 238 | + $current_form->decrease_earnings($curr_total, $payment->ID); |
|
| 239 | 239 | |
| 240 | 240 | // Increase sale of new give form. |
| 241 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
| 241 | + $new_form = new Give_Donate_Form($new_form_id); |
|
| 242 | 242 | $new_form->increase_sales(); |
| 243 | - $new_form->increase_earnings( $new_total, $payment->ID ); |
|
| 243 | + $new_form->increase_earnings($new_total, $payment->ID); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Re setup payment to update new meta value in object. |
| 247 | - $payment->update_payment_setup( $payment->ID ); |
|
| 247 | + $payment->update_payment_setup($payment->ID); |
|
| 248 | 248 | |
| 249 | 249 | // Update form id in payment logs. |
| 250 | - Give()->async_process->data( array( |
|
| 251 | - 'data' => array( $new_form_id, $payment_id ), |
|
| 250 | + Give()->async_process->data(array( |
|
| 251 | + 'data' => array($new_form_id, $payment_id), |
|
| 252 | 252 | 'hook' => 'give_update_log_form_id', |
| 253 | - ) )->dispatch(); |
|
| 253 | + ))->dispatch(); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Update price id if current form is variable form. |
| 257 | 257 | /* @var Give_Donate_Form $form */ |
| 258 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
| 258 | + $form = new Give_Donate_Form($payment->form_id); |
|
| 259 | 259 | |
| 260 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
| 260 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
| 261 | 261 | |
| 262 | 262 | // Get payment meta data. |
| 263 | 263 | $payment_meta = $payment->get_meta(); |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $price_id = ''; |
| 267 | 267 | |
| 268 | 268 | // Get price info |
| 269 | - if( 0 <= $data['give-variable-price'] ) { |
|
| 270 | - foreach ( $form->prices as $variable_price ) { |
|
| 271 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
| 269 | + if (0 <= $data['give-variable-price']) { |
|
| 270 | + foreach ($form->prices as $variable_price) { |
|
| 271 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
| 272 | 272 | $price_info = $variable_price; |
| 273 | 273 | break; |
| 274 | 274 | } |
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // Set price id. |
| 279 | - if( ! empty( $price_info ) ) { |
|
| 279 | + if ( ! empty($price_info)) { |
|
| 280 | 280 | $price_id = $data['give-variable-price']; |
| 281 | 281 | |
| 282 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
| 282 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
| 283 | 283 | // Set price id to amount match. |
| 284 | 284 | $price_id = $price_info['_give_id']['level_id']; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - } elseif( $form->is_custom_price_mode() ){ |
|
| 287 | + } elseif ($form->is_custom_price_mode()) { |
|
| 288 | 288 | $price_id = 'custom'; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -292,11 +292,11 @@ discard block |
||
| 292 | 292 | $payment_meta['price_id'] = $price_id; |
| 293 | 293 | |
| 294 | 294 | // Update payment give form meta data. |
| 295 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
| 296 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 295 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
| 296 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 297 | 297 | |
| 298 | 298 | // Re setup payment to update new meta value in object. |
| 299 | - $payment->update_payment_setup( $payment->ID ); |
|
| 299 | + $payment->update_payment_setup($payment->ID); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | * |
| 308 | 308 | * @param int $payment_id The ID of the payment. |
| 309 | 309 | */ |
| 310 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
| 310 | + do_action('give_updated_edited_donation', $payment_id); |
|
| 311 | 311 | |
| 312 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id=' . $payment_id ) ); |
|
| 312 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id='.$payment_id)); |
|
| 313 | 313 | exit; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 316 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * Trigger a Donation Deletion. |
@@ -324,48 +324,48 @@ discard block |
||
| 324 | 324 | * |
| 325 | 325 | * @return void |
| 326 | 326 | */ |
| 327 | -function give_trigger_donation_delete( $data ) { |
|
| 328 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
| 327 | +function give_trigger_donation_delete($data) { |
|
| 328 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
| 329 | 329 | |
| 330 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 330 | + $payment_id = absint($data['purchase_id']); |
|
| 331 | 331 | |
| 332 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 333 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 332 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 333 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - give_delete_donation( $payment_id ); |
|
| 337 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted' ) ); |
|
| 336 | + give_delete_donation($payment_id); |
|
| 337 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted')); |
|
| 338 | 338 | give_die(); |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
| 342 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | 345 | * AJAX Store Donation Note |
| 346 | 346 | */ |
| 347 | 347 | function give_ajax_store_payment_note() { |
| 348 | 348 | |
| 349 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 350 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 349 | + $payment_id = absint($_POST['payment_id']); |
|
| 350 | + $note = wp_kses($_POST['note'], array()); |
|
| 351 | 351 | |
| 352 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 353 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 352 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 353 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if ( empty( $payment_id ) ) { |
|
| 357 | - die( '-1' ); |
|
| 356 | + if (empty($payment_id)) { |
|
| 357 | + die('-1'); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if ( empty( $note ) ) { |
|
| 361 | - die( '-1' ); |
|
| 360 | + if (empty($note)) { |
|
| 361 | + die('-1'); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 365 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 364 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 365 | + die(give_get_payment_note_html($note_id)); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 368 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 369 | 369 | |
| 370 | 370 | /** |
| 371 | 371 | * Triggers a donation note deletion without ajax |
@@ -376,24 +376,24 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @return void |
| 378 | 378 | */ |
| 379 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 379 | +function give_trigger_payment_note_deletion($data) { |
|
| 380 | 380 | |
| 381 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 381 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 382 | 382 | return; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 386 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 385 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 386 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 389 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id='.absint($data['payment_id'])); |
|
| 390 | 390 | |
| 391 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 391 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 392 | 392 | |
| 393 | - wp_redirect( $edit_order_url ); |
|
| 393 | + wp_redirect($edit_order_url); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 396 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | 399 | * Delete a payment note deletion with ajax |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | function give_ajax_delete_payment_note() { |
| 406 | 406 | |
| 407 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 408 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 407 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 408 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 412 | - die( '1' ); |
|
| 411 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 412 | + die('1'); |
|
| 413 | 413 | } else { |
| 414 | - die( '-1' ); |
|
| 414 | + die('-1'); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 419 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
@@ -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,33 +158,33 @@ 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 | <p> |
| 178 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
| 179 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
| 178 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
| 179 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
| 180 | 180 | </p> |
| 181 | 181 | </div> |
| 182 | 182 | |
| 183 | 183 | <div class="give-admin-box-inside"> |
| 184 | 184 | <p> |
| 185 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
| 186 | - <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"/> : |
|
| 187 | - <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"/> |
|
| 185 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
| 186 | + <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"/> : |
|
| 187 | + <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"/> |
|
| 188 | 188 | </p> |
| 189 | 189 | </div> |
| 190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @param int $payment_id Payment id. |
| 200 | 200 | */ |
| 201 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
| 201 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
| 202 | 202 | ?> |
| 203 | 203 | |
| 204 | 204 | <div class="give-order-payment give-admin-box-inside"> |
| 205 | 205 | <p> |
| 206 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
| 207 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 208 | - <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 ) ); ?>"/> |
|
| 206 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
| 207 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 208 | + <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)); ?>"/> |
|
| 209 | 209 | </p> |
| 210 | 210 | </div> |
| 211 | 211 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @param int $payment_id Payment id. |
| 219 | 219 | */ |
| 220 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
| 220 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
| 221 | 221 | ?> |
| 222 | 222 | |
| 223 | 223 | </div> |
@@ -235,27 +235,27 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @param int $payment_id Payment id. |
| 237 | 237 | */ |
| 238 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
| 238 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
| 239 | 239 | ?> |
| 240 | 240 | |
| 241 | 241 | <div id="major-publishing-actions"> |
| 242 | 242 | <div id="publishing-action"> |
| 243 | 243 | |
| 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' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
| 455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
| 454 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
| 455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
| 456 | 456 | 'selected' => $payment_meta['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,8 +464,8 @@ 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 | 471 | <p> |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @param int $payment_id Payment id. |
| 481 | 481 | */ |
| 482 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 482 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 483 | 483 | |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | * |
| 492 | 492 | * @param int $payment_id Payment id. |
| 493 | 493 | */ |
| 494 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 494 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 495 | 495 | |
| 496 | 496 | /** |
| 497 | 497 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | * |
| 503 | 503 | * @param int $payment_id Payment id. |
| 504 | 504 | */ |
| 505 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 505 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 506 | 506 | |
| 507 | 507 | /** |
| 508 | 508 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @param int $payment_id Payment id. |
| 515 | 515 | */ |
| 516 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 516 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 517 | 517 | ?> |
| 518 | 518 | </p> |
| 519 | 519 | </div> |
@@ -533,59 +533,59 @@ discard block |
||
| 533 | 533 | * |
| 534 | 534 | * @param int $payment_id Payment id. |
| 535 | 535 | */ |
| 536 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
| 536 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
| 537 | 537 | ?> |
| 538 | 538 | |
| 539 | 539 | <div id="give-donor-details" class="postbox"> |
| 540 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
| 540 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
| 541 | 541 | |
| 542 | 542 | <div class="inside"> |
| 543 | 543 | |
| 544 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
| 544 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
| 545 | 545 | |
| 546 | 546 | <div class="column-container donor-info"> |
| 547 | 547 | <div class="column"> |
| 548 | 548 | <p> |
| 549 | - <strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 549 | + <strong><?php _e('Donor ID:', 'give'); ?></strong><br> |
|
| 550 | 550 | <?php |
| 551 | - if ( ! empty( $donor->id ) ) { |
|
| 551 | + if ( ! empty($donor->id)) { |
|
| 552 | 552 | printf( |
| 553 | 553 | '<a href="%1$s">%2$s</a>', |
| 554 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
| 554 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
| 555 | 555 | $donor->id |
| 556 | 556 | ); |
| 557 | 557 | } |
| 558 | 558 | ?> |
| 559 | - <span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
| 559 | + <span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span> |
|
| 560 | 560 | </p> |
| 561 | 561 | <p> |
| 562 | - <strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 563 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 562 | + <strong><?php _e('Donor Since:', 'give'); ?></strong><br> |
|
| 563 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 564 | 564 | </p> |
| 565 | 565 | </div> |
| 566 | 566 | <div class="column"> |
| 567 | 567 | <p> |
| 568 | - <strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 568 | + <strong><?php _e('Donor Name:', 'give'); ?></strong><br> |
|
| 569 | 569 | <?php |
| 570 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 571 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 570 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 571 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 572 | 572 | |
| 573 | 573 | // Check whether the donor name and WP_User name is same or not. |
| 574 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 575 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
| 574 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 575 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
| 576 | 576 | } else { |
| 577 | 577 | echo $donor_name; |
| 578 | 578 | } |
| 579 | 579 | ?> |
| 580 | 580 | </p> |
| 581 | 581 | <p> |
| 582 | - <strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 582 | + <strong><?php _e('Donor Email:', 'give'); ?></strong><br> |
|
| 583 | 583 | <?php echo $donor->email; ?> |
| 584 | 584 | </p> |
| 585 | 585 | </div> |
| 586 | 586 | <div class="column"> |
| 587 | 587 | <p> |
| 588 | - <strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 588 | + <strong><?php _e('Change Donor:', 'give'); ?></strong><br> |
|
| 589 | 589 | <?php |
| 590 | 590 | echo Give()->html->donor_dropdown( |
| 591 | 591 | array( |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | ?> |
| 597 | 597 | </p> |
| 598 | 598 | <p> |
| 599 | - <?php if ( ! empty( $company_name ) ) { |
|
| 599 | + <?php if ( ! empty($company_name)) { |
|
| 600 | 600 | ?> |
| 601 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
| 601 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
| 602 | 602 | <?php |
| 603 | 603 | echo $company_name; |
| 604 | 604 | } ?> |
@@ -609,19 +609,19 @@ discard block |
||
| 609 | 609 | <div class="column-container new-donor" style="display: none"> |
| 610 | 610 | <div class="column"> |
| 611 | 611 | <p> |
| 612 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
| 612 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
| 613 | 613 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
| 614 | 614 | </p> |
| 615 | 615 | </div> |
| 616 | 616 | <div class="column"> |
| 617 | 617 | <p> |
| 618 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
| 618 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
| 619 | 619 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
| 620 | 620 | </p> |
| 621 | 621 | </div> |
| 622 | 622 | <div class="column"> |
| 623 | 623 | <p> |
| 624 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
| 624 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
| 625 | 625 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 626 | 626 | </p> |
| 627 | 627 | </div> |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | <p> |
| 630 | 630 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 631 | 631 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 632 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 632 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 633 | 633 | <br> |
| 634 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 634 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 635 | 635 | </p> |
| 636 | 636 | </div> |
| 637 | 637 | </div> |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | * @param array $payment_meta Payment meta. |
| 647 | 647 | * @param array $user_info User information. |
| 648 | 648 | */ |
| 649 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 649 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 650 | 650 | |
| 651 | 651 | /** |
| 652 | 652 | * Fires on the donation details page, in the donor-details metabox. |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | * |
| 656 | 656 | * @param int $payment_id Payment id. |
| 657 | 657 | */ |
| 658 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 658 | + do_action('give_payment_view_details', $payment_id); |
|
| 659 | 659 | ?> |
| 660 | 660 | |
| 661 | 661 | </div> |
@@ -671,11 +671,11 @@ discard block |
||
| 671 | 671 | * |
| 672 | 672 | * @param int $payment_id Payment id. |
| 673 | 673 | */ |
| 674 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
| 674 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
| 675 | 675 | ?> |
| 676 | 676 | |
| 677 | 677 | <div id="give-billing-details" class="postbox"> |
| 678 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
| 678 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
| 679 | 679 | |
| 680 | 680 | <div class="inside"> |
| 681 | 681 | |
@@ -685,9 +685,9 @@ discard block |
||
| 685 | 685 | <div class="data column-container"> |
| 686 | 686 | |
| 687 | 687 | <?php |
| 688 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
| 688 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
| 689 | 689 | |
| 690 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
| 690 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
| 691 | 691 | |
| 692 | 692 | // Get the country list that does not have any states init. |
| 693 | 693 | $no_states_country = give_no_states_country_list(); |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | <div class="row"> |
| 697 | 697 | <div id="give-order-address-country-wrap"> |
| 698 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
| 698 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
| 699 | 699 | <?php |
| 700 | 700 | echo Give()->html->select( |
| 701 | 701 | array( |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | 'show_option_all' => false, |
| 706 | 706 | 'show_option_none' => false, |
| 707 | 707 | 'chosen' => true, |
| 708 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 709 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 708 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 709 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 710 | 710 | ) |
| 711 | 711 | ); |
| 712 | 712 | ?> |
@@ -715,35 +715,35 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | <div class="row"> |
| 717 | 717 | <div class="give-wrap-address-line1"> |
| 718 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
| 719 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 718 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
| 719 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 720 | 720 | </div> |
| 721 | 721 | </div> |
| 722 | 722 | |
| 723 | 723 | <div class="row"> |
| 724 | 724 | <div class="give-wrap-address-line2"> |
| 725 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
| 726 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 725 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
| 726 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 727 | 727 | </div> |
| 728 | 728 | </div> |
| 729 | 729 | |
| 730 | 730 | <div class="row"> |
| 731 | 731 | <div class="give-wrap-address-city"> |
| 732 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 733 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 732 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 733 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 734 | 734 | </div> |
| 735 | 735 | </div> |
| 736 | 736 | |
| 737 | 737 | <?php |
| 738 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
| 738 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
| 739 | 739 | ?> |
| 740 | 740 | <div class="row"> |
| 741 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
| 742 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
| 743 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
| 741 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
| 742 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
| 743 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
| 744 | 744 | <?php |
| 745 | - $states = give_get_states( $address['country'] ); |
|
| 746 | - if ( ! empty( $states ) ) { |
|
| 745 | + $states = give_get_states($address['country']); |
|
| 746 | + if ( ! empty($states)) { |
|
| 747 | 747 | echo Give()->html->select( |
| 748 | 748 | array( |
| 749 | 749 | 'options' => $states, |
@@ -752,23 +752,23 @@ discard block |
||
| 752 | 752 | 'show_option_all' => false, |
| 753 | 753 | 'show_option_none' => false, |
| 754 | 754 | 'chosen' => true, |
| 755 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 756 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 755 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 756 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 757 | 757 | ) |
| 758 | 758 | ); |
| 759 | 759 | } else { |
| 760 | 760 | ?> |
| 761 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 761 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 762 | 762 | <?php |
| 763 | 763 | } |
| 764 | 764 | ?> |
| 765 | 765 | </div> |
| 766 | 766 | </div> |
| 767 | 767 | |
| 768 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
| 768 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
| 769 | 769 | <div class="give-wrap-address-zip"> |
| 770 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 771 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 770 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
| 771 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 772 | 772 | </div> |
| 773 | 773 | </div> |
| 774 | 774 | </div> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | * |
| 788 | 788 | * @param int $payment_id Payment id. |
| 789 | 789 | */ |
| 790 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 790 | + do_action('give_payment_billing_details', $payment_id); |
|
| 791 | 791 | ?> |
| 792 | 792 | |
| 793 | 793 | </div> |
@@ -803,34 +803,34 @@ discard block |
||
| 803 | 803 | * |
| 804 | 804 | * @param int $payment_id Payment id. |
| 805 | 805 | */ |
| 806 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
| 806 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
| 807 | 807 | ?> |
| 808 | 808 | |
| 809 | 809 | <div id="give-payment-notes" class="postbox"> |
| 810 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
| 810 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
| 811 | 811 | |
| 812 | 812 | <div class="inside"> |
| 813 | 813 | <div id="give-payment-notes-inner"> |
| 814 | 814 | <?php |
| 815 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 816 | - if ( ! empty( $notes ) ) { |
|
| 815 | + $notes = give_get_payment_notes($payment_id); |
|
| 816 | + if ( ! empty($notes)) { |
|
| 817 | 817 | $no_notes_display = ' style="display:none;"'; |
| 818 | - foreach ( $notes as $note ) : |
|
| 818 | + foreach ($notes as $note) : |
|
| 819 | 819 | |
| 820 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 820 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 821 | 821 | |
| 822 | 822 | endforeach; |
| 823 | 823 | } else { |
| 824 | 824 | $no_notes_display = ''; |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
| 827 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
| 828 | 828 | ?> |
| 829 | 829 | </div> |
| 830 | 830 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 831 | 831 | |
| 832 | 832 | <div class="give-clearfix"> |
| 833 | - <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> |
|
| 833 | + <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> |
|
| 834 | 834 | </div> |
| 835 | 835 | |
| 836 | 836 | </div> |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | * |
| 847 | 847 | * @param int $payment_id Payment id. |
| 848 | 848 | */ |
| 849 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
| 849 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
| 850 | 850 | ?> |
| 851 | 851 | |
| 852 | 852 | </div> |
@@ -868,11 +868,11 @@ discard block |
||
| 868 | 868 | * |
| 869 | 869 | * @param int $payment_id Payment id. |
| 870 | 870 | */ |
| 871 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
| 871 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
| 872 | 872 | |
| 873 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 873 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 874 | 874 | ?> |
| 875 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 875 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 876 | 876 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 877 | 877 | </form> |
| 878 | 878 | <?php |
@@ -883,6 +883,6 @@ discard block |
||
| 883 | 883 | * |
| 884 | 884 | * @param int $payment_id Payment id. |
| 885 | 885 | */ |
| 886 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
| 886 | + do_action('give_view_donation_details_after', $payment_id); |
|
| 887 | 887 | ?> |
| 888 | 888 | </div><!-- /.wrap --> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | 25 | |
| 26 | - $this->shortcode['title'] = __( 'Give Totals', 'give' ); |
|
| 27 | - $this->shortcode['label'] = __( 'Give Totals', 'give' ); |
|
| 26 | + $this->shortcode['title'] = __('Give Totals', 'give'); |
|
| 27 | + $this->shortcode['label'] = __('Give Totals', 'give'); |
|
| 28 | 28 | |
| 29 | - parent::__construct( 'give_totals' ); |
|
| 29 | + parent::__construct('give_totals'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -39,69 +39,69 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $category_options = array(); |
| 41 | 41 | $category_lists = array(); |
| 42 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
| 43 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) && ! is_wp_error( $categories ) ) { |
|
| 44 | - foreach ( $categories as $category ) { |
|
| 45 | - $category_options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
| 42 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
| 43 | + if (give_is_setting_enabled(give_get_option('categories')) && ! is_wp_error($categories)) { |
|
| 44 | + foreach ($categories as $category) { |
|
| 45 | + $category_options[absint($category->term_id)] = esc_html($category->name); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $category_lists['type'] = 'listbox'; |
| 49 | 49 | $category_lists['name'] = 'cats'; |
| 50 | - $category_lists['label'] = __( 'Select a Donation Form Category:', 'give' ); |
|
| 51 | - $category_lists['tooltip'] = __( 'Select a Donation Form Category', 'give' ); |
|
| 50 | + $category_lists['label'] = __('Select a Donation Form Category:', 'give'); |
|
| 51 | + $category_lists['tooltip'] = __('Select a Donation Form Category', 'give'); |
|
| 52 | 52 | $category_lists['options'] = $category_options; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $tag_options = array(); |
| 56 | 56 | $tag_lists = array(); |
| 57 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
| 58 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) && ! is_wp_error( $tags ) ) { |
|
| 59 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
| 60 | - foreach ( $tags as $tag ) { |
|
| 61 | - $tag_options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
| 57 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
| 58 | + if (give_is_setting_enabled(give_get_option('tags')) && ! is_wp_error($tags)) { |
|
| 59 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
| 60 | + foreach ($tags as $tag) { |
|
| 61 | + $tag_options[absint($tag->term_id)] = esc_html($tag->name); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $tag_lists['type'] = 'listbox'; |
| 65 | 65 | $tag_lists['name'] = 'tags'; |
| 66 | - $tag_lists['label'] = __( 'Select a Donation Form Tag:', 'give' ); |
|
| 67 | - $tag_lists['tooltip'] = __( 'Select a Donation Form Tag', 'give' ); |
|
| 66 | + $tag_lists['label'] = __('Select a Donation Form Tag:', 'give'); |
|
| 67 | + $tag_lists['tooltip'] = __('Select a Donation Form Tag', 'give'); |
|
| 68 | 68 | $tag_lists['options'] = $tag_options; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return array( |
| 72 | 72 | array( |
| 73 | 73 | 'type' => 'container', |
| 74 | - 'html' => sprintf( '<p class="give-totals-shortcode-container-message">%s</p>', |
|
| 75 | - __( 'This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give' ) |
|
| 74 | + 'html' => sprintf('<p class="give-totals-shortcode-container-message">%s</p>', |
|
| 75 | + __('This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give') |
|
| 76 | 76 | ), |
| 77 | 77 | ), |
| 78 | 78 | array( |
| 79 | 79 | 'type' => 'container', |
| 80 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Shortcode Configuration', 'give' ) ), |
|
| 80 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Shortcode Configuration', 'give')), |
|
| 81 | 81 | ), |
| 82 | 82 | array( |
| 83 | 83 | 'type' => 'textbox', |
| 84 | 84 | 'name' => 'ids', |
| 85 | - 'label' => __( 'Donation Form IDs:', 'give' ), |
|
| 86 | - 'tooltip' => __( 'Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give' ), |
|
| 85 | + 'label' => __('Donation Form IDs:', 'give'), |
|
| 86 | + 'tooltip' => __('Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give'), |
|
| 87 | 87 | ), |
| 88 | 88 | $category_lists, |
| 89 | 89 | $tag_lists, |
| 90 | 90 | array( |
| 91 | 91 | 'type' => 'textbox', |
| 92 | 92 | 'name' => 'total_goal', |
| 93 | - 'label' => __( 'Total Goal:', 'give' ), |
|
| 94 | - 'tooltip' => __( 'Enter the total goal amount that you would like to display.', 'give' ), |
|
| 93 | + 'label' => __('Total Goal:', 'give'), |
|
| 94 | + 'tooltip' => __('Enter the total goal amount that you would like to display.', 'give'), |
|
| 95 | 95 | 'required' => array( |
| 96 | - 'alert' => esc_html__( 'Please enter a valid total goal amount.', 'give' ), |
|
| 96 | + 'alert' => esc_html__('Please enter a valid total goal amount.', 'give'), |
|
| 97 | 97 | ), |
| 98 | 98 | ), |
| 99 | 99 | array( |
| 100 | 100 | 'type' => 'textbox', |
| 101 | 101 | 'name' => 'message', |
| 102 | - 'label' => __( 'Message:', 'give' ), |
|
| 103 | - 'tooltip' => __( 'Enter a message to display encouraging donors to support the goal.', 'give' ), |
|
| 104 | - 'value' => apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) ), |
|
| 102 | + 'label' => __('Message:', 'give'), |
|
| 103 | + 'tooltip' => __('Enter a message to display encouraging donors to support the goal.', 'give'), |
|
| 104 | + 'value' => apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give')), |
|
| 105 | 105 | 'multiline' => true, |
| 106 | 106 | 'minWidth' => 300, |
| 107 | 107 | 'minHeight' => 60, |
@@ -109,24 +109,24 @@ discard block |
||
| 109 | 109 | array( |
| 110 | 110 | 'type' => 'textbox', |
| 111 | 111 | 'name' => 'link', |
| 112 | - 'label' => __( 'Link:', 'give' ), |
|
| 113 | - 'tooltip' => __( 'Enter a link to the main campaign donation form.', 'give' ), |
|
| 112 | + 'label' => __('Link:', 'give'), |
|
| 113 | + 'tooltip' => __('Enter a link to the main campaign donation form.', 'give'), |
|
| 114 | 114 | ), |
| 115 | 115 | array( |
| 116 | 116 | 'type' => 'textbox', |
| 117 | 117 | 'name' => 'link_text', |
| 118 | - 'label' => __( 'Link Text:', 'give' ), |
|
| 119 | - 'tooltip' => __( 'Enter hyperlink text for the link to the main campaign donation form.', 'give' ), |
|
| 120 | - 'value' => __( 'Donate!', 'give' ), |
|
| 118 | + 'label' => __('Link Text:', 'give'), |
|
| 119 | + 'tooltip' => __('Enter hyperlink text for the link to the main campaign donation form.', 'give'), |
|
| 120 | + 'value' => __('Donate!', 'give'), |
|
| 121 | 121 | ), |
| 122 | 122 | array( |
| 123 | 123 | 'type' => 'listbox', |
| 124 | 124 | 'name' => 'progress_bar', |
| 125 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
| 126 | - 'tooltip' => __( 'Select whether you would like to show a goal progress bar.', 'give' ), |
|
| 125 | + 'label' => __('Show Progress Bar:', 'give'), |
|
| 126 | + 'tooltip' => __('Select whether you would like to show a goal progress bar.', 'give'), |
|
| 127 | 127 | 'options' => array( |
| 128 | - 'true' => __( 'Show', 'give' ), |
|
| 129 | - 'false' => __( 'Hide', 'give' ), |
|
| 128 | + 'true' => __('Show', 'give'), |
|
| 129 | + 'false' => __('Hide', 'give'), |
|
| 130 | 130 | ), |
| 131 | 131 | 'value' => 'true', |
| 132 | 132 | ), |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * Class constructor |
| 33 | 33 | */ |
| 34 | 34 | public function __construct() { |
| 35 | - add_action( 'admin_init', array( $this, 'init'), 999 ); |
|
| 35 | + add_action('admin_init', array($this, 'init'), 999); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * @since 2.1.0 |
| 42 | 42 | * @access public |
| 43 | 43 | */ |
| 44 | - public function init(){ |
|
| 45 | - if ( $this->is_add_button() ) { |
|
| 46 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
| 44 | + public function init() { |
|
| 45 | + if ($this->is_add_button()) { |
|
| 46 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
| 47 | 47 | |
| 48 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
| 49 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
| 50 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
| 48 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
| 49 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
| 50 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
| 54 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
| 53 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
| 54 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @since 1.0 |
| 65 | 65 | */ |
| 66 | - public function mce_external_plugins( $plugin_array ) { |
|
| 66 | + public function mce_external_plugins($plugin_array) { |
|
| 67 | 67 | |
| 68 | - if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { |
|
| 68 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { |
|
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'includes/admin/shortcodes/mce-plugin.js'; |
|
| 72 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'includes/admin/shortcodes/mce-plugin.js'; |
|
| 73 | 73 | |
| 74 | 74 | return $plugin_array; |
| 75 | 75 | } |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | * @since 1.0 |
| 83 | 83 | */ |
| 84 | 84 | public function admin_enqueue_assets() { |
| 85 | - $direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : ''; |
|
| 85 | + $direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : ''; |
|
| 86 | 86 | |
| 87 | 87 | wp_enqueue_script( |
| 88 | 88 | 'give_shortcode', |
| 89 | - GIVE_PLUGIN_URL . 'assets/dist/js/admin-shortcodes.js', |
|
| 90 | - array( 'jquery' ), |
|
| 89 | + GIVE_PLUGIN_URL.'assets/dist/js/admin-shortcodes.js', |
|
| 90 | + array('jquery'), |
|
| 91 | 91 | GIVE_VERSION, |
| 92 | 92 | true |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | wp_enqueue_style( |
| 96 | 96 | 'give-admin-shortcode-button-style', |
| 97 | - GIVE_PLUGIN_URL . 'assets/dist/css/admin-shortcode-button' . $direction . '.css', |
|
| 97 | + GIVE_PLUGIN_URL.'assets/dist/css/admin-shortcode-button'.$direction.'.css', |
|
| 98 | 98 | array(), |
| 99 | 99 | GIVE_VERSION |
| 100 | 100 | ); |
@@ -109,17 +109,17 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function admin_localize_scripts() { |
| 111 | 111 | |
| 112 | - if ( ! empty( self::$shortcodes ) ) { |
|
| 112 | + if ( ! empty(self::$shortcodes)) { |
|
| 113 | 113 | |
| 114 | 114 | $variables = array(); |
| 115 | 115 | |
| 116 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
| 117 | - if ( ! empty( $values['required'] ) ) { |
|
| 118 | - $variables[ $shortcode ] = $values['required']; |
|
| 116 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
| 117 | + if ( ! empty($values['required'])) { |
|
| 118 | + $variables[$shortcode] = $values['required']; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
| 122 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
@@ -134,16 +134,16 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $shortcodes = array(); |
| 136 | 136 | |
| 137 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
| 137 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Filters the condition for including the current shortcode |
| 141 | 141 | * |
| 142 | 142 | * @since 1.0 |
| 143 | 143 | */ |
| 144 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
| 144 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
| 145 | 145 | |
| 146 | - $shortcodes[ $shortcode ] = sprintf( |
|
| 146 | + $shortcodes[$shortcode] = sprintf( |
|
| 147 | 147 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>', |
| 148 | 148 | $shortcode, |
| 149 | 149 | $shortcode, |
@@ -152,37 +152,37 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ( ! empty( $shortcodes ) ) { |
|
| 155 | + if ( ! empty($shortcodes)) { |
|
| 156 | 156 | |
| 157 | 157 | // check current WP version |
| 158 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) |
|
| 159 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/dist/images/give-media.png" />' |
|
| 160 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
| 158 | + $img = (version_compare(get_bloginfo('version'), '3.5', '<')) |
|
| 159 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/dist/images/give-media.png" />' |
|
| 160 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
| 161 | 161 | |
| 162 | - reset( $shortcodes ); |
|
| 162 | + reset($shortcodes); |
|
| 163 | 163 | |
| 164 | - if ( 1 === count( $shortcodes ) ) { |
|
| 164 | + if (1 === count($shortcodes)) { |
|
| 165 | 165 | |
| 166 | - $shortcode = key( $shortcodes ); |
|
| 166 | + $shortcode = key($shortcodes); |
|
| 167 | 167 | |
| 168 | 168 | printf( |
| 169 | 169 | '<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>', |
| 170 | 170 | $shortcode, |
| 171 | - sprintf( '%s %s %s', |
|
| 171 | + sprintf('%s %s %s', |
|
| 172 | 172 | $img, |
| 173 | - __( 'Insert', 'give' ), |
|
| 174 | - self::$shortcodes[ $shortcode ]['label'] |
|
| 173 | + __('Insert', 'give'), |
|
| 174 | + self::$shortcodes[$shortcode]['label'] |
|
| 175 | 175 | ) |
| 176 | 176 | ); |
| 177 | 177 | } else { |
| 178 | 178 | printf( |
| 179 | - '<div class="sc-wrap">' . |
|
| 180 | - '<button class="button sc-button" type="button">%s %s</button>' . |
|
| 181 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
| 179 | + '<div class="sc-wrap">'. |
|
| 180 | + '<button class="button sc-button" type="button">%s %s</button>'. |
|
| 181 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
| 182 | 182 | '</div>', |
| 183 | 183 | $img, |
| 184 | - __( 'Give Shortcodes', 'give' ), |
|
| 185 | - implode( '', array_values( $shortcodes ) ) |
|
| 184 | + __('Give Shortcodes', 'give'), |
|
| 185 | + implode('', array_values($shortcodes)) |
|
| 186 | 186 | ); |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function shortcode_ajax() { |
| 199 | 199 | |
| 200 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
| 200 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
| 201 | 201 | $response = false; |
| 202 | 202 | |
| 203 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
| 203 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
| 204 | 204 | |
| 205 | - $data = self::$shortcodes[ $shortcode ]; |
|
| 205 | + $data = self::$shortcodes[$shortcode]; |
|
| 206 | 206 | |
| 207 | - if ( ! empty( $data['errors'] ) ) { |
|
| 208 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
| 207 | + if ( ! empty($data['errors'])) { |
|
| 208 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $response = array( |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | ); |
| 218 | 218 | } else { |
| 219 | 219 | // todo: handle error |
| 220 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
| 220 | + error_log(print_r('AJAX error!', 1)); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - wp_send_json( $response ); |
|
| 223 | + wp_send_json($response); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -234,21 +234,21 @@ discard block |
||
| 234 | 234 | private function is_add_button() { |
| 235 | 235 | global $pagenow; |
| 236 | 236 | |
| 237 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( |
|
| 237 | + $shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( |
|
| 238 | 238 | 'post.php', |
| 239 | 239 | 'page.php', |
| 240 | 240 | 'post-new.php', |
| 241 | 241 | 'post-edit.php', |
| 242 | 242 | 'edit.php', |
| 243 | 243 | 'edit.php?post_type=page', |
| 244 | - ) ); |
|
| 244 | + )); |
|
| 245 | 245 | |
| 246 | 246 | // Only run in admin post/page creation and edit screens |
| 247 | 247 | if ( |
| 248 | 248 | ! is_admin() |
| 249 | - || ! in_array( $pagenow, $shortcode_button_pages ) |
|
| 250 | - || ! apply_filters( 'give_shortcode_button_condition', true ) |
|
| 251 | - || empty( self::$shortcodes ) |
|
| 249 | + || ! in_array($pagenow, $shortcode_button_pages) |
|
| 250 | + || ! apply_filters('give_shortcode_button_condition', true) |
|
| 251 | + || empty(self::$shortcodes) |
|
| 252 | 252 | ) { |
| 253 | 253 | return false; |
| 254 | 254 | } |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
| 27 | 27 | * @return array $form_columns Updated array of forms columns |
| 28 | 28 | * Post Type List Table |
| 29 | 29 | */ |
| 30 | -function give_form_columns( $give_form_columns ) { |
|
| 30 | +function give_form_columns($give_form_columns) { |
|
| 31 | 31 | |
| 32 | 32 | // Standard columns |
| 33 | 33 | $give_form_columns = array( |
| 34 | 34 | 'cb' => '<input type="checkbox"/>', |
| 35 | - 'title' => __( 'Name', 'give' ), |
|
| 36 | - 'form_category' => __( 'Categories', 'give' ), |
|
| 37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
| 38 | - 'price' => __( 'Amount', 'give' ), |
|
| 39 | - 'goal' => __( 'Goal', 'give' ), |
|
| 40 | - 'donations' => __( 'Donations', 'give' ), |
|
| 41 | - 'earnings' => __( 'Income', 'give' ), |
|
| 42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
| 43 | - 'date' => __( 'Date', 'give' ), |
|
| 35 | + 'title' => __('Name', 'give'), |
|
| 36 | + 'form_category' => __('Categories', 'give'), |
|
| 37 | + 'form_tag' => __('Tags', 'give'), |
|
| 38 | + 'price' => __('Amount', 'give'), |
|
| 39 | + 'goal' => __('Goal', 'give'), |
|
| 40 | + 'donations' => __('Donations', 'give'), |
|
| 41 | + 'earnings' => __('Income', 'give'), |
|
| 42 | + 'shortcode' => __('Shortcode', 'give'), |
|
| 43 | + 'date' => __('Date', 'give'), |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | // Does the user want categories / tags? |
| 47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
| 48 | - unset( $give_form_columns['form_category'] ); |
|
| 47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
| 48 | + unset($give_form_columns['form_category']); |
|
| 49 | 49 | } |
| 50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
| 51 | - unset( $give_form_columns['form_tag'] ); |
|
| 50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
| 51 | + unset($give_form_columns['form_tag']); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
| 54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
| 57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Render Give Form Columns |
@@ -66,70 +66,70 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
| 70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
| 69 | +function give_render_form_columns($column_name, $post_id) { |
|
| 70 | + if (get_post_type($post_id) == 'give_forms') { |
|
| 71 | 71 | |
| 72 | - switch ( $column_name ) { |
|
| 72 | + switch ($column_name) { |
|
| 73 | 73 | case 'form_category': |
| 74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
| 74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
| 75 | 75 | break; |
| 76 | 76 | case 'form_tag': |
| 77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
| 77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
| 78 | 78 | break; |
| 79 | 79 | case 'price': |
| 80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
| 81 | - echo give_price_range( $post_id ); |
|
| 80 | + if (give_has_variable_prices($post_id)) { |
|
| 81 | + echo give_price_range($post_id); |
|
| 82 | 82 | } else { |
| 83 | - echo give_price( $post_id, false ); |
|
| 84 | - printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) ); |
|
| 83 | + echo give_price($post_id, false); |
|
| 84 | + printf('<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr($post_id), esc_attr(give_get_form_price($post_id))); |
|
| 85 | 85 | } |
| 86 | 86 | break; |
| 87 | 87 | case 'goal': |
| 88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
| 88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
| 89 | 89 | |
| 90 | - echo give_admin_form_goal_stats( $post_id ); |
|
| 90 | + echo give_admin_form_goal_stats($post_id); |
|
| 91 | 91 | |
| 92 | 92 | } else { |
| 93 | - _e( 'No Goal Set', 'give' ); |
|
| 93 | + _e('No Goal Set', 'give'); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | printf( |
| 97 | 97 | '<input type="hidden" class="formgoal-%1$s" value="%2$s" />', |
| 98 | - esc_attr( $post_id ), |
|
| 99 | - give_get_form_goal( $post_id ) |
|
| 98 | + esc_attr($post_id), |
|
| 99 | + give_get_form_goal($post_id) |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | break; |
| 103 | 103 | case 'donations': |
| 104 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 104 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 105 | 105 | printf( |
| 106 | 106 | '<a href="%1$s">%2$s</a>', |
| 107 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ), |
|
| 108 | - give_get_form_sales_stats( $post_id ) |
|
| 107 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)), |
|
| 108 | + give_get_form_sales_stats($post_id) |
|
| 109 | 109 | ); |
| 110 | 110 | } else { |
| 111 | 111 | echo '-'; |
| 112 | 112 | } |
| 113 | 113 | break; |
| 114 | 114 | case 'earnings': |
| 115 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 115 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 116 | 116 | printf( |
| 117 | 117 | '<a href="%1$s">%2$s</a>', |
| 118 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ), |
|
| 119 | - give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) ) |
|
| 118 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)), |
|
| 119 | + give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false))) |
|
| 120 | 120 | ); |
| 121 | 121 | } else { |
| 122 | 122 | echo '-'; |
| 123 | 123 | } |
| 124 | 124 | break; |
| 125 | 125 | case 'shortcode': |
| 126 | - printf( '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="%s"]"', absint( $post_id ) ); |
|
| 126 | + printf('<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="%s"]"', absint($post_id)); |
|
| 127 | 127 | break; |
| 128 | 128 | }// End switch(). |
| 129 | 129 | }// End if(). |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
| 132 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Registers the sortable columns in the list table |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return array $columns Array of sortable columns |
| 142 | 142 | */ |
| 143 | -function give_sortable_form_columns( $columns ) { |
|
| 143 | +function give_sortable_form_columns($columns) { |
|
| 144 | 144 | $columns['price'] = 'amount'; |
| 145 | 145 | $columns['sales'] = 'sales'; |
| 146 | 146 | $columns['earnings'] = 'earnings'; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return $columns; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
| 153 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Sorts Columns in the Forms List Table |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @return array $vars Array of all the sort variables. |
| 163 | 163 | */ |
| 164 | -function give_sort_forms( $vars ) { |
|
| 164 | +function give_sort_forms($vars) { |
|
| 165 | 165 | // Check if we're viewing the "give_forms" post type. |
| 166 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
| 166 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
| 167 | 167 | return $vars; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - switch ( $vars['orderby'] ) { |
|
| 170 | + switch ($vars['orderby']) { |
|
| 171 | 171 | // Check if 'orderby' is set to "sales". |
| 172 | 172 | case 'sales': |
| 173 | 173 | $vars = array_merge( |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | // Check if "orderby" is set to "price/amount". |
| 194 | 194 | case 'amount': |
| 195 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 195 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 196 | 196 | |
| 197 | 197 | $vars['orderby'] = 'meta_value_num'; |
| 198 | 198 | $vars['meta_query'] = array( |
@@ -244,17 +244,17 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @return array Array of all sort variables. |
| 246 | 246 | */ |
| 247 | -function give_filter_forms( $vars ) { |
|
| 248 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
| 247 | +function give_filter_forms($vars) { |
|
| 248 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
| 249 | 249 | |
| 250 | 250 | // If an author ID was passed, use it |
| 251 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
| 251 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
| 252 | 252 | |
| 253 | 253 | $author_id = $_REQUEST['author']; |
| 254 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
| 255 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 254 | + if ((int) $author_id !== get_current_user_id()) { |
|
| 255 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
| 256 | 256 | 'response' => 403, |
| 257 | - ) ); |
|
| 257 | + )); |
|
| 258 | 258 | } |
| 259 | 259 | $vars = array_merge( |
| 260 | 260 | $vars, |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | * @return void |
| 279 | 279 | */ |
| 280 | 280 | function give_forms_load() { |
| 281 | - add_filter( 'request', 'give_sort_forms' ); |
|
| 282 | - add_filter( 'request', 'give_filter_forms' ); |
|
| 281 | + add_filter('request', 'give_sort_forms'); |
|
| 282 | + add_filter('request', 'give_filter_forms'); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
| 285 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * Remove Forms Month Filter |
@@ -296,17 +296,17 @@ discard block |
||
| 296 | 296 | * @global $typenow The post type we are viewing. |
| 297 | 297 | * @return array Empty array disables the dropdown. |
| 298 | 298 | */ |
| 299 | -function give_remove_month_filter( $dates ) { |
|
| 299 | +function give_remove_month_filter($dates) { |
|
| 300 | 300 | global $typenow; |
| 301 | 301 | |
| 302 | - if ( $typenow == 'give_forms' ) { |
|
| 302 | + if ($typenow == 'give_forms') { |
|
| 303 | 303 | $dates = array(); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | return $dates; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
| 309 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
| 310 | 310 | |
| 311 | 311 | /** |
| 312 | 312 | * Updates price when saving post |
@@ -318,33 +318,33 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return int|null |
| 320 | 320 | */ |
| 321 | -function give_price_save_quick_edit( $post_id ) { |
|
| 322 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
| 321 | +function give_price_save_quick_edit($post_id) { |
|
| 322 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
| 323 | 323 | return; |
| 324 | 324 | } |
| 325 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 325 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 326 | 326 | return $post_id; |
| 327 | 327 | } |
| 328 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 328 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 329 | 329 | return $post_id; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
| 333 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) ); |
|
| 332 | + if (isset($_REQUEST['_give_regprice'])) { |
|
| 333 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice'])))); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Override the Donation minimum amount. |
| 337 | 337 | if ( |
| 338 | - isset( $_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'] ) |
|
| 338 | + isset($_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range']) |
|
| 339 | 339 | && 'set' === $_REQUEST['_give_price_option'] |
| 340 | - && give_is_setting_enabled( $_REQUEST['_give_custom_amount'] ) |
|
| 341 | - && give_maybe_sanitize_amount( $_REQUEST['_give_set_price'] ) < give_maybe_sanitize_amount( $_REQUEST['_give_custom_amount_range']['minimum'] ) |
|
| 340 | + && give_is_setting_enabled($_REQUEST['_give_custom_amount']) |
|
| 341 | + && give_maybe_sanitize_amount($_REQUEST['_give_set_price']) < give_maybe_sanitize_amount($_REQUEST['_give_custom_amount_range']['minimum']) |
|
| 342 | 342 | ) { |
| 343 | - give_update_meta( $post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db( $_REQUEST['_give_set_price'] ) ); |
|
| 343 | + give_update_meta($post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db($_REQUEST['_give_set_price'])); |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
| 347 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | 350 | * Process bulk edit actions via AJAX |
@@ -354,18 +354,18 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | function give_save_bulk_edit() { |
| 356 | 356 | |
| 357 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
| 357 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
| 358 | 358 | |
| 359 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
| 360 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
| 361 | - foreach ( $post_ids as $post_id ) { |
|
| 359 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
| 360 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
| 361 | + foreach ($post_ids as $post_id) { |
|
| 362 | 362 | |
| 363 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 363 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 364 | 364 | continue; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( ! empty( $price ) ) { |
|
| 368 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) ); |
|
| 367 | + if ( ! empty($price)) { |
|
| 368 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price)); |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -373,4 +373,4 @@ discard block |
||
| 373 | 373 | die(); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
| 376 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
|
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Page' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Page. |
@@ -70,25 +70,25 @@ discard block |
||
| 70 | 70 | // Get current setting page. |
| 71 | 71 | $this->current_setting_page = give_get_current_setting_page(); |
| 72 | 72 | |
| 73 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
| 74 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
| 75 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 73 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
| 74 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
| 75 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
| 76 | 76 | |
| 77 | 77 | // Output section only if exist. |
| 78 | 78 | $sections = $this->get_sections(); |
| 79 | - if ( ! empty( $sections ) ) { |
|
| 80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
| 79 | + if ( ! empty($sections)) { |
|
| 80 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
| 81 | 81 | $this, |
| 82 | 82 | 'output_sections', |
| 83 | - ) ); |
|
| 83 | + )); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Save hide button by default. |
| 87 | 87 | $GLOBALS['give_hide_save_button'] = true; |
| 88 | 88 | |
| 89 | 89 | // Enable saving feature. |
| 90 | - if ( $this->enable_save ) { |
|
| 91 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
| 90 | + if ($this->enable_save) { |
|
| 91 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - function set_default_setting_tab( $setting_tab ) { |
|
| 116 | + function set_default_setting_tab($setting_tab) { |
|
| 117 | 117 | return $this->default_tab; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return array |
| 128 | 128 | */ |
| 129 | - public function add_settings_page( $pages ) { |
|
| 130 | - $pages[ $this->id ] = $this->label; |
|
| 129 | + public function add_settings_page($pages) { |
|
| 130 | + $pages[$this->id] = $this->label; |
|
| 131 | 131 | |
| 132 | 132 | return $pages; |
| 133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @param array $settings |
| 148 | 148 | */ |
| 149 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
| 149 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
| 150 | 150 | |
| 151 | 151 | // Output. |
| 152 | 152 | return $settings; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return array |
| 160 | 160 | */ |
| 161 | 161 | public function get_sections() { |
| 162 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
| 162 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -176,40 +176,40 @@ discard block |
||
| 176 | 176 | $sections = $this->get_sections(); |
| 177 | 177 | |
| 178 | 178 | // Bailout. |
| 179 | - if ( empty( $sections ) ) { |
|
| 179 | + if (empty($sections)) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Show section settings only if setting section exist. |
| 184 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ), true ) ) { |
|
| 185 | - echo wp_kses_post( '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>' ); |
|
| 184 | + if ($current_section && ! in_array($current_section, array_keys($sections), true)) { |
|
| 185 | + echo wp_kses_post('<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'); |
|
| 186 | 186 | $GLOBALS['give_hide_save_button'] = true; |
| 187 | 187 | |
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( is_null( $this->current_setting_page ) ) { |
|
| 191 | + if (is_null($this->current_setting_page)) { |
|
| 192 | 192 | $this->current_setting_page = give_get_current_setting_page(); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $section_list = array(); |
| 196 | - foreach ( $sections as $id => $label ) { |
|
| 196 | + foreach ($sections as $id => $label) { |
|
| 197 | 197 | /** |
| 198 | 198 | * Fire the filter to hide particular section on tab. |
| 199 | 199 | * |
| 200 | 200 | * @since 2.0 |
| 201 | 201 | */ |
| 202 | - if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) { |
|
| 202 | + if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) { |
|
| 203 | 203 | continue; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section === $id ? 'current' : '' ) . '">' . $label . '</a>'; |
|
| 206 | + $section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section === $id ? 'current' : '').'">'.$label.'</a>'; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - echo wp_kses_post( sprintf( |
|
| 209 | + echo wp_kses_post(sprintf( |
|
| 210 | 210 | '<ul class="give-subsubsub">%s</ul><br class="clear" /><hr>', |
| 211 | - implode( ' | </li>', $section_list ) |
|
| 212 | - ) ); |
|
| 211 | + implode(' | </li>', $section_list) |
|
| 212 | + )); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | * @return void |
| 222 | 222 | */ |
| 223 | 223 | public function output() { |
| 224 | - if ( $this->enable_save ) { |
|
| 224 | + if ($this->enable_save) { |
|
| 225 | 225 | $GLOBALS['give_hide_save_button'] = false; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $settings = $this->get_settings(); |
| 229 | 229 | |
| 230 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 230 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @since 2.1 |
| 247 | 247 | */ |
| 248 | - if ( apply_filters( "give_save_options_{$this->id}_{$current_section}", true ) ) { |
|
| 249 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
| 248 | + if (apply_filters("give_save_options_{$this->id}_{$current_section}", true)) { |
|
| 249 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @since 1.8 |
| 256 | 256 | */ |
| 257 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
| 257 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | $section = $this->get_sections(); |
| 272 | 272 | $current_section = give_get_current_setting_section(); |
| 273 | 273 | |
| 274 | - if ( array_key_exists( $current_section, $section ) ) { |
|
| 275 | - $heading[] = $section[ $current_section ]; |
|
| 274 | + if (array_key_exists($current_section, $section)) { |
|
| 275 | + $heading[] = $section[$current_section]; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - return array_unique( $heading ); |
|
| 278 | + return array_unique($heading); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | public function get_heading_html() { |
| 290 | 290 | return sprintf( |
| 291 | 291 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
| 292 | - implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
|
| 292 | + implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading()) |
|
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if access directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) : |
|
| 18 | +if ( ! class_exists('Give_Donation_Receipt_Email')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Give_Donation_Receipt_Email |
@@ -35,22 +35,22 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function init() { |
| 37 | 37 | // Initialize empty payment. |
| 38 | - $this->payment = new Give_Payment( 0 ); |
|
| 38 | + $this->payment = new Give_Payment(0); |
|
| 39 | 39 | |
| 40 | - $this->load( array( |
|
| 40 | + $this->load(array( |
|
| 41 | 41 | 'id' => 'donation-receipt', |
| 42 | - 'label' => __( 'Donation Receipt', 'give' ), |
|
| 43 | - 'description' => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ), |
|
| 42 | + 'label' => __('Donation Receipt', 'give'), |
|
| 43 | + 'description' => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'), |
|
| 44 | 44 | 'notification_status' => 'enabled', |
| 45 | 45 | 'form_metabox_setting' => true, |
| 46 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
| 47 | - 'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ), |
|
| 46 | + 'recipient_group_name' => __('Donor', 'give'), |
|
| 47 | + 'default_email_subject' => esc_attr__('Donation Receipt', 'give'), |
|
| 48 | 48 | 'default_email_message' => give_get_default_donation_receipt_email(), |
| 49 | - 'default_email_header' => __( 'Donation Receipt', 'give' ), |
|
| 50 | - ) ); |
|
| 49 | + 'default_email_header' => __('Donation Receipt', 'give'), |
|
| 50 | + )); |
|
| 51 | 51 | |
| 52 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) ); |
|
| 53 | - add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) ); |
|
| 52 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt')); |
|
| 53 | + add_action('give_email_links', array($this, 'resend_donation_receipt')); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | * @param int $form_id |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function get_email_subject( $form_id = null ) { |
|
| 65 | + public function get_email_subject($form_id = null) { |
|
| 66 | 66 | $subject = wp_strip_all_tags( |
| 67 | 67 | Give_Email_Notification_Util::get_value( |
| 68 | 68 | $this, |
| 69 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
| 69 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
| 70 | 70 | $form_id, |
| 71 | 71 | $this->config['default_email_subject'] |
| 72 | 72 | ) |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * @param int $form_id |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function get_email_message( $form_id = null ) { |
|
| 112 | + public function get_email_message($form_id = null) { |
|
| 113 | 113 | $message = Give_Email_Notification_Util::get_value( |
| 114 | 114 | $this, |
| 115 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
| 115 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
| 116 | 116 | $form_id, |
| 117 | 117 | $this->config['default_email_message'] |
| 118 | 118 | ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @since 1.0 |
| 125 | 125 | */ |
| 126 | 126 | $message = apply_filters( |
| 127 | - 'give_donation_receipt_' . Give()->emails->get_template(), |
|
| 127 | + 'give_donation_receipt_'.Give()->emails->get_template(), |
|
| 128 | 128 | $message, |
| 129 | 129 | $this->payment->ID, |
| 130 | 130 | $this->payment->payment_meta |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param int $form_id |
| 168 | 168 | * @return array |
| 169 | 169 | */ |
| 170 | - public function get_email_attachments( $form_id = null) { |
|
| 170 | + public function get_email_attachments($form_id = null) { |
|
| 171 | 171 | /** |
| 172 | 172 | * Filter the attachments. |
| 173 | 173 | * Note: this filter will deprecate soon. |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | $this->payment->payment_meta |
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - Give()->emails->__set( 'from_name', $from_name ); |
|
| 240 | - Give()->emails->__set( 'from_email', $from_email ); |
|
| 241 | - Give()->emails->__set( 'heading', $this->get_email_header() ); |
|
| 239 | + Give()->emails->__set('from_name', $from_name); |
|
| 240 | + Give()->emails->__set('from_email', $from_email); |
|
| 241 | + Give()->emails->__set('heading', $this->get_email_header()); |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * Filters the donation receipt's email headers. |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->payment->payment_meta |
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - Give()->emails->__set( 'headers', $headers ); |
|
| 258 | + Give()->emails->__set('headers', $headers); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -266,16 +266,16 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @param $payment_id |
| 268 | 268 | */ |
| 269 | - public function send_donation_receipt( $payment_id ) { |
|
| 270 | - $this->payment = new Give_Payment( $payment_id ); |
|
| 269 | + public function send_donation_receipt($payment_id) { |
|
| 270 | + $this->payment = new Give_Payment($payment_id); |
|
| 271 | 271 | |
| 272 | 272 | // Setup email data. |
| 273 | 273 | $this->setup_email_data(); |
| 274 | 274 | |
| 275 | 275 | // Send email. |
| 276 | - $this->send_email_notification( array( |
|
| 276 | + $this->send_email_notification(array( |
|
| 277 | 277 | 'payment_id' => $this->payment->ID, |
| 278 | - ) ); |
|
| 278 | + )); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -286,35 +286,35 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param array $data Donation details. |
| 288 | 288 | */ |
| 289 | - public function resend_donation_receipt( $data ) { |
|
| 290 | - $purchase_id = absint( $data['purchase_id'] ); |
|
| 289 | + public function resend_donation_receipt($data) { |
|
| 290 | + $purchase_id = absint($data['purchase_id']); |
|
| 291 | 291 | |
| 292 | - if ( empty( $purchase_id ) ) { |
|
| 292 | + if (empty($purchase_id)) { |
|
| 293 | 293 | return; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Get donation payment information. |
| 297 | - $this->payment = new Give_Payment( $purchase_id ); |
|
| 297 | + $this->payment = new Give_Payment($purchase_id); |
|
| 298 | 298 | |
| 299 | - if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) { |
|
| 300 | - wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 299 | + if ( ! current_user_can('edit_give_payments', $this->payment->ID)) { |
|
| 300 | + wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array( |
|
| 301 | 301 | 'response' => 403, |
| 302 | - ) ); |
|
| 302 | + )); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Setup email data. |
| 306 | 306 | $this->setup_email_data(); |
| 307 | 307 | |
| 308 | 308 | // Send email. |
| 309 | - $this->send_email_notification( array( |
|
| 309 | + $this->send_email_notification(array( |
|
| 310 | 310 | 'payment_id' => $this->payment->ID, |
| 311 | - ) ); |
|
| 311 | + )); |
|
| 312 | 312 | |
| 313 | - wp_redirect( add_query_arg( array( |
|
| 313 | + wp_redirect(add_query_arg(array( |
|
| 314 | 314 | 'give-messages[]' => 'email-sent', |
| 315 | 315 | 'give-action' => false, |
| 316 | 316 | 'purchase_id' => false, |
| 317 | - ) ) ); |
|
| 317 | + ))); |
|
| 318 | 318 | exit; |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -19,28 +19,28 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return array |
| 21 | 21 | */ |
| 22 | -function give_email_notification_row_actions_callback( $row_actions, $email ) { |
|
| 23 | - if( Give_Email_Notification_Util::is_email_preview( $email ) ) { |
|
| 22 | +function give_email_notification_row_actions_callback($row_actions, $email) { |
|
| 23 | + if (Give_Email_Notification_Util::is_email_preview($email)) { |
|
| 24 | 24 | $preview_link = sprintf( |
| 25 | 25 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 26 | 26 | wp_nonce_url( |
| 27 | 27 | add_query_arg( |
| 28 | - array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ), |
|
| 28 | + array('give_action' => 'preview_email', 'email_type' => $email->config['id']), |
|
| 29 | 29 | home_url() |
| 30 | 30 | ), 'give-preview-email' |
| 31 | 31 | ), |
| 32 | - __( 'Preview', 'give' ) |
|
| 32 | + __('Preview', 'give') |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | $send_preview_email_link = sprintf( |
| 36 | 36 | '<a href="%1$s">%2$s</a>', |
| 37 | 37 | wp_nonce_url( |
| 38 | - add_query_arg( array( |
|
| 38 | + add_query_arg(array( |
|
| 39 | 39 | 'give_action' => 'send_preview_email', |
| 40 | 40 | 'email_type' => $email->config['id'], |
| 41 | 41 | 'give-messages[]' => 'sent-test-email', |
| 42 | - ) ), 'give-send-preview-email' ), |
|
| 43 | - __( 'Send test email', 'give' ) |
|
| 42 | + )), 'give-send-preview-email' ), |
|
| 43 | + __('Send test email', 'give') |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $row_actions['email_preview'] = $preview_link; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | return $row_actions; |
| 51 | 51 | } |
| 52 | -add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 ); |
|
| 52 | +add_filter('give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2); |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * This help to decode all email template tags. |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
| 64 | -function give_decode_email_tags( $message, $email_obj ) { |
|
| 65 | - if ( ! empty( $email_obj->tag_args ) ) { |
|
| 66 | - $message = give_do_email_tags( $message, $email_obj->tag_args ); |
|
| 64 | +function give_decode_email_tags($message, $email_obj) { |
|
| 65 | + if ( ! empty($email_obj->tag_args)) { |
|
| 66 | + $message = give_do_email_tags($message, $email_obj->tag_args); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $message; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | -add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 ); |
|
| 73 | 72 | \ No newline at end of file |
| 73 | +add_filter('give_email_message', 'give_decode_email_tags', 10, 2); |
|
| 74 | 74 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @access public |
| 36 | 36 | */ |
| 37 | 37 | public function __construct() { |
| 38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
| 39 | - add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10, 1 ); |
|
| 40 | - add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard' ), 10 ); |
|
| 38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
| 39 | + add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10, 1); |
|
| 40 | + add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | 53 | public function add_roles() { |
| 54 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
| 54 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
| 55 | 55 | 'read' => true, |
| 56 | 56 | 'edit_posts' => true, |
| 57 | 57 | 'delete_posts' => true, |
@@ -80,25 +80,25 @@ discard block |
||
| 80 | 80 | 'publish_posts' => true, |
| 81 | 81 | 'read_private_pages' => true, |
| 82 | 82 | 'read_private_posts' => true, |
| 83 | - ) ); |
|
| 83 | + )); |
|
| 84 | 84 | |
| 85 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
| 85 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
| 86 | 86 | 'read' => true, |
| 87 | 87 | 'edit_posts' => false, |
| 88 | 88 | 'delete_posts' => false, |
| 89 | - ) ); |
|
| 89 | + )); |
|
| 90 | 90 | |
| 91 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
| 91 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
| 92 | 92 | 'read' => true, |
| 93 | 93 | 'edit_posts' => true, |
| 94 | 94 | 'edit_pages' => true, |
| 95 | 95 | 'upload_files' => true, |
| 96 | 96 | 'delete_posts' => false, |
| 97 | - ) ); |
|
| 97 | + )); |
|
| 98 | 98 | |
| 99 | - add_role( 'give_donor', __( 'Give Donor', 'give' ), array( |
|
| 99 | + add_role('give_donor', __('Give Donor', 'give'), array( |
|
| 100 | 100 | 'read' => true, |
| 101 | - ) ); |
|
| 101 | + )); |
|
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | |
@@ -117,54 +117,54 @@ discard block |
||
| 117 | 117 | public function add_caps() { |
| 118 | 118 | global $wp_roles; |
| 119 | 119 | |
| 120 | - if ( class_exists( 'WP_Roles' ) ) { |
|
| 121 | - if ( ! isset( $wp_roles ) ) { |
|
| 120 | + if (class_exists('WP_Roles')) { |
|
| 121 | + if ( ! isset($wp_roles)) { |
|
| 122 | 122 | $wp_roles = new WP_Roles(); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( is_object( $wp_roles ) ) { |
|
| 127 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
| 128 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
| 129 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
| 130 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
| 131 | - $wp_roles->add_cap( 'give_manager', 'view_give_payments' ); |
|
| 126 | + if (is_object($wp_roles)) { |
|
| 127 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
| 128 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
| 129 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
| 130 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
| 131 | + $wp_roles->add_cap('give_manager', 'view_give_payments'); |
|
| 132 | 132 | |
| 133 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
| 134 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
| 135 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
| 136 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
| 137 | - $wp_roles->add_cap( 'administrator', 'view_give_payments' ); |
|
| 133 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
| 134 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
| 135 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
| 136 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
| 137 | + $wp_roles->add_cap('administrator', 'view_give_payments'); |
|
| 138 | 138 | |
| 139 | 139 | // Add the main post type capabilities. |
| 140 | 140 | $capabilities = $this->get_core_caps(); |
| 141 | - foreach ( $capabilities as $cap_group ) { |
|
| 142 | - foreach ( $cap_group as $cap ) { |
|
| 143 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
| 144 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
| 141 | + foreach ($capabilities as $cap_group) { |
|
| 142 | + foreach ($cap_group as $cap) { |
|
| 143 | + $wp_roles->add_cap('administrator', $cap); |
|
| 144 | + $wp_roles->add_cap('give_manager', $cap); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Add Capabilities to Give Workers User Role. |
| 149 | - $wp_roles->add_cap( 'give_worker', 'edit_give_payments' ); |
|
| 150 | - $wp_roles->add_cap( 'give_worker', 'delete_give_forms' ); |
|
| 151 | - $wp_roles->add_cap( 'give_worker', 'delete_others_give_forms' ); |
|
| 152 | - $wp_roles->add_cap( 'give_worker', 'delete_private_give_forms' ); |
|
| 153 | - $wp_roles->add_cap( 'give_worker', 'delete_published_give_forms' ); |
|
| 154 | - $wp_roles->add_cap( 'give_worker', 'edit_give_forms' ); |
|
| 155 | - $wp_roles->add_cap( 'give_worker', 'edit_others_give_forms' ); |
|
| 156 | - $wp_roles->add_cap( 'give_worker', 'edit_private_give_forms' ); |
|
| 157 | - $wp_roles->add_cap( 'give_worker', 'edit_published_give_forms' ); |
|
| 158 | - $wp_roles->add_cap( 'give_worker', 'publish_give_forms' ); |
|
| 159 | - $wp_roles->add_cap( 'give_worker', 'read_private_give_forms' ); |
|
| 149 | + $wp_roles->add_cap('give_worker', 'edit_give_payments'); |
|
| 150 | + $wp_roles->add_cap('give_worker', 'delete_give_forms'); |
|
| 151 | + $wp_roles->add_cap('give_worker', 'delete_others_give_forms'); |
|
| 152 | + $wp_roles->add_cap('give_worker', 'delete_private_give_forms'); |
|
| 153 | + $wp_roles->add_cap('give_worker', 'delete_published_give_forms'); |
|
| 154 | + $wp_roles->add_cap('give_worker', 'edit_give_forms'); |
|
| 155 | + $wp_roles->add_cap('give_worker', 'edit_others_give_forms'); |
|
| 156 | + $wp_roles->add_cap('give_worker', 'edit_private_give_forms'); |
|
| 157 | + $wp_roles->add_cap('give_worker', 'edit_published_give_forms'); |
|
| 158 | + $wp_roles->add_cap('give_worker', 'publish_give_forms'); |
|
| 159 | + $wp_roles->add_cap('give_worker', 'read_private_give_forms'); |
|
| 160 | 160 | |
| 161 | 161 | // Add Capabilities to Give Accountant User Role. |
| 162 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
| 163 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
| 164 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
| 165 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
| 166 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
| 167 | - $wp_roles->add_cap( 'give_accountant', 'view_give_payments' ); |
|
| 162 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
| 163 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
| 164 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
| 165 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
| 166 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
| 167 | + $wp_roles->add_cap('give_accountant', 'view_give_payments'); |
|
| 168 | 168 | |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | public function get_core_caps() { |
| 183 | 183 | $capabilities = array(); |
| 184 | 184 | |
| 185 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
| 185 | + $capability_types = array('give_form', 'give_payment'); |
|
| 186 | 186 | |
| 187 | - foreach ( $capability_types as $capability_type ) { |
|
| 188 | - $capabilities[ $capability_type ] = array( |
|
| 187 | + foreach ($capability_types as $capability_type) { |
|
| 188 | + $capabilities[$capability_type] = array( |
|
| 189 | 189 | // Post type. |
| 190 | 190 | "edit_{$capability_type}", |
| 191 | 191 | "read_{$capability_type}", |
@@ -231,22 +231,22 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array $caps Meta capabilities. |
| 233 | 233 | */ |
| 234 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 234 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
| 235 | 235 | |
| 236 | - switch ( $cap ) { |
|
| 236 | + switch ($cap) { |
|
| 237 | 237 | |
| 238 | 238 | case 'view_give_form_stats' : |
| 239 | 239 | |
| 240 | - if ( empty( $args[0] ) ) { |
|
| 240 | + if (empty($args[0])) { |
|
| 241 | 241 | break; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $form = get_post( $args[0] ); |
|
| 245 | - if ( empty( $form ) ) { |
|
| 244 | + $form = get_post($args[0]); |
|
| 245 | + if (empty($form)) { |
|
| 246 | 246 | break; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
| 249 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
| 250 | 250 | $caps = array(); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -273,57 +273,57 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | global $wp_roles; |
| 275 | 275 | |
| 276 | - if ( class_exists( 'WP_Roles' ) ) { |
|
| 277 | - if ( ! isset( $wp_roles ) ) { |
|
| 276 | + if (class_exists('WP_Roles')) { |
|
| 277 | + if ( ! isset($wp_roles)) { |
|
| 278 | 278 | $wp_roles = new WP_Roles(); |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ( is_object( $wp_roles ) ) { |
|
| 282 | + if (is_object($wp_roles)) { |
|
| 283 | 283 | // Give Manager Capabilities. |
| 284 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
| 285 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
| 286 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
| 287 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
| 284 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
| 285 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
| 286 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
| 287 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
| 288 | 288 | |
| 289 | 289 | // Site Administrator Capabilities. |
| 290 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
| 291 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
| 292 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
| 293 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
| 294 | - $wp_roles->remove_cap( 'administrator', 'view_give_payments' ); |
|
| 290 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
| 291 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
| 292 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
| 293 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
| 294 | + $wp_roles->remove_cap('administrator', 'view_give_payments'); |
|
| 295 | 295 | |
| 296 | 296 | // Remove the Main Post Type Capabilities. |
| 297 | 297 | $capabilities = $this->get_core_caps(); |
| 298 | 298 | |
| 299 | - foreach ( $capabilities as $cap_group ) { |
|
| 300 | - foreach ( $cap_group as $cap ) { |
|
| 301 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
| 302 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
| 299 | + foreach ($capabilities as $cap_group) { |
|
| 300 | + foreach ($cap_group as $cap) { |
|
| 301 | + $wp_roles->remove_cap('give_manager', $cap); |
|
| 302 | + $wp_roles->remove_cap('administrator', $cap); |
|
| 303 | 303 | |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // Remove capabilities from the Give Worker role. |
| 308 | - $wp_roles->remove_cap( 'give_worker', 'edit_give_payments' ); |
|
| 309 | - $wp_roles->remove_cap( 'give_worker', 'delete_give_forms' ); |
|
| 310 | - $wp_roles->remove_cap( 'give_worker', 'delete_others_give_forms' ); |
|
| 311 | - $wp_roles->remove_cap( 'give_worker', 'delete_private_give_forms' ); |
|
| 312 | - $wp_roles->remove_cap( 'give_worker', 'delete_published_give_forms' ); |
|
| 313 | - $wp_roles->remove_cap( 'give_worker', 'edit_give_forms' ); |
|
| 314 | - $wp_roles->remove_cap( 'give_worker', 'edit_others_give_forms' ); |
|
| 315 | - $wp_roles->remove_cap( 'give_worker', 'edit_private_give_forms' ); |
|
| 316 | - $wp_roles->remove_cap( 'give_worker', 'edit_published_give_forms' ); |
|
| 317 | - $wp_roles->remove_cap( 'give_worker', 'publish_give_forms' ); |
|
| 318 | - $wp_roles->remove_cap( 'give_worker', 'read_private_give_forms' ); |
|
| 308 | + $wp_roles->remove_cap('give_worker', 'edit_give_payments'); |
|
| 309 | + $wp_roles->remove_cap('give_worker', 'delete_give_forms'); |
|
| 310 | + $wp_roles->remove_cap('give_worker', 'delete_others_give_forms'); |
|
| 311 | + $wp_roles->remove_cap('give_worker', 'delete_private_give_forms'); |
|
| 312 | + $wp_roles->remove_cap('give_worker', 'delete_published_give_forms'); |
|
| 313 | + $wp_roles->remove_cap('give_worker', 'edit_give_forms'); |
|
| 314 | + $wp_roles->remove_cap('give_worker', 'edit_others_give_forms'); |
|
| 315 | + $wp_roles->remove_cap('give_worker', 'edit_private_give_forms'); |
|
| 316 | + $wp_roles->remove_cap('give_worker', 'edit_published_give_forms'); |
|
| 317 | + $wp_roles->remove_cap('give_worker', 'publish_give_forms'); |
|
| 318 | + $wp_roles->remove_cap('give_worker', 'read_private_give_forms'); |
|
| 319 | 319 | |
| 320 | 320 | // Remove Capabilities from Give Accountant User Role. |
| 321 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
| 322 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
| 323 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
| 324 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
| 325 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_payments' ); |
|
| 326 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_payments' ); |
|
| 321 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
| 322 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
| 323 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
| 324 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
| 325 | + $wp_roles->remove_cap('give_accountant', 'edit_give_payments'); |
|
| 326 | + $wp_roles->remove_cap('give_accountant', 'view_give_payments'); |
|
| 327 | 327 | |
| 328 | 328 | } |
| 329 | 329 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $current_user = wp_get_current_user(); |
| 347 | 347 | |
| 348 | 348 | // If user with "Give Accountant" user role is logged-in . |
| 349 | - if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) { |
|
| 349 | + if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) { |
|
| 350 | 350 | |
| 351 | 351 | // Return false, means no prevention. |
| 352 | 352 | return false; |