@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function give_customers_page() { |
| 26 | 26 | $default_views = give_customer_views(); |
| 27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
| 28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
| 29 | - give_render_customer_view( $requested_view, $default_views ); |
|
| 27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
| 28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
| 29 | + give_render_customer_view($requested_view, $default_views); |
|
| 30 | 30 | } else { |
| 31 | 31 | give_customers_list(); |
| 32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $views = array(); |
| 44 | 44 | |
| 45 | - return apply_filters( 'give_customer_views', $views ); |
|
| 45 | + return apply_filters('give_customer_views', $views); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $tabs = array(); |
| 58 | 58 | |
| 59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
| 59 | + return apply_filters('give_customer_tabs', $tabs); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | function give_customers_list() { |
| 70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
| 70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
| 71 | 71 | |
| 72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
| 73 | 73 | $customers_table->prepare_items(); |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @since 1.0 |
| 82 | 82 | */ |
| 83 | - do_action( 'give_donors_table_top' ); |
|
| 83 | + do_action('give_donors_table_top'); |
|
| 84 | 84 | ?> |
| 85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
| 85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
| 86 | 86 | <?php |
| 87 | - $customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
| 87 | + $customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
| 88 | 88 | $customers_table->display(); |
| 89 | 89 | ?> |
| 90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @since 1.0 |
| 99 | 99 | */ |
| 100 | - do_action( 'give_donors_table_bottom' ); |
|
| 100 | + do_action('give_donors_table_bottom'); |
|
| 101 | 101 | ?> |
| 102 | 102 | </div> |
| 103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | -function give_render_customer_view( $view, $callbacks ) { |
|
| 116 | +function give_render_customer_view($view, $callbacks) { |
|
| 117 | 117 | |
| 118 | 118 | $render = true; |
| 119 | 119 | |
| 120 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
| 120 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
| 121 | 121 | |
| 122 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
| 123 | - give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
| 122 | + if ( ! current_user_can($customer_view_role)) { |
|
| 123 | + give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give')); |
|
| 124 | 124 | $render = false; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 128 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
| 127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 128 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
| 129 | 129 | $render = false; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $customer_id = (int) $_GET['id']; |
| 133 | - $customer = new Give_Customer( $customer_id ); |
|
| 133 | + $customer = new Give_Customer($customer_id); |
|
| 134 | 134 | |
| 135 | - if ( empty( $customer->id ) ) { |
|
| 136 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
| 135 | + if (empty($customer->id)) { |
|
| 136 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
| 137 | 137 | $render = false; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -142,34 +142,34 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | <div class='wrap'> |
| 144 | 144 | |
| 145 | - <?php if ( give_get_errors() ) : ?> |
|
| 145 | + <?php if (give_get_errors()) : ?> |
|
| 146 | 146 | <div class="error settings-error"> |
| 147 | - <?php give_print_errors( 0 ); ?> |
|
| 147 | + <?php give_print_errors(0); ?> |
|
| 148 | 148 | </div> |
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | |
| 151 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1> |
|
| 151 | + <h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1> |
|
| 152 | 152 | |
| 153 | - <?php if ( $customer && $render ) : ?> |
|
| 153 | + <?php if ($customer && $render) : ?> |
|
| 154 | 154 | |
| 155 | 155 | <h2 class="nav-tab-wrapper"> |
| 156 | 156 | <?php |
| 157 | - foreach ( $customer_tabs as $key => $tab ) : |
|
| 157 | + foreach ($customer_tabs as $key => $tab) : |
|
| 158 | 158 | $active = $key === $view ? true : false; |
| 159 | 159 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
| 160 | 160 | printf( |
| 161 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
| 162 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ), |
|
| 163 | - esc_attr( $class ), |
|
| 164 | - sanitize_html_class( $tab['dashicon'] ), |
|
| 165 | - esc_html( $tab['title'] ) |
|
| 161 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
| 162 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)), |
|
| 163 | + esc_attr($class), |
|
| 164 | + sanitize_html_class($tab['dashicon']), |
|
| 165 | + esc_html($tab['title']) |
|
| 166 | 166 | ); |
| 167 | 167 | endforeach; |
| 168 | 168 | ?> |
| 169 | 169 | </h2> |
| 170 | 170 | |
| 171 | 171 | <div id="give-customer-card-wrapper"> |
| 172 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
| 172 | + <?php $callbacks[$view]($customer) ?> |
|
| 173 | 173 | </div> |
| 174 | 174 | |
| 175 | 175 | <?php endif; ?> |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @return void |
| 191 | 191 | */ |
| 192 | -function give_customers_view( $customer ) { |
|
| 192 | +function give_customers_view($customer) { |
|
| 193 | 193 | |
| 194 | - $customer_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 194 | + $customer_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Fires in donor profile screen, above the donor card. |
@@ -200,32 +200,32 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @param object $customer The customer object being displayed. |
| 202 | 202 | */ |
| 203 | - do_action( 'give_donor_card_top', $customer ); |
|
| 203 | + do_action('give_donor_card_top', $customer); |
|
| 204 | 204 | ?> |
| 205 | 205 | |
| 206 | 206 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
| 207 | 207 | |
| 208 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
| 208 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
| 209 | 209 | |
| 210 | 210 | <div class="customer-info"> |
| 211 | 211 | |
| 212 | 212 | <div class="donor-bio-header clearfix"> |
| 213 | 213 | |
| 214 | 214 | <div class="avatar-wrap left" id="customer-avatar"> |
| 215 | - <?php echo get_avatar( $customer->email ); ?> |
|
| 215 | + <?php echo get_avatar($customer->email); ?> |
|
| 216 | 216 | </div> |
| 217 | 217 | |
| 218 | 218 | <div id="customer-name-wrap" class="left"> |
| 219 | 219 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
| 220 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
| 220 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
| 221 | 221 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
| 222 | 222 | </div> |
| 223 | 223 | <p class="customer-since info-item"> |
| 224 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
| 225 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
| 224 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
| 225 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
| 226 | 226 | </p> |
| 227 | - <?php if ( current_user_can( $customer_edit_role ) ) : ?> |
|
| 228 | - <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
| 227 | + <?php if (current_user_can($customer_edit_role)) : ?> |
|
| 228 | + <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
| 229 | 229 | <?php endif; ?> |
| 230 | 230 | </div> |
| 231 | 231 | <!-- /donor-bio-header --> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | <table class="widefat"> |
| 236 | 236 | <tbody> |
| 237 | 237 | <tr class="alternate"> |
| 238 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User:', 'give' ); ?></label></th> |
|
| 238 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User:', 'give'); ?></label></th> |
|
| 239 | 239 | <td> |
| 240 | 240 | <span class="customer-user-id info-item edit-item"> |
| 241 | 241 | <?php |
@@ -252,37 +252,37 @@ discard block |
||
| 252 | 252 | 'data' => $data_atts, |
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | - if ( ! empty( $user_id ) ) { |
|
| 256 | - $userdata = get_userdata( $user_id ); |
|
| 255 | + if ( ! empty($user_id)) { |
|
| 256 | + $userdata = get_userdata($user_id); |
|
| 257 | 257 | $user_args['selected'] = $user_id; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - echo Give()->html->ajax_user_search( $user_args ); |
|
| 260 | + echo Give()->html->ajax_user_search($user_args); |
|
| 261 | 261 | ?> |
| 262 | 262 | </span> |
| 263 | 263 | |
| 264 | 264 | <span class="customer-user-id info-item editable"> |
| 265 | - <?php if ( !empty( $userdata ) ) { ?> |
|
| 266 | - <span data-key="user_id">#<?php echo $customer->user_id . ' - ' . $userdata->display_name; ?></span> |
|
| 265 | + <?php if ( ! empty($userdata)) { ?> |
|
| 266 | + <span data-key="user_id">#<?php echo $customer->user_id.' - '.$userdata->display_name; ?></span> |
|
| 267 | 267 | <?php } else { ?> |
| 268 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
| 268 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
| 269 | 269 | <?php } ?> |
| 270 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) { ?> |
|
| 271 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
| 270 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?> |
|
| 271 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
| 272 | 272 | <?php } ?> |
| 273 | 273 | </span> |
| 274 | 274 | </td> |
| 275 | 275 | </tr> |
| 276 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
| 276 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
| 277 | 277 | |
| 278 | 278 | <tr> |
| 279 | - <th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th> |
|
| 279 | + <th scope="col"><?php esc_html_e('Address:', 'give'); ?></th> |
|
| 280 | 280 | <td class="row-title"> |
| 281 | 281 | |
| 282 | 282 | <div class="customer-address-wrapper"> |
| 283 | 283 | |
| 284 | 284 | <?php |
| 285 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
| 285 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
| 286 | 286 | $defaults = array( |
| 287 | 287 | 'line1' => '', |
| 288 | 288 | 'line2' => '', |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | 'zip' => '', |
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | - $address = wp_parse_args( $address, $defaults ); |
|
| 295 | + $address = wp_parse_args($address, $defaults); |
|
| 296 | 296 | ?> |
| 297 | 297 | |
| 298 | - <?php if ( ! empty( $address ) ) { ?> |
|
| 298 | + <?php if ( ! empty($address)) { ?> |
|
| 299 | 299 | <span class="customer-address info-item editable"> |
| 300 | 300 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
| 301 | 301 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -306,43 +306,43 @@ discard block |
||
| 306 | 306 | </span> |
| 307 | 307 | <?php } ?> |
| 308 | 308 | <span class="customer-address info-item edit-item"> |
| 309 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 310 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 311 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 309 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 310 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 311 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 312 | 312 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
| 313 | 313 | <?php |
| 314 | 314 | |
| 315 | 315 | $selected_country = $address['country']; |
| 316 | 316 | |
| 317 | 317 | $countries = give_get_country_list(); |
| 318 | - foreach ( $countries as $country_code => $country ) { |
|
| 319 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 318 | + foreach ($countries as $country_code => $country) { |
|
| 319 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 320 | 320 | } |
| 321 | 321 | ?> |
| 322 | 322 | </select> |
| 323 | 323 | <?php |
| 324 | 324 | $selected_state = give_get_state(); |
| 325 | - $states = give_get_states( $selected_country ); |
|
| 325 | + $states = give_get_states($selected_country); |
|
| 326 | 326 | |
| 327 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
| 327 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
| 328 | 328 | |
| 329 | - if ( ! empty( $states ) ) { |
|
| 329 | + if ( ! empty($states)) { |
|
| 330 | 330 | ?> |
| 331 | 331 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
| 332 | 332 | <?php |
| 333 | - foreach ( $states as $state_code => $state ) { |
|
| 334 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 333 | + foreach ($states as $state_code => $state) { |
|
| 334 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 335 | 335 | } |
| 336 | 336 | ?> |
| 337 | 337 | </select> |
| 338 | 338 | <?php |
| 339 | 339 | } else { |
| 340 | 340 | ?> |
| 341 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
| 341 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
| 342 | 342 | <?php |
| 343 | 343 | } |
| 344 | 344 | ?> |
| 345 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 345 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 346 | 346 | </span> |
| 347 | 347 | |
| 348 | 348 | </div> |
@@ -358,10 +358,10 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | <span id="customer-edit-actions" class="edit-item"> |
| 360 | 360 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
| 361 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
| 361 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
| 362 | 362 | <input type="hidden" name="give_action" value="edit-customer" /> |
| 363 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
| 364 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 363 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
| 364 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 365 | 365 | </span> |
| 366 | 366 | |
| 367 | 367 | </form> |
@@ -376,24 +376,24 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @param object $customer The customer object being displayed. |
| 378 | 378 | */ |
| 379 | - do_action( 'give_donor_before_stats', $customer ); |
|
| 379 | + do_action('give_donor_before_stats', $customer); |
|
| 380 | 380 | ?> |
| 381 | 381 | |
| 382 | 382 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
| 383 | 383 | <ul> |
| 384 | 384 | <li> |
| 385 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
| 385 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
| 386 | 386 | <span class="dashicons dashicons-heart"></span> |
| 387 | 387 | <?php |
| 388 | 388 | // Completed Donations |
| 389 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
| 390 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
| 389 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
| 390 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
| 391 | 391 | ?> |
| 392 | 392 | </a> |
| 393 | 393 | </li> |
| 394 | 394 | <li> |
| 395 | 395 | <span class="dashicons dashicons-chart-area"></span> |
| 396 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
| 396 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
| 397 | 397 | </li> |
| 398 | 398 | <?php |
| 399 | 399 | /** |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @param object $customer The customer object being displayed. |
| 407 | 407 | */ |
| 408 | - do_action( 'give_donor_stats_list', $customer ); |
|
| 408 | + do_action('give_donor_stats_list', $customer); |
|
| 409 | 409 | ?> |
| 410 | 410 | </ul> |
| 411 | 411 | </div> |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | * |
| 419 | 419 | * @param object $customer The customer object being displayed. |
| 420 | 420 | */ |
| 421 | - do_action( 'give_donor_before_tables_wrapper', $customer ); |
|
| 421 | + do_action('give_donor_before_tables_wrapper', $customer); |
|
| 422 | 422 | ?> |
| 423 | 423 | |
| 424 | 424 | <div id="customer-tables-wrapper" class="customer-section"> |
@@ -431,46 +431,46 @@ discard block |
||
| 431 | 431 | * |
| 432 | 432 | * @param object $customer The customer object being displayed. |
| 433 | 433 | */ |
| 434 | - do_action( 'give_donor_before_tables', $customer ); |
|
| 434 | + do_action('give_donor_before_tables', $customer); |
|
| 435 | 435 | ?> |
| 436 | 436 | |
| 437 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
| 437 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
| 438 | 438 | |
| 439 | 439 | <table class="wp-list-table widefat striped emails"> |
| 440 | 440 | <thead> |
| 441 | 441 | <tr> |
| 442 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
| 443 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
| 442 | + <th><?php _e('Email', 'give'); ?></th> |
|
| 443 | + <th><?php _e('Actions', 'give'); ?></th> |
|
| 444 | 444 | </tr> |
| 445 | 445 | </thead> |
| 446 | 446 | |
| 447 | 447 | <tbody> |
| 448 | - <?php if ( ! empty( $customer->emails ) ) { ?> |
|
| 448 | + <?php if ( ! empty($customer->emails)) { ?> |
|
| 449 | 449 | |
| 450 | - <?php foreach ( $customer->emails as $key => $email ) : ?> |
|
| 450 | + <?php foreach ($customer->emails as $key => $email) : ?> |
|
| 451 | 451 | <tr data-key="<?php echo $key; ?>"> |
| 452 | 452 | <td> |
| 453 | 453 | <?php echo $email; ?> |
| 454 | - <?php if ( 'primary' === $key ) : ?> |
|
| 454 | + <?php if ('primary' === $key) : ?> |
|
| 455 | 455 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
| 456 | 456 | <?php endif; ?> |
| 457 | 457 | </td> |
| 458 | 458 | <td> |
| 459 | - <?php if ( 'primary' !== $key ) : ?> |
|
| 459 | + <?php if ('primary' !== $key) : ?> |
|
| 460 | 460 | <?php |
| 461 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); |
|
| 462 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
| 463 | - 'email' => rawurlencode( $email ), |
|
| 461 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); |
|
| 462 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
| 463 | + 'email' => rawurlencode($email), |
|
| 464 | 464 | 'give_action' => 'set_donor_primary_email', |
| 465 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
| 466 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
| 467 | - 'email' => rawurlencode( $email ), |
|
| 465 | + ), $base_url), 'give-set-donor-primary-email'); |
|
| 466 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
| 467 | + 'email' => rawurlencode($email), |
|
| 468 | 468 | 'give_action' => 'remove_donor_email', |
| 469 | - ), $base_url ), 'give-remove-donor-email' ); |
|
| 469 | + ), $base_url), 'give-remove-donor-email'); |
|
| 470 | 470 | ?> |
| 471 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
| 471 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
| 472 | 472 | | |
| 473 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
| 473 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
| 474 | 474 | <?php endif; ?> |
| 475 | 475 | </td> |
| 476 | 476 | </tr> |
@@ -480,59 +480,59 @@ discard block |
||
| 480 | 480 | <td colspan="2" class="add-customer-email-td"> |
| 481 | 481 | <div class="add-customer-email-wrapper"> |
| 482 | 482 | <input type="hidden" name="customer-id" value="<?php echo $customer->id; ?>" /> |
| 483 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
| 484 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
| 485 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
| 486 | - <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
| 483 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
| 484 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
| 485 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
| 486 | + <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e('Add Email', 'give'); ?></button> |
|
| 487 | 487 | <span class="spinner"></span> |
| 488 | 488 | </div> |
| 489 | 489 | <div class="notice-wrap"></div> |
| 490 | 490 | </td> |
| 491 | 491 | </tr> |
| 492 | 492 | <?php } else { ?> |
| 493 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'easy-digital-downloads' ); ?></td></tr> |
|
| 493 | + <tr><td colspan="2"><?php _e('No Emails Found', 'easy-digital-downloads'); ?></td></tr> |
|
| 494 | 494 | <?php }// End if(). |
| 495 | 495 | ?> |
| 496 | 496 | </tbody> |
| 497 | 497 | </table> |
| 498 | 498 | |
| 499 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
| 499 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
| 500 | 500 | <?php |
| 501 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
| 502 | - $payments = give_get_payments( array( |
|
| 501 | + $payment_ids = explode(',', $customer->payment_ids); |
|
| 502 | + $payments = give_get_payments(array( |
|
| 503 | 503 | 'post__in' => $payment_ids, |
| 504 | - ) ); |
|
| 505 | - $payments = array_slice( $payments, 0, 10 ); |
|
| 504 | + )); |
|
| 505 | + $payments = array_slice($payments, 0, 10); |
|
| 506 | 506 | ?> |
| 507 | 507 | <table class="wp-list-table widefat striped payments"> |
| 508 | 508 | <thead> |
| 509 | 509 | <tr> |
| 510 | - <th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
| 511 | - <th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
| 512 | - <th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
| 513 | - <th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
| 514 | - <th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
| 510 | + <th scope="col"><?php esc_html_e('ID', 'give'); ?></th> |
|
| 511 | + <th scope="col"><?php esc_html_e('Amount', 'give'); ?></th> |
|
| 512 | + <th scope="col"><?php esc_html_e('Date', 'give'); ?></th> |
|
| 513 | + <th scope="col"><?php esc_html_e('Status', 'give'); ?></th> |
|
| 514 | + <th scope="col"><?php esc_html_e('Actions', 'give'); ?></th> |
|
| 515 | 515 | </tr> |
| 516 | 516 | </thead> |
| 517 | 517 | <tbody> |
| 518 | - <?php if ( ! empty( $payments ) ) { ?> |
|
| 519 | - <?php foreach ( $payments as $payment ) : ?> |
|
| 518 | + <?php if ( ! empty($payments)) { ?> |
|
| 519 | + <?php foreach ($payments as $payment) : ?> |
|
| 520 | 520 | <tr> |
| 521 | 521 | <td><?php echo $payment->ID; ?></td> |
| 522 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
| 523 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
| 524 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
| 522 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
| 523 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
| 524 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
| 525 | 525 | <td> |
| 526 | 526 | <?php |
| 527 | 527 | printf( |
| 528 | 528 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 529 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ), |
|
| 529 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID), |
|
| 530 | 530 | sprintf( |
| 531 | 531 | /* translators: %s: Donation ID */ |
| 532 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
| 532 | + esc_attr__('View Donation %s.', 'give'), |
|
| 533 | 533 | $payment->ID |
| 534 | 534 | ), |
| 535 | - esc_html__( 'View Donation', 'give' ) |
|
| 535 | + esc_html__('View Donation', 'give') |
|
| 536 | 536 | ); |
| 537 | 537 | ?> |
| 538 | 538 | |
@@ -547,47 +547,47 @@ discard block |
||
| 547 | 547 | * @param object $customer The customer object being displayed. |
| 548 | 548 | * @param object $payment The payment object being displayed. |
| 549 | 549 | */ |
| 550 | - do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); |
|
| 550 | + do_action('give_donor_recent_purchases_actions', $customer, $payment); |
|
| 551 | 551 | ?> |
| 552 | 552 | </td> |
| 553 | 553 | </tr> |
| 554 | 554 | <?php endforeach; ?> |
| 555 | 555 | <?php } else { ?> |
| 556 | 556 | <tr> |
| 557 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
| 557 | + <td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td> |
|
| 558 | 558 | </tr> |
| 559 | 559 | <?php }// End if(). |
| 560 | 560 | ?> |
| 561 | 561 | </tbody> |
| 562 | 562 | </table> |
| 563 | 563 | |
| 564 | - <h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3> |
|
| 564 | + <h3><?php esc_html_e('Completed Forms', 'give'); ?></h3> |
|
| 565 | 565 | <?php |
| 566 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
| 566 | + $donations = give_get_users_completed_donations($customer->email); |
|
| 567 | 567 | ?> |
| 568 | 568 | <table class="wp-list-table widefat striped donations"> |
| 569 | 569 | <thead> |
| 570 | 570 | <tr> |
| 571 | - <th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th> |
|
| 572 | - <th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
| 571 | + <th scope="col"><?php esc_html_e('Form', 'give'); ?></th> |
|
| 572 | + <th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
| 573 | 573 | </tr> |
| 574 | 574 | </thead> |
| 575 | 575 | <tbody> |
| 576 | - <?php if ( ! empty( $donations ) ) { ?> |
|
| 577 | - <?php foreach ( $donations as $donation ) : ?> |
|
| 576 | + <?php if ( ! empty($donations)) { ?> |
|
| 577 | + <?php foreach ($donations as $donation) : ?> |
|
| 578 | 578 | <tr> |
| 579 | 579 | <td><?php echo $donation->post_title; ?></td> |
| 580 | 580 | <td> |
| 581 | 581 | <?php |
| 582 | 582 | printf( |
| 583 | 583 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 584 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
| 584 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
| 585 | 585 | sprintf( |
| 586 | 586 | /* translators: %s: form name */ |
| 587 | - esc_attr__( 'View Form %s.', 'give' ), |
|
| 587 | + esc_attr__('View Form %s.', 'give'), |
|
| 588 | 588 | $donation->post_title |
| 589 | 589 | ), |
| 590 | - esc_html__( 'View Form', 'give' ) |
|
| 590 | + esc_html__('View Form', 'give') |
|
| 591 | 591 | ); |
| 592 | 592 | ?> |
| 593 | 593 | </td> |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | <?php endforeach; ?> |
| 596 | 596 | <?php } else { ?> |
| 597 | 597 | <tr> |
| 598 | - <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td> |
|
| 598 | + <td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td> |
|
| 599 | 599 | </tr> |
| 600 | 600 | <?php } ?> |
| 601 | 601 | </tbody> |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | * |
| 610 | 610 | * @param object $customer The customer object being displayed. |
| 611 | 611 | */ |
| 612 | - do_action( 'give_donor_after_tables', $customer ); |
|
| 612 | + do_action('give_donor_after_tables', $customer); |
|
| 613 | 613 | ?> |
| 614 | 614 | |
| 615 | 615 | </div> |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @param object $customer The customer object being displayed. |
| 624 | 624 | */ |
| 625 | - do_action( 'give_donor_card_bottom', $customer ); |
|
| 625 | + do_action('give_donor_card_bottom', $customer); |
|
| 626 | 626 | |
| 627 | 627 | } |
| 628 | 628 | |
@@ -635,30 +635,30 @@ discard block |
||
| 635 | 635 | * |
| 636 | 636 | * @return void |
| 637 | 637 | */ |
| 638 | -function give_customer_notes_view( $customer ) { |
|
| 638 | +function give_customer_notes_view($customer) { |
|
| 639 | 639 | |
| 640 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
| 641 | - $paged = absint( $paged ); |
|
| 640 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
| 641 | + $paged = absint($paged); |
|
| 642 | 642 | $note_count = $customer->get_notes_count(); |
| 643 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
| 644 | - $total_pages = ceil( $note_count / $per_page ); |
|
| 645 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
| 643 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
| 644 | + $total_pages = ceil($note_count / $per_page); |
|
| 645 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
| 646 | 646 | ?> |
| 647 | 647 | |
| 648 | 648 | <div id="customer-notes-wrapper"> |
| 649 | 649 | <div class="customer-notes-header"> |
| 650 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
| 650 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
| 651 | 651 | </div> |
| 652 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
| 652 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
| 653 | 653 | |
| 654 | - <?php if ( 1 == $paged ) : ?> |
|
| 654 | + <?php if (1 == $paged) : ?> |
|
| 655 | 655 | <div style="display: block; margin-bottom: 55px;"> |
| 656 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
| 656 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
| 657 | 657 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
| 658 | 658 | <br /> |
| 659 | 659 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
| 660 | 660 | <input type="hidden" name="give_action" value="add-customer-note" /> |
| 661 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
| 661 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
| 662 | 662 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
| 663 | 663 | </form> |
| 664 | 664 | </div> |
@@ -673,26 +673,26 @@ discard block |
||
| 673 | 673 | 'show_all' => true, |
| 674 | 674 | ); |
| 675 | 675 | |
| 676 | - echo paginate_links( $pagination_args ); |
|
| 676 | + echo paginate_links($pagination_args); |
|
| 677 | 677 | ?> |
| 678 | 678 | |
| 679 | 679 | <div id="give-customer-notes" class="postbox"> |
| 680 | - <?php if ( count( $customer_notes ) > 0 ) { ?> |
|
| 681 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
| 680 | + <?php if (count($customer_notes) > 0) { ?> |
|
| 681 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
| 682 | 682 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
| 683 | 683 | <span class="note-content-wrap"> |
| 684 | - <?php echo stripslashes( $note ); ?> |
|
| 684 | + <?php echo stripslashes($note); ?> |
|
| 685 | 685 | </span> |
| 686 | 686 | </div> |
| 687 | 687 | <?php endforeach; ?> |
| 688 | 688 | <?php } else { ?> |
| 689 | 689 | <div class="give-no-customer-notes"> |
| 690 | - <?php esc_html_e( 'No donor notes found.', 'give' ); ?> |
|
| 690 | + <?php esc_html_e('No donor notes found.', 'give'); ?> |
|
| 691 | 691 | </div> |
| 692 | 692 | <?php } ?> |
| 693 | 693 | </div> |
| 694 | 694 | |
| 695 | - <?php echo paginate_links( $pagination_args ); ?> |
|
| 695 | + <?php echo paginate_links($pagination_args); ?> |
|
| 696 | 696 | |
| 697 | 697 | </div> |
| 698 | 698 | |
@@ -708,9 +708,9 @@ discard block |
||
| 708 | 708 | * |
| 709 | 709 | * @return void |
| 710 | 710 | */ |
| 711 | -function give_customers_delete_view( $customer ) { |
|
| 711 | +function give_customers_delete_view($customer) { |
|
| 712 | 712 | |
| 713 | - $customer_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 713 | + $customer_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 714 | 714 | |
| 715 | 715 | /** |
| 716 | 716 | * Fires in donor delete screen, above the content. |
@@ -719,15 +719,15 @@ discard block |
||
| 719 | 719 | * |
| 720 | 720 | * @param object $customer The customer object being displayed. |
| 721 | 721 | */ |
| 722 | - do_action( 'give_customer_delete_top', $customer ); |
|
| 722 | + do_action('give_customer_delete_top', $customer); |
|
| 723 | 723 | ?> |
| 724 | 724 | |
| 725 | 725 | <div class="info-wrapper customer-section"> |
| 726 | 726 | |
| 727 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
| 727 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
| 728 | 728 | |
| 729 | 729 | <div class="customer-notes-header"> |
| 730 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
| 730 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
| 731 | 731 | </div> |
| 732 | 732 | |
| 733 | 733 | |
@@ -735,20 +735,20 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | <span class="delete-customer-options"> |
| 737 | 737 | <p> |
| 738 | - <?php echo Give()->html->checkbox( array( |
|
| 738 | + <?php echo Give()->html->checkbox(array( |
|
| 739 | 739 | 'name' => 'give-customer-delete-confirm', |
| 740 | - ) ); ?> |
|
| 741 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
| 740 | + )); ?> |
|
| 741 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
| 742 | 742 | </p> |
| 743 | 743 | |
| 744 | 744 | <p> |
| 745 | - <?php echo Give()->html->checkbox( array( |
|
| 745 | + <?php echo Give()->html->checkbox(array( |
|
| 746 | 746 | 'name' => 'give-customer-delete-records', |
| 747 | 747 | 'options' => array( |
| 748 | 748 | 'disabled' => true, |
| 749 | 749 | ), |
| 750 | - ) ); ?> |
|
| 751 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
| 750 | + )); ?> |
|
| 751 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label> |
|
| 752 | 752 | </p> |
| 753 | 753 | |
| 754 | 754 | <?php |
@@ -761,16 +761,16 @@ discard block |
||
| 761 | 761 | * |
| 762 | 762 | * @param object $customer The customer object being displayed. |
| 763 | 763 | */ |
| 764 | - do_action( 'give_customer_delete_inputs', $customer ); |
|
| 764 | + do_action('give_customer_delete_inputs', $customer); |
|
| 765 | 765 | ?> |
| 766 | 766 | </span> |
| 767 | 767 | |
| 768 | 768 | <span id="customer-edit-actions"> |
| 769 | 769 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
| 770 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
| 770 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
| 771 | 771 | <input type="hidden" name="give_action" value="delete-customer" /> |
| 772 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
| 773 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 772 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
| 773 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 774 | 774 | </span> |
| 775 | 775 | |
| 776 | 776 | </div> |
@@ -786,5 +786,5 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @param object $customer The customer object being displayed. |
| 788 | 788 | */ |
| 789 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
| 789 | + do_action('give_customer_delete_bottom', $customer); |
|
| 790 | 790 | } |
@@ -539,23 +539,23 @@ |
||
| 539 | 539 | public function get_donor( $payment ) { |
| 540 | 540 | |
| 541 | 541 | $donor_id = give_get_payment_customer_id( $payment->ID ); |
| 542 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation'); |
|
| 543 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor'); |
|
| 542 | + $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation'); |
|
| 543 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor'); |
|
| 544 | 544 | |
| 545 | - $value = ''; |
|
| 545 | + $value = ''; |
|
| 546 | 546 | if ( ! empty( $donor_id ) ) { |
| 547 | 547 | |
| 548 | - // Check whether the donor name and WP_User name is same or not. |
|
| 549 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 550 | - $value .= $donor_billing_name . ' ('; |
|
| 551 | - } |
|
| 548 | + // Check whether the donor name and WP_User name is same or not. |
|
| 549 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 550 | + $value .= $donor_billing_name . ' ('; |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | 553 | $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
| 554 | 554 | |
| 555 | - // Check whether the donor name and WP_User name is same or not. |
|
| 556 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 557 | - $value .= ')'; |
|
| 558 | - } |
|
| 555 | + // Check whether the donor name and WP_User name is same or not. |
|
| 556 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 557 | + $value .= ')'; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | 560 | } else { |
| 561 | 561 | $email = give_get_payment_user_email( $payment->ID ); |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded. |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | public function __construct() { |
| 119 | 119 | |
| 120 | 120 | // Set parent defaults. |
| 121 | - parent::__construct( array( |
|
| 122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | - 'ajax' => false, // Does this table support ajax? |
|
| 125 | - ) ); |
|
| 121 | + parent::__construct(array( |
|
| 122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | + 'ajax' => false, // Does this table support ajax? |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $this->get_payment_counts(); |
| 128 | 128 | $this->process_bulk_action(); |
| 129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -135,29 +135,29 @@ discard block |
||
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | 137 | public function advanced_filters() { |
| 138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 141 | 141 | ?> |
| 142 | 142 | <div id="give-payment-filters"> |
| 143 | 143 | <span id="give-payment-date-filters"> |
| 144 | 144 | <label for="start-date" |
| 145 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 145 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 146 | 146 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
| 147 | 147 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
| 148 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 148 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 149 | 149 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
| 150 | 150 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
| 151 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
| 151 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
| 152 | 152 | </span> |
| 153 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 154 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
| 153 | + <?php if ( ! empty($status)) : ?> |
|
| 154 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
| 155 | 155 | <?php endif; ?> |
| 156 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
| 157 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
| 158 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
| 156 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
| 157 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
| 158 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
| 159 | 159 | <?php endif; ?> |
| 160 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 160 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 161 | 161 | </div> |
| 162 | 162 | |
| 163 | 163 | <?php |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | - public function search_box( $text, $input_id ) { |
|
| 178 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 177 | + public function search_box($text, $input_id) { |
|
| 178 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $input_id = $input_id . '-search-input'; |
|
| 182 | + $input_id = $input_id.'-search-input'; |
|
| 183 | 183 | |
| 184 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 185 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 184 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 185 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 186 | 186 | } |
| 187 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 188 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 187 | + if ( ! empty($_REQUEST['order'])) { |
|
| 188 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 189 | 189 | } |
| 190 | 190 | ?> |
| 191 | 191 | <p class="search-box" role="search"> |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.7 |
| 199 | 199 | */ |
| 200 | - do_action( 'give_payment_history_search' ); |
|
| 200 | + do_action('give_payment_history_search'); |
|
| 201 | 201 | ?> |
| 202 | 202 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 203 | 203 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 204 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
| 204 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
| 205 | 205 | </p> |
| 206 | 206 | <?php |
| 207 | 207 | } |
@@ -215,52 +215,52 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function get_views() { |
| 217 | 217 | |
| 218 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 219 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 220 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 221 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 222 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 223 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 224 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 225 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 226 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 218 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 219 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 220 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 221 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 222 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 223 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 224 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 225 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 226 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 227 | 227 | |
| 228 | 228 | $views = array( |
| 229 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 229 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 230 | 230 | 'status', |
| 231 | 231 | 'paged', |
| 232 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 233 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 232 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 233 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 234 | 234 | 'status' => 'publish', |
| 235 | 235 | 'paged' => false, |
| 236 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 237 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 236 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 237 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 238 | 238 | 'status' => 'pending', |
| 239 | 239 | 'paged' => false, |
| 240 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 241 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 240 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 241 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 242 | 242 | 'status' => 'refunded', |
| 243 | 243 | 'paged' => false, |
| 244 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 245 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 244 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 245 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 246 | 246 | 'status' => 'revoked', |
| 247 | 247 | 'paged' => false, |
| 248 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 249 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 248 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 249 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 250 | 250 | 'status' => 'failed', |
| 251 | 251 | 'paged' => false, |
| 252 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 253 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 252 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 253 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 254 | 254 | 'status' => 'cancelled', |
| 255 | 255 | 'paged' => false, |
| 256 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 257 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 256 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 257 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 258 | 258 | 'status' => 'abandoned', |
| 259 | 259 | 'paged' => false, |
| 260 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
| 260 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
| 261 | 261 | ); |
| 262 | 262 | |
| 263 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 263 | + return apply_filters('give_payments_table_views', $views); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -273,15 +273,15 @@ discard block |
||
| 273 | 273 | public function get_columns() { |
| 274 | 274 | $columns = array( |
| 275 | 275 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 276 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 277 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 278 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 279 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 280 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 281 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 276 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 277 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 278 | + 'status' => esc_html__('Status', 'give'), |
|
| 279 | + 'date' => esc_html__('Date', 'give'), |
|
| 280 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 281 | + 'details' => esc_html__('Details', 'give'), |
|
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 284 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function get_sortable_columns() { |
| 295 | 295 | $columns = array( |
| 296 | - 'donation' => array( 'ID', true ), |
|
| 297 | - 'donation_form' => array( 'donation_form', false ), |
|
| 298 | - 'status' => array( 'status', false ), |
|
| 299 | - 'amount' => array( 'amount', false ), |
|
| 300 | - 'date' => array( 'date', false ), |
|
| 296 | + 'donation' => array('ID', true), |
|
| 297 | + 'donation_form' => array('donation_form', false), |
|
| 298 | + 'status' => array('status', false), |
|
| 299 | + 'amount' => array('amount', false), |
|
| 300 | + 'date' => array('date', false), |
|
| 301 | 301 | ); |
| 302 | 302 | |
| 303 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 303 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -326,70 +326,70 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return string Column Name |
| 328 | 328 | */ |
| 329 | - public function column_default( $payment, $column_name ) { |
|
| 329 | + public function column_default($payment, $column_name) { |
|
| 330 | 330 | |
| 331 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
| 332 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 331 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
| 332 | + $row_actions = $this->get_row_actions($payment); |
|
| 333 | 333 | |
| 334 | - switch ( $column_name ) { |
|
| 334 | + switch ($column_name) { |
|
| 335 | 335 | case 'donation' : |
| 336 | 336 | $value = sprintf( |
| 337 | 337 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
| 338 | 338 | $single_donation_url, |
| 339 | - sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), |
|
| 339 | + sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), |
|
| 340 | 340 | $payment->ID, |
| 341 | - esc_html__( 'by', 'give' ), |
|
| 342 | - $this->get_donor( $payment ) |
|
| 341 | + esc_html__('by', 'give'), |
|
| 342 | + $this->get_donor($payment) |
|
| 343 | 343 | ); |
| 344 | - $value .= $this->get_donor_email( $payment ); |
|
| 345 | - $value .= $this->row_actions( $row_actions ); |
|
| 344 | + $value .= $this->get_donor_email($payment); |
|
| 345 | + $value .= $this->row_actions($row_actions); |
|
| 346 | 346 | break; |
| 347 | 347 | |
| 348 | 348 | case 'amount' : |
| 349 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 350 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 351 | - $value .= sprintf( |
|
| 349 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 350 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 351 | + $value .= sprintf( |
|
| 352 | 352 | '<br><small>%1$s %2$s</small>', |
| 353 | - __( 'via', 'give' ), |
|
| 354 | - give_get_gateway_admin_label( $payment->gateway ) |
|
| 353 | + __('via', 'give'), |
|
| 354 | + give_get_gateway_admin_label($payment->gateway) |
|
| 355 | 355 | ); |
| 356 | 356 | break; |
| 357 | 357 | |
| 358 | 358 | case 'donation_form' : |
| 359 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 360 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 361 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 359 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 360 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 361 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 362 | 362 | |
| 363 | - if ( ! empty( $level ) ) { |
|
| 363 | + if ( ! empty($level)) { |
|
| 364 | 364 | $value .= $level; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'date' : |
| 370 | - $date = strtotime( $payment->date ); |
|
| 371 | - $value = date_i18n( give_date_format(), $date ); |
|
| 370 | + $date = strtotime($payment->date); |
|
| 371 | + $value = date_i18n(give_date_format(), $date); |
|
| 372 | 372 | break; |
| 373 | 373 | |
| 374 | 374 | case 'status' : |
| 375 | - $value = $this->get_payment_status( $payment ); |
|
| 375 | + $value = $this->get_payment_status($payment); |
|
| 376 | 376 | break; |
| 377 | 377 | |
| 378 | 378 | case 'details' : |
| 379 | 379 | $value = sprintf( |
| 380 | 380 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
| 381 | 381 | $single_donation_url, |
| 382 | - sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) |
|
| 382 | + sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID) |
|
| 383 | 383 | ); |
| 384 | 384 | break; |
| 385 | 385 | |
| 386 | 386 | default: |
| 387 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 387 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 388 | 388 | break; |
| 389 | 389 | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 392 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -402,17 +402,17 @@ discard block |
||
| 402 | 402 | * |
| 403 | 403 | * @return string Data shown in the Email column |
| 404 | 404 | */ |
| 405 | - public function get_donor_email( $payment ) { |
|
| 405 | + public function get_donor_email($payment) { |
|
| 406 | 406 | |
| 407 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 407 | + $email = give_get_payment_user_email($payment->ID); |
|
| 408 | 408 | |
| 409 | - if ( empty( $email ) ) { |
|
| 410 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 409 | + if (empty($email)) { |
|
| 410 | + $email = esc_html__('(unknown)', 'give'); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 413 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 414 | 414 | |
| 415 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 415 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -424,18 +424,18 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @return array $actions |
| 426 | 426 | */ |
| 427 | - function get_row_actions( $payment ) { |
|
| 427 | + function get_row_actions($payment) { |
|
| 428 | 428 | |
| 429 | 429 | $actions = array(); |
| 430 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 430 | + $email = give_get_payment_user_email($payment->ID); |
|
| 431 | 431 | |
| 432 | 432 | // Add search term string back to base URL. |
| 433 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 434 | - if ( ! empty( $search_terms ) ) { |
|
| 435 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 433 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 434 | + if ( ! empty($search_terms)) { |
|
| 435 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 438 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 439 | 439 | |
| 440 | 440 | $actions['email_links'] = sprintf( |
| 441 | 441 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | ), |
| 450 | 450 | 'give_payment_nonce' |
| 451 | 451 | ), |
| 452 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
| 453 | - esc_html__( 'Resend Receipt', 'give' ) |
|
| 452 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
| 453 | + esc_html__('Resend Receipt', 'give') |
|
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | } |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | ), |
| 468 | 468 | 'give_donation_nonce' |
| 469 | 469 | ), |
| 470 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
| 471 | - esc_html__( 'Delete', 'give' ) |
|
| 470 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
| 471 | + esc_html__('Delete', 'give') |
|
| 472 | 472 | ); |
| 473 | 473 | |
| 474 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 474 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | * |
| 486 | 486 | * @return string Data shown in the Email column |
| 487 | 487 | */ |
| 488 | - function get_payment_status( $payment ) { |
|
| 489 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 490 | - if ( $payment->mode == 'test' ) { |
|
| 491 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 488 | + function get_payment_status($payment) { |
|
| 489 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 490 | + if ($payment->mode == 'test') { |
|
| 491 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | return $value; |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * |
| 505 | 505 | * @return string Displays a checkbox. |
| 506 | 506 | */ |
| 507 | - public function column_cb( $payment ) { |
|
| 507 | + public function column_cb($payment) { |
|
| 508 | 508 | return sprintf( |
| 509 | 509 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
| 510 | 510 | 'payment', |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | * |
| 523 | 523 | * @return string Displays a checkbox. |
| 524 | 524 | */ |
| 525 | - public function get_payment_id( $payment ) { |
|
| 526 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 525 | + public function get_payment_id($payment) { |
|
| 526 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -536,33 +536,33 @@ discard block |
||
| 536 | 536 | * |
| 537 | 537 | * @return string Data shown in the User column |
| 538 | 538 | */ |
| 539 | - public function get_donor( $payment ) { |
|
| 539 | + public function get_donor($payment) { |
|
| 540 | 540 | |
| 541 | - $donor_id = give_get_payment_customer_id( $payment->ID ); |
|
| 542 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation'); |
|
| 543 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor'); |
|
| 541 | + $donor_id = give_get_payment_customer_id($payment->ID); |
|
| 542 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
| 543 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 544 | 544 | |
| 545 | 545 | $value = ''; |
| 546 | - if ( ! empty( $donor_id ) ) { |
|
| 546 | + if ( ! empty($donor_id)) { |
|
| 547 | 547 | |
| 548 | 548 | // Check whether the donor name and WP_User name is same or not. |
| 549 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 550 | - $value .= $donor_billing_name . ' ('; |
|
| 549 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 550 | + $value .= $donor_billing_name.' ('; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
| 553 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
| 554 | 554 | |
| 555 | 555 | // Check whether the donor name and WP_User name is same or not. |
| 556 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 557 | - $value .= ')'; |
|
| 556 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 557 | + $value .= ')'; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | } else { |
| 561 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 562 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
| 561 | + $email = give_get_payment_user_email($payment->ID); |
|
| 562 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 565 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | /** |
@@ -574,18 +574,18 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | public function get_bulk_actions() { |
| 576 | 576 | $actions = array( |
| 577 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
| 578 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
| 579 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
| 580 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
| 581 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
| 582 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
| 583 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
| 584 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
| 585 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
| 577 | + 'delete' => esc_html__('Delete', 'give'), |
|
| 578 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
| 579 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
| 580 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
| 581 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
| 582 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
| 583 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
| 584 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
| 585 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
| 586 | 586 | ); |
| 587 | 587 | |
| 588 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 588 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
@@ -596,59 +596,59 @@ discard block |
||
| 596 | 596 | * @return void |
| 597 | 597 | */ |
| 598 | 598 | public function process_bulk_action() { |
| 599 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 599 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 600 | 600 | $action = $this->current_action(); |
| 601 | 601 | |
| 602 | - if ( ! is_array( $ids ) ) { |
|
| 603 | - $ids = array( $ids ); |
|
| 602 | + if ( ! is_array($ids)) { |
|
| 603 | + $ids = array($ids); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - if ( empty( $action ) ) { |
|
| 606 | + if (empty($action)) { |
|
| 607 | 607 | return; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - foreach ( $ids as $id ) { |
|
| 610 | + foreach ($ids as $id) { |
|
| 611 | 611 | |
| 612 | 612 | // Detect when a bulk action is being triggered. |
| 613 | - switch ( $this->current_action() ) { |
|
| 613 | + switch ($this->current_action()) { |
|
| 614 | 614 | |
| 615 | 615 | case'delete': |
| 616 | - give_delete_purchase( $id ); |
|
| 616 | + give_delete_purchase($id); |
|
| 617 | 617 | break; |
| 618 | 618 | |
| 619 | 619 | case 'set-status-publish': |
| 620 | - give_update_payment_status( $id, 'publish' ); |
|
| 620 | + give_update_payment_status($id, 'publish'); |
|
| 621 | 621 | break; |
| 622 | 622 | |
| 623 | 623 | case 'set-status-pending': |
| 624 | - give_update_payment_status( $id, 'pending' ); |
|
| 624 | + give_update_payment_status($id, 'pending'); |
|
| 625 | 625 | break; |
| 626 | 626 | |
| 627 | 627 | case 'set-status-refunded': |
| 628 | - give_update_payment_status( $id, 'refunded' ); |
|
| 628 | + give_update_payment_status($id, 'refunded'); |
|
| 629 | 629 | break; |
| 630 | 630 | case 'set-status-revoked': |
| 631 | - give_update_payment_status( $id, 'revoked' ); |
|
| 631 | + give_update_payment_status($id, 'revoked'); |
|
| 632 | 632 | break; |
| 633 | 633 | |
| 634 | 634 | case 'set-status-failed': |
| 635 | - give_update_payment_status( $id, 'failed' ); |
|
| 635 | + give_update_payment_status($id, 'failed'); |
|
| 636 | 636 | break; |
| 637 | 637 | |
| 638 | 638 | case 'set-status-cancelled': |
| 639 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 639 | + give_update_payment_status($id, 'cancelled'); |
|
| 640 | 640 | break; |
| 641 | 641 | |
| 642 | 642 | case 'set-status-abandoned': |
| 643 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 643 | + give_update_payment_status($id, 'abandoned'); |
|
| 644 | 644 | break; |
| 645 | 645 | |
| 646 | 646 | case 'set-status-preapproval': |
| 647 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 647 | + give_update_payment_status($id, 'preapproval'); |
|
| 648 | 648 | break; |
| 649 | 649 | |
| 650 | 650 | case 'resend-receipt': |
| 651 | - give_email_donation_receipt( $id, false ); |
|
| 651 | + give_email_donation_receipt($id, false); |
|
| 652 | 652 | break; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | * @param int $id The ID of the payment. |
| 661 | 661 | * @param string $current_action The action that is being triggered. |
| 662 | 662 | */ |
| 663 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 663 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | } |
@@ -676,27 +676,27 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $args = array(); |
| 678 | 678 | |
| 679 | - if ( isset( $_GET['user'] ) ) { |
|
| 680 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 681 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 682 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 683 | - if ( $is_user ) { |
|
| 684 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 685 | - unset( $args['s'] ); |
|
| 679 | + if (isset($_GET['user'])) { |
|
| 680 | + $args['user'] = urldecode($_GET['user']); |
|
| 681 | + } elseif (isset($_GET['s'])) { |
|
| 682 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 683 | + if ($is_user) { |
|
| 684 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 685 | + unset($args['s']); |
|
| 686 | 686 | } else { |
| 687 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 687 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 692 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 691 | + if ( ! empty($_GET['start-date'])) { |
|
| 692 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 696 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 695 | + if ( ! empty($_GET['end-date'])) { |
|
| 696 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - $payment_count = give_count_payments( $args ); |
|
| 699 | + $payment_count = give_count_payments($args); |
|
| 700 | 700 | $this->complete_count = $payment_count->publish; |
| 701 | 701 | $this->pending_count = $payment_count->pending; |
| 702 | 702 | $this->refunded_count = $payment_count->refunded; |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | $this->cancelled_count = $payment_count->cancelled; |
| 706 | 706 | $this->abandoned_count = $payment_count->abandoned; |
| 707 | 707 | |
| 708 | - foreach ( $payment_count as $count ) { |
|
| 708 | + foreach ($payment_count as $count) { |
|
| 709 | 709 | $this->total_count += $count; |
| 710 | 710 | } |
| 711 | 711 | } |
@@ -720,26 +720,26 @@ discard block |
||
| 720 | 720 | public function payments_data() { |
| 721 | 721 | |
| 722 | 722 | $per_page = $this->per_page; |
| 723 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 724 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 725 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 726 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 727 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 728 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 729 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 730 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 731 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 732 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 733 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 734 | - |
|
| 735 | - if ( ! empty( $search ) ) { |
|
| 723 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 724 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 725 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 726 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 727 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 728 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 729 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 730 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 731 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 732 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 733 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 734 | + |
|
| 735 | + if ( ! empty($search)) { |
|
| 736 | 736 | $status = 'any'; // Force all payment statuses when searching. |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | $args = array( |
| 740 | 740 | 'output' => 'payments', |
| 741 | 741 | 'number' => $per_page, |
| 742 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 742 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 743 | 743 | 'orderby' => $orderby, |
| 744 | 744 | 'order' => $order, |
| 745 | 745 | 'user' => $user, |
@@ -753,12 +753,12 @@ discard block |
||
| 753 | 753 | 'end_date' => $end_date, |
| 754 | 754 | ); |
| 755 | 755 | |
| 756 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 756 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 757 | 757 | $args['search_in_notes'] = true; |
| 758 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 758 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - $p_query = new Give_Payments_Query( $args ); |
|
| 761 | + $p_query = new Give_Payments_Query($args); |
|
| 762 | 762 | |
| 763 | 763 | return $p_query->get_payments(); |
| 764 | 764 | |
@@ -778,17 +778,17 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | public function prepare_items() { |
| 780 | 780 | |
| 781 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 781 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 782 | 782 | |
| 783 | 783 | $columns = $this->get_columns(); |
| 784 | 784 | $hidden = array(); // No hidden columns. |
| 785 | 785 | $sortable = $this->get_sortable_columns(); |
| 786 | 786 | $data = $this->payments_data(); |
| 787 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 787 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 788 | 788 | |
| 789 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 789 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 790 | 790 | |
| 791 | - switch ( $status ) { |
|
| 791 | + switch ($status) { |
|
| 792 | 792 | case 'publish': |
| 793 | 793 | $total_items = $this->complete_count; |
| 794 | 794 | break; |
@@ -815,19 +815,19 @@ discard block |
||
| 815 | 815 | break; |
| 816 | 816 | default: |
| 817 | 817 | // Retrieve the count of the non-default-Give status. |
| 818 | - $count = wp_count_posts( 'give_payment' ); |
|
| 819 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
| 818 | + $count = wp_count_posts('give_payment'); |
|
| 819 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
| 820 | 820 | break; |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | $this->items = $data; |
| 824 | 824 | |
| 825 | - $this->set_pagination_args( array( |
|
| 825 | + $this->set_pagination_args(array( |
|
| 826 | 826 | 'total_items' => $total_items, |
| 827 | 827 | // We have to calculate the total number of items. |
| 828 | 828 | 'per_page' => $this->per_page, |
| 829 | 829 | // We have to determine how many items to show on a page. |
| 830 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 830 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 831 | 831 | // We have to calculate the total number of pages. |
| 832 | 832 | ) |
| 833 | 833 | ); |
@@ -514,16 +514,16 @@ |
||
| 514 | 514 | <p> |
| 515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
| 516 | 516 | <?php |
| 517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 519 | - |
|
| 520 | - // Check whether the donor name and WP_User name is same or not. |
|
| 521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 522 | - 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>)'; |
|
| 523 | - }else{ |
|
| 524 | - echo $donor_name; |
|
| 525 | - } |
|
| 526 | - ?> |
|
| 517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 519 | + |
|
| 520 | + // Check whether the donor name and WP_User name is same or not. |
|
| 521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 522 | + 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>)'; |
|
| 523 | + }else{ |
|
| 524 | + echo $donor_name; |
|
| 525 | + } |
|
| 526 | + ?> |
|
| 527 | 527 | </p> |
| 528 | 528 | <p> |
| 529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Setup the variables |
| 28 | -$payment_id = absint( $_GET['id'] ); |
|
| 29 | -$payment = new Give_Payment( $payment_id ); |
|
| 28 | +$payment_id = absint($_GET['id']); |
|
| 29 | +$payment = new Give_Payment($payment_id); |
|
| 30 | 30 | |
| 31 | 31 | // Sanity check... fail if donation ID is invalid |
| 32 | 32 | $payment_exists = $payment->ID; |
| 33 | -if ( empty( $payment_exists ) ) { |
|
| 34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 33 | +if (empty($payment_exists)) { |
|
| 34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $number = $payment->number; |
| 38 | 38 | $payment_meta = $payment->get_meta(); |
| 39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 40 | 40 | $user_id = $payment->user_id; |
| 41 | 41 | $donor_id = $payment->customer_id; |
| 42 | -$payment_date = strtotime( $payment->date ); |
|
| 43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 42 | +$payment_date = strtotime($payment->date); |
|
| 43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 44 | 44 | $address = $payment->address; |
| 45 | 45 | $currency_code = $payment->currency; |
| 46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | <h1 id="transaction-details-heading"><?php |
| 53 | 53 | printf( |
| 54 | 54 | /* translators: %s: donation number */ |
| 55 | - esc_html__( 'Donation %s', 'give' ), |
|
| 55 | + esc_html__('Donation %s', 'give'), |
|
| 56 | 56 | $number |
| 57 | 57 | ); |
| 58 | - if ( $payment_mode == 'test' ) { |
|
| 59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
| 58 | + if ($payment_mode == 'test') { |
|
| 59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
| 60 | 60 | } |
| 61 | 61 | ?></h1> |
| 62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param int $payment_id Payment id. |
| 70 | 70 | */ |
| 71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
| 71 | + do_action('give_view_order_details_before', $payment_id); |
|
| 72 | 72 | ?> |
| 73 | 73 | <form id="give-edit-order-form" method="post"> |
| 74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param int $payment_id Payment id. |
| 81 | 81 | */ |
| 82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
| 82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
| 83 | 83 | ?> |
| 84 | 84 | <div id="poststuff"> |
| 85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @param int $payment_id Payment id. |
| 97 | 97 | */ |
| 98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
| 98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
| 99 | 99 | ?> |
| 100 | 100 | |
| 101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
| 102 | 102 | |
| 103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
| 103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
| 104 | 104 | |
| 105 | 105 | <div class="inside"> |
| 106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param int $payment_id Payment id. |
| 115 | 115 | */ |
| 116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
| 116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
| 117 | 117 | ?> |
| 118 | 118 | |
| 119 | 119 | <div class="give-admin-box-inside"> |
| 120 | 120 | <p> |
| 121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 125 | 125 | <?php endforeach; ?> |
| 126 | 126 | </select> |
| 127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 128 | 128 | </p> |
| 129 | 129 | </div> |
| 130 | 130 | |
| 131 | 131 | <div class="give-admin-box-inside"> |
| 132 | 132 | <p> |
| 133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 134 | - <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"/> |
|
| 133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 134 | + <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"/> |
|
| 135 | 135 | </p> |
| 136 | 136 | </div> |
| 137 | 137 | |
| 138 | 138 | <div class="give-admin-box-inside"> |
| 139 | 139 | <p> |
| 140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 141 | - <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"/> : |
|
| 142 | - <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"/> |
|
| 140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 141 | + <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"/> : |
|
| 142 | + <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"/> |
|
| 143 | 143 | </p> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @param int $payment_id Payment id. |
| 155 | 155 | */ |
| 156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
| 156 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
| 157 | 157 | |
| 158 | 158 | // @TODO: Fees |
| 159 | - $fees = give_get_payment_fees( $payment_id ); |
|
| 160 | - if ( ! empty( $fees ) ) : ?> |
|
| 159 | + $fees = give_get_payment_fees($payment_id); |
|
| 160 | + if ( ! empty($fees)) : ?> |
|
| 161 | 161 | <div class="give-order-fees give-admin-box-inside"> |
| 162 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
| 162 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
| 163 | 163 | <ul class="give-payment-fees"> |
| 164 | - <?php foreach ( $fees as $fee ) : ?> |
|
| 164 | + <?php foreach ($fees as $fee) : ?> |
|
| 165 | 165 | <li> |
| 166 | 166 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
| 167 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
| 167 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
| 168 | 168 | </li> |
| 169 | 169 | <?php endforeach; ?> |
| 170 | 170 | </ul> |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | <div class="give-order-payment give-admin-box-inside"> |
| 175 | 175 | <p> |
| 176 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 177 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 178 | - <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_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
| 176 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 177 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 178 | + <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_get_payment_amount($payment_id))); ?>"/> |
|
| 179 | 179 | </p> |
| 180 | 180 | </div> |
| 181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @param int $payment_id Payment id. |
| 189 | 189 | */ |
| 190 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 190 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 191 | 191 | ?> |
| 192 | 192 | |
| 193 | 193 | </div> |
@@ -205,17 +205,17 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @param int $payment_id Payment id. |
| 207 | 207 | */ |
| 208 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 208 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 209 | 209 | ?> |
| 210 | 210 | |
| 211 | 211 | <div id="major-publishing-actions"> |
| 212 | 212 | <div id="publishing-action"> |
| 213 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 214 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 215 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 213 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 214 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 215 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 216 | 216 | 'give-action' => 'email_links', |
| 217 | 217 | 'purchase_id' => $payment_id, |
| 218 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 218 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 219 | 219 | <?php endif; ?> |
| 220 | 220 | </div> |
| 221 | 221 | <div class="clear"></div> |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @param int $payment_id Payment id. |
| 231 | 231 | */ |
| 232 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 232 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 233 | 233 | ?> |
| 234 | 234 | |
| 235 | 235 | </div> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | <div id="give-order-details" class="postbox give-order-data"> |
| 242 | 242 | |
| 243 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 243 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 244 | 244 | |
| 245 | 245 | <div class="inside"> |
| 246 | 246 | <div class="give-admin-box"> |
@@ -253,44 +253,44 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @param int $payment_id Payment id. |
| 255 | 255 | */ |
| 256 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 256 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 257 | 257 | |
| 258 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 259 | - if ( $gateway ) : ?> |
|
| 258 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 259 | + if ($gateway) : ?> |
|
| 260 | 260 | <div class="give-order-gateway give-admin-box-inside"> |
| 261 | 261 | <p> |
| 262 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 263 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 262 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 263 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 264 | 264 | </p> |
| 265 | 265 | </div> |
| 266 | 266 | <?php endif; ?> |
| 267 | 267 | |
| 268 | 268 | <div class="give-order-payment-key give-admin-box-inside"> |
| 269 | 269 | <p> |
| 270 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 271 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 270 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 271 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 272 | 272 | </p> |
| 273 | 273 | </div> |
| 274 | 274 | |
| 275 | 275 | <div class="give-order-ip give-admin-box-inside"> |
| 276 | 276 | <p> |
| 277 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 278 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 277 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 278 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 279 | 279 | </p> |
| 280 | 280 | </div> |
| 281 | 281 | |
| 282 | - <?php if ( $transaction_id ) : ?> |
|
| 282 | + <?php if ($transaction_id) : ?> |
|
| 283 | 283 | <div class="give-order-tx-id give-admin-box-inside"> |
| 284 | 284 | <p> |
| 285 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 286 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 285 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 286 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 287 | 287 | </p> |
| 288 | 288 | </div> |
| 289 | 289 | <?php endif; ?> |
| 290 | 290 | |
| 291 | 291 | <div class="give-admin-box-inside"> |
| 292 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
| 293 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 292 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
| 293 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 294 | 294 | </p> |
| 295 | 295 | </div> |
| 296 | 296 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @param int $payment_id Payment id. |
| 304 | 304 | */ |
| 305 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 305 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 306 | 306 | ?> |
| 307 | 307 | |
| 308 | 308 | </div> |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @param int $payment_id Payment id. |
| 324 | 324 | */ |
| 325 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 325 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 326 | 326 | ?> |
| 327 | 327 | |
| 328 | 328 | </div> |
@@ -342,56 +342,56 @@ discard block |
||
| 342 | 342 | * |
| 343 | 343 | * @param int $payment_id Payment id. |
| 344 | 344 | */ |
| 345 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 345 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 346 | 346 | ?> |
| 347 | 347 | |
| 348 | 348 | <?php $column_count = 'columns-3'; ?> |
| 349 | 349 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 350 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 350 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 351 | 351 | |
| 352 | 352 | <div class="inside"> |
| 353 | 353 | |
| 354 | 354 | <div class="column-container"> |
| 355 | 355 | <div class="column"> |
| 356 | 356 | <p> |
| 357 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 357 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 358 | 358 | <?php |
| 359 | - if ( $payment_meta['form_id'] ) : |
|
| 359 | + if ($payment_meta['form_id']) : |
|
| 360 | 360 | printf( |
| 361 | 361 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 362 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 362 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 363 | 363 | $payment_meta['form_id'] |
| 364 | 364 | ); |
| 365 | 365 | endif; |
| 366 | 366 | ?> |
| 367 | 367 | </p> |
| 368 | 368 | <p> |
| 369 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 370 | - <?php echo Give()->html->forms_dropdown( array( |
|
| 369 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 370 | + <?php echo Give()->html->forms_dropdown(array( |
|
| 371 | 371 | 'selected' => $payment_meta['form_id'], |
| 372 | 372 | 'name' => 'give-payment-form-select', |
| 373 | 373 | 'id' => 'give-payment-form-select', |
| 374 | 374 | 'chosen' => true, |
| 375 | - ) ); ?> |
|
| 375 | + )); ?> |
|
| 376 | 376 | </p> |
| 377 | 377 | </div> |
| 378 | 378 | <div class="column"> |
| 379 | 379 | <p> |
| 380 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 381 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 380 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 381 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 382 | 382 | </p> |
| 383 | 383 | <p> |
| 384 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 384 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 385 | 385 | <span class="give-donation-level"> |
| 386 | 386 | <?php |
| 387 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 388 | - if ( empty( $var_prices ) ) { |
|
| 389 | - esc_html_e( 'n/a', 'give' ); |
|
| 387 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 388 | + if (empty($var_prices)) { |
|
| 389 | + esc_html_e('n/a', 'give'); |
|
| 390 | 390 | } else { |
| 391 | 391 | $prices_atts = ''; |
| 392 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 393 | - foreach ( $variable_prices as $variable_price ) { |
|
| 394 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
| 392 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 393 | + foreach ($variable_prices as $variable_price) { |
|
| 394 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | // Variable price dropdown options. |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | 'chosen' => true, |
| 402 | 402 | 'show_option_all' => '', |
| 403 | 403 | 'show_option_none' => '', |
| 404 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
| 404 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
| 405 | 405 | 'selected' => $payment_meta['price_id'], |
| 406 | 406 | ); |
| 407 | 407 | // Render variable prices select tag html. |
| 408 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 408 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 409 | 409 | } |
| 410 | 410 | ?> |
| 411 | 411 | </span> |
@@ -413,8 +413,8 @@ discard block |
||
| 413 | 413 | </div> |
| 414 | 414 | <div class="column"> |
| 415 | 415 | <p> |
| 416 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 417 | - <?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
| 416 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 417 | + <?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?> |
|
| 418 | 418 | </p> |
| 419 | 419 | <p> |
| 420 | 420 | <?php |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @param int $payment_id Payment id. |
| 429 | 429 | */ |
| 430 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 430 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 431 | 431 | |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @param int $payment_id Payment id. |
| 441 | 441 | */ |
| 442 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 442 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 443 | 443 | |
| 444 | 444 | /** |
| 445 | 445 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @param int $payment_id Payment id. |
| 452 | 452 | */ |
| 453 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 453 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | 456 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * |
| 462 | 462 | * @param int $payment_id Payment id. |
| 463 | 463 | */ |
| 464 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 464 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 465 | 465 | ?> |
| 466 | 466 | </p> |
| 467 | 467 | </div> |
@@ -481,67 +481,67 @@ discard block |
||
| 481 | 481 | * |
| 482 | 482 | * @param int $payment_id Payment id. |
| 483 | 483 | */ |
| 484 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 484 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 485 | 485 | ?> |
| 486 | 486 | |
| 487 | 487 | <div id="give-donor-details" class="postbox"> |
| 488 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 488 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 489 | 489 | |
| 490 | 490 | <div class="inside"> |
| 491 | 491 | |
| 492 | - <?php $donor = new Give_Customer( $donor_id ); ?> |
|
| 492 | + <?php $donor = new Give_Customer($donor_id); ?> |
|
| 493 | 493 | |
| 494 | 494 | <div class="column-container customer-info"> |
| 495 | 495 | <div class="column"> |
| 496 | 496 | <p> |
| 497 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 497 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 498 | 498 | <?php |
| 499 | - if ( ! empty( $donor->id ) ) { |
|
| 499 | + if ( ! empty($donor->id)) { |
|
| 500 | 500 | printf( |
| 501 | 501 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 502 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
| 502 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
| 503 | 503 | $donor->id |
| 504 | 504 | ); |
| 505 | 505 | } |
| 506 | 506 | ?> |
| 507 | 507 | </p> |
| 508 | 508 | <p> |
| 509 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 510 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 509 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 510 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 511 | 511 | </p> |
| 512 | 512 | </div> |
| 513 | 513 | <div class="column"> |
| 514 | 514 | <p> |
| 515 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 515 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 516 | 516 | <?php |
| 517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 517 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 518 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 519 | 519 | |
| 520 | 520 | // Check whether the donor name and WP_User name is same or not. |
| 521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 522 | - 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>)'; |
|
| 523 | - }else{ |
|
| 521 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 522 | + 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>)'; |
|
| 523 | + } else { |
|
| 524 | 524 | echo $donor_name; |
| 525 | 525 | } |
| 526 | 526 | ?> |
| 527 | 527 | </p> |
| 528 | 528 | <p> |
| 529 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 529 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 530 | 530 | <?php echo $donor->email; ?> |
| 531 | 531 | </p> |
| 532 | 532 | </div> |
| 533 | 533 | <div class="column"> |
| 534 | 534 | <p> |
| 535 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 535 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 536 | 536 | <?php |
| 537 | - echo Give()->html->donor_dropdown( array( |
|
| 537 | + echo Give()->html->donor_dropdown(array( |
|
| 538 | 538 | 'selected' => $donor->id, |
| 539 | 539 | 'name' => 'customer-id', |
| 540 | - ) ); |
|
| 540 | + )); |
|
| 541 | 541 | ?> |
| 542 | 542 | </p> |
| 543 | 543 | <p> |
| 544 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 544 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 545 | 545 | </p> |
| 546 | 546 | </div> |
| 547 | 547 | </div> |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | <div class="column-container new-customer" style="display: none"> |
| 550 | 550 | <div class="column"> |
| 551 | 551 | <p> |
| 552 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 552 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 553 | 553 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
| 554 | 554 | </p> |
| 555 | 555 | </div> |
| 556 | 556 | <div class="column"> |
| 557 | 557 | <p> |
| 558 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 558 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 559 | 559 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
| 560 | 560 | </p> |
| 561 | 561 | </div> |
@@ -563,9 +563,9 @@ discard block |
||
| 563 | 563 | <p> |
| 564 | 564 | <input type="hidden" name="give-current-customer" value="<?php echo $donor->id; ?>"/> |
| 565 | 565 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
| 566 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 566 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 567 | 567 | <br> |
| 568 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 568 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 569 | 569 | </p> |
| 570 | 570 | </div> |
| 571 | 571 | </div> |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @param array $payment_meta Payment meta. |
| 582 | 582 | * @param array $user_info User information. |
| 583 | 583 | */ |
| 584 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 584 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 585 | 585 | |
| 586 | 586 | /** |
| 587 | 587 | * Fires in order details page, in the donor-details metabox. |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | * |
| 591 | 591 | * @param int $payment_id Payment id. |
| 592 | 592 | */ |
| 593 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 593 | + do_action('give_payment_view_details', $payment_id); |
|
| 594 | 594 | ?> |
| 595 | 595 | |
| 596 | 596 | </div> |
@@ -606,11 +606,11 @@ discard block |
||
| 606 | 606 | * |
| 607 | 607 | * @param int $payment_id Payment id. |
| 608 | 608 | */ |
| 609 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 609 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 610 | 610 | ?> |
| 611 | 611 | |
| 612 | 612 | <div id="give-billing-details" class="postbox"> |
| 613 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 613 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 614 | 614 | |
| 615 | 615 | <div class="inside"> |
| 616 | 616 | |
@@ -620,59 +620,59 @@ discard block |
||
| 620 | 620 | <div class="data column-container"> |
| 621 | 621 | <div class="column"> |
| 622 | 622 | <div class="give-wrap-address-line1"> |
| 623 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 624 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 623 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 624 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 625 | 625 | </div> |
| 626 | 626 | <div class="give-wrap-address-line2"> |
| 627 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 628 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 627 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 628 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 629 | 629 | </div> |
| 630 | 630 | </div> |
| 631 | 631 | <div class="column"> |
| 632 | 632 | <div class="give-wrap-address-city"> |
| 633 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 634 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 633 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 634 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 635 | 635 | </div> |
| 636 | 636 | <div class="give-wrap-address-zip"> |
| 637 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 638 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 637 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 638 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 639 | 639 | |
| 640 | 640 | </div> |
| 641 | 641 | </div> |
| 642 | 642 | <div class="column"> |
| 643 | 643 | <div id="give-order-address-country-wrap"> |
| 644 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 644 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 645 | 645 | <?php |
| 646 | - echo Give()->html->select( array( |
|
| 646 | + echo Give()->html->select(array( |
|
| 647 | 647 | 'options' => give_get_country_list(), |
| 648 | 648 | 'name' => 'give-payment-address[0][country]', |
| 649 | 649 | 'selected' => $address['country'], |
| 650 | 650 | 'show_option_all' => false, |
| 651 | 651 | 'show_option_none' => false, |
| 652 | 652 | 'chosen' => true, |
| 653 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 654 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 655 | - ) ); |
|
| 653 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 654 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 655 | + )); |
|
| 656 | 656 | ?> |
| 657 | 657 | </div> |
| 658 | 658 | <div id="give-order-address-state-wrap"> |
| 659 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
| 659 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
| 660 | 660 | <?php |
| 661 | - $states = give_get_states( $address['country'] ); |
|
| 662 | - if ( ! empty( $states ) ) { |
|
| 663 | - echo Give()->html->select( array( |
|
| 661 | + $states = give_get_states($address['country']); |
|
| 662 | + if ( ! empty($states)) { |
|
| 663 | + echo Give()->html->select(array( |
|
| 664 | 664 | 'options' => $states, |
| 665 | 665 | 'name' => 'give-payment-address[0][state]', |
| 666 | 666 | 'selected' => $address['state'], |
| 667 | 667 | 'show_option_all' => false, |
| 668 | 668 | 'show_option_none' => false, |
| 669 | 669 | 'chosen' => true, |
| 670 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 671 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 672 | - ) ); |
|
| 670 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 671 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 672 | + )); |
|
| 673 | 673 | } else { |
| 674 | 674 | ?> |
| 675 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 675 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 676 | 676 | <?php |
| 677 | 677 | } ?> |
| 678 | 678 | </div> |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | * |
| 693 | 693 | * @param int $payment_id Payment id. |
| 694 | 694 | */ |
| 695 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 695 | + do_action('give_payment_billing_details', $payment_id); |
|
| 696 | 696 | ?> |
| 697 | 697 | |
| 698 | 698 | </div> |
@@ -708,32 +708,32 @@ discard block |
||
| 708 | 708 | * |
| 709 | 709 | * @param int $payment_id Payment id. |
| 710 | 710 | */ |
| 711 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 711 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 712 | 712 | ?> |
| 713 | 713 | |
| 714 | 714 | <div id="give-payment-notes" class="postbox"> |
| 715 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 715 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 716 | 716 | |
| 717 | 717 | <div class="inside"> |
| 718 | 718 | <div id="give-payment-notes-inner"> |
| 719 | 719 | <?php |
| 720 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 721 | - if ( ! empty( $notes ) ) { |
|
| 720 | + $notes = give_get_payment_notes($payment_id); |
|
| 721 | + if ( ! empty($notes)) { |
|
| 722 | 722 | $no_notes_display = ' style="display:none;"'; |
| 723 | - foreach ( $notes as $note ) : |
|
| 723 | + foreach ($notes as $note) : |
|
| 724 | 724 | |
| 725 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 725 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 726 | 726 | |
| 727 | 727 | endforeach; |
| 728 | 728 | } else { |
| 729 | 729 | $no_notes_display = ''; |
| 730 | 730 | } |
| 731 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
| 731 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
| 732 | 732 | </div> |
| 733 | 733 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 734 | 734 | |
| 735 | 735 | <div class="give-clearfix"> |
| 736 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
| 736 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
| 737 | 737 | </div> |
| 738 | 738 | |
| 739 | 739 | </div> |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @param int $payment_id Payment id. |
| 751 | 751 | */ |
| 752 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 752 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 753 | 753 | ?> |
| 754 | 754 | |
| 755 | 755 | </div> |
@@ -771,11 +771,11 @@ discard block |
||
| 771 | 771 | * |
| 772 | 772 | * @param int $payment_id Payment id. |
| 773 | 773 | */ |
| 774 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 774 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 775 | 775 | |
| 776 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 776 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 777 | 777 | ?> |
| 778 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 778 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 779 | 779 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 780 | 780 | </form> |
| 781 | 781 | <?php |
@@ -786,6 +786,6 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @param int $payment_id Payment id. |
| 788 | 788 | */ |
| 789 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 789 | + do_action('give_view_order_details_after', $payment_id); |
|
| 790 | 790 | ?> |
| 791 | 791 | </div><!-- /.wrap --> |
@@ -520,7 +520,7 @@ |
||
| 520 | 520 | // Check whether the donor name and WP_User name is same or not. |
| 521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
| 522 | 522 | 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>)'; |
| 523 | - }else{ |
|
| 523 | + } else{ |
|
| 524 | 524 | echo $donor_name; |
| 525 | 525 | } |
| 526 | 526 | ?> |
@@ -610,31 +610,31 @@ |
||
| 610 | 610 | */ |
| 611 | 611 | function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
| 612 | 612 | |
| 613 | - // ID shouldn't be empty |
|
| 614 | - if( empty( $id ) ){ |
|
| 615 | - return; |
|
| 616 | - } |
|
| 613 | + // ID shouldn't be empty |
|
| 614 | + if( empty( $id ) ){ |
|
| 615 | + return; |
|
| 616 | + } |
|
| 617 | 617 | |
| 618 | - $name = ''; |
|
| 618 | + $name = ''; |
|
| 619 | 619 | |
| 620 | - switch( $from ){ |
|
| 620 | + switch( $from ){ |
|
| 621 | 621 | |
| 622 | - case 'donation': |
|
| 622 | + case 'donation': |
|
| 623 | 623 | |
| 624 | - $user_info = give_get_payment_meta_user_info( $id ); |
|
| 625 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 624 | + $user_info = give_get_payment_meta_user_info( $id ); |
|
| 625 | + $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 626 | 626 | |
| 627 | - break; |
|
| 627 | + break; |
|
| 628 | 628 | |
| 629 | - case 'donor': |
|
| 629 | + case 'donor': |
|
| 630 | 630 | |
| 631 | - $donor = new Give_Customer( $id ); |
|
| 632 | - $name = $donor->name; |
|
| 631 | + $donor = new Give_Customer( $id ); |
|
| 632 | + $name = $donor->name; |
|
| 633 | 633 | |
| 634 | - break; |
|
| 634 | + break; |
|
| 635 | 635 | |
| 636 | - } |
|
| 636 | + } |
|
| 637 | 637 | |
| 638 | - return trim( $name ); |
|
| 638 | + return trim( $name ); |
|
| 639 | 639 | |
| 640 | 640 | } |
@@ -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 | |
@@ -30,36 +30,36 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return bool|object List of all user donations |
| 32 | 32 | */ |
| 33 | -function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
| 33 | +function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
| 34 | 34 | |
| 35 | - if ( empty( $user ) ) { |
|
| 35 | + if (empty($user)) { |
|
| 36 | 36 | $user = get_current_user_id(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
| 39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $status = $status === 'complete' ? 'publish' : $status; |
| 44 | 44 | |
| 45 | - if ( $pagination ) { |
|
| 46 | - if ( get_query_var( 'paged' ) ) { |
|
| 47 | - $paged = get_query_var( 'paged' ); |
|
| 48 | - } elseif ( get_query_var( 'page' ) ) { |
|
| 49 | - $paged = get_query_var( 'page' ); |
|
| 45 | + if ($pagination) { |
|
| 46 | + if (get_query_var('paged')) { |
|
| 47 | + $paged = get_query_var('paged'); |
|
| 48 | + } elseif (get_query_var('page')) { |
|
| 49 | + $paged = get_query_var('page'); |
|
| 50 | 50 | } else { |
| 51 | 51 | $paged = 1; |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
| 55 | + $args = apply_filters('give_get_users_donations_args', array( |
|
| 56 | 56 | 'user' => $user, |
| 57 | 57 | 'number' => $number, |
| 58 | 58 | 'status' => $status, |
| 59 | 59 | 'orderby' => 'date', |
| 60 | - ) ); |
|
| 60 | + )); |
|
| 61 | 61 | |
| 62 | - if ( $pagination ) { |
|
| 62 | + if ($pagination) { |
|
| 63 | 63 | |
| 64 | 64 | $args['page'] = $paged; |
| 65 | 65 | |
@@ -69,20 +69,20 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
| 73 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
| 72 | + $by_user_id = is_numeric($user) ? true : false; |
|
| 73 | + $customer = new Give_Customer($user, $by_user_id); |
|
| 74 | 74 | |
| 75 | - if ( ! empty( $customer->payment_ids ) ) { |
|
| 75 | + if ( ! empty($customer->payment_ids)) { |
|
| 76 | 76 | |
| 77 | - unset( $args['user'] ); |
|
| 78 | - $args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) ); |
|
| 77 | + unset($args['user']); |
|
| 78 | + $args['post__in'] = array_map('absint', explode(',', $customer->payment_ids)); |
|
| 79 | 79 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
| 82 | + $purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
| 83 | 83 | |
| 84 | 84 | // No donations |
| 85 | - if ( ! $purchases ) { |
|
| 85 | + if ( ! $purchases) { |
|
| 86 | 86 | return false; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -101,65 +101,65 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return bool|object List of unique forms donated by user |
| 103 | 103 | */ |
| 104 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
| 105 | - if ( empty( $user ) ) { |
|
| 104 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
| 105 | + if (empty($user)) { |
|
| 106 | 106 | $user = get_current_user_id(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( empty( $user ) ) { |
|
| 109 | + if (empty($user)) { |
|
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
| 113 | + $by_user_id = is_numeric($user) ? true : false; |
|
| 114 | 114 | |
| 115 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
| 115 | + $customer = new Give_Customer($user, $by_user_id); |
|
| 116 | 116 | |
| 117 | - if ( empty( $customer->payment_ids ) ) { |
|
| 117 | + if (empty($customer->payment_ids)) { |
|
| 118 | 118 | return false; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Get all the items donated |
| 122 | - $payment_ids = array_reverse( explode( ',', $customer->payment_ids ) ); |
|
| 123 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
| 124 | - if ( ! empty( $limit_payments ) ) { |
|
| 125 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
| 122 | + $payment_ids = array_reverse(explode(',', $customer->payment_ids)); |
|
| 123 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
| 124 | + if ( ! empty($limit_payments)) { |
|
| 125 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
| 126 | 126 | } |
| 127 | 127 | $donation_data = array(); |
| 128 | - foreach ( $payment_ids as $payment_id ) { |
|
| 129 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
| 128 | + foreach ($payment_ids as $payment_id) { |
|
| 129 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if ( empty( $donation_data ) ) { |
|
| 132 | + if (empty($donation_data)) { |
|
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // Grab only the post ids "form_id" of the forms donated on this order |
| 137 | 137 | $completed_donations_ids = array(); |
| 138 | - foreach ( $donation_data as $purchase_meta ) { |
|
| 139 | - $completed_donations_ids[] = isset( $purchase_meta['form_id'] ) ? $purchase_meta['form_id'] : ''; |
|
| 138 | + foreach ($donation_data as $purchase_meta) { |
|
| 139 | + $completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : ''; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( empty( $completed_donations_ids ) ) { |
|
| 142 | + if (empty($completed_donations_ids)) { |
|
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Only include each donation once |
| 147 | - $form_ids = array_unique( $completed_donations_ids ); |
|
| 147 | + $form_ids = array_unique($completed_donations_ids); |
|
| 148 | 148 | |
| 149 | 149 | // Make sure we still have some products and a first item |
| 150 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
| 150 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $post_type = get_post_type( $form_ids[0] ); |
|
| 154 | + $post_type = get_post_type($form_ids[0]); |
|
| 155 | 155 | |
| 156 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
| 156 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
| 157 | 157 | 'include' => $form_ids, |
| 158 | 158 | 'post_type' => $post_type, |
| 159 | - 'posts_per_page' => - 1, |
|
| 160 | - ) ); |
|
| 159 | + 'posts_per_page' => -1, |
|
| 160 | + )); |
|
| 161 | 161 | |
| 162 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
| 162 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return bool True if has donated, false other wise. |
| 177 | 177 | */ |
| 178 | -function give_has_purchases( $user_id = null ) { |
|
| 179 | - if ( empty( $user_id ) ) { |
|
| 178 | +function give_has_purchases($user_id = null) { |
|
| 179 | + if (empty($user_id)) { |
|
| 180 | 180 | $user_id = get_current_user_id(); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( give_get_users_purchases( $user_id, 1 ) ) { |
|
| 183 | + if (give_get_users_purchases($user_id, 1)) { |
|
| 184 | 184 | return true; // User has at least one donation |
| 185 | 185 | } |
| 186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return array |
| 202 | 202 | */ |
| 203 | -function give_get_purchase_stats_by_user( $user = '' ) { |
|
| 203 | +function give_get_purchase_stats_by_user($user = '') { |
|
| 204 | 204 | |
| 205 | - if ( is_email( $user ) ) { |
|
| 205 | + if (is_email($user)) { |
|
| 206 | 206 | |
| 207 | 207 | $field = 'email'; |
| 208 | 208 | |
| 209 | - } elseif ( is_numeric( $user ) ) { |
|
| 209 | + } elseif (is_numeric($user)) { |
|
| 210 | 210 | |
| 211 | 211 | $field = 'user_id'; |
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $stats = array(); |
| 216 | - $customer = Give()->customers->get_customer_by( $field, $user ); |
|
| 216 | + $customer = Give()->customers->get_customer_by($field, $user); |
|
| 217 | 217 | |
| 218 | - if ( $customer ) { |
|
| 218 | + if ($customer) { |
|
| 219 | 219 | |
| 220 | - $customer = new Give_Customer( $customer->id ); |
|
| 220 | + $customer = new Give_Customer($customer->id); |
|
| 221 | 221 | |
| 222 | - $stats['purchases'] = absint( $customer->purchase_count ); |
|
| 223 | - $stats['total_spent'] = give_sanitize_amount( $customer->purchase_value ); |
|
| 222 | + $stats['purchases'] = absint($customer->purchase_count); |
|
| 223 | + $stats['total_spent'] = give_sanitize_amount($customer->purchase_value); |
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @since 1.7 |
| 231 | 231 | */ |
| 232 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
| 232 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
| 233 | 233 | |
| 234 | 234 | return $stats; |
| 235 | 235 | } |
@@ -247,21 +247,21 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return int The total number of donations |
| 249 | 249 | */ |
| 250 | -function give_count_purchases_of_customer( $user = null ) { |
|
| 250 | +function give_count_purchases_of_customer($user = null) { |
|
| 251 | 251 | |
| 252 | 252 | // Logged in? |
| 253 | - if ( empty( $user ) ) { |
|
| 253 | + if (empty($user)) { |
|
| 254 | 254 | $user = get_current_user_id(); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // Email access? |
| 258 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
| 258 | + if (empty($user) && Give()->email_access->token_email) { |
|
| 259 | 259 | $user = Give()->email_access->token_email; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false; |
|
| 262 | + $stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false; |
|
| 263 | 263 | |
| 264 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
| 264 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return float The total amount the user has spent |
| 276 | 276 | */ |
| 277 | -function give_purchase_total_of_user( $user = null ) { |
|
| 277 | +function give_purchase_total_of_user($user = null) { |
|
| 278 | 278 | |
| 279 | - $stats = give_get_purchase_stats_by_user( $user ); |
|
| 279 | + $stats = give_get_purchase_stats_by_user($user); |
|
| 280 | 280 | |
| 281 | 281 | return $stats['total_spent']; |
| 282 | 282 | } |
@@ -292,40 +292,40 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return bool |
| 294 | 294 | */ |
| 295 | -function give_validate_username( $username, $form_id = 0 ) { |
|
| 295 | +function give_validate_username($username, $form_id = 0) { |
|
| 296 | 296 | $valid = true; |
| 297 | 297 | |
| 298 | 298 | // Validate username. |
| 299 | - if ( ! empty( $username ) ) { |
|
| 299 | + if ( ! empty($username)) { |
|
| 300 | 300 | |
| 301 | 301 | // Sanitize username. |
| 302 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
| 302 | + $sanitized_user_name = sanitize_user($username, false); |
|
| 303 | 303 | |
| 304 | 304 | // We have an user name, check if it already exists. |
| 305 | - if ( username_exists( $username ) ) { |
|
| 305 | + if (username_exists($username)) { |
|
| 306 | 306 | // Username already registered. |
| 307 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
| 307 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
| 308 | 308 | $valid = false; |
| 309 | 309 | |
| 310 | 310 | // Check if it's valid. |
| 311 | - } elseif ( $sanitized_user_name !== $username ) { |
|
| 311 | + } elseif ($sanitized_user_name !== $username) { |
|
| 312 | 312 | // Invalid username. |
| 313 | - if ( is_multisite() ) { |
|
| 314 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
| 313 | + if (is_multisite()) { |
|
| 314 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
| 315 | 315 | $valid = false; |
| 316 | 316 | } else { |
| 317 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
| 317 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
| 318 | 318 | $valid = false; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | } else { |
| 322 | 322 | // Username is empty. |
| 323 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
| 323 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
| 324 | 324 | $valid = false; |
| 325 | 325 | |
| 326 | 326 | // Check if guest checkout is disable for form. |
| 327 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
| 328 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
| 327 | + if ($form_id && give_logged_in_only($form_id)) { |
|
| 328 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
| 329 | 329 | $valid = false; |
| 330 | 330 | } |
| 331 | 331 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * @param string $username |
| 340 | 340 | * @param bool $form_id |
| 341 | 341 | */ |
| 342 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
| 342 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
| 343 | 343 | |
| 344 | 344 | return $valid; |
| 345 | 345 | } |
@@ -355,22 +355,22 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @return bool |
| 357 | 357 | */ |
| 358 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
| 358 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
| 359 | 359 | $valid = true; |
| 360 | 360 | |
| 361 | - if ( empty( $email ) ) { |
|
| 361 | + if (empty($email)) { |
|
| 362 | 362 | // No email. |
| 363 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
| 363 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
| 364 | 364 | $valid = false; |
| 365 | 365 | |
| 366 | - } elseif ( ! is_email( $email ) ) { |
|
| 366 | + } elseif ( ! is_email($email)) { |
|
| 367 | 367 | // Validate email. |
| 368 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
| 368 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
| 369 | 369 | $valid = false; |
| 370 | 370 | |
| 371 | - } elseif ( $registering_new_user && email_exists( $email ) ) { |
|
| 371 | + } elseif ($registering_new_user && email_exists($email)) { |
|
| 372 | 372 | // Check if email exists. |
| 373 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
| 373 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
| 374 | 374 | $valid = false; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @param string $email |
| 384 | 384 | * @param bool $registering_new_user |
| 385 | 385 | */ |
| 386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
| 386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
| 387 | 387 | |
| 388 | 388 | return $valid; |
| 389 | 389 | } |
@@ -399,25 +399,25 @@ discard block |
||
| 399 | 399 | * |
| 400 | 400 | * @return bool |
| 401 | 401 | */ |
| 402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
| 402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
| 403 | 403 | $valid = true; |
| 404 | 404 | |
| 405 | - if ( $password && $confirm_password ) { |
|
| 405 | + if ($password && $confirm_password) { |
|
| 406 | 406 | // Verify confirmation matches. |
| 407 | - if ( $password != $confirm_password ) { |
|
| 407 | + if ($password != $confirm_password) { |
|
| 408 | 408 | // Passwords do not match |
| 409 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match.', 'give' ) ); |
|
| 409 | + give_set_error('password_mismatch', __('Passwords don\'t match.', 'give')); |
|
| 410 | 410 | $valid = false; |
| 411 | 411 | } |
| 412 | - } elseif ( $registering_new_user ) { |
|
| 412 | + } elseif ($registering_new_user) { |
|
| 413 | 413 | // Password or confirmation missing. |
| 414 | - if ( ! $password ) { |
|
| 414 | + if ( ! $password) { |
|
| 415 | 415 | // The password is invalid. |
| 416 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
| 416 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
| 417 | 417 | $valid = false; |
| 418 | - } elseif ( ! $confirm_password ) { |
|
| 418 | + } elseif ( ! $confirm_password) { |
|
| 419 | 419 | // Confirmation password is invalid. |
| 420 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
| 420 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
| 421 | 421 | $valid = false; |
| 422 | 422 | } |
| 423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | * @param string $confirm_password |
| 433 | 433 | * @param bool $registering_new_user |
| 434 | 434 | */ |
| 435 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
| 435 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
| 436 | 436 | |
| 437 | 437 | return $valid; |
| 438 | 438 | } |
@@ -451,32 +451,32 @@ discard block |
||
| 451 | 451 | * |
| 452 | 452 | * @return void |
| 453 | 453 | */ |
| 454 | -function give_add_past_purchases_to_new_user( $user_id ) { |
|
| 454 | +function give_add_past_purchases_to_new_user($user_id) { |
|
| 455 | 455 | |
| 456 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
| 456 | + $email = get_the_author_meta('user_email', $user_id); |
|
| 457 | 457 | |
| 458 | - $payments = give_get_payments( array( 's' => $email ) ); |
|
| 458 | + $payments = give_get_payments(array('s' => $email)); |
|
| 459 | 459 | |
| 460 | - if ( $payments ) { |
|
| 461 | - foreach ( $payments as $payment ) { |
|
| 462 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
| 460 | + if ($payments) { |
|
| 461 | + foreach ($payments as $payment) { |
|
| 462 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
| 463 | 463 | continue; |
| 464 | 464 | } // This payment already associated with an account |
| 465 | 465 | |
| 466 | - $meta = give_get_payment_meta( $payment->ID ); |
|
| 467 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
| 466 | + $meta = give_get_payment_meta($payment->ID); |
|
| 467 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
| 468 | 468 | $meta['user_info']['id'] = $user_id; |
| 469 | 469 | $meta['user_info'] = $meta['user_info']; |
| 470 | 470 | |
| 471 | 471 | // Store the updated user ID in the payment meta |
| 472 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
| 473 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
| 472 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
| 473 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | -add_action( 'user_register', 'give_add_past_purchases_to_new_user' ); |
|
| 479 | +add_action('user_register', 'give_add_past_purchases_to_new_user'); |
|
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | /** |
@@ -502,34 +502,34 @@ discard block |
||
| 502 | 502 | * |
| 503 | 503 | * @return array The donor's address, if any |
| 504 | 504 | */ |
| 505 | -function give_get_donor_address( $user_id = 0 ) { |
|
| 506 | - if ( empty( $user_id ) ) { |
|
| 505 | +function give_get_donor_address($user_id = 0) { |
|
| 506 | + if (empty($user_id)) { |
|
| 507 | 507 | $user_id = get_current_user_id(); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
| 510 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
| 511 | 511 | |
| 512 | - if ( ! isset( $address['line1'] ) ) { |
|
| 512 | + if ( ! isset($address['line1'])) { |
|
| 513 | 513 | $address['line1'] = ''; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if ( ! isset( $address['line2'] ) ) { |
|
| 516 | + if ( ! isset($address['line2'])) { |
|
| 517 | 517 | $address['line2'] = ''; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if ( ! isset( $address['city'] ) ) { |
|
| 520 | + if ( ! isset($address['city'])) { |
|
| 521 | 521 | $address['city'] = ''; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - if ( ! isset( $address['zip'] ) ) { |
|
| 524 | + if ( ! isset($address['zip'])) { |
|
| 525 | 525 | $address['zip'] = ''; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - if ( ! isset( $address['country'] ) ) { |
|
| 528 | + if ( ! isset($address['country'])) { |
|
| 529 | 529 | $address['country'] = ''; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - if ( ! isset( $address['state'] ) ) { |
|
| 532 | + if ( ! isset($address['state'])) { |
|
| 533 | 533 | $address['state'] = ''; |
| 534 | 534 | } |
| 535 | 535 | |
@@ -549,42 +549,42 @@ discard block |
||
| 549 | 549 | * |
| 550 | 550 | * @return void |
| 551 | 551 | */ |
| 552 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
| 552 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
| 553 | 553 | |
| 554 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
| 554 | + if (empty($user_id) || empty($user_data)) { |
|
| 555 | 555 | return; |
| 556 | 556 | } |
| 557 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
| 557 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
| 558 | 558 | |
| 559 | 559 | /* translators: %s: site name */ |
| 560 | - $message = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
| 560 | + $message = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n"; |
|
| 561 | 561 | /* translators: %s: user login */ |
| 562 | - $message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n"; |
|
| 562 | + $message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n"; |
|
| 563 | 563 | /* translators: %s: user email */ |
| 564 | - $message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n"; |
|
| 564 | + $message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n"; |
|
| 565 | 565 | |
| 566 | 566 | Give()->emails->send( |
| 567 | - get_option( 'admin_email' ), |
|
| 567 | + get_option('admin_email'), |
|
| 568 | 568 | sprintf( |
| 569 | 569 | /* translators: %s: site name */ |
| 570 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
| 570 | + esc_attr__('[%s] New User Registration', 'give'), |
|
| 571 | 571 | $blogname |
| 572 | 572 | ), |
| 573 | 573 | $message |
| 574 | 574 | ); |
| 575 | 575 | |
| 576 | 576 | /* translators: %s: user login */ |
| 577 | - $message = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n"; |
|
| 577 | + $message = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n"; |
|
| 578 | 578 | /* translators: %s: paswword */ |
| 579 | - $message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n"; |
|
| 579 | + $message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n"; |
|
| 580 | 580 | |
| 581 | - $message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login »', 'give' ) . '</a>' . "\r\n"; |
|
| 581 | + $message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login »', 'give').'</a>'."\r\n"; |
|
| 582 | 582 | |
| 583 | 583 | Give()->emails->send( |
| 584 | 584 | $user_data['user_email'], |
| 585 | 585 | sprintf( |
| 586 | 586 | /* translators: %s: site name */ |
| 587 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
| 587 | + esc_attr__('[%s] Your username and password', 'give'), |
|
| 588 | 588 | $blogname |
| 589 | 589 | ), |
| 590 | 590 | $message |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
| 595 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
| 596 | 596 | |
| 597 | 597 | |
| 598 | 598 | /** |
@@ -608,33 +608,33 @@ discard block |
||
| 608 | 608 | * |
| 609 | 609 | * @return string |
| 610 | 610 | */ |
| 611 | -function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
|
| 611 | +function give_get_donor_name_by($id = 0, $from = 'donation') { |
|
| 612 | 612 | |
| 613 | 613 | // ID shouldn't be empty |
| 614 | - if( empty( $id ) ){ |
|
| 614 | + if (empty($id)) { |
|
| 615 | 615 | return; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | $name = ''; |
| 619 | 619 | |
| 620 | - switch( $from ){ |
|
| 620 | + switch ($from) { |
|
| 621 | 621 | |
| 622 | 622 | case 'donation': |
| 623 | 623 | |
| 624 | - $user_info = give_get_payment_meta_user_info( $id ); |
|
| 625 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
| 624 | + $user_info = give_get_payment_meta_user_info($id); |
|
| 625 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
| 626 | 626 | |
| 627 | 627 | break; |
| 628 | 628 | |
| 629 | 629 | case 'donor': |
| 630 | 630 | |
| 631 | - $donor = new Give_Customer( $id ); |
|
| 631 | + $donor = new Give_Customer($id); |
|
| 632 | 632 | $name = $donor->name; |
| 633 | 633 | |
| 634 | 634 | break; |
| 635 | 635 | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - return trim( $name ); |
|
| 638 | + return trim($name); |
|
| 639 | 639 | |
| 640 | 640 | } |
@@ -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,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return string Donations dropdown. |
| 37 | 37 | */ |
| 38 | - public function donations_dropdown( $args = array() ) { |
|
| 38 | + public function donations_dropdown($args = array()) { |
|
| 39 | 39 | |
| 40 | 40 | $defaults = array( |
| 41 | 41 | 'name' => 'donations', |
@@ -45,32 +45,32 @@ discard block |
||
| 45 | 45 | 'selected' => 0, |
| 46 | 46 | 'chosen' => false, |
| 47 | 47 | 'number' => 30, |
| 48 | - 'placeholder' => __( 'Select a donation', 'give' ), |
|
| 48 | + 'placeholder' => __('Select a donation', 'give'), |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - $args = wp_parse_args( $args, $defaults ); |
|
| 51 | + $args = wp_parse_args($args, $defaults); |
|
| 52 | 52 | |
| 53 | - $payments = new Give_Payments_Query( array( |
|
| 53 | + $payments = new Give_Payments_Query(array( |
|
| 54 | 54 | 'number' => $args['number'], |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | $payments = $payments->get_payments(); |
| 58 | 58 | |
| 59 | 59 | $options = array(); |
| 60 | 60 | |
| 61 | 61 | // Provide nice human readable options. |
| 62 | - if ( $payments ) { |
|
| 62 | + if ($payments) { |
|
| 63 | 63 | $options[0] = $args['placeholder']; |
| 64 | - foreach ( $payments as $payment ) { |
|
| 64 | + foreach ($payments as $payment) { |
|
| 65 | 65 | |
| 66 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
| 66 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | - $options[0] = __( 'No donations found.', 'give' ); |
|
| 70 | + $options[0] = __('No donations found.', 'give'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $output = $this->select( array( |
|
| 73 | + $output = $this->select(array( |
|
| 74 | 74 | 'name' => $args['name'], |
| 75 | 75 | 'selected' => $args['selected'], |
| 76 | 76 | 'id' => $args['id'], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'select_atts' => $args['select_atts'], |
| 83 | 83 | 'show_option_all' => false, |
| 84 | 84 | 'show_option_none' => false, |
| 85 | - ) ); |
|
| 85 | + )); |
|
| 86 | 86 | |
| 87 | 87 | return $output; |
| 88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return string Give forms dropdown. |
| 101 | 101 | */ |
| 102 | - public function forms_dropdown( $args = array() ) { |
|
| 102 | + public function forms_dropdown($args = array()) { |
|
| 103 | 103 | |
| 104 | 104 | $defaults = array( |
| 105 | 105 | 'name' => 'forms', |
@@ -109,39 +109,39 @@ discard block |
||
| 109 | 109 | 'selected' => 0, |
| 110 | 110 | 'chosen' => false, |
| 111 | 111 | 'number' => 30, |
| 112 | - 'placeholder' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
| 112 | + 'placeholder' => esc_attr__('Select a Donation Form', 'give'), |
|
| 113 | 113 | 'data' => array( |
| 114 | 114 | 'search-type' => 'form', |
| 115 | 115 | ), |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $args = wp_parse_args( $args, $defaults ); |
|
| 118 | + $args = wp_parse_args($args, $defaults); |
|
| 119 | 119 | |
| 120 | - $forms = get_posts( array( |
|
| 120 | + $forms = get_posts(array( |
|
| 121 | 121 | 'post_type' => 'give_forms', |
| 122 | 122 | 'orderby' => 'title', |
| 123 | 123 | 'order' => 'ASC', |
| 124 | 124 | 'posts_per_page' => $args['number'], |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $options = array(); |
| 128 | 128 | |
| 129 | 129 | // Ensure the selected. |
| 130 | - if ( false !== $args['selected'] && $args['selected'] !== 0 ) { |
|
| 131 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
| 130 | + if (false !== $args['selected'] && $args['selected'] !== 0) { |
|
| 131 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( $forms ) { |
|
| 134 | + if ($forms) { |
|
| 135 | 135 | $options[0] = $args['placeholder']; |
| 136 | - foreach ( $forms as $form ) { |
|
| 137 | - $form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title; |
|
| 138 | - $options[ absint( $form->ID ) ] = esc_html( $form_title ); |
|
| 136 | + foreach ($forms as $form) { |
|
| 137 | + $form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title; |
|
| 138 | + $options[absint($form->ID)] = esc_html($form_title); |
|
| 139 | 139 | } |
| 140 | 140 | } else { |
| 141 | - $options[0] = esc_html__( 'No forms found.', 'give' ); |
|
| 141 | + $options[0] = esc_html__('No forms found.', 'give'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $output = $this->select( array( |
|
| 144 | + $output = $this->select(array( |
|
| 145 | 145 | 'name' => $args['name'], |
| 146 | 146 | 'selected' => $args['selected'], |
| 147 | 147 | 'id' => $args['id'], |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'show_option_all' => false, |
| 154 | 154 | 'show_option_none' => false, |
| 155 | 155 | 'data' => $args['data'], |
| 156 | - ) ); |
|
| 156 | + )); |
|
| 157 | 157 | |
| 158 | 158 | return $output; |
| 159 | 159 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return string Donors dropdown. |
| 172 | 172 | */ |
| 173 | - public function donor_dropdown( $args = array() ) { |
|
| 173 | + public function donor_dropdown($args = array()) { |
|
| 174 | 174 | |
| 175 | 175 | $defaults = array( |
| 176 | 176 | 'name' => 'donors', |
@@ -179,57 +179,57 @@ discard block |
||
| 179 | 179 | 'multiple' => false, |
| 180 | 180 | 'selected' => 0, |
| 181 | 181 | 'chosen' => true, |
| 182 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
| 182 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
| 183 | 183 | 'number' => 30, |
| 184 | 184 | 'data' => array( |
| 185 | 185 | 'search-type' => 'donor', |
| 186 | 186 | ), |
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | - $args = wp_parse_args( $args, $defaults ); |
|
| 189 | + $args = wp_parse_args($args, $defaults); |
|
| 190 | 190 | |
| 191 | - $customers = Give()->customers->get_customers( array( |
|
| 191 | + $customers = Give()->customers->get_customers(array( |
|
| 192 | 192 | 'number' => $args['number'], |
| 193 | - ) ); |
|
| 193 | + )); |
|
| 194 | 194 | |
| 195 | 195 | $options = array(); |
| 196 | 196 | |
| 197 | - if ( $customers ) { |
|
| 198 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
| 199 | - foreach ( $customers as $customer ) { |
|
| 200 | - $options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
| 197 | + if ($customers) { |
|
| 198 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
| 199 | + foreach ($customers as $customer) { |
|
| 200 | + $options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')'); |
|
| 201 | 201 | } |
| 202 | 202 | } else { |
| 203 | - $options[0] = esc_html__( 'No donors found.', 'give' ); |
|
| 203 | + $options[0] = esc_html__('No donors found.', 'give'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if ( ! empty( $args['selected'] ) ) { |
|
| 206 | + if ( ! empty($args['selected'])) { |
|
| 207 | 207 | |
| 208 | 208 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
| 209 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
| 209 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
| 210 | 210 | |
| 211 | - $customer = new Give_Customer( $args['selected'] ); |
|
| 211 | + $customer = new Give_Customer($args['selected']); |
|
| 212 | 212 | |
| 213 | - if ( $customer ) { |
|
| 213 | + if ($customer) { |
|
| 214 | 214 | |
| 215 | - $options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
| 215 | + $options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')'); |
|
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $output = $this->select( array( |
|
| 221 | + $output = $this->select(array( |
|
| 222 | 222 | 'name' => $args['name'], |
| 223 | 223 | 'selected' => $args['selected'], |
| 224 | 224 | 'id' => $args['id'], |
| 225 | - 'class' => $args['class'] . ' give-customer-select', |
|
| 225 | + 'class' => $args['class'].' give-customer-select', |
|
| 226 | 226 | 'options' => $options, |
| 227 | 227 | 'multiple' => $args['multiple'], |
| 228 | 228 | 'chosen' => $args['chosen'], |
| 229 | 229 | 'show_option_all' => false, |
| 230 | 230 | 'show_option_none' => false, |
| 231 | 231 | 'data' => $args['data'], |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | 234 | return $output; |
| 235 | 235 | } |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return string Categories dropdown. |
| 250 | 250 | */ |
| 251 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) { |
|
| 252 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
| 251 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) { |
|
| 252 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
| 253 | 253 | $options = array(); |
| 254 | 254 | |
| 255 | - foreach ( $categories as $category ) { |
|
| 256 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
| 255 | + foreach ($categories as $category) { |
|
| 256 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 259 | + $output = $this->select(wp_parse_args($args, array( |
|
| 260 | 260 | 'name' => $name, |
| 261 | 261 | 'selected' => $selected, |
| 262 | 262 | 'options' => $options, |
| 263 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
| 263 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
| 264 | 264 | 'show_option_none' => false, |
| 265 | - ) ) ); |
|
| 265 | + ))); |
|
| 266 | 266 | |
| 267 | 267 | return $output; |
| 268 | 268 | } |
@@ -281,21 +281,21 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return string Tags dropdown. |
| 283 | 283 | */ |
| 284 | - public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) { |
|
| 285 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
| 284 | + public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) { |
|
| 285 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
| 286 | 286 | $options = array(); |
| 287 | 287 | |
| 288 | - foreach ( $tags as $tag ) { |
|
| 289 | - $options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
| 288 | + foreach ($tags as $tag) { |
|
| 289 | + $options[absint($tag->term_id)] = esc_html($tag->name); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 292 | + $output = $this->select(wp_parse_args($args, array( |
|
| 293 | 293 | 'name' => $name, |
| 294 | 294 | 'selected' => $selected, |
| 295 | 295 | 'options' => $options, |
| 296 | - 'show_option_all' => esc_html__( 'All Tags', 'give' ), |
|
| 296 | + 'show_option_all' => esc_html__('All Tags', 'give'), |
|
| 297 | 297 | 'show_option_none' => false, |
| 298 | - ) ) ); |
|
| 298 | + ))); |
|
| 299 | 299 | |
| 300 | 300 | return $output; |
| 301 | 301 | } |
@@ -315,25 +315,25 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string Years dropdown. |
| 317 | 317 | */ |
| 318 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
| 319 | - $current = date( 'Y' ); |
|
| 320 | - $start_year = $current - absint( $years_before ); |
|
| 321 | - $end_year = $current + absint( $years_after ); |
|
| 322 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
| 318 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
| 319 | + $current = date('Y'); |
|
| 320 | + $start_year = $current - absint($years_before); |
|
| 321 | + $end_year = $current + absint($years_after); |
|
| 322 | + $selected = empty($selected) ? date('Y') : $selected; |
|
| 323 | 323 | $options = array(); |
| 324 | 324 | |
| 325 | - while ( $start_year <= $end_year ) { |
|
| 326 | - $options[ absint( $start_year ) ] = $start_year; |
|
| 327 | - $start_year ++; |
|
| 325 | + while ($start_year <= $end_year) { |
|
| 326 | + $options[absint($start_year)] = $start_year; |
|
| 327 | + $start_year++; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $output = $this->select( array( |
|
| 330 | + $output = $this->select(array( |
|
| 331 | 331 | 'name' => $name, |
| 332 | 332 | 'selected' => $selected, |
| 333 | 333 | 'options' => $options, |
| 334 | 334 | 'show_option_all' => false, |
| 335 | 335 | 'show_option_none' => false, |
| 336 | - ) ); |
|
| 336 | + )); |
|
| 337 | 337 | |
| 338 | 338 | return $output; |
| 339 | 339 | } |
@@ -351,23 +351,23 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @return string Months dropdown. |
| 353 | 353 | */ |
| 354 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
| 354 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
| 355 | 355 | $month = 1; |
| 356 | 356 | $options = array(); |
| 357 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
| 357 | + $selected = empty($selected) ? date('n') : $selected; |
|
| 358 | 358 | |
| 359 | - while ( $month <= 12 ) { |
|
| 360 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
| 361 | - $month ++; |
|
| 359 | + while ($month <= 12) { |
|
| 360 | + $options[absint($month)] = give_month_num_to_name($month); |
|
| 361 | + $month++; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $output = $this->select( array( |
|
| 364 | + $output = $this->select(array( |
|
| 365 | 365 | 'name' => $name, |
| 366 | 366 | 'selected' => $selected, |
| 367 | 367 | 'options' => $options, |
| 368 | 368 | 'show_option_all' => false, |
| 369 | 369 | 'show_option_none' => false, |
| 370 | - ) ); |
|
| 370 | + )); |
|
| 371 | 371 | |
| 372 | 372 | return $output; |
| 373 | 373 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * |
| 385 | 385 | * @return string The dropdown. |
| 386 | 386 | */ |
| 387 | - public function select( $args = array() ) { |
|
| 387 | + public function select($args = array()) { |
|
| 388 | 388 | $defaults = array( |
| 389 | 389 | 'options' => array(), |
| 390 | 390 | 'name' => null, |
@@ -395,67 +395,67 @@ discard block |
||
| 395 | 395 | 'placeholder' => null, |
| 396 | 396 | 'multiple' => false, |
| 397 | 397 | 'select_atts' => false, |
| 398 | - 'show_option_all' => __( 'All', 'give' ), |
|
| 399 | - 'show_option_none' => __( 'None', 'give' ), |
|
| 398 | + 'show_option_all' => __('All', 'give'), |
|
| 399 | + 'show_option_none' => __('None', 'give'), |
|
| 400 | 400 | 'data' => array(), |
| 401 | 401 | 'readonly' => false, |
| 402 | 402 | 'disabled' => false, |
| 403 | 403 | ); |
| 404 | 404 | |
| 405 | - $args = wp_parse_args( $args, $defaults ); |
|
| 405 | + $args = wp_parse_args($args, $defaults); |
|
| 406 | 406 | |
| 407 | 407 | $data_elements = ''; |
| 408 | - foreach ( $args['data'] as $key => $value ) { |
|
| 409 | - $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
| 408 | + foreach ($args['data'] as $key => $value) { |
|
| 409 | + $data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if ( $args['multiple'] ) { |
|
| 412 | + if ($args['multiple']) { |
|
| 413 | 413 | $multiple = ' MULTIPLE'; |
| 414 | 414 | } else { |
| 415 | 415 | $multiple = ''; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if ( $args['chosen'] ) { |
|
| 418 | + if ($args['chosen']) { |
|
| 419 | 419 | $args['class'] .= ' give-select-chosen'; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if ( $args['placeholder'] ) { |
|
| 422 | + if ($args['placeholder']) { |
|
| 423 | 423 | $placeholder = $args['placeholder']; |
| 424 | 424 | } else { |
| 425 | 425 | $placeholder = ''; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
| 428 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>'; |
|
| 429 | 429 | |
| 430 | - if ( $args['show_option_all'] ) { |
|
| 431 | - if ( $args['multiple'] ) { |
|
| 432 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
| 430 | + if ($args['show_option_all']) { |
|
| 431 | + if ($args['multiple']) { |
|
| 432 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
| 433 | 433 | } else { |
| 434 | - $selected = selected( $args['selected'], 0, false ); |
|
| 434 | + $selected = selected($args['selected'], 0, false); |
|
| 435 | 435 | } |
| 436 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
| 436 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if ( ! empty( $args['options'] ) ) { |
|
| 439 | + if ( ! empty($args['options'])) { |
|
| 440 | 440 | |
| 441 | - if ( $args['show_option_none'] ) { |
|
| 442 | - if ( $args['multiple'] ) { |
|
| 443 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
| 441 | + if ($args['show_option_none']) { |
|
| 442 | + if ($args['multiple']) { |
|
| 443 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
| 444 | 444 | } else { |
| 445 | - $selected = selected( $args['selected'], - 1, false ); |
|
| 445 | + $selected = selected($args['selected'], - 1, false); |
|
| 446 | 446 | } |
| 447 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 447 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - foreach ( $args['options'] as $key => $option ) { |
|
| 450 | + foreach ($args['options'] as $key => $option) { |
|
| 451 | 451 | |
| 452 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 453 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
| 452 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
| 453 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
| 454 | 454 | } else { |
| 455 | - $selected = selected( $args['selected'], $key, false ); |
|
| 455 | + $selected = selected($args['selected'], $key, false); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
| 458 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * |
| 477 | 477 | * @return string The checkbox. |
| 478 | 478 | */ |
| 479 | - public function checkbox( $args = array() ) { |
|
| 479 | + public function checkbox($args = array()) { |
|
| 480 | 480 | $defaults = array( |
| 481 | 481 | 'name' => null, |
| 482 | 482 | 'current' => null, |
@@ -487,16 +487,16 @@ discard block |
||
| 487 | 487 | ), |
| 488 | 488 | ); |
| 489 | 489 | |
| 490 | - $args = wp_parse_args( $args, $defaults ); |
|
| 490 | + $args = wp_parse_args($args, $defaults); |
|
| 491 | 491 | |
| 492 | 492 | $options = ''; |
| 493 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
| 493 | + if ( ! empty($args['options']['disabled'])) { |
|
| 494 | 494 | $options .= ' disabled="disabled"'; |
| 495 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
| 495 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
| 496 | 496 | $options .= ' readonly'; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
| 499 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
| 500 | 500 | |
| 501 | 501 | return $output; |
| 502 | 502 | } |
@@ -513,22 +513,22 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @return string The text field. |
| 515 | 515 | */ |
| 516 | - public function text( $args = array() ) { |
|
| 516 | + public function text($args = array()) { |
|
| 517 | 517 | // Backwards compatibility. |
| 518 | - if ( func_num_args() > 1 ) { |
|
| 518 | + if (func_num_args() > 1) { |
|
| 519 | 519 | $args = func_get_args(); |
| 520 | 520 | |
| 521 | 521 | $name = $args[0]; |
| 522 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
| 523 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
| 524 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
| 522 | + $value = isset($args[1]) ? $args[1] : ''; |
|
| 523 | + $label = isset($args[2]) ? $args[2] : ''; |
|
| 524 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $defaults = array( |
| 528 | - 'name' => isset( $name ) ? $name : 'text', |
|
| 529 | - 'value' => isset( $value ) ? $value : null, |
|
| 530 | - 'label' => isset( $label ) ? $label : null, |
|
| 531 | - 'desc' => isset( $desc ) ? $desc : null, |
|
| 528 | + 'name' => isset($name) ? $name : 'text', |
|
| 529 | + 'value' => isset($value) ? $value : null, |
|
| 530 | + 'label' => isset($label) ? $label : null, |
|
| 531 | + 'desc' => isset($desc) ? $desc : null, |
|
| 532 | 532 | 'placeholder' => '', |
| 533 | 533 | 'class' => 'regular-text', |
| 534 | 534 | 'disabled' => false, |
@@ -536,29 +536,29 @@ discard block |
||
| 536 | 536 | 'data' => false, |
| 537 | 537 | ); |
| 538 | 538 | |
| 539 | - $args = wp_parse_args( $args, $defaults ); |
|
| 539 | + $args = wp_parse_args($args, $defaults); |
|
| 540 | 540 | |
| 541 | 541 | $disabled = ''; |
| 542 | - if ( $args['disabled'] ) { |
|
| 542 | + if ($args['disabled']) { |
|
| 543 | 543 | $disabled = ' disabled="disabled"'; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | $data = ''; |
| 547 | - if ( ! empty( $args['data'] ) ) { |
|
| 548 | - foreach ( $args['data'] as $key => $value ) { |
|
| 549 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
| 547 | + if ( ! empty($args['data'])) { |
|
| 548 | + foreach ($args['data'] as $key => $value) { |
|
| 549 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 553 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 554 | 554 | |
| 555 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 555 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 556 | 556 | |
| 557 | - if ( ! empty( $args['desc'] ) ) { |
|
| 558 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 557 | + if ( ! empty($args['desc'])) { |
|
| 558 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
| 561 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
| 562 | 562 | |
| 563 | 563 | $output .= '</span>'; |
| 564 | 564 | |
@@ -577,15 +577,15 @@ discard block |
||
| 577 | 577 | * |
| 578 | 578 | * @return string The date picker. |
| 579 | 579 | */ |
| 580 | - public function date_field( $args = array() ) { |
|
| 580 | + public function date_field($args = array()) { |
|
| 581 | 581 | |
| 582 | - if ( empty( $args['class'] ) ) { |
|
| 582 | + if (empty($args['class'])) { |
|
| 583 | 583 | $args['class'] = 'give_datepicker'; |
| 584 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
| 584 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
| 585 | 585 | $args['class'] .= ' give_datepicker'; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - return $this->text( $args ); |
|
| 588 | + return $this->text($args); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | * |
| 601 | 601 | * @return string The textarea. |
| 602 | 602 | */ |
| 603 | - public function textarea( $args = array() ) { |
|
| 603 | + public function textarea($args = array()) { |
|
| 604 | 604 | $defaults = array( |
| 605 | 605 | 'name' => 'textarea', |
| 606 | 606 | 'value' => null, |
@@ -610,21 +610,21 @@ discard block |
||
| 610 | 610 | 'disabled' => false, |
| 611 | 611 | ); |
| 612 | 612 | |
| 613 | - $args = wp_parse_args( $args, $defaults ); |
|
| 613 | + $args = wp_parse_args($args, $defaults); |
|
| 614 | 614 | |
| 615 | 615 | $disabled = ''; |
| 616 | - if ( $args['disabled'] ) { |
|
| 616 | + if ($args['disabled']) { |
|
| 617 | 617 | $disabled = ' disabled="disabled"'; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 620 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 621 | 621 | |
| 622 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 622 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 623 | 623 | |
| 624 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
| 624 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
| 625 | 625 | |
| 626 | - if ( ! empty( $args['desc'] ) ) { |
|
| 627 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 626 | + if ( ! empty($args['desc'])) { |
|
| 627 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $output .= '</span>'; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * |
| 645 | 645 | * @return string The text field with ajax search. |
| 646 | 646 | */ |
| 647 | - public function ajax_user_search( $args = array() ) { |
|
| 647 | + public function ajax_user_search($args = array()) { |
|
| 648 | 648 | |
| 649 | 649 | $defaults = array( |
| 650 | 650 | 'name' => 'users', |
@@ -655,13 +655,13 @@ discard block |
||
| 655 | 655 | 'chosen' => true, |
| 656 | 656 | 'number' => 2, |
| 657 | 657 | 'select_atts' => '', |
| 658 | - 'placeholder' => __( 'Select a user', 'give' ), |
|
| 658 | + 'placeholder' => __('Select a user', 'give'), |
|
| 659 | 659 | 'data' => array( |
| 660 | 660 | 'search-type' => 'user', |
| 661 | 661 | ), |
| 662 | 662 | ); |
| 663 | 663 | |
| 664 | - $args = wp_parse_args( $args, $defaults ); |
|
| 664 | + $args = wp_parse_args($args, $defaults); |
|
| 665 | 665 | |
| 666 | 666 | // Set initial args. |
| 667 | 667 | $get_users_args = array( |
@@ -670,31 +670,31 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // Ensure selected user is not included in initial query. |
| 672 | 672 | // This is because sites with many users, it's not a guarantee the selected user will be returned. |
| 673 | - if ( ! empty( $args['selected'] ) ) { |
|
| 673 | + if ( ! empty($args['selected'])) { |
|
| 674 | 674 | $get_users_args['exclude'] = $args['selected']; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | // Initial users array. |
| 678 | - $users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args ); |
|
| 678 | + $users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args); |
|
| 679 | 679 | |
| 680 | 680 | // Now add the selected user to the $users array if the arg is present. |
| 681 | - if ( ! empty( $args['selected'] ) ) { |
|
| 682 | - $selected_user = apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );; |
|
| 683 | - $users = array_merge( $users, $selected_user ); |
|
| 681 | + if ( ! empty($args['selected'])) { |
|
| 682 | + $selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ; |
|
| 683 | + $users = array_merge($users, $selected_user); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | $options = array(); |
| 687 | 687 | |
| 688 | - if ( $users ) { |
|
| 688 | + if ($users) { |
|
| 689 | 689 | $options[0] = $args['placeholder']; |
| 690 | - foreach ( $users as $user ) { |
|
| 691 | - $options[ absint( $user->id ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' ); |
|
| 690 | + foreach ($users as $user) { |
|
| 691 | + $options[absint($user->id)] = esc_html($user->user_login.' ('.$user->user_email.')'); |
|
| 692 | 692 | } |
| 693 | 693 | } else { |
| 694 | - $options[0] = __( 'No users found.', 'give' ); |
|
| 694 | + $options[0] = __('No users found.', 'give'); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $output = $this->select( array( |
|
| 697 | + $output = $this->select(array( |
|
| 698 | 698 | 'name' => $args['name'], |
| 699 | 699 | 'selected' => $args['selected'], |
| 700 | 700 | 'id' => $args['id'], |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | 'show_option_all' => false, |
| 708 | 708 | 'show_option_none' => false, |
| 709 | 709 | 'data' => $args['data'], |
| 710 | - ) ); |
|
| 710 | + )); |
|
| 711 | 711 | |
| 712 | 712 | return $output; |
| 713 | 713 | |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly. |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @return Give |
| 196 | 196 | */ |
| 197 | 197 | public static function instance() {
|
| 198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 199 | 199 | self::$instance = new Give; |
| 200 | 200 | self::$instance->setup_constants(); |
| 201 | 201 | |
| 202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 203 | 203 | |
| 204 | 204 | self::$instance->includes(); |
| 205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @since 1.8.7 |
| 222 | 222 | */ |
| 223 | - do_action( 'give_init', self::$instance ); |
|
| 223 | + do_action('give_init', self::$instance);
|
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function __clone() {
|
| 242 | 242 | // Cloning instances of the class is forbidden |
| 243 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 243 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function __wakeup() {
|
| 255 | 255 | // Unserializing instances of the class is forbidden. |
| 256 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 256 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -267,33 +267,33 @@ discard block |
||
| 267 | 267 | private function setup_constants() {
|
| 268 | 268 | |
| 269 | 269 | // Plugin version |
| 270 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 271 | - define( 'GIVE_VERSION', '1.8.9' ); |
|
| 270 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 271 | + define('GIVE_VERSION', '1.8.9');
|
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Plugin Folder Path |
| 275 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 276 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 275 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 276 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Plugin Folder URL |
| 280 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 281 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 280 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 281 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // Plugin Basename aka: "give/give.php" |
| 285 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 286 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 285 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 286 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Plugin Root File |
| 290 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 291 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 290 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 291 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Make sure CAL_GREGORIAN is defined |
| 295 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 296 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 295 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 296 | + define('CAL_GREGORIAN', 1);
|
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
@@ -308,127 +308,127 @@ discard block |
||
| 308 | 308 | private function includes() {
|
| 309 | 309 | global $give_options; |
| 310 | 310 | |
| 311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 313 | 313 | $give_options = give_get_settings(); |
| 314 | 314 | |
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 320 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 321 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 323 | - |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 338 | - |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
| 356 | - |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 361 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 362 | - |
|
| 363 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 364 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 365 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 366 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 367 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 368 | - |
|
| 369 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 370 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 371 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 372 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 374 | - |
|
| 375 | - if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 376 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 320 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 321 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 323 | + |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 338 | + |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
| 356 | + |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 361 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 362 | + |
|
| 363 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 364 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 365 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 366 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 367 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 368 | + |
|
| 369 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 370 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 371 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 372 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 374 | + |
|
| 375 | + if (defined('WP_CLI') && WP_CLI) {
|
|
| 376 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 380 | - |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
| 387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
| 389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 393 | - |
|
| 394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 396 | - |
|
| 397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 400 | - |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
| 403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 404 | - |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
| 406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
| 407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
| 408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
| 409 | - |
|
| 410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 412 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 413 | - |
|
| 414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
| 415 | - |
|
| 416 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 417 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 419 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 420 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 421 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 424 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 425 | - |
|
| 426 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 427 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 379 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 380 | + |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
| 387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
| 389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 393 | + |
|
| 394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 396 | + |
|
| 397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 400 | + |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
| 403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 404 | + |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
| 406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
| 407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
| 408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
| 409 | + |
|
| 410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 412 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 413 | + |
|
| 414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
| 415 | + |
|
| 416 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 417 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 419 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 420 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 421 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 424 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 425 | + |
|
| 426 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 427 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 428 | 428 | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 431 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 432 | 432 | |
| 433 | 433 | } |
| 434 | 434 | |
@@ -442,26 +442,26 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | public function load_textdomain() {
|
| 444 | 444 | // Set filter for Give's languages directory |
| 445 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 446 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 445 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 446 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 447 | 447 | |
| 448 | 448 | // Traditional WordPress plugin locale filter |
| 449 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 450 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 449 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 450 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 451 | 451 | |
| 452 | 452 | // Setup paths to current locale file |
| 453 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 454 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 453 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 454 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 455 | 455 | |
| 456 | - if ( file_exists( $mofile_global ) ) {
|
|
| 456 | + if (file_exists($mofile_global)) {
|
|
| 457 | 457 | // Look in global /wp-content/languages/give folder |
| 458 | - load_textdomain( 'give', $mofile_global ); |
|
| 459 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 458 | + load_textdomain('give', $mofile_global);
|
|
| 459 | + } elseif (file_exists($mofile_local)) {
|
|
| 460 | 460 | // Look in local location from filter `give_languages_directory` |
| 461 | - load_textdomain( 'give', $mofile_local ); |
|
| 461 | + load_textdomain('give', $mofile_local);
|
|
| 462 | 462 | } else {
|
| 463 | 463 | // Load the default language files packaged up w/ Give |
| 464 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 464 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |