@@ -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_donors_page() { |
| 26 | 26 | $default_views = give_donor_views(); |
| 27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
| 28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
| 29 | - give_render_donor_view( $requested_view, $default_views ); |
|
| 27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
| 28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
| 29 | + give_render_donor_view($requested_view, $default_views); |
|
| 30 | 30 | } else { |
| 31 | 31 | give_donors_list(); |
| 32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $views = array(); |
| 44 | 44 | |
| 45 | - return apply_filters( 'give_donor_views', $views ); |
|
| 45 | + return apply_filters('give_donor_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_donor_tabs', $tabs ); |
|
| 59 | + return apply_filters('give_donor_tabs', $tabs); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | function give_donors_list() { |
| 70 | - include dirname( __FILE__ ) . '/class-donor-table.php'; |
|
| 70 | + include dirname(__FILE__).'/class-donor-table.php'; |
|
| 71 | 71 | |
| 72 | 72 | $donors_table = new Give_Donor_List_Table(); |
| 73 | 73 | $donors_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 | - $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
| 87 | + $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
| 88 | 88 | $donors_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_donor_view( $view, $callbacks ) { |
|
| 116 | +function give_render_donor_view($view, $callbacks) { |
|
| 117 | 117 | |
| 118 | 118 | $render = true; |
| 119 | 119 | |
| 120 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
| 120 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
| 121 | 121 | |
| 122 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
| 123 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
| 122 | + if ( ! current_user_can($donor_view_role)) { |
|
| 123 | + give_set_error('give-no-access', __('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_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
| 127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 128 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
| 129 | 129 | $render = false; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $donor_id = (int) $_GET['id']; |
| 133 | - $donor = new Give_Donor( $donor_id ); |
|
| 133 | + $donor = new Give_Donor($donor_id); |
|
| 134 | 134 | |
| 135 | - if ( empty( $donor->id ) ) { |
|
| 136 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
| 135 | + if (empty($donor->id)) { |
|
| 136 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
| 137 | 137 | $render = false; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -142,9 +142,9 @@ 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()->notices->render_frontend_notices( 0 ); ?> |
|
| 147 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
| 148 | 148 | </div> |
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | |
@@ -152,32 +152,32 @@ discard block |
||
| 152 | 152 | <?php |
| 153 | 153 | printf( |
| 154 | 154 | /* translators: %s: donor number */ |
| 155 | - esc_html__( 'Donor %s', 'give' ), |
|
| 155 | + esc_html__('Donor %s', 'give'), |
|
| 156 | 156 | $donor_id |
| 157 | 157 | ); |
| 158 | 158 | ?> |
| 159 | 159 | </h1> |
| 160 | 160 | |
| 161 | - <?php if ( $donor && $render ) : ?> |
|
| 161 | + <?php if ($donor && $render) : ?> |
|
| 162 | 162 | |
| 163 | 163 | <h2 class="nav-tab-wrapper"> |
| 164 | 164 | <?php |
| 165 | - foreach ( $donor_tabs as $key => $tab ) : |
|
| 165 | + foreach ($donor_tabs as $key => $tab) : |
|
| 166 | 166 | $active = $key === $view ? true : false; |
| 167 | 167 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
| 168 | 168 | printf( |
| 169 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
| 170 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
| 171 | - esc_attr( $class ), |
|
| 172 | - sanitize_html_class( $tab['dashicon'] ), |
|
| 173 | - esc_html( $tab['title'] ) |
|
| 169 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
| 170 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
| 171 | + esc_attr($class), |
|
| 172 | + sanitize_html_class($tab['dashicon']), |
|
| 173 | + esc_html($tab['title']) |
|
| 174 | 174 | ); |
| 175 | 175 | endforeach; |
| 176 | 176 | ?> |
| 177 | 177 | </h2> |
| 178 | 178 | |
| 179 | 179 | <div id="give-donor-card-wrapper"> |
| 180 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
| 180 | + <?php $callbacks[$view]($donor) ?> |
|
| 181 | 181 | </div> |
| 182 | 182 | |
| 183 | 183 | <?php endif; ?> |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @return void |
| 199 | 199 | */ |
| 200 | -function give_donor_view( $donor ) { |
|
| 200 | +function give_donor_view($donor) { |
|
| 201 | 201 | |
| 202 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 202 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * Fires in donor profile screen, above the donor card. |
@@ -208,32 +208,32 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @param object $donor The donor object being displayed. |
| 210 | 210 | */ |
| 211 | - do_action( 'give_donor_card_top', $donor ); |
|
| 211 | + do_action('give_donor_card_top', $donor); |
|
| 212 | 212 | ?> |
| 213 | 213 | |
| 214 | 214 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
| 215 | 215 | |
| 216 | - <form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
| 216 | + <form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
| 217 | 217 | |
| 218 | 218 | <div class="donor-info"> |
| 219 | 219 | |
| 220 | 220 | <div class="donor-bio-header clearfix"> |
| 221 | 221 | |
| 222 | 222 | <div class="avatar-wrap left" id="donor-avatar"> |
| 223 | - <?php echo get_avatar( $donor->email ); ?> |
|
| 223 | + <?php echo get_avatar($donor->email); ?> |
|
| 224 | 224 | </div> |
| 225 | 225 | |
| 226 | 226 | <div id="donor-name-wrap" class="left"> |
| 227 | 227 | <span class="donor-id">#<?php echo $donor->id; ?></span> |
| 228 | - <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
| 228 | + <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
| 229 | 229 | <span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span> |
| 230 | 230 | </div> |
| 231 | 231 | <p class="donor-since info-item"> |
| 232 | - <?php _e( 'Donor since', 'give' ); ?> |
|
| 233 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 232 | + <?php _e('Donor since', 'give'); ?> |
|
| 233 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 234 | 234 | </p> |
| 235 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
| 236 | - <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
| 235 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
| 236 | + <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
| 237 | 237 | <?php endif; ?> |
| 238 | 238 | </div> |
| 239 | 239 | <!-- /donor-bio-header --> |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | <table class="widefat"> |
| 244 | 244 | <tbody> |
| 245 | 245 | <tr class="alternate"> |
| 246 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
| 246 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
| 247 | 247 | <td> |
| 248 | 248 | <span class="donor-user-id info-item edit-item"> |
| 249 | 249 | <?php |
@@ -260,48 +260,48 @@ discard block |
||
| 260 | 260 | 'data' => $data_atts, |
| 261 | 261 | ); |
| 262 | 262 | |
| 263 | - if ( ! empty( $user_id ) ) { |
|
| 264 | - $userdata = get_userdata( $user_id ); |
|
| 263 | + if ( ! empty($user_id)) { |
|
| 264 | + $userdata = get_userdata($user_id); |
|
| 265 | 265 | $user_args['selected'] = $user_id; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - echo Give()->html->ajax_user_search( $user_args ); |
|
| 268 | + echo Give()->html->ajax_user_search($user_args); |
|
| 269 | 269 | ?> |
| 270 | 270 | </span> |
| 271 | 271 | |
| 272 | 272 | <span class="donor-user-id info-item editable"> |
| 273 | - <?php if ( ! empty( $userdata ) ) { ?> |
|
| 274 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
| 273 | + <?php if ( ! empty($userdata)) { ?> |
|
| 274 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
| 275 | 275 | <?php } else { ?> |
| 276 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
| 276 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
| 277 | 277 | <?php } ?> |
| 278 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?> |
|
| 278 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?> |
|
| 279 | 279 | <span class="disconnect-user"> |
| 280 | 280 | - |
| 281 | - <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"> |
|
| 282 | - <?php _e( 'Disconnect User', 'give' ); ?> |
|
| 281 | + <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e('Disconnects the current user ID from this donor record.', 'give'); ?>"> |
|
| 282 | + <?php _e('Disconnect User', 'give'); ?> |
|
| 283 | 283 | </a> |
| 284 | 284 | </span> |
| 285 | 285 | <span class="view-user-profile"> |
| 286 | 286 | | |
| 287 | - <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id=' . $donor->user_id; ?>" aria-label="<?php _e( 'View User Profile of current user ID.', 'give' ); ?>"> |
|
| 288 | - <?php _e( 'View User Profile', 'give' ); ?> |
|
| 287 | + <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id='.$donor->user_id; ?>" aria-label="<?php _e('View User Profile of current user ID.', 'give'); ?>"> |
|
| 288 | + <?php _e('View User Profile', 'give'); ?> |
|
| 289 | 289 | </a> |
| 290 | 290 | </span> |
| 291 | 291 | <?php } ?> |
| 292 | 292 | </span> |
| 293 | 293 | </td> |
| 294 | 294 | </tr> |
| 295 | - <?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?> |
|
| 295 | + <?php if (isset($donor->user_id) && $donor->user_id > 0) : ?> |
|
| 296 | 296 | |
| 297 | 297 | <tr> |
| 298 | - <th scope="col"><?php _e( 'Address:', 'give' ); ?></th> |
|
| 298 | + <th scope="col"><?php _e('Address:', 'give'); ?></th> |
|
| 299 | 299 | <td class="row-title"> |
| 300 | 300 | |
| 301 | 301 | <div class="donor-address-wrapper"> |
| 302 | 302 | |
| 303 | 303 | <?php |
| 304 | - $address = get_user_meta( $donor->user_id, '_give_user_address', true ); |
|
| 304 | + $address = get_user_meta($donor->user_id, '_give_user_address', true); |
|
| 305 | 305 | $defaults = array( |
| 306 | 306 | 'line1' => '', |
| 307 | 307 | 'line2' => '', |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | 'zip' => '', |
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | - $address = wp_parse_args( $address, $defaults ); |
|
| 314 | + $address = wp_parse_args($address, $defaults); |
|
| 315 | 315 | ?> |
| 316 | 316 | |
| 317 | - <?php if ( ! empty( $address ) ) { ?> |
|
| 317 | + <?php if ( ! empty($address)) { ?> |
|
| 318 | 318 | <span class="donor-address info-item editable"> |
| 319 | 319 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
| 320 | 320 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -325,43 +325,43 @@ discard block |
||
| 325 | 325 | </span> |
| 326 | 326 | <?php } ?> |
| 327 | 327 | <span class="donor-address info-item edit-item"> |
| 328 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 329 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 330 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 328 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 329 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 330 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 331 | 331 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
| 332 | 332 | <?php |
| 333 | 333 | |
| 334 | 334 | $selected_country = $address['country']; |
| 335 | 335 | |
| 336 | 336 | $countries = give_get_country_list(); |
| 337 | - foreach ( $countries as $country_code => $country ) { |
|
| 338 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 337 | + foreach ($countries as $country_code => $country) { |
|
| 338 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 339 | 339 | } |
| 340 | 340 | ?> |
| 341 | 341 | </select> |
| 342 | 342 | <?php |
| 343 | 343 | $selected_state = give_get_state(); |
| 344 | - $states = give_get_states( $selected_country ); |
|
| 344 | + $states = give_get_states($selected_country); |
|
| 345 | 345 | |
| 346 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
| 346 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
| 347 | 347 | |
| 348 | - if ( ! empty( $states ) ) { |
|
| 348 | + if ( ! empty($states)) { |
|
| 349 | 349 | ?> |
| 350 | 350 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
| 351 | 351 | <?php |
| 352 | - foreach ( $states as $state_code => $state ) { |
|
| 353 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 352 | + foreach ($states as $state_code => $state) { |
|
| 353 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 354 | 354 | } |
| 355 | 355 | ?> |
| 356 | 356 | </select> |
| 357 | 357 | <?php |
| 358 | 358 | } else { |
| 359 | 359 | ?> |
| 360 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province / County', 'give' ); ?>" /> |
|
| 360 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province / County', 'give'); ?>" /> |
|
| 361 | 361 | <?php |
| 362 | 362 | } |
| 363 | 363 | ?> |
| 364 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 364 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 365 | 365 | </span> |
| 366 | 366 | |
| 367 | 367 | </div> |
@@ -377,10 +377,10 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | <span id="donor-edit-actions" class="edit-item"> |
| 379 | 379 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" /> |
| 380 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
| 380 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
| 381 | 381 | <input type="hidden" name="give_action" value="edit-donor" /> |
| 382 | - <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
| 383 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 382 | + <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
| 383 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 384 | 384 | </span> |
| 385 | 385 | |
| 386 | 386 | </form> |
@@ -395,24 +395,24 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @param object $donor The donor object being displayed. |
| 397 | 397 | */ |
| 398 | - do_action( 'give_donor_before_stats', $donor ); |
|
| 398 | + do_action('give_donor_before_stats', $donor); |
|
| 399 | 399 | ?> |
| 400 | 400 | |
| 401 | 401 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
| 402 | 402 | <ul> |
| 403 | 403 | <li> |
| 404 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
| 404 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
| 405 | 405 | <span class="dashicons dashicons-heart"></span> |
| 406 | 406 | <?php |
| 407 | 407 | // Completed Donations |
| 408 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
| 409 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
| 408 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
| 409 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
| 410 | 410 | ?> |
| 411 | 411 | </a> |
| 412 | 412 | </li> |
| 413 | 413 | <li> |
| 414 | 414 | <span class="dashicons dashicons-chart-area"></span> |
| 415 | - <?php echo give_currency_filter( give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
| 415 | + <?php echo give_currency_filter(give_format_amount($donor->purchase_value, array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
| 416 | 416 | </li> |
| 417 | 417 | <?php |
| 418 | 418 | /** |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @param object $donor The donor object being displayed. |
| 426 | 426 | */ |
| 427 | - do_action( 'give_donor_stats_list', $donor ); |
|
| 427 | + do_action('give_donor_stats_list', $donor); |
|
| 428 | 428 | ?> |
| 429 | 429 | </ul> |
| 430 | 430 | </div> |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | * |
| 438 | 438 | * @param object $donor The donor object being displayed. |
| 439 | 439 | */ |
| 440 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
| 440 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
| 441 | 441 | ?> |
| 442 | 442 | |
| 443 | 443 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -450,46 +450,46 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @param object $donor The donor object being displayed. |
| 452 | 452 | */ |
| 453 | - do_action( 'give_donor_before_tables', $donor ); |
|
| 453 | + do_action('give_donor_before_tables', $donor); |
|
| 454 | 454 | ?> |
| 455 | 455 | |
| 456 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
| 456 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
| 457 | 457 | |
| 458 | 458 | <table class="wp-list-table widefat striped emails"> |
| 459 | 459 | <thead> |
| 460 | 460 | <tr> |
| 461 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
| 462 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
| 461 | + <th><?php _e('Email', 'give'); ?></th> |
|
| 462 | + <th><?php _e('Actions', 'give'); ?></th> |
|
| 463 | 463 | </tr> |
| 464 | 464 | </thead> |
| 465 | 465 | |
| 466 | 466 | <tbody> |
| 467 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
| 467 | + <?php if ( ! empty($donor->emails)) { ?> |
|
| 468 | 468 | |
| 469 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
| 469 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
| 470 | 470 | <tr data-key="<?php echo $key; ?>"> |
| 471 | 471 | <td> |
| 472 | 472 | <?php echo $email; ?> |
| 473 | - <?php if ( 'primary' === $key ) : ?> |
|
| 473 | + <?php if ('primary' === $key) : ?> |
|
| 474 | 474 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
| 475 | 475 | <?php endif; ?> |
| 476 | 476 | </td> |
| 477 | 477 | <td> |
| 478 | - <?php if ( 'primary' !== $key ) : ?> |
|
| 478 | + <?php if ('primary' !== $key) : ?> |
|
| 479 | 479 | <?php |
| 480 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
| 481 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
| 482 | - 'email' => rawurlencode( $email ), |
|
| 480 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
| 481 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
| 482 | + 'email' => rawurlencode($email), |
|
| 483 | 483 | 'give_action' => 'set_donor_primary_email', |
| 484 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
| 485 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
| 486 | - 'email' => rawurlencode( $email ), |
|
| 484 | + ), $base_url), 'give-set-donor-primary-email'); |
|
| 485 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
| 486 | + 'email' => rawurlencode($email), |
|
| 487 | 487 | 'give_action' => 'remove_donor_email', |
| 488 | - ), $base_url ), 'give-remove-donor-email' ); |
|
| 488 | + ), $base_url), 'give-remove-donor-email'); |
|
| 489 | 489 | ?> |
| 490 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
| 490 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
| 491 | 491 | | |
| 492 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
| 492 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
| 493 | 493 | <?php endif; ?> |
| 494 | 494 | </td> |
| 495 | 495 | </tr> |
@@ -499,59 +499,59 @@ discard block |
||
| 499 | 499 | <td colspan="2" class="add-donor-email-td"> |
| 500 | 500 | <div class="add-donor-email-wrapper"> |
| 501 | 501 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" /> |
| 502 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
| 503 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
| 504 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
| 505 | - <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
| 502 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
| 503 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
| 504 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
| 505 | + <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
| 506 | 506 | <span class="spinner"></span> |
| 507 | 507 | </div> |
| 508 | 508 | <div class="notice-wrap"></div> |
| 509 | 509 | </td> |
| 510 | 510 | </tr> |
| 511 | 511 | <?php } else { ?> |
| 512 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr> |
|
| 512 | + <tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr> |
|
| 513 | 513 | <?php }// End if(). |
| 514 | 514 | ?> |
| 515 | 515 | </tbody> |
| 516 | 516 | </table> |
| 517 | 517 | |
| 518 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
| 518 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
| 519 | 519 | <?php |
| 520 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
| 521 | - $payments = give_get_payments( array( |
|
| 520 | + $payment_ids = explode(',', $donor->payment_ids); |
|
| 521 | + $payments = give_get_payments(array( |
|
| 522 | 522 | 'post__in' => $payment_ids, |
| 523 | - ) ); |
|
| 524 | - $payments = array_slice( $payments, 0, 10 ); |
|
| 523 | + )); |
|
| 524 | + $payments = array_slice($payments, 0, 10); |
|
| 525 | 525 | ?> |
| 526 | 526 | <table class="wp-list-table widefat striped payments"> |
| 527 | 527 | <thead> |
| 528 | 528 | <tr> |
| 529 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
| 530 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
| 531 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
| 532 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
| 533 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
| 529 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
| 530 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
| 531 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
| 532 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
| 533 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
| 534 | 534 | </tr> |
| 535 | 535 | </thead> |
| 536 | 536 | <tbody> |
| 537 | - <?php if ( ! empty( $payments ) ) { ?> |
|
| 538 | - <?php foreach ( $payments as $payment ) : ?> |
|
| 537 | + <?php if ( ! empty($payments)) { ?> |
|
| 538 | + <?php foreach ($payments as $payment) : ?> |
|
| 539 | 539 | <tr> |
| 540 | 540 | <td><?php echo $payment->ID; ?></td> |
| 541 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
| 542 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
| 543 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
| 541 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
| 542 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
| 543 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
| 544 | 544 | <td> |
| 545 | 545 | <?php |
| 546 | 546 | printf( |
| 547 | 547 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 548 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
| 548 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
| 549 | 549 | sprintf( |
| 550 | 550 | /* translators: %s: Donation ID */ |
| 551 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
| 551 | + esc_attr__('View Donation %s.', 'give'), |
|
| 552 | 552 | $payment->ID |
| 553 | 553 | ), |
| 554 | - __( 'View Donation', 'give' ) |
|
| 554 | + __('View Donation', 'give') |
|
| 555 | 555 | ); |
| 556 | 556 | ?> |
| 557 | 557 | |
@@ -566,47 +566,47 @@ discard block |
||
| 566 | 566 | * @param object $donor The donor object being displayed. |
| 567 | 567 | * @param object $payment The payment object being displayed. |
| 568 | 568 | */ |
| 569 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
| 569 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
| 570 | 570 | ?> |
| 571 | 571 | </td> |
| 572 | 572 | </tr> |
| 573 | 573 | <?php endforeach; ?> |
| 574 | 574 | <?php } else { ?> |
| 575 | 575 | <tr> |
| 576 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
| 576 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
| 577 | 577 | </tr> |
| 578 | 578 | <?php }// End if(). |
| 579 | 579 | ?> |
| 580 | 580 | </tbody> |
| 581 | 581 | </table> |
| 582 | 582 | |
| 583 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
| 583 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
| 584 | 584 | <?php |
| 585 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
| 585 | + $donations = give_get_users_completed_donations($donor->email); |
|
| 586 | 586 | ?> |
| 587 | 587 | <table class="wp-list-table widefat striped donations"> |
| 588 | 588 | <thead> |
| 589 | 589 | <tr> |
| 590 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
| 591 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
| 590 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
| 591 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
| 592 | 592 | </tr> |
| 593 | 593 | </thead> |
| 594 | 594 | <tbody> |
| 595 | - <?php if ( ! empty( $donations ) ) { ?> |
|
| 596 | - <?php foreach ( $donations as $donation ) : ?> |
|
| 595 | + <?php if ( ! empty($donations)) { ?> |
|
| 596 | + <?php foreach ($donations as $donation) : ?> |
|
| 597 | 597 | <tr> |
| 598 | 598 | <td><?php echo $donation->post_title; ?></td> |
| 599 | 599 | <td> |
| 600 | 600 | <?php |
| 601 | 601 | printf( |
| 602 | 602 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 603 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
| 603 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
| 604 | 604 | sprintf( |
| 605 | 605 | /* translators: %s: form name */ |
| 606 | - esc_attr__( 'View Form %s.', 'give' ), |
|
| 606 | + esc_attr__('View Form %s.', 'give'), |
|
| 607 | 607 | $donation->post_title |
| 608 | 608 | ), |
| 609 | - __( 'View Form', 'give' ) |
|
| 609 | + __('View Form', 'give') |
|
| 610 | 610 | ); |
| 611 | 611 | ?> |
| 612 | 612 | </td> |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | <?php endforeach; ?> |
| 615 | 615 | <?php } else { ?> |
| 616 | 616 | <tr> |
| 617 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
| 617 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
| 618 | 618 | </tr> |
| 619 | 619 | <?php } ?> |
| 620 | 620 | </tbody> |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | * |
| 629 | 629 | * @param object $donor The donor object being displayed. |
| 630 | 630 | */ |
| 631 | - do_action( 'give_donor_after_tables', $donor ); |
|
| 631 | + do_action('give_donor_after_tables', $donor); |
|
| 632 | 632 | ?> |
| 633 | 633 | |
| 634 | 634 | </div> |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | * |
| 642 | 642 | * @param object $donor The donor object being displayed. |
| 643 | 643 | */ |
| 644 | - do_action( 'give_donor_card_bottom', $donor ); |
|
| 644 | + do_action('give_donor_card_bottom', $donor); |
|
| 645 | 645 | |
| 646 | 646 | } |
| 647 | 647 | |
@@ -654,30 +654,30 @@ discard block |
||
| 654 | 654 | * |
| 655 | 655 | * @return void |
| 656 | 656 | */ |
| 657 | -function give_donor_notes_view( $donor ) { |
|
| 657 | +function give_donor_notes_view($donor) { |
|
| 658 | 658 | |
| 659 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
| 660 | - $paged = absint( $paged ); |
|
| 659 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
| 660 | + $paged = absint($paged); |
|
| 661 | 661 | $note_count = $donor->get_notes_count(); |
| 662 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
| 663 | - $total_pages = ceil( $note_count / $per_page ); |
|
| 664 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
| 662 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
| 663 | + $total_pages = ceil($note_count / $per_page); |
|
| 664 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
| 665 | 665 | ?> |
| 666 | 666 | |
| 667 | 667 | <div id="donor-notes-wrapper"> |
| 668 | 668 | <div class="donor-notes-header"> |
| 669 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
| 669 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
| 670 | 670 | </div> |
| 671 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
| 671 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
| 672 | 672 | |
| 673 | - <?php if ( 1 == $paged ) : ?> |
|
| 673 | + <?php if (1 == $paged) : ?> |
|
| 674 | 674 | <div style="display: block; margin-bottom: 55px;"> |
| 675 | - <form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
| 675 | + <form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
| 676 | 676 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
| 677 | 677 | <br /> |
| 678 | 678 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" /> |
| 679 | 679 | <input type="hidden" name="give_action" value="add-donor-note" /> |
| 680 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
| 680 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
| 681 | 681 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" /> |
| 682 | 682 | </form> |
| 683 | 683 | </div> |
@@ -692,26 +692,26 @@ discard block |
||
| 692 | 692 | 'show_all' => true, |
| 693 | 693 | ); |
| 694 | 694 | |
| 695 | - echo paginate_links( $pagination_args ); |
|
| 695 | + echo paginate_links($pagination_args); |
|
| 696 | 696 | ?> |
| 697 | 697 | |
| 698 | 698 | <div id="give-donor-notes" class="postbox"> |
| 699 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
| 700 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
| 699 | + <?php if (count($donor_notes) > 0) { ?> |
|
| 700 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
| 701 | 701 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
| 702 | 702 | <span class="note-content-wrap"> |
| 703 | - <?php echo stripslashes( $note ); ?> |
|
| 703 | + <?php echo stripslashes($note); ?> |
|
| 704 | 704 | </span> |
| 705 | 705 | </div> |
| 706 | 706 | <?php endforeach; ?> |
| 707 | 707 | <?php } else { ?> |
| 708 | 708 | <div class="give-no-donor-notes"> |
| 709 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
| 709 | + <?php _e('No donor notes found.', 'give'); ?> |
|
| 710 | 710 | </div> |
| 711 | 711 | <?php } ?> |
| 712 | 712 | </div> |
| 713 | 713 | |
| 714 | - <?php echo paginate_links( $pagination_args ); ?> |
|
| 714 | + <?php echo paginate_links($pagination_args); ?> |
|
| 715 | 715 | |
| 716 | 716 | </div> |
| 717 | 717 | |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | * |
| 728 | 728 | * @return void |
| 729 | 729 | */ |
| 730 | -function give_donor_delete_view( $donor ) { |
|
| 730 | +function give_donor_delete_view($donor) { |
|
| 731 | 731 | |
| 732 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
| 732 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
| 733 | 733 | |
| 734 | 734 | /** |
| 735 | 735 | * Fires in donor delete screen, above the content. |
@@ -738,15 +738,15 @@ discard block |
||
| 738 | 738 | * |
| 739 | 739 | * @param object $donor The donor object being displayed. |
| 740 | 740 | */ |
| 741 | - do_action( 'give_donor_delete_top', $donor ); |
|
| 741 | + do_action('give_donor_delete_top', $donor); |
|
| 742 | 742 | ?> |
| 743 | 743 | |
| 744 | 744 | <div class="info-wrapper donor-section"> |
| 745 | 745 | |
| 746 | - <form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
| 746 | + <form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
| 747 | 747 | |
| 748 | 748 | <div class="donor-notes-header"> |
| 749 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
| 749 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
| 750 | 750 | </div> |
| 751 | 751 | |
| 752 | 752 | |
@@ -754,20 +754,20 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | <span class="delete-donor-options"> |
| 756 | 756 | <p> |
| 757 | - <?php echo Give()->html->checkbox( array( |
|
| 757 | + <?php echo Give()->html->checkbox(array( |
|
| 758 | 758 | 'name' => 'give-donor-delete-confirm', |
| 759 | - ) ); ?> |
|
| 760 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
| 759 | + )); ?> |
|
| 760 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
| 761 | 761 | </p> |
| 762 | 762 | |
| 763 | 763 | <p> |
| 764 | - <?php echo Give()->html->checkbox( array( |
|
| 764 | + <?php echo Give()->html->checkbox(array( |
|
| 765 | 765 | 'name' => 'give-donor-delete-records', |
| 766 | 766 | 'options' => array( |
| 767 | 767 | 'disabled' => true, |
| 768 | 768 | ), |
| 769 | - ) ); ?> |
|
| 770 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
| 769 | + )); ?> |
|
| 770 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
| 771 | 771 | </p> |
| 772 | 772 | |
| 773 | 773 | <?php |
@@ -780,16 +780,16 @@ discard block |
||
| 780 | 780 | * |
| 781 | 781 | * @param object $donor The donor object being displayed. |
| 782 | 782 | */ |
| 783 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
| 783 | + do_action('give_donor_delete_inputs', $donor); |
|
| 784 | 784 | ?> |
| 785 | 785 | </span> |
| 786 | 786 | |
| 787 | 787 | <span id="donor-edit-actions"> |
| 788 | 788 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" /> |
| 789 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
| 789 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
| 790 | 790 | <input type="hidden" name="give_action" value="delete-donor" /> |
| 791 | - <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
| 792 | - <a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 791 | + <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
| 792 | + <a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 793 | 793 | </span> |
| 794 | 794 | |
| 795 | 795 | </div> |
@@ -805,5 +805,5 @@ discard block |
||
| 805 | 805 | * |
| 806 | 806 | * @param object $donor The donor object being displayed. |
| 807 | 807 | */ |
| 808 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
| 808 | + do_action('give_donor_delete_bottom', $donor); |
|
| 809 | 809 | } |
@@ -2,13 +2,13 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Admin View: Settings |
| 4 | 4 | */ |
| 5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 5 | +if ( ! defined('ABSPATH')) { |
|
| 6 | 6 | exit; |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | // Bailout: Do not output anything if setting tab is not defined. |
| 11 | -if( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) : |
|
| 11 | +if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) : |
|
| 12 | 12 | /** |
| 13 | 13 | * Filter the form action. |
| 14 | 14 | * |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @since 1.8 |
| 20 | 20 | */ |
| 21 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
| 21 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Filter the main form tab. |
@@ -30,20 +30,20 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @since 1.8 |
| 32 | 32 | */ |
| 33 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
| 34 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
| 33 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
| 34 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
| 35 | 35 | ?> |
| 36 | - <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix . '-setting-page'; ?>"> |
|
| 36 | + <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix.'-setting-page'; ?>"> |
|
| 37 | 37 | <?php echo $form_open_tag; ?> |
| 38 | - <h1 class="wp-heading-inline"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1> |
|
| 38 | + <h1 class="wp-heading-inline"><?php echo esc_html($tabs[$current_tab]); ?></h1> |
|
| 39 | 39 | <?php |
| 40 | 40 | // Show messages. |
| 41 | 41 | self::show_messages(); |
| 42 | 42 | ?> |
| 43 | 43 | <div class="nav-tab-wrapper give-nav-tab-wrapper"> |
| 44 | 44 | <?php |
| 45 | - foreach ( $tabs as $name => $label ) { |
|
| 46 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
| 45 | + foreach ($tabs as $name => $label) { |
|
| 46 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab == $name ? 'nav-tab-active' : '').'">'.$label.'</a>'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @since 1.8 |
| 57 | 57 | */ |
| 58 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
| 58 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
| 59 | 59 | ?> |
| 60 | 60 | </div> |
| 61 | 61 | <div class="give-sub-nav-tab-wrapper"> |
| 62 | - <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
| 62 | + <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
| 63 | 63 | <nav class="give-sub-nav-tab give-hidden"></nav> |
| 64 | 64 | </div> |
| 65 | 65 | <?php |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @since 1.8 |
| 75 | 75 | */ |
| 76 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
| 76 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Trigger Action. |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @since 1.8 |
| 86 | 86 | */ |
| 87 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
| 87 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
| 88 | 88 | |
| 89 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
| 89 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
| 90 | 90 | <div class="give-submit-wrap"> |
| 91 | - <?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?> |
|
| 92 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'give' ); ?>" /> |
|
| 91 | + <?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?> |
|
| 92 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e('Save changes', 'give'); ?>" /> |
|
| 93 | 93 | </div> |
| 94 | 94 | <?php endif; ?> |
| 95 | 95 | <?php echo $form_close_tag; ?> |
| 96 | 96 | </div> |
| 97 | -<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
| 97 | +<?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?> |
|
| 98 | 98 | <?php endif; ?> |
| 99 | 99 | \ No newline at end of file |
@@ -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 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | global $status, $page; |
| 63 | 63 | |
| 64 | 64 | // Set parent defaults |
| 65 | - parent::__construct( array( |
|
| 66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
| 67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
| 68 | - 'ajax' => false,// Does this table support ajax? |
|
| 69 | - ) ); |
|
| 65 | + parent::__construct(array( |
|
| 66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
| 67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
| 68 | + 'ajax' => false, // Does this table support ajax? |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return false |
| 85 | 85 | */ |
| 86 | - public function search_box( $text, $input_id ) { |
|
| 86 | + public function search_box($text, $input_id) { |
|
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - public function give_search_box( $text, $input_id ) { |
|
| 102 | - $input_id = $input_id . '-search-input'; |
|
| 101 | + public function give_search_box($text, $input_id) { |
|
| 102 | + $input_id = $input_id.'-search-input'; |
|
| 103 | 103 | |
| 104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 106 | 106 | } |
| 107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 107 | + if ( ! empty($_REQUEST['order'])) { |
|
| 108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 109 | 109 | } |
| 110 | 110 | ?> |
| 111 | 111 | <p class="search-box donor-search" role="search"> |
| 112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 115 | 115 | </p> |
| 116 | 116 | <?php |
| 117 | 117 | } |
@@ -124,33 +124,33 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @param string $which |
| 126 | 126 | */ |
| 127 | - protected function display_tablenav( $which ) { |
|
| 127 | + protected function display_tablenav($which) { |
|
| 128 | 128 | |
| 129 | - if ( 'top' === $which ) { |
|
| 130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 129 | + if ('top' === $which) { |
|
| 130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 131 | 131 | } |
| 132 | 132 | ?> |
| 133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 134 | 134 | |
| 135 | - <?php if ( 'top' === $which ) { ?> |
|
| 135 | + <?php if ('top' === $which) { ?> |
|
| 136 | 136 | <h2 class="alignleft reports-earnings-title"> |
| 137 | - <?php esc_html_e( 'Donors Report', 'give' ); ?> |
|
| 137 | + <?php esc_html_e('Donors Report', 'give'); ?> |
|
| 138 | 138 | </h2> |
| 139 | 139 | <?php } ?> |
| 140 | 140 | |
| 141 | 141 | <div class="alignright tablenav-right"> |
| 142 | 142 | <div class="actions bulkactions"> |
| 143 | 143 | <?php |
| 144 | - if ( 'top' === $which ) { |
|
| 145 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
| 144 | + if ('top' === $which) { |
|
| 145 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->bulk_actions( $which ); ?> |
|
| 148 | + $this->bulk_actions($which); ?> |
|
| 149 | 149 | |
| 150 | 150 | </div> |
| 151 | 151 | <?php |
| 152 | - $this->extra_tablenav( $which ); |
|
| 153 | - $this->pagination( $which ); |
|
| 152 | + $this->extra_tablenav($which); |
|
| 153 | + $this->pagination($which); |
|
| 154 | 154 | ?> |
| 155 | 155 | </div> |
| 156 | 156 | |
@@ -172,35 +172,35 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return string Column Name |
| 174 | 174 | */ |
| 175 | - public function column_default( $item, $column_name ) { |
|
| 175 | + public function column_default($item, $column_name) { |
|
| 176 | 176 | |
| 177 | - switch ( $column_name ) { |
|
| 177 | + switch ($column_name) { |
|
| 178 | 178 | |
| 179 | 179 | case 'name' : |
| 180 | - $name = '#' . $item['id'] . ' '; |
|
| 181 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 182 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 183 | - $value = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>'; |
|
| 180 | + $name = '#'.$item['id'].' '; |
|
| 181 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
| 182 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 183 | + $value = '<a href="'.esc_url($view_url).'">'.$name.'</a>'; |
|
| 184 | 184 | break; |
| 185 | 185 | |
| 186 | 186 | case 'num_donations' : |
| 187 | 187 | $value = sprintf( |
| 188 | 188 | '<a href="%s">%s</a>', |
| 189 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $item['id'] ) ), |
|
| 190 | - esc_html( $item['num_donations'] ) |
|
| 189 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($item['id'])), |
|
| 190 | + esc_html($item['num_donations']) |
|
| 191 | 191 | ); |
| 192 | 192 | break; |
| 193 | 193 | |
| 194 | 194 | case 'amount_spent' : |
| 195 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
| 195 | + $value = give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
| 196 | 196 | break; |
| 197 | 197 | |
| 198 | 198 | default: |
| 199 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 199 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 200 | 200 | break; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
| 203 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function get_columns() { |
| 214 | 214 | $columns = array( |
| 215 | - 'name' => __( 'Name', 'give' ), |
|
| 216 | - 'email' => __( 'Email', 'give' ), |
|
| 217 | - 'num_donations' => __( 'Donations', 'give' ), |
|
| 218 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
| 215 | + 'name' => __('Name', 'give'), |
|
| 216 | + 'email' => __('Email', 'give'), |
|
| 217 | + 'num_donations' => __('Donations', 'give'), |
|
| 218 | + 'amount_spent' => __('Total Donated', 'give'), |
|
| 219 | 219 | ); |
| 220 | 220 | |
| 221 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
| 221 | + return apply_filters('give_report_donor_columns', $columns); |
|
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function get_sortable_columns() { |
| 233 | 233 | return array( |
| 234 | - 'id' => array( 'id', true ), |
|
| 235 | - 'name' => array( 'name', true ), |
|
| 236 | - 'num_donations' => array( 'purchase_count', false ), |
|
| 237 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 234 | + 'id' => array('id', true), |
|
| 235 | + 'name' => array('name', true), |
|
| 236 | + 'num_donations' => array('purchase_count', false), |
|
| 237 | + 'amount_spent' => array('purchase_value', false), |
|
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @since 1.0 |
| 246 | 246 | * @return void |
| 247 | 247 | */ |
| 248 | - public function bulk_actions( $which = '' ) { |
|
| 248 | + public function bulk_actions($which = '') { |
|
| 249 | 249 | |
| 250 | 250 | } |
| 251 | 251 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @return int Current page number |
| 258 | 258 | */ |
| 259 | 259 | public function get_paged() { |
| 260 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 260 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @return mixed string If search is present, false otherwise |
| 269 | 269 | */ |
| 270 | 270 | public function get_search() { |
| 271 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 271 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -287,15 +287,15 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | // Get donor query. |
| 289 | 289 | $args = $this->get_donor_query(); |
| 290 | - $donors = Give()->donors->get_donors( $args ); |
|
| 290 | + $donors = Give()->donors->get_donors($args); |
|
| 291 | 291 | |
| 292 | - if ( $donors ) { |
|
| 292 | + if ($donors) { |
|
| 293 | 293 | |
| 294 | - $this->count = count( $donors ); |
|
| 294 | + $this->count = count($donors); |
|
| 295 | 295 | |
| 296 | - foreach ( $donors as $donor ) { |
|
| 296 | + foreach ($donors as $donor) { |
|
| 297 | 297 | |
| 298 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
| 298 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
| 299 | 299 | |
| 300 | 300 | $data[] = array( |
| 301 | 301 | 'id' => $donor->id, |
@@ -323,9 +323,9 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $_donor_query['number'] = -1; |
| 325 | 325 | $_donor_query['offset'] = 0; |
| 326 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
| 326 | + $donors = Give()->donors->get_donors($_donor_query); |
|
| 327 | 327 | |
| 328 | - return count( $donors ); |
|
| 328 | + return count($donors); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | public function get_donor_query() { |
| 339 | 339 | $paged = $this->get_paged(); |
| 340 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 340 | + $offset = $this->per_page * ($paged - 1); |
|
| 341 | 341 | $search = $this->get_search(); |
| 342 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 343 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 342 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 343 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 344 | 344 | |
| 345 | 345 | $args = array( |
| 346 | 346 | 'number' => $this->per_page, |
@@ -349,10 +349,10 @@ discard block |
||
| 349 | 349 | 'orderby' => $orderby, |
| 350 | 350 | ); |
| 351 | 351 | |
| 352 | - if( $search ) { |
|
| 353 | - if ( is_email( $search ) ) { |
|
| 352 | + if ($search) { |
|
| 353 | + if (is_email($search)) { |
|
| 354 | 354 | $args['email'] = $search; |
| 355 | - } elseif ( is_numeric( $search ) ) { |
|
| 355 | + } elseif (is_numeric($search)) { |
|
| 356 | 356 | $args['id'] = $search; |
| 357 | 357 | } else { |
| 358 | 358 | $args['name'] = $search; |
@@ -379,16 +379,16 @@ discard block |
||
| 379 | 379 | $hidden = array(); // No hidden columns |
| 380 | 380 | $sortable = $this->get_sortable_columns(); |
| 381 | 381 | |
| 382 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 382 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 383 | 383 | |
| 384 | 384 | $this->items = $this->reports_data(); |
| 385 | 385 | |
| 386 | 386 | $this->total = $this->get_donor_count(); |
| 387 | 387 | |
| 388 | - $this->set_pagination_args( array( |
|
| 388 | + $this->set_pagination_args(array( |
|
| 389 | 389 | 'total_items' => $this->total, |
| 390 | 390 | 'per_page' => $this->per_page, |
| 391 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
| 392 | - ) ); |
|
| 391 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
| 392 | + )); |
|
| 393 | 393 | } |
| 394 | 394 | } |
@@ -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 | /** |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | global $status, $page; |
| 57 | 57 | |
| 58 | 58 | // Set parent defaults |
| 59 | - parent::__construct( array( |
|
| 60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 59 | + parent::__construct(array( |
|
| 60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 62 | 62 | 'ajax' => false // Does this table support ajax? |
| 63 | - ) ); |
|
| 63 | + )); |
|
| 64 | 64 | |
| 65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
| 65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
| 66 | 66 | $this->query(); |
| 67 | 67 | |
| 68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return string Column Name |
| 80 | 80 | */ |
| 81 | - public function column_default( $item, $column_name ) { |
|
| 82 | - switch ( $column_name ) { |
|
| 81 | + public function column_default($item, $column_name) { |
|
| 82 | + switch ($column_name) { |
|
| 83 | 83 | case 'title': |
| 84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
| 84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
| 85 | 85 | |
| 86 | 86 | return sprintf( |
| 87 | 87 | '<a href="%s">%s</a>', |
| 88 | - get_edit_post_link( $item['ID'] ), |
|
| 88 | + get_edit_post_link($item['ID']), |
|
| 89 | 89 | $title |
| 90 | 90 | ); |
| 91 | 91 | case 'sales': |
| 92 | 92 | return sprintf( |
| 93 | 93 | '<a href="%s">%s</a>', |
| 94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
| 94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
| 95 | 95 | $item['sales'] |
| 96 | 96 | ); |
| 97 | 97 | case 'earnings' : |
| 98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
| 98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
| 99 | 99 | case 'average_sales' : |
| 100 | - return round( $item[ $column_name ] ); |
|
| 100 | + return round($item[$column_name]); |
|
| 101 | 101 | case 'average_earnings' : |
| 102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
| 102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
| 103 | 103 | case 'details' : |
| 104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
| 104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
| 105 | 105 | default: |
| 106 | - return $item[ $column_name ]; |
|
| 106 | + return $item[$column_name]; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function get_columns() { |
| 119 | 119 | $columns = array( |
| 120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
| 121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
| 122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
| 124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
| 125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
| 120 | + 'title' => esc_html__('Form', 'give'), |
|
| 121 | + 'sales' => esc_html__('Donations', 'give'), |
|
| 122 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
| 124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
| 125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function get_sortable_columns() { |
| 140 | 140 | return array( |
| 141 | - 'title' => array( 'title', true ), |
|
| 142 | - 'sales' => array( 'sales', false ), |
|
| 143 | - 'earnings' => array( 'earnings', false ), |
|
| 141 | + 'title' => array('title', true), |
|
| 142 | + 'sales' => array('sales', false), |
|
| 143 | + 'earnings' => array('earnings', false), |
|
| 144 | 144 | ); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @return int Current page number |
| 154 | 154 | */ |
| 155 | 155 | public function get_paged() { |
| 156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @return int Category ID |
| 166 | 166 | */ |
| 167 | 167 | public function get_category() { |
| 168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
| 168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @return void |
| 178 | 178 | */ |
| 179 | - public function bulk_actions( $which = '' ) { |
|
| 179 | + public function bulk_actions($which = '') { |
|
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @param string $which |
| 190 | 190 | */ |
| 191 | - protected function display_tablenav( $which ) { |
|
| 191 | + protected function display_tablenav($which) { |
|
| 192 | 192 | |
| 193 | - if ( 'top' === $which ) { |
|
| 194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 193 | + if ('top' === $which) { |
|
| 194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 195 | 195 | } |
| 196 | 196 | ?> |
| 197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 198 | 198 | |
| 199 | - <?php if ( 'top' === $which ) { ?> |
|
| 199 | + <?php if ('top' === $which) { ?> |
|
| 200 | 200 | <h2 class="alignleft reports-earnings-title"> |
| 201 | - <?php esc_html_e( 'Donation Forms Report', 'give' ); ?> |
|
| 201 | + <?php esc_html_e('Donation Forms Report', 'give'); ?> |
|
| 202 | 202 | </h2> |
| 203 | 203 | <?php } ?> |
| 204 | 204 | |
| 205 | 205 | <div class="alignright tablenav-right"> |
| 206 | 206 | <div class="actions bulkactions"> |
| 207 | - <?php $this->bulk_actions( $which ); ?> |
|
| 207 | + <?php $this->bulk_actions($which); ?> |
|
| 208 | 208 | </div> |
| 209 | 209 | <?php |
| 210 | - $this->extra_tablenav( $which ); |
|
| 211 | - $this->pagination( $which ); |
|
| 210 | + $this->extra_tablenav($which); |
|
| 211 | + $this->pagination($which); |
|
| 212 | 212 | ?> |
| 213 | 213 | </div> |
| 214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function category_filter() { |
| 230 | 230 | |
| 231 | - $categories = get_terms( 'form_category' ); |
|
| 232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
| 233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
| 231 | + $categories = get_terms('form_category'); |
|
| 232 | + if ($categories && ! is_wp_error($categories)) { |
|
| 233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function query() { |
| 246 | 246 | |
| 247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
| 248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
| 248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 249 | 249 | $category = $this->get_category(); |
| 250 | 250 | |
| 251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | 'suppress_filters' => true |
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | - if ( ! empty( $category ) ) { |
|
| 261 | + if ( ! empty($category)) { |
|
| 262 | 262 | $args['tax_query'] = array( |
| 263 | 263 | array( |
| 264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - switch ( $orderby ) : |
|
| 270 | + switch ($orderby) : |
|
| 271 | 271 | case 'title' : |
| 272 | 272 | $args['orderby'] = 'title'; |
| 273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | break; |
| 284 | 284 | endswitch; |
| 285 | 285 | |
| 286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
| 286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
| 287 | 287 | |
| 288 | - $this->donation_forms = new WP_Query( $args ); |
|
| 288 | + $this->donation_forms = new WP_Query($args); |
|
| 289 | 289 | |
| 290 | 290 | // Store total number of donation forms count. |
| 291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | |
| 306 | 306 | $give_forms = $this->donation_forms->posts; |
| 307 | 307 | |
| 308 | - if ( $give_forms ) { |
|
| 309 | - foreach ( $give_forms as $form ) { |
|
| 308 | + if ($give_forms) { |
|
| 309 | + foreach ($give_forms as $form) { |
|
| 310 | 310 | $reports_data[] = array( |
| 311 | 311 | 'ID' => $form, |
| 312 | - 'title' => get_the_title( $form ), |
|
| 313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
| 314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
| 315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
| 316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
| 312 | + 'title' => get_the_title($form), |
|
| 313 | + 'sales' => give_get_form_sales_stats($form), |
|
| 314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
| 315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
| 316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
| 317 | 317 | ); |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
| 338 | 338 | $columns = $this->get_columns(); |
| 339 | 339 | $hidden = array(); // No hidden columns |
| 340 | 340 | $sortable = $this->get_sortable_columns(); |
| 341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 342 | 342 | $this->items = $this->reports_data(); |
| 343 | 343 | $total_items = $this->count; |
| 344 | 344 | |
| 345 | - $this->set_pagination_args( array( |
|
| 345 | + $this->set_pagination_args(array( |
|
| 346 | 346 | 'total_items' => $total_items, |
| 347 | 347 | 'per_page' => $this->per_page, |
| 348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 349 | 349 | ) |
| 350 | 350 | ); |
| 351 | 351 | } |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
| 85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
| 86 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
| 87 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
| 83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
| 85 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
| 86 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
| 87 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function get_sortable_columns() { |
| 101 | 101 | return array( |
| 102 | - 'total_donations' => array( 'total_donations', false ) |
|
| 102 | + 'total_donations' => array('total_donations', false) |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return int Current page number |
| 113 | 113 | */ |
| 114 | 114 | public function get_paged() { |
| 115 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 115 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @since 1.0 |
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | - public function bulk_actions( $which = '' ) { |
|
| 126 | + public function bulk_actions($which = '') { |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
@@ -135,27 +135,27 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param string $which |
| 137 | 137 | */ |
| 138 | - protected function display_tablenav( $which ) { |
|
| 138 | + protected function display_tablenav($which) { |
|
| 139 | 139 | |
| 140 | - if ( 'top' === $which ) { |
|
| 141 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 140 | + if ('top' === $which) { |
|
| 141 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 142 | 142 | } |
| 143 | 143 | ?> |
| 144 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 144 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 145 | 145 | |
| 146 | - <?php if ( 'top' === $which ) { ?> |
|
| 146 | + <?php if ('top' === $which) { ?> |
|
| 147 | 147 | <h2 class="alignleft reports-earnings-title"> |
| 148 | - <?php esc_html_e( 'Donation Methods Report', 'give' ); ?> |
|
| 148 | + <?php esc_html_e('Donation Methods Report', 'give'); ?> |
|
| 149 | 149 | </h2> |
| 150 | 150 | <?php } ?> |
| 151 | 151 | |
| 152 | 152 | <div class="alignright tablenav-right"> |
| 153 | 153 | <div class="actions bulkactions"> |
| 154 | - <?php $this->bulk_actions( $which ); ?> |
|
| 154 | + <?php $this->bulk_actions($which); ?> |
|
| 155 | 155 | </div> |
| 156 | 156 | <?php |
| 157 | - $this->extra_tablenav( $which ); |
|
| 158 | - $this->pagination( $which ); |
|
| 157 | + $this->extra_tablenav($which); |
|
| 158 | + $this->pagination($which); |
|
| 159 | 159 | ?> |
| 160 | 160 | </div> |
| 161 | 161 | |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return int |
| 179 | 179 | */ |
| 180 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
| 180 | + public function give_sort_total_donations($old_value, $new_value) { |
|
| 181 | 181 | // If no sort, default to label. |
| 182 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
| 182 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
| 183 | 183 | |
| 184 | 184 | //If no order, default to asc. |
| 185 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
| 185 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
| 186 | 186 | |
| 187 | 187 | //Determine sort order. |
| 188 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
| 188 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
| 189 | 189 | |
| 190 | - return ( $order === 'asc' ) ? $result : -$result; |
|
| 190 | + return ($order === 'asc') ? $result : -$result; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | $gateways = give_get_payment_gateways(); |
| 205 | 205 | $stats = new Give_Payment_Stats(); |
| 206 | 206 | |
| 207 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 207 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 208 | 208 | |
| 209 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 210 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 209 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 210 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 211 | 211 | |
| 212 | 212 | $reports_data[] = array( |
| 213 | 213 | 'ID' => $gateway_id, |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | 'complete_sales' => $complete_count, |
| 216 | 216 | 'pending_sales' => $pending_count, |
| 217 | 217 | 'total_sales' => $complete_count + $pending_count, |
| 218 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
| 218 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | $columns = $this->get_columns(); |
| 237 | 237 | $hidden = array(); // No hidden columns |
| 238 | 238 | $sortable = $this->get_sortable_columns(); |
| 239 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 239 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 240 | 240 | $this->items = $this->reports_data(); |
| 241 | 241 | |
| 242 | 242 | // Sort Array when we are sorting data in array. |
| 243 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
| 243 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
| 244 | 244 | |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly. |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function give_reports_page() { |
| 32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 34 | 34 | $views = give_reports_default_views(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
| 39 | 39 | |
| 40 | 40 | <h2 class="nav-tab-wrapper"> |
| 41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 41 | + <?php foreach ($views as $tab => $label) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => $tab, |
| 44 | 44 | 'settings-updated' => false, |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 49 | 49 | 'tab' => 'export', |
| 50 | 50 | 'settings-updated' => false, |
| 51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 52 | 52 | <?php } |
| 53 | 53 | /** |
| 54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - do_action( 'give_reports_tabs' ); |
|
| 60 | + do_action('give_reports_tabs'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </h2> |
| 63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.0 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_reports_page_top' ); |
|
| 70 | + do_action('give_reports_page_top'); |
|
| 71 | 71 | |
| 72 | 72 | // Set $active_tab prior to hook firing. |
| 73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
| 73 | + if (in_array($active_tab, array_keys($views))) { |
|
| 74 | 74 | $active_tab = 'reports'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
| 82 | + do_action("give_reports_tab_{$active_tab}"); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Fires after the report page. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_reports_page_bottom' ); |
|
| 89 | + do_action('give_reports_page_bottom'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div><!-- .wrap --> |
| 92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function give_reports_default_views() { |
| 102 | 102 | $views = array( |
| 103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
| 105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
| 106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
| 103 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 104 | + 'forms' => esc_html__('Forms', 'give'), |
|
| 105 | + 'donors' => esc_html__('Donors', 'give'), |
|
| 106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 109 | + $views = apply_filters('give_report_views', $views); |
|
| 110 | 110 | |
| 111 | 111 | return $views; |
| 112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | * @since 1.0 |
| 122 | 122 | * @return string $view Report View |
| 123 | 123 | */ |
| 124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 124 | +function give_get_reporting_view($default = 'earnings') { |
|
| 125 | 125 | |
| 126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 127 | 127 | $view = $default; |
| 128 | 128 | } else { |
| 129 | 129 | $view = $_GET['view']; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 132 | + return apply_filters('give_get_reporting_view', $view); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $current_view = 'earnings'; |
| 143 | 143 | $views = give_reports_default_views(); |
| 144 | 144 | |
| 145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
| 145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
| 146 | 146 | $current_view = $_GET['tab']; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.0 |
| 153 | 153 | */ |
| 154 | - do_action( "give_reports_view_{$current_view}" ); |
|
| 154 | + do_action("give_reports_view_{$current_view}"); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function give_report_views() { |
| 166 | 166 | $views = give_reports_default_views(); |
| 167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 168 | 168 | /** |
| 169 | 169 | * Fires before the report page actions form. |
| 170 | 170 | * |
| 171 | 171 | * @since 1.0 |
| 172 | 172 | */ |
| 173 | - do_action( 'give_report_view_actions_before' ); |
|
| 173 | + do_action('give_report_view_actions_before'); |
|
| 174 | 174 | ?> |
| 175 | 175 | <form id="give-reports-filter" method="get"> |
| 176 | 176 | <select id="give-reports-view" name="view"> |
| 177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 180 | 180 | <?php endforeach; ?> |
| 181 | 181 | </select> |
| 182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @since 1.0 |
| 190 | 190 | */ |
| 191 | - do_action( 'give_report_view_actions' ); |
|
| 191 | + do_action('give_report_view_actions'); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
| 195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
| 196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 197 | 197 | </form> |
| 198 | 198 | <?php |
| 199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @since 1.0 |
| 203 | 203 | */ |
| 204 | - do_action( 'give_report_view_actions_after' ); |
|
| 204 | + do_action('give_report_view_actions_after'); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | function give_reports_forms_table() { |
| 216 | 216 | |
| 217 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 217 | + if (isset($_GET['form-id'])) { |
|
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 222 | 222 | |
| 223 | 223 | $give_table = new Give_Form_Reports_Table(); |
| 224 | 224 | $give_table->prepare_items(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | <?php |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 233 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * Renders the detailed report for a specific give form. |
@@ -239,20 +239,20 @@ discard block |
||
| 239 | 239 | * @return void |
| 240 | 240 | */ |
| 241 | 241 | function give_reports_form_details() { |
| 242 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 242 | + if ( ! isset($_GET['form-id'])) { |
|
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | ?> |
| 246 | 246 | <div class="tablenav top reports-forms-details-wrap"> |
| 247 | 247 | <div class="actions bulkactions"> |
| 248 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 248 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 249 | 249 | </div> |
| 250 | 250 | </div> |
| 251 | 251 | <?php |
| 252 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 252 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 255 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * Renders the Reports Donors Table |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | 265 | function give_reports_donors_table() { |
| 266 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 266 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 267 | 267 | |
| 268 | 268 | $give_table = new Give_Donor_Reports_Table(); |
| 269 | 269 | $give_table->prepare_items(); |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @since 1.0 |
| 277 | 277 | */ |
| 278 | - do_action( 'give_logs_donors_table_top' ); |
|
| 278 | + do_action('give_logs_donors_table_top'); |
|
| 279 | 279 | |
| 280 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
| 280 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
| 281 | 281 | $give_table->display(); |
| 282 | 282 | ?> |
| 283 | 283 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @since 1.0 |
| 292 | 292 | */ |
| 293 | - do_action( 'give_logs_donors_table_bottom' ); |
|
| 293 | + do_action('give_logs_donors_table_bottom'); |
|
| 294 | 294 | ?> |
| 295 | 295 | </div> |
| 296 | 296 | <?php |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 299 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * Renders the Gateways Table |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | * @return void |
| 308 | 308 | */ |
| 309 | 309 | function give_reports_gateways_table() { |
| 310 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 310 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 311 | 311 | |
| 312 | 312 | $give_table = new Give_Gateway_Reports_Table(); |
| 313 | 313 | $give_table->prepare_items(); |
| 314 | 314 | $give_table->display(); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 317 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Renders the Reports Earnings Graphs |
@@ -325,13 +325,13 @@ discard block |
||
| 325 | 325 | function give_reports_earnings() { |
| 326 | 326 | ?> |
| 327 | 327 | <div class="tablenav top reports-table-nav"> |
| 328 | - <h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2> |
|
| 328 | + <h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2> |
|
| 329 | 329 | </div> |
| 330 | 330 | <?php |
| 331 | 331 | give_reports_graph(); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 334 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | function give_estimated_monthly_stats() { |
| 344 | 344 | |
| 345 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
| 345 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
| 346 | 346 | |
| 347 | - if ( false === $estimated ) { |
|
| 347 | + if (false === $estimated) { |
|
| 348 | 348 | |
| 349 | 349 | $estimated = array( |
| 350 | 350 | 'earnings' => 0, |
@@ -353,22 +353,22 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | $stats = new Give_Payment_Stats; |
| 355 | 355 | |
| 356 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 357 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 356 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 357 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 358 | 358 | |
| 359 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 360 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 361 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 362 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 359 | + $current_day = date('d', current_time('timestamp')); |
|
| 360 | + $current_month = date('n', current_time('timestamp')); |
|
| 361 | + $current_year = date('Y', current_time('timestamp')); |
|
| 362 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 363 | 363 | |
| 364 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 365 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 364 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 365 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 366 | 366 | |
| 367 | 367 | // Cache for one day |
| 368 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
| 368 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return maybe_unserialize( $estimated ); |
|
| 371 | + return maybe_unserialize($estimated); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | function give_reports_set_form_method() { |
| 382 | 382 | return 'get'; |
| 383 | 383 | } |
| 384 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
| 385 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
| 384 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
| 385 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
| 386 | 386 | |
| 387 | 387 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -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" class="wp-heading-inline"><?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,13 +153,13 @@ 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 | <div class="give-order-payment give-admin-box-inside"> |
| 159 | 159 | <p> |
| 160 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 161 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 162 | - <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 ), false, false ) ); ?>"/> |
|
| 160 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 161 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 162 | + <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), false, false)); ?>"/> |
|
| 163 | 163 | </p> |
| 164 | 164 | </div> |
| 165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @param int $payment_id Payment id. |
| 173 | 173 | */ |
| 174 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 174 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 175 | 175 | ?> |
| 176 | 176 | |
| 177 | 177 | </div> |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param int $payment_id Payment id. |
| 191 | 191 | */ |
| 192 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 192 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 193 | 193 | ?> |
| 194 | 194 | |
| 195 | 195 | <div id="major-publishing-actions"> |
| 196 | 196 | <div id="publishing-action"> |
| 197 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 198 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 199 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 197 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 198 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 199 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 200 | 200 | 'give-action' => 'email_links', |
| 201 | 201 | 'purchase_id' => $payment_id, |
| 202 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 202 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 203 | 203 | <?php endif; ?> |
| 204 | 204 | </div> |
| 205 | 205 | <div class="clear"></div> |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * |
| 214 | 214 | * @param int $payment_id Payment id. |
| 215 | 215 | */ |
| 216 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 216 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 217 | 217 | ?> |
| 218 | 218 | |
| 219 | 219 | </div> |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | <div id="give-order-details" class="postbox give-order-data"> |
| 226 | 226 | |
| 227 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 227 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 228 | 228 | |
| 229 | 229 | <div class="inside"> |
| 230 | 230 | <div class="give-admin-box"> |
@@ -237,44 +237,44 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @param int $payment_id Payment id. |
| 239 | 239 | */ |
| 240 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 240 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 241 | 241 | |
| 242 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 243 | - if ( $gateway ) : ?> |
|
| 242 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 243 | + if ($gateway) : ?> |
|
| 244 | 244 | <div class="give-order-gateway give-admin-box-inside"> |
| 245 | 245 | <p> |
| 246 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 247 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 246 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 247 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 248 | 248 | </p> |
| 249 | 249 | </div> |
| 250 | 250 | <?php endif; ?> |
| 251 | 251 | |
| 252 | 252 | <div class="give-order-payment-key give-admin-box-inside"> |
| 253 | 253 | <p> |
| 254 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 255 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 254 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 255 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 256 | 256 | </p> |
| 257 | 257 | </div> |
| 258 | 258 | |
| 259 | 259 | <div class="give-order-ip give-admin-box-inside"> |
| 260 | 260 | <p> |
| 261 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 262 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 261 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 262 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 263 | 263 | </p> |
| 264 | 264 | </div> |
| 265 | 265 | |
| 266 | - <?php if ( $transaction_id ) : ?> |
|
| 266 | + <?php if ($transaction_id) : ?> |
|
| 267 | 267 | <div class="give-order-tx-id give-admin-box-inside"> |
| 268 | 268 | <p> |
| 269 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 270 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 269 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 270 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 271 | 271 | </p> |
| 272 | 272 | </div> |
| 273 | 273 | <?php endif; ?> |
| 274 | 274 | |
| 275 | 275 | <div class="give-admin-box-inside"> |
| 276 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
| 277 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 276 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
| 277 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 278 | 278 | </p> |
| 279 | 279 | </div> |
| 280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param int $payment_id Payment id. |
| 288 | 288 | */ |
| 289 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 289 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 290 | 290 | ?> |
| 291 | 291 | |
| 292 | 292 | </div> |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @param int $payment_id Payment id. |
| 308 | 308 | */ |
| 309 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 309 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 310 | 310 | ?> |
| 311 | 311 | |
| 312 | 312 | </div> |
@@ -326,56 +326,56 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @param int $payment_id Payment id. |
| 328 | 328 | */ |
| 329 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 329 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 330 | 330 | ?> |
| 331 | 331 | |
| 332 | 332 | <?php $column_count = 'columns-3'; ?> |
| 333 | 333 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 334 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 334 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 335 | 335 | |
| 336 | 336 | <div class="inside"> |
| 337 | 337 | |
| 338 | 338 | <div class="column-container"> |
| 339 | 339 | <div class="column"> |
| 340 | 340 | <p> |
| 341 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 341 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 342 | 342 | <?php |
| 343 | - if ( $payment_meta['form_id'] ) : |
|
| 343 | + if ($payment_meta['form_id']) : |
|
| 344 | 344 | printf( |
| 345 | 345 | '<a href="%1$s">#%2$s</a>', |
| 346 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 346 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 347 | 347 | $payment_meta['form_id'] |
| 348 | 348 | ); |
| 349 | 349 | endif; |
| 350 | 350 | ?> |
| 351 | 351 | </p> |
| 352 | 352 | <p> |
| 353 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 354 | - <?php echo Give()->html->forms_dropdown( array( |
|
| 353 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 354 | + <?php echo Give()->html->forms_dropdown(array( |
|
| 355 | 355 | 'selected' => $payment_meta['form_id'], |
| 356 | 356 | 'name' => 'give-payment-form-select', |
| 357 | 357 | 'id' => 'give-payment-form-select', |
| 358 | 358 | 'chosen' => true, |
| 359 | - ) ); ?> |
|
| 359 | + )); ?> |
|
| 360 | 360 | </p> |
| 361 | 361 | </div> |
| 362 | 362 | <div class="column"> |
| 363 | 363 | <p> |
| 364 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 365 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 364 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 365 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 366 | 366 | </p> |
| 367 | 367 | <p> |
| 368 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 368 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 369 | 369 | <span class="give-donation-level"> |
| 370 | 370 | <?php |
| 371 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 372 | - if ( empty( $var_prices ) ) { |
|
| 373 | - esc_html_e( 'n/a', 'give' ); |
|
| 371 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 372 | + if (empty($var_prices)) { |
|
| 373 | + esc_html_e('n/a', 'give'); |
|
| 374 | 374 | } else { |
| 375 | 375 | $prices_atts = ''; |
| 376 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 377 | - foreach ( $variable_prices as $variable_price ) { |
|
| 378 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
| 376 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 377 | + foreach ($variable_prices as $variable_price) { |
|
| 378 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | // Variable price dropdown options. |
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | 'name' => 'give-variable-price', |
| 385 | 385 | 'chosen' => true, |
| 386 | 386 | 'show_option_all' => '', |
| 387 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
| 388 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
| 387 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
| 388 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
| 389 | 389 | 'selected' => $payment_meta['price_id'], |
| 390 | 390 | ); |
| 391 | 391 | // Render variable prices select tag html. |
| 392 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 392 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 393 | 393 | } |
| 394 | 394 | ?> |
| 395 | 395 | </span> |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | </div> |
| 398 | 398 | <div class="column"> |
| 399 | 399 | <p> |
| 400 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 401 | - <?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
| 400 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 401 | + <?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?> |
|
| 402 | 402 | </p> |
| 403 | 403 | <p> |
| 404 | 404 | <?php |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * |
| 412 | 412 | * @param int $payment_id Payment id. |
| 413 | 413 | */ |
| 414 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 414 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @param int $payment_id Payment id. |
| 425 | 425 | */ |
| 426 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 426 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | 429 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * |
| 435 | 435 | * @param int $payment_id Payment id. |
| 436 | 436 | */ |
| 437 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 437 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 438 | 438 | |
| 439 | 439 | /** |
| 440 | 440 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * |
| 446 | 446 | * @param int $payment_id Payment id. |
| 447 | 447 | */ |
| 448 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 448 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 449 | 449 | ?> |
| 450 | 450 | </p> |
| 451 | 451 | </div> |
@@ -465,67 +465,67 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @param int $payment_id Payment id. |
| 467 | 467 | */ |
| 468 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 468 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 469 | 469 | ?> |
| 470 | 470 | |
| 471 | 471 | <div id="give-donor-details" class="postbox"> |
| 472 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 472 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 473 | 473 | |
| 474 | 474 | <div class="inside"> |
| 475 | 475 | |
| 476 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
| 476 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
| 477 | 477 | |
| 478 | 478 | <div class="column-container donor-info"> |
| 479 | 479 | <div class="column"> |
| 480 | 480 | <p> |
| 481 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 481 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 482 | 482 | <?php |
| 483 | - if ( ! empty( $donor->id ) ) { |
|
| 483 | + if ( ! empty($donor->id)) { |
|
| 484 | 484 | printf( |
| 485 | 485 | '<a href="%1$s">#%2$s</a>', |
| 486 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
| 486 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
| 487 | 487 | $donor->id |
| 488 | 488 | ); |
| 489 | 489 | } |
| 490 | 490 | ?> |
| 491 | 491 | </p> |
| 492 | 492 | <p> |
| 493 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 494 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 493 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 494 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 495 | 495 | </p> |
| 496 | 496 | </div> |
| 497 | 497 | <div class="column"> |
| 498 | 498 | <p> |
| 499 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 499 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 500 | 500 | <?php |
| 501 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 502 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 501 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 502 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 503 | 503 | |
| 504 | 504 | // Check whether the donor name and WP_User name is same or not. |
| 505 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 506 | - 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>)'; |
|
| 507 | - }else{ |
|
| 505 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 506 | + 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>)'; |
|
| 507 | + } else { |
|
| 508 | 508 | echo $donor_name; |
| 509 | 509 | } |
| 510 | 510 | ?> |
| 511 | 511 | </p> |
| 512 | 512 | <p> |
| 513 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 513 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 514 | 514 | <?php echo $donor->email; ?> |
| 515 | 515 | </p> |
| 516 | 516 | </div> |
| 517 | 517 | <div class="column"> |
| 518 | 518 | <p> |
| 519 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 519 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 520 | 520 | <?php |
| 521 | - echo Give()->html->donor_dropdown( array( |
|
| 521 | + echo Give()->html->donor_dropdown(array( |
|
| 522 | 522 | 'selected' => $donor->id, |
| 523 | 523 | 'name' => 'donor-id', |
| 524 | - ) ); |
|
| 524 | + )); |
|
| 525 | 525 | ?> |
| 526 | 526 | </p> |
| 527 | 527 | <p> |
| 528 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 528 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 529 | 529 | </p> |
| 530 | 530 | </div> |
| 531 | 531 | </div> |
@@ -533,13 +533,13 @@ discard block |
||
| 533 | 533 | <div class="column-container new-donor" style="display: none"> |
| 534 | 534 | <div class="column"> |
| 535 | 535 | <p> |
| 536 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 536 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 537 | 537 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
| 538 | 538 | </p> |
| 539 | 539 | </div> |
| 540 | 540 | <div class="column"> |
| 541 | 541 | <p> |
| 542 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 542 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 543 | 543 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 544 | 544 | </p> |
| 545 | 545 | </div> |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | <p> |
| 548 | 548 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 549 | 549 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 550 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 550 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 551 | 551 | <br> |
| 552 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 552 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 553 | 553 | </p> |
| 554 | 554 | </div> |
| 555 | 555 | </div> |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | * @param array $payment_meta Payment meta. |
| 566 | 566 | * @param array $user_info User information. |
| 567 | 567 | */ |
| 568 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 568 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | 571 | * Fires on the donation details page, in the donor-details metabox. |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | * |
| 575 | 575 | * @param int $payment_id Payment id. |
| 576 | 576 | */ |
| 577 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 577 | + do_action('give_payment_view_details', $payment_id); |
|
| 578 | 578 | ?> |
| 579 | 579 | |
| 580 | 580 | </div> |
@@ -590,11 +590,11 @@ discard block |
||
| 590 | 590 | * |
| 591 | 591 | * @param int $payment_id Payment id. |
| 592 | 592 | */ |
| 593 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 593 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 594 | 594 | ?> |
| 595 | 595 | |
| 596 | 596 | <div id="give-billing-details" class="postbox"> |
| 597 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 597 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 598 | 598 | |
| 599 | 599 | <div class="inside"> |
| 600 | 600 | |
@@ -604,59 +604,59 @@ discard block |
||
| 604 | 604 | <div class="data column-container"> |
| 605 | 605 | <div class="column"> |
| 606 | 606 | <div class="give-wrap-address-line1"> |
| 607 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 608 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 607 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 608 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 609 | 609 | </div> |
| 610 | 610 | <div class="give-wrap-address-line2"> |
| 611 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 612 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 611 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 612 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 613 | 613 | </div> |
| 614 | 614 | </div> |
| 615 | 615 | <div class="column"> |
| 616 | 616 | <div class="give-wrap-address-city"> |
| 617 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 618 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 617 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 618 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 619 | 619 | </div> |
| 620 | 620 | <div class="give-wrap-address-zip"> |
| 621 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 622 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 621 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 622 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 623 | 623 | |
| 624 | 624 | </div> |
| 625 | 625 | </div> |
| 626 | 626 | <div class="column"> |
| 627 | 627 | <div id="give-order-address-country-wrap"> |
| 628 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 628 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 629 | 629 | <?php |
| 630 | - echo Give()->html->select( array( |
|
| 630 | + echo Give()->html->select(array( |
|
| 631 | 631 | 'options' => give_get_country_list(), |
| 632 | 632 | 'name' => 'give-payment-address[0][country]', |
| 633 | 633 | 'selected' => $address['country'], |
| 634 | 634 | 'show_option_all' => false, |
| 635 | 635 | 'show_option_none' => false, |
| 636 | 636 | 'chosen' => true, |
| 637 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 638 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 639 | - ) ); |
|
| 637 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 638 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 639 | + )); |
|
| 640 | 640 | ?> |
| 641 | 641 | </div> |
| 642 | 642 | <div id="give-order-address-state-wrap"> |
| 643 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
| 643 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
| 644 | 644 | <?php |
| 645 | - $states = give_get_states( $address['country'] ); |
|
| 646 | - if ( ! empty( $states ) ) { |
|
| 647 | - echo Give()->html->select( array( |
|
| 645 | + $states = give_get_states($address['country']); |
|
| 646 | + if ( ! empty($states)) { |
|
| 647 | + echo Give()->html->select(array( |
|
| 648 | 648 | 'options' => $states, |
| 649 | 649 | 'name' => 'give-payment-address[0][state]', |
| 650 | 650 | 'selected' => $address['state'], |
| 651 | 651 | 'show_option_all' => false, |
| 652 | 652 | 'show_option_none' => false, |
| 653 | 653 | 'chosen' => true, |
| 654 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 655 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 656 | - ) ); |
|
| 654 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 655 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 656 | + )); |
|
| 657 | 657 | } else { |
| 658 | 658 | ?> |
| 659 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 659 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 660 | 660 | <?php |
| 661 | 661 | } ?> |
| 662 | 662 | </div> |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @param int $payment_id Payment id. |
| 678 | 678 | */ |
| 679 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 679 | + do_action('give_payment_billing_details', $payment_id); |
|
| 680 | 680 | ?> |
| 681 | 681 | |
| 682 | 682 | </div> |
@@ -692,32 +692,32 @@ discard block |
||
| 692 | 692 | * |
| 693 | 693 | * @param int $payment_id Payment id. |
| 694 | 694 | */ |
| 695 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 695 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 696 | 696 | ?> |
| 697 | 697 | |
| 698 | 698 | <div id="give-payment-notes" class="postbox"> |
| 699 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 699 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 700 | 700 | |
| 701 | 701 | <div class="inside"> |
| 702 | 702 | <div id="give-payment-notes-inner"> |
| 703 | 703 | <?php |
| 704 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 705 | - if ( ! empty( $notes ) ) { |
|
| 704 | + $notes = give_get_payment_notes($payment_id); |
|
| 705 | + if ( ! empty($notes)) { |
|
| 706 | 706 | $no_notes_display = ' style="display:none;"'; |
| 707 | - foreach ( $notes as $note ) : |
|
| 707 | + foreach ($notes as $note) : |
|
| 708 | 708 | |
| 709 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 709 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 710 | 710 | |
| 711 | 711 | endforeach; |
| 712 | 712 | } else { |
| 713 | 713 | $no_notes_display = ''; |
| 714 | 714 | } |
| 715 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
| 715 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
| 716 | 716 | </div> |
| 717 | 717 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 718 | 718 | |
| 719 | 719 | <div class="give-clearfix"> |
| 720 | - <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> |
|
| 720 | + <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> |
|
| 721 | 721 | </div> |
| 722 | 722 | |
| 723 | 723 | </div> |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @param int $payment_id Payment id. |
| 735 | 735 | */ |
| 736 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 736 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 737 | 737 | ?> |
| 738 | 738 | |
| 739 | 739 | </div> |
@@ -755,11 +755,11 @@ discard block |
||
| 755 | 755 | * |
| 756 | 756 | * @param int $payment_id Payment id. |
| 757 | 757 | */ |
| 758 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 758 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 759 | 759 | |
| 760 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 760 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 761 | 761 | ?> |
| 762 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 762 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 763 | 763 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 764 | 764 | </form> |
| 765 | 765 | <?php |
@@ -770,6 +770,6 @@ discard block |
||
| 770 | 770 | * |
| 771 | 771 | * @param int $payment_id Payment id. |
| 772 | 772 | */ |
| 773 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 773 | + do_action('give_view_order_details_after', $payment_id); |
|
| 774 | 774 | ?> |
| 775 | 775 | </div><!-- /.wrap --> |
@@ -363,8 +363,8 @@ |
||
| 363 | 363 | 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
| 364 | 364 | ), |
| 365 | 365 | 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
| 366 | - 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
| 367 | - 'give_donation_import' => 'give_donation_import', |
|
| 366 | + 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
| 367 | + 'give_donation_import' => 'give_donation_import', |
|
| 368 | 368 | 'setting_not_save_message' => __( 'Changes you made may not be saved.','give' ), |
| 369 | 369 | ) ); |
| 370 | 370 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,26 +25,26 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_load_scripts() { |
| 27 | 27 | |
| 28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
| 29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
| 28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
| 29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
| 31 | 31 | |
| 32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 34 | 34 | |
| 35 | 35 | // Localize / PHP to AJAX vars. |
| 36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
| 36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
| 37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
| 38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
| 38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
| 39 | 39 | 'currency' => give_get_currency(), |
| 40 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 40 | + 'currency_sign' => give_currency_filter(''), |
|
| 41 | 41 | 'currency_pos' => give_get_currency_position(), |
| 42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
| 43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
| 44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
| 45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
| 46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
| 47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
| 44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
| 45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
| 46 | + 'general_loading' => __('Loading...', 'give'), |
|
| 47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
| 48 | 48 | 'number_decimals' => give_get_price_decimals(), |
| 49 | 49 | 'give_version' => GIVE_VERSION, |
| 50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,81 +58,81 @@ discard block |
||
| 58 | 58 | 'give_form_translation_js', |
| 59 | 59 | array( |
| 60 | 60 | // Field name Validation message. |
| 61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
| 62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
| 63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
| 64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
| 65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
| 66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
| 67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
| 61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
| 62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
| 63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
| 64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
| 65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
| 66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
| 67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
| 68 | 68 | ) |
| 69 | 69 | ), |
| 70 | - ) ); |
|
| 70 | + )); |
|
| 71 | 71 | |
| 72 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
| 72 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
| 73 | 73 | 'ajaxurl' => give_get_ajax_url(), |
| 74 | - 'loading' => __( 'Loading', 'give' ), |
|
| 74 | + 'loading' => __('Loading', 'give'), |
|
| 75 | 75 | // General loading message. |
| 76 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
| 76 | + 'select_option' => __('Please select an option', 'give'), |
|
| 77 | 77 | // Variable pricing error with multi-donation option enabled. |
| 78 | - 'default_gateway' => give_get_default_gateway( null ), |
|
| 79 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
| 78 | + 'default_gateway' => give_get_default_gateway(null), |
|
| 79 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
| 80 | 80 | 'number_decimals' => give_get_price_decimals(), |
| 81 | - ) ); |
|
| 81 | + )); |
|
| 82 | 82 | |
| 83 | 83 | // DEBUG is On. |
| 84 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
| 84 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
| 85 | 85 | |
| 86 | - if ( give_is_cc_verify_enabled() ) { |
|
| 87 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 88 | - wp_enqueue_script( 'give-cc-validator' ); |
|
| 86 | + if (give_is_cc_verify_enabled()) { |
|
| 87 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 88 | + wp_enqueue_script('give-cc-validator'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 92 | - wp_enqueue_script( 'give-float-labels' ); |
|
| 91 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 92 | + wp_enqueue_script('give-float-labels'); |
|
| 93 | 93 | |
| 94 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 95 | - wp_enqueue_script( 'give-blockui' ); |
|
| 94 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 95 | + wp_enqueue_script('give-blockui'); |
|
| 96 | 96 | |
| 97 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 98 | - wp_enqueue_script( 'give-qtip' ); |
|
| 97 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 98 | + wp_enqueue_script('give-qtip'); |
|
| 99 | 99 | |
| 100 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 101 | - wp_enqueue_script( 'give-accounting' ); |
|
| 100 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 101 | + wp_enqueue_script('give-accounting'); |
|
| 102 | 102 | |
| 103 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 104 | - wp_enqueue_script( 'give-magnific' ); |
|
| 103 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 104 | + wp_enqueue_script('give-magnific'); |
|
| 105 | 105 | |
| 106 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 107 | - wp_enqueue_script( 'give-checkout-global' ); |
|
| 106 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 107 | + wp_enqueue_script('give-checkout-global'); |
|
| 108 | 108 | |
| 109 | 109 | // General scripts. |
| 110 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 111 | - wp_enqueue_script( 'give-scripts' ); |
|
| 110 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 111 | + wp_enqueue_script('give-scripts'); |
|
| 112 | 112 | |
| 113 | 113 | // Load AJAX scripts, if enabled. |
| 114 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 115 | - wp_enqueue_script( 'give-ajax' ); |
|
| 114 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 115 | + wp_enqueue_script('give-ajax'); |
|
| 116 | 116 | |
| 117 | 117 | // Localize / Pass AJAX vars from PHP, |
| 118 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
| 119 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
| 118 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
| 119 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
| 120 | 120 | |
| 121 | 121 | } else { |
| 122 | 122 | |
| 123 | 123 | // DEBUG is OFF (one JS file to rule them all!). |
| 124 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 125 | - wp_enqueue_script( 'give' ); |
|
| 124 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 125 | + wp_enqueue_script('give'); |
|
| 126 | 126 | |
| 127 | 127 | // Localize / Pass AJAX vars from PHP. |
| 128 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
| 129 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
| 128 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
| 129 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
| 135 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Register styles. |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | function give_register_styles() { |
| 147 | 147 | |
| 148 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
| 148 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
| 153 | - wp_enqueue_style( 'give-styles' ); |
|
| 152 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
| 153 | + wp_enqueue_style('give-styles'); |
|
| 154 | 154 | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
| 157 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -167,19 +167,19 @@ discard block |
||
| 167 | 167 | function give_get_stylesheet_uri() { |
| 168 | 168 | |
| 169 | 169 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 170 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 170 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 171 | 171 | |
| 172 | 172 | // LTR or RTL files. |
| 173 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 173 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 174 | 174 | |
| 175 | - $file = 'give' . $direction . $suffix . '.css'; |
|
| 175 | + $file = 'give'.$direction.$suffix.'.css'; |
|
| 176 | 176 | $templates_dir = give_get_theme_template_dir_name(); |
| 177 | 177 | |
| 178 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
| 179 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 180 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
| 181 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 182 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
| 178 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
| 179 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 180 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
| 181 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 182 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
| 183 | 183 | |
| 184 | 184 | $uri = false; |
| 185 | 185 | |
@@ -189,23 +189,23 @@ discard block |
||
| 189 | 189 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 190 | 190 | * This allows users to copy just give.css to their theme. |
| 191 | 191 | */ |
| 192 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
| 193 | - if ( ! empty( $nonmin ) ) { |
|
| 194 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 192 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
| 193 | + if ( ! empty($nonmin)) { |
|
| 194 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 195 | 195 | } else { |
| 196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
| 196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
| 197 | 197 | } |
| 198 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
| 199 | - if ( ! empty( $nonmin ) ) { |
|
| 200 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 198 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
| 199 | + if ( ! empty($nonmin)) { |
|
| 200 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 201 | 201 | } else { |
| 202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
| 202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
| 203 | 203 | } |
| 204 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
| 205 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
| 204 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
| 205 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
| 208 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | |
@@ -222,79 +222,79 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return void |
| 224 | 224 | */ |
| 225 | -function give_load_admin_scripts( $hook ) { |
|
| 225 | +function give_load_admin_scripts($hook) { |
|
| 226 | 226 | |
| 227 | 227 | global $post, $post_type; |
| 228 | 228 | |
| 229 | 229 | $give_options = give_get_settings(); |
| 230 | 230 | |
| 231 | 231 | // Directories of assets. |
| 232 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 233 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 234 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 232 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 233 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 234 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 235 | 235 | |
| 236 | 236 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 237 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 237 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 238 | 238 | |
| 239 | 239 | // LTR or RTL files. |
| 240 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 240 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 241 | 241 | |
| 242 | 242 | // Global Admin. |
| 243 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
| 244 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
| 243 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
| 244 | + wp_enqueue_style('give-admin-bar-notification'); |
|
| 245 | 245 | |
| 246 | 246 | // Give Admin Only. |
| 247 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
| 247 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // CSS. |
| 252 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
| 253 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 254 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 255 | - wp_enqueue_style( 'give-admin' ); |
|
| 256 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 257 | - wp_enqueue_style( 'jquery-chosen' ); |
|
| 258 | - wp_enqueue_style( 'thickbox' ); |
|
| 259 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 252 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
| 253 | + wp_enqueue_style('jquery-ui-css'); |
|
| 254 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
| 255 | + wp_enqueue_style('give-admin'); |
|
| 256 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
| 257 | + wp_enqueue_style('jquery-chosen'); |
|
| 258 | + wp_enqueue_style('thickbox'); |
|
| 259 | + wp_enqueue_style('wp-color-picker'); |
|
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | // JS. |
| 263 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 264 | - wp_enqueue_script( 'give-selector-cache' ); |
|
| 263 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 264 | + wp_enqueue_script('give-selector-cache'); |
|
| 265 | 265 | |
| 266 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 267 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 266 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 267 | + wp_enqueue_script('jquery-chosen'); |
|
| 268 | 268 | |
| 269 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 270 | - wp_enqueue_script( 'give-accounting' ); |
|
| 269 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 270 | + wp_enqueue_script('give-accounting'); |
|
| 271 | 271 | |
| 272 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 273 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 274 | - wp_enqueue_script( 'thickbox' ); |
|
| 272 | + wp_enqueue_script('wp-color-picker'); |
|
| 273 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 274 | + wp_enqueue_script('thickbox'); |
|
| 275 | 275 | |
| 276 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
| 277 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
| 276 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
| 277 | + wp_enqueue_script('give-admin-scripts'); |
|
| 278 | 278 | |
| 279 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
| 280 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 279 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
| 280 | + wp_enqueue_script('jquery-flot'); |
|
| 281 | 281 | |
| 282 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 283 | - wp_enqueue_script( 'give-qtip' ); |
|
| 282 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 283 | + wp_enqueue_script('give-qtip'); |
|
| 284 | 284 | |
| 285 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 286 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
| 285 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 286 | + wp_enqueue_script('give-repeatable-fields'); |
|
| 287 | 287 | |
| 288 | 288 | // Forms CPT Script. |
| 289 | - if ( $post_type === 'give_forms' ) { |
|
| 290 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 291 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
| 289 | + if ($post_type === 'give_forms') { |
|
| 290 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 291 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Settings Scripts. |
| 295 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
| 296 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 297 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
| 295 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
| 296 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 297 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // Price Separators. |
@@ -302,80 +302,80 @@ discard block |
||
| 302 | 302 | $decimal_separator = give_get_price_decimal_separator(); |
| 303 | 303 | |
| 304 | 304 | // Localize strings & variables for JS. |
| 305 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
| 306 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
| 305 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
| 306 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
| 307 | 307 | 'give_version' => GIVE_VERSION, |
| 308 | 308 | 'thousands_separator' => $thousand_separator, |
| 309 | 309 | 'decimal_separator' => $decimal_separator, |
| 310 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
| 311 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
| 312 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
| 313 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
| 314 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
| 315 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
| 316 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
| 317 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
| 318 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
| 319 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 320 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 321 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
| 322 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
| 323 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
| 324 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
| 325 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
| 326 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
| 327 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
| 310 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
| 311 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
| 312 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
| 313 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
| 314 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
| 315 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
| 316 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
| 317 | + 'one_option' => __('Choose a form', 'give'), |
|
| 318 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
| 319 | + 'currency_sign' => give_currency_filter(''), |
|
| 320 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 321 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
| 322 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
| 323 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
| 324 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
| 325 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
| 326 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
| 327 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
| 328 | 328 | /* translators : %s: Donation form options metabox */ |
| 329 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
| 330 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 331 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
| 332 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
| 333 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
| 334 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
| 335 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
| 329 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
| 330 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 331 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
| 332 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
| 333 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
| 334 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
| 335 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
| 336 | 336 | 'bulk_action' => array( |
| 337 | 337 | 'delete' => array( |
| 338 | - 'zero' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
| 339 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
| 340 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
| 338 | + 'zero' => __('You must choose at least one or more payments to delete.', 'give'), |
|
| 339 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
| 340 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
| 341 | 341 | ), |
| 342 | 342 | 'resend-receipt' => array( |
| 343 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
| 344 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
| 345 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
| 343 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
| 344 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
| 345 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
| 346 | 346 | ), |
| 347 | 347 | 'set-to-status' => array( |
| 348 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
| 349 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
| 350 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
| 348 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
| 349 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
| 350 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
| 351 | 351 | ), |
| 352 | 352 | ), |
| 353 | 353 | 'metabox_fields' => array( |
| 354 | 354 | 'media' => array( |
| 355 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
| 355 | + 'button_title' => __('Choose Image', 'give'), |
|
| 356 | 356 | ), |
| 357 | 357 | 'file' => array( |
| 358 | - 'button_title' => __( 'Choose File', 'give' ), |
|
| 358 | + 'button_title' => __('Choose File', 'give'), |
|
| 359 | 359 | ) |
| 360 | 360 | ), |
| 361 | 361 | 'chosen' => array( |
| 362 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
| 363 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
| 362 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
| 363 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
| 364 | 364 | ), |
| 365 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
| 366 | - 'error_message' => __( 'Something went wrong kindly try again!','give' ), |
|
| 365 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
| 366 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
| 367 | 367 | 'give_donation_import' => 'give_donation_import', |
| 368 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.','give' ), |
|
| 369 | - ) ); |
|
| 368 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
| 369 | + )); |
|
| 370 | 370 | |
| 371 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
| 371 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
| 372 | 372 | // call for new media manager. |
| 373 | 373 | wp_enqueue_media(); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
| 378 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | 381 | * Admin Give Icon |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | ?> |
| 391 | 391 | <style type="text/css" media="screen"> |
| 392 | 392 | |
| 393 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
| 393 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
| 394 | 394 | @font-face { |
| 395 | 395 | font-family: 'give-icomoon'; |
| 396 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 397 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 398 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 399 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 396 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 397 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 398 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 399 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 400 | 400 | font-weight: normal; |
| 401 | 401 | font-style: normal; |
| 402 | 402 | } |
@@ -415,4 +415,4 @@ discard block |
||
| 415 | 415 | <?php |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
| 418 | +add_action('admin_head', 'give_admin_icon'); |
|
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return mixed |
| 24 | 24 | */ |
| 25 | 25 | function give_get_price_decimals() { |
| 26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 2 ) ); |
|
| 26 | + return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 2)); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function give_get_price_thousand_separator() { |
| 37 | 37 | $give_options = give_get_settings(); |
| 38 | - $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ','; |
|
| 39 | - $thousand_separator = empty( $thousand_separator ) ? ' ' : $thousand_separator; |
|
| 38 | + $thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ','; |
|
| 39 | + $thousand_separator = empty($thousand_separator) ? ' ' : $thousand_separator; |
|
| 40 | 40 | |
| 41 | 41 | return $thousand_separator; |
| 42 | 42 | } |
@@ -55,11 +55,10 @@ discard block |
||
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | $thousand_separator = give_get_price_thousand_separator(); |
| 58 | - $default_decimal_separator = in_array( $thousand_separator, $default_decimal_separators ) ? |
|
| 59 | - $default_decimal_separators[$thousand_separator] : |
|
| 60 | - '.'; |
|
| 58 | + $default_decimal_separator = in_array($thousand_separator, $default_decimal_separators) ? |
|
| 59 | + $default_decimal_separators[$thousand_separator] : '.'; |
|
| 61 | 60 | |
| 62 | - $decimal_separator = give_get_option( 'decimal_separator', $default_decimal_separator ); |
|
| 61 | + $decimal_separator = give_get_option('decimal_separator', $default_decimal_separator); |
|
| 63 | 62 | |
| 64 | 63 | return $decimal_separator; |
| 65 | 64 | } |
@@ -74,8 +73,8 @@ discard block |
||
| 74 | 73 | * |
| 75 | 74 | * @return string $amount Newly sanitized amount |
| 76 | 75 | */ |
| 77 | -function give_sanitize_amount_for_db( $number ) { |
|
| 78 | - return give_maybe_sanitize_amount( $number, 6 ); |
|
| 76 | +function give_sanitize_amount_for_db($number) { |
|
| 77 | + return give_maybe_sanitize_amount($number, 6); |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | /** |
@@ -89,41 +88,41 @@ discard block |
||
| 89 | 88 | * |
| 90 | 89 | * @return string $amount Newly sanitized amount |
| 91 | 90 | */ |
| 92 | -function give_maybe_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
| 91 | +function give_maybe_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
| 93 | 92 | $thousand_separator = give_get_price_thousand_separator(); |
| 94 | 93 | $decimal_separator = give_get_price_decimal_separator(); |
| 95 | 94 | |
| 96 | 95 | // Bailout. |
| 97 | - if( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) { |
|
| 96 | + if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) { |
|
| 98 | 97 | return $number; |
| 99 | 98 | }elseif ( |
| 100 | - ( false == strpos( $number, $thousand_separator ) ) && |
|
| 101 | - ( false === strpos( $number, $decimal_separator ) ) |
|
| 99 | + (false == strpos($number, $thousand_separator)) && |
|
| 100 | + (false === strpos($number, $decimal_separator)) |
|
| 102 | 101 | ) { |
| 103 | - return number_format( $number, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' ); |
|
| 102 | + return number_format($number, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', ''); |
|
| 104 | 103 | } |
| 105 | 104 | |
| 106 | 105 | // Handle thousand separator as '.' |
| 107 | 106 | // Handle sanitize database values. |
| 108 | - $number_parts = explode( '.', $number ); |
|
| 109 | - $is_db_sanitize_val = ( 2 === count( $number_parts ) && |
|
| 110 | - is_numeric( $number_parts[0] ) && |
|
| 111 | - is_numeric( $number_parts[1] ) && |
|
| 112 | - ( 6 === strlen( $number_parts[1] ) ) ); |
|
| 107 | + $number_parts = explode('.', $number); |
|
| 108 | + $is_db_sanitize_val = (2 === count($number_parts) && |
|
| 109 | + is_numeric($number_parts[0]) && |
|
| 110 | + is_numeric($number_parts[1]) && |
|
| 111 | + (6 === strlen($number_parts[1]))); |
|
| 113 | 112 | |
| 114 | - if( $is_db_sanitize_val ) { |
|
| 113 | + if ($is_db_sanitize_val) { |
|
| 115 | 114 | // Sanitize database value. |
| 116 | - return number_format( $number, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' ); |
|
| 115 | + return number_format($number, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', ''); |
|
| 117 | 116 | |
| 118 | 117 | } elseif ( |
| 119 | 118 | '.' === $thousand_separator && |
| 120 | - false !== strpos( $number, $thousand_separator ) |
|
| 121 | - ){ |
|
| 119 | + false !== strpos($number, $thousand_separator) |
|
| 120 | + ) { |
|
| 122 | 121 | // Fix point thousand separator value. |
| 123 | - $number = str_replace( '.', '', $number ); |
|
| 122 | + $number = str_replace('.', '', $number); |
|
| 124 | 123 | } |
| 125 | 124 | |
| 126 | - return give_sanitize_amount( $number, $dp, $trim_zeros ); |
|
| 125 | + return give_sanitize_amount($number, $dp, $trim_zeros); |
|
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | /** |
@@ -139,67 +138,67 @@ discard block |
||
| 139 | 138 | * |
| 140 | 139 | * @return string $amount Newly sanitized amount |
| 141 | 140 | */ |
| 142 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
| 141 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
| 143 | 142 | |
| 144 | 143 | // Bailout. |
| 145 | - if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) { |
|
| 144 | + if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) { |
|
| 146 | 145 | return $number; |
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 | // Remove slash from amount. |
| 150 | 149 | // If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number. |
| 151 | 150 | // To prevent notices and warning remove slash from amount/number. |
| 152 | - $number = wp_unslash( $number ); |
|
| 151 | + $number = wp_unslash($number); |
|
| 153 | 152 | |
| 154 | 153 | $thousand_separator = give_get_price_thousand_separator(); |
| 155 | 154 | |
| 156 | 155 | $locale = localeconv(); |
| 157 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
| 156 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
| 158 | 157 | |
| 159 | 158 | // Remove locale from string |
| 160 | - if ( ! is_float( $number ) ) { |
|
| 161 | - $number = str_replace( $decimals, '.', $number ); |
|
| 159 | + if ( ! is_float($number)) { |
|
| 160 | + $number = str_replace($decimals, '.', $number); |
|
| 162 | 161 | } |
| 163 | 162 | |
| 164 | 163 | // Remove thousand amount formatting if amount has. |
| 165 | 164 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
| 166 | 165 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
| 167 | - if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
| 168 | - $number = str_replace( $thousand_separator, '', $number ); |
|
| 169 | - } elseif ( in_array( $thousand_separator, $decimals ) ) { |
|
| 170 | - $number = preg_replace( '/\.(?=.*\.)/', '', $number ); |
|
| 166 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
| 167 | + $number = str_replace($thousand_separator, '', $number); |
|
| 168 | + } elseif (in_array($thousand_separator, $decimals)) { |
|
| 169 | + $number = preg_replace('/\.(?=.*\.)/', '', $number); |
|
| 171 | 170 | } |
| 172 | 171 | |
| 173 | 172 | // Remove non numeric entity before decimal separator. |
| 174 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
| 173 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
| 175 | 174 | $default_dp = give_get_price_decimals(); |
| 176 | 175 | |
| 177 | 176 | // Reset negative amount to zero. |
| 178 | - if ( 0 > $number ) { |
|
| 179 | - $number = number_format( 0, $default_dp, '.' ); |
|
| 177 | + if (0 > $number) { |
|
| 178 | + $number = number_format(0, $default_dp, '.'); |
|
| 180 | 179 | } |
| 181 | 180 | |
| 182 | 181 | // If number does not have decimal then add number of decimals to it. |
| 183 | 182 | if ( |
| 184 | - false === strpos( $number, '.' ) |
|
| 185 | - || ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) ) |
|
| 183 | + false === strpos($number, '.') |
|
| 184 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
| 186 | 185 | ) { |
| 187 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
| 186 | + $number = number_format($number, $default_dp, '.', ''); |
|
| 188 | 187 | } |
| 189 | 188 | |
| 190 | 189 | // Format number by custom number of decimals. |
| 191 | - if ( false !== $dp ) { |
|
| 192 | - $dp = intval( is_bool( $dp ) ? $default_dp : $dp ); |
|
| 193 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
| 194 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
| 190 | + if (false !== $dp) { |
|
| 191 | + $dp = intval(is_bool($dp) ? $default_dp : $dp); |
|
| 192 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
| 193 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
| 195 | 194 | } |
| 196 | 195 | |
| 197 | 196 | // Trim zeros. |
| 198 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
| 199 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
| 197 | + if ($trim_zeros && strstr($number, '.')) { |
|
| 198 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
| 200 | 199 | } |
| 201 | 200 | |
| 202 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
| 201 | + return apply_filters('give_sanitize_amount', $number); |
|
| 203 | 202 | } |
| 204 | 203 | |
| 205 | 204 | /** |
@@ -212,10 +211,10 @@ discard block |
||
| 212 | 211 | * |
| 213 | 212 | * @return string $amount Newly formatted amount or Price Not Available |
| 214 | 213 | */ |
| 215 | -function give_format_amount( $amount, $args = array() ) { |
|
| 214 | +function give_format_amount($amount, $args = array()) { |
|
| 216 | 215 | // Backward compatibility. |
| 217 | - if( is_bool( $args ) ) { |
|
| 218 | - $args = array( 'decimal' => $args ); |
|
| 216 | + if (is_bool($args)) { |
|
| 217 | + $args = array('decimal' => $args); |
|
| 219 | 218 | } |
| 220 | 219 | |
| 221 | 220 | $default_args = array( |
@@ -224,60 +223,59 @@ discard block |
||
| 224 | 223 | 'currency' => give_get_currency(), |
| 225 | 224 | ); |
| 226 | 225 | |
| 227 | - $args = wp_parse_args( $args, $default_args ); |
|
| 226 | + $args = wp_parse_args($args, $default_args); |
|
| 228 | 227 | |
| 229 | 228 | $formatted = 0; |
| 230 | 229 | $thousands_sep = give_get_price_thousand_separator(); |
| 231 | 230 | $decimal_sep = give_get_price_decimal_separator(); |
| 232 | - $decimals = ! empty( $args['decimal'] ) ? give_get_price_decimals() : 0; |
|
| 231 | + $decimals = ! empty($args['decimal']) ? give_get_price_decimals() : 0; |
|
| 233 | 232 | $currency = $args['currency']; |
| 234 | 233 | |
| 235 | - if ( ! empty( $amount ) ) { |
|
| 234 | + if ( ! empty($amount)) { |
|
| 236 | 235 | // Sanitize amount before formatting. |
| 237 | - $amount = ! empty( $args['sanitize'] ) ? |
|
| 238 | - give_maybe_sanitize_amount( $amount, $decimals ) : |
|
| 239 | - number_format( $amount, $decimals, '.', '' ); |
|
| 236 | + $amount = ! empty($args['sanitize']) ? |
|
| 237 | + give_maybe_sanitize_amount($amount, $decimals) : number_format($amount, $decimals, '.', ''); |
|
| 240 | 238 | |
| 241 | - switch ( $currency ) { |
|
| 239 | + switch ($currency) { |
|
| 242 | 240 | case 'INR': |
| 243 | 241 | $decimal_amount = ''; |
| 244 | 242 | |
| 245 | 243 | // Extract decimals from amount |
| 246 | - if ( ( $pos = strpos( $amount, '.' ) ) !== false ) { |
|
| 247 | - if ( ! empty( $decimals ) ) { |
|
| 248 | - $decimal_amount = substr( round( substr( $amount, $pos ), $decimals ), 1 ); |
|
| 249 | - $amount = substr( $amount, 0, $pos ); |
|
| 250 | - |
|
| 251 | - if ( ! $decimal_amount ) { |
|
| 252 | - $decimal_amount = substr( '.0000000000', 0, ( $decimals + 1 ) ); |
|
| 253 | - } elseif ( ( $decimals + 1 ) > strlen( $decimal_amount ) ) { |
|
| 254 | - $decimal_amount = substr( "{$decimal_amount}000000000", 0, ( $decimals + 1 ) ); |
|
| 244 | + if (($pos = strpos($amount, '.')) !== false) { |
|
| 245 | + if ( ! empty($decimals)) { |
|
| 246 | + $decimal_amount = substr(round(substr($amount, $pos), $decimals), 1); |
|
| 247 | + $amount = substr($amount, 0, $pos); |
|
| 248 | + |
|
| 249 | + if ( ! $decimal_amount) { |
|
| 250 | + $decimal_amount = substr('.0000000000', 0, ($decimals + 1)); |
|
| 251 | + } elseif (($decimals + 1) > strlen($decimal_amount)) { |
|
| 252 | + $decimal_amount = substr("{$decimal_amount}000000000", 0, ($decimals + 1)); |
|
| 255 | 253 | } |
| 256 | 254 | |
| 257 | 255 | } else { |
| 258 | - $amount = number_format( $amount, $decimals, $decimal_sep, '' ); |
|
| 256 | + $amount = number_format($amount, $decimals, $decimal_sep, ''); |
|
| 259 | 257 | } |
| 260 | 258 | } |
| 261 | 259 | |
| 262 | 260 | // Extract last 3 from amount |
| 263 | - $result = substr( $amount, - 3 ); |
|
| 264 | - $amount = substr( $amount, 0, - 3 ); |
|
| 261 | + $result = substr($amount, - 3); |
|
| 262 | + $amount = substr($amount, 0, - 3); |
|
| 265 | 263 | |
| 266 | 264 | // Apply digits 2 by 2 |
| 267 | - while ( strlen( $amount ) > 0 ) { |
|
| 268 | - $result = substr( $amount, - 2 ) . $thousands_sep . $result; |
|
| 269 | - $amount = substr( $amount, 0, - 2 ); |
|
| 265 | + while (strlen($amount) > 0) { |
|
| 266 | + $result = substr($amount, - 2).$thousands_sep.$result; |
|
| 267 | + $amount = substr($amount, 0, - 2); |
|
| 270 | 268 | } |
| 271 | 269 | |
| 272 | - $formatted = $result . $decimal_amount; |
|
| 270 | + $formatted = $result.$decimal_amount; |
|
| 273 | 271 | break; |
| 274 | 272 | |
| 275 | 273 | default: |
| 276 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
| 274 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
| 277 | 275 | } |
| 278 | 276 | } |
| 279 | 277 | |
| 280 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args ); |
|
| 278 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args); |
|
| 281 | 279 | } |
| 282 | 280 | |
| 283 | 281 | |
@@ -295,51 +293,51 @@ discard block |
||
| 295 | 293 | * |
| 296 | 294 | * @return float|string formatted amount number with large number names. |
| 297 | 295 | */ |
| 298 | -function give_human_format_large_amount( $amount, $args = array() ) { |
|
| 296 | +function give_human_format_large_amount($amount, $args = array()) { |
|
| 299 | 297 | $default_args = array( |
| 300 | 298 | 'currency' => give_get_currency(), |
| 301 | 299 | ); |
| 302 | 300 | |
| 303 | - $args = wp_parse_args( $args, $default_args ); |
|
| 301 | + $args = wp_parse_args($args, $default_args); |
|
| 304 | 302 | |
| 305 | 303 | // Get thousand separator. |
| 306 | 304 | $thousands_sep = give_get_price_thousand_separator(); |
| 307 | 305 | |
| 308 | 306 | // Sanitize amount. |
| 309 | - $sanitize_amount = give_maybe_sanitize_amount( $amount ); |
|
| 307 | + $sanitize_amount = give_maybe_sanitize_amount($amount); |
|
| 310 | 308 | |
| 311 | 309 | // Explode amount to calculate name of large numbers. |
| 312 | - $amount_array = explode( $thousands_sep, $amount ); |
|
| 310 | + $amount_array = explode($thousands_sep, $amount); |
|
| 313 | 311 | |
| 314 | 312 | // Calculate amount parts count. |
| 315 | - $amount_count_parts = count( $amount_array ); |
|
| 313 | + $amount_count_parts = count($amount_array); |
|
| 316 | 314 | |
| 317 | 315 | // Human format amount (default). |
| 318 | 316 | $human_format_amount = $amount; |
| 319 | 317 | |
| 320 | - switch ( $args['currency'] ) { |
|
| 318 | + switch ($args['currency']) { |
|
| 321 | 319 | case 'INR': |
| 322 | 320 | // Calculate large number formatted amount. |
| 323 | - if ( 4 < $amount_count_parts ) { |
|
| 324 | - $human_format_amount = sprintf( esc_html__( '%s arab', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
| 325 | - } elseif ( 3 < $amount_count_parts ) { |
|
| 326 | - $human_format_amount = sprintf( esc_html__( '%s crore', 'give' ), round( ( $sanitize_amount / 10000000 ), 2 ) ); |
|
| 327 | - } elseif ( 2 < $amount_count_parts ) { |
|
| 328 | - $human_format_amount = sprintf( esc_html__( '%s lakh', 'give' ), round( ( $sanitize_amount / 100000 ), 2 ) ); |
|
| 321 | + if (4 < $amount_count_parts) { |
|
| 322 | + $human_format_amount = sprintf(esc_html__('%s arab', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
| 323 | + } elseif (3 < $amount_count_parts) { |
|
| 324 | + $human_format_amount = sprintf(esc_html__('%s crore', 'give'), round(($sanitize_amount / 10000000), 2)); |
|
| 325 | + } elseif (2 < $amount_count_parts) { |
|
| 326 | + $human_format_amount = sprintf(esc_html__('%s lakh', 'give'), round(($sanitize_amount / 100000), 2)); |
|
| 329 | 327 | } |
| 330 | 328 | break; |
| 331 | 329 | default: |
| 332 | 330 | // Calculate large number formatted amount. |
| 333 | - if ( 4 < $amount_count_parts ) { |
|
| 334 | - $human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
| 335 | - } elseif ( 3 < $amount_count_parts ) { |
|
| 336 | - $human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
| 337 | - } elseif ( 2 < $amount_count_parts ) { |
|
| 338 | - $human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) ); |
|
| 331 | + if (4 < $amount_count_parts) { |
|
| 332 | + $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
| 333 | + } elseif (3 < $amount_count_parts) { |
|
| 334 | + $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
| 335 | + } elseif (2 < $amount_count_parts) { |
|
| 336 | + $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
| 339 | 337 | } |
| 340 | 338 | } |
| 341 | 339 | |
| 342 | - return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount ); |
|
| 340 | + return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount); |
|
| 343 | 341 | } |
| 344 | 342 | |
| 345 | 343 | /** |
@@ -353,17 +351,16 @@ discard block |
||
| 353 | 351 | * |
| 354 | 352 | * @return string $amount Newly formatted amount or Price Not Available |
| 355 | 353 | */ |
| 356 | -function give_format_decimal( $amount, $dp = false, $sanitize = true ) { |
|
| 354 | +function give_format_decimal($amount, $dp = false, $sanitize = true) { |
|
| 357 | 355 | $decimal_separator = give_get_price_decimal_separator(); |
| 358 | 356 | $formatted_amount = $sanitize ? |
| 359 | - give_maybe_sanitize_amount( $amount, $dp ) : |
|
| 360 | - number_format( $amount, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' ); |
|
| 357 | + give_maybe_sanitize_amount($amount, $dp) : number_format($amount, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', ''); |
|
| 361 | 358 | |
| 362 | - if ( false !== strpos( $formatted_amount, '.' ) ) { |
|
| 363 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
| 359 | + if (false !== strpos($formatted_amount, '.')) { |
|
| 360 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
| 364 | 361 | } |
| 365 | 362 | |
| 366 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
| 363 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
| 367 | 364 | } |
| 368 | 365 | |
| 369 | 366 | /** |
@@ -377,24 +374,24 @@ discard block |
||
| 377 | 374 | * |
| 378 | 375 | * @return mixed|string |
| 379 | 376 | */ |
| 380 | -function give_currency_filter( $price = '', $currency = '', $decode_currency = false ) { |
|
| 377 | +function give_currency_filter($price = '', $currency = '', $decode_currency = false) { |
|
| 381 | 378 | |
| 382 | - if ( empty( $currency ) || ! array_key_exists( (string) $currency, give_get_currencies() ) ) { |
|
| 379 | + if (empty($currency) || ! array_key_exists((string) $currency, give_get_currencies())) { |
|
| 383 | 380 | $currency = give_get_currency(); |
| 384 | 381 | } |
| 385 | 382 | |
| 386 | - $position = give_get_option( 'currency_position', 'before' ); |
|
| 383 | + $position = give_get_option('currency_position', 'before'); |
|
| 387 | 384 | |
| 388 | 385 | $negative = $price < 0; |
| 389 | 386 | |
| 390 | - if ( $negative ) { |
|
| 387 | + if ($negative) { |
|
| 391 | 388 | // Remove proceeding "-". |
| 392 | - $price = substr( $price, 1 ); |
|
| 389 | + $price = substr($price, 1); |
|
| 393 | 390 | } |
| 394 | 391 | |
| 395 | - $symbol = give_currency_symbol( $currency, $decode_currency ); |
|
| 392 | + $symbol = give_currency_symbol($currency, $decode_currency); |
|
| 396 | 393 | |
| 397 | - switch ( $currency ) : |
|
| 394 | + switch ($currency) : |
|
| 398 | 395 | case 'GBP' : |
| 399 | 396 | case 'BRL' : |
| 400 | 397 | case 'EUR' : |
@@ -423,13 +420,13 @@ discard block |
||
| 423 | 420 | case 'MAD' : |
| 424 | 421 | case 'KRW' : |
| 425 | 422 | case 'ZAR' : |
| 426 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
| 423 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
| 427 | 424 | break; |
| 428 | 425 | case 'NOK' : |
| 429 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
| 426 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
| 430 | 427 | break; |
| 431 | 428 | default : |
| 432 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
| 429 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
| 433 | 430 | break; |
| 434 | 431 | endswitch; |
| 435 | 432 | |
@@ -444,11 +441,11 @@ discard block |
||
| 444 | 441 | * and if currency is USD and currency position is after then |
| 445 | 442 | * filter name will be give_usd_currency_filter_after |
| 446 | 443 | */ |
| 447 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
| 444 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
| 448 | 445 | |
| 449 | - if ( $negative ) { |
|
| 446 | + if ($negative) { |
|
| 450 | 447 | // Prepend the minus sign before the currency sign. |
| 451 | - $formatted = '-' . $formatted; |
|
| 448 | + $formatted = '-'.$formatted; |
|
| 452 | 449 | } |
| 453 | 450 | |
| 454 | 451 | return $formatted; |
@@ -464,21 +461,21 @@ discard block |
||
| 464 | 461 | */ |
| 465 | 462 | function give_currency_decimal_filter() { |
| 466 | 463 | |
| 467 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 464 | + remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 468 | 465 | |
| 469 | 466 | // Set default number of decimals. |
| 470 | 467 | $decimals = give_get_price_decimals(); |
| 471 | 468 | |
| 472 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 469 | + add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 473 | 470 | |
| 474 | 471 | // Get number of decimals with backward compatibility ( version < 1.6 ) |
| 475 | - if ( 1 <= func_num_args() ) { |
|
| 476 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
| 472 | + if (1 <= func_num_args()) { |
|
| 473 | + $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0))); |
|
| 477 | 474 | } |
| 478 | 475 | |
| 479 | 476 | $currency = give_get_currency(); |
| 480 | 477 | |
| 481 | - switch ( $currency ) { |
|
| 478 | + switch ($currency) { |
|
| 482 | 479 | case 'RIAL' : |
| 483 | 480 | case 'JPY' : |
| 484 | 481 | case 'TWD' : |
@@ -488,11 +485,11 @@ discard block |
||
| 488 | 485 | break; |
| 489 | 486 | } |
| 490 | 487 | |
| 491 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
| 488 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
| 492 | 489 | } |
| 493 | 490 | |
| 494 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 495 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 491 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 492 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
| 496 | 493 | |
| 497 | 494 | |
| 498 | 495 | /** |
@@ -504,7 +501,7 @@ discard block |
||
| 504 | 501 | * |
| 505 | 502 | * @return string Date format string |
| 506 | 503 | */ |
| 507 | -function give_date_format( $date_context = '' ) { |
|
| 504 | +function give_date_format($date_context = '') { |
|
| 508 | 505 | /** |
| 509 | 506 | * Filter the date context |
| 510 | 507 | * |
@@ -525,19 +522,19 @@ discard block |
||
| 525 | 522 | * |
| 526 | 523 | * } |
| 527 | 524 | */ |
| 528 | - $date_format_contexts = apply_filters( 'give_date_format_contexts', array() ); |
|
| 525 | + $date_format_contexts = apply_filters('give_date_format_contexts', array()); |
|
| 529 | 526 | |
| 530 | 527 | // Set date format to default date format. |
| 531 | - $date_format = get_option( 'date_format' ); |
|
| 528 | + $date_format = get_option('date_format'); |
|
| 532 | 529 | |
| 533 | 530 | // Update date format if we have non empty date format context array and non empty date format string for that context. |
| 534 | - if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) { |
|
| 535 | - $date_format = ! empty( $date_format_contexts[ $date_context ] ) |
|
| 536 | - ? $date_format_contexts[ $date_context ] |
|
| 531 | + if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) { |
|
| 532 | + $date_format = ! empty($date_format_contexts[$date_context]) |
|
| 533 | + ? $date_format_contexts[$date_context] |
|
| 537 | 534 | : $date_format; |
| 538 | 535 | } |
| 539 | 536 | |
| 540 | - return apply_filters( 'give_date_format', $date_format ); |
|
| 537 | + return apply_filters('give_date_format', $date_format); |
|
| 541 | 538 | } |
| 542 | 539 | |
| 543 | 540 | /** |
@@ -551,8 +548,8 @@ discard block |
||
| 551 | 548 | * |
| 552 | 549 | * @return string |
| 553 | 550 | */ |
| 554 | -function give_get_cache_key( $action, $query_args ) { |
|
| 555 | - return Give_Cache::get_key( $action, $query_args ); |
|
| 551 | +function give_get_cache_key($action, $query_args) { |
|
| 552 | + return Give_Cache::get_key($action, $query_args); |
|
| 556 | 553 | } |
| 557 | 554 | |
| 558 | 555 | /** |
@@ -565,11 +562,11 @@ discard block |
||
| 565 | 562 | * |
| 566 | 563 | * @return string|array |
| 567 | 564 | */ |
| 568 | -function give_clean( $var ) { |
|
| 569 | - if ( is_array( $var ) ) { |
|
| 570 | - return array_map( 'give_clean', $var ); |
|
| 565 | +function give_clean($var) { |
|
| 566 | + if (is_array($var)) { |
|
| 567 | + return array_map('give_clean', $var); |
|
| 571 | 568 | } else { |
| 572 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
| 569 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
| 573 | 570 | } |
| 574 | 571 | } |
| 575 | 572 | |
@@ -582,10 +579,10 @@ discard block |
||
| 582 | 579 | * |
| 583 | 580 | * @return int |
| 584 | 581 | */ |
| 585 | -function give_let_to_num( $size ) { |
|
| 586 | - $l = substr( $size, - 1 ); |
|
| 587 | - $ret = substr( $size, 0, - 1 ); |
|
| 588 | - switch ( strtoupper( $l ) ) { |
|
| 582 | +function give_let_to_num($size) { |
|
| 583 | + $l = substr($size, - 1); |
|
| 584 | + $ret = substr($size, 0, - 1); |
|
| 585 | + switch (strtoupper($l)) { |
|
| 589 | 586 | case 'P': |
| 590 | 587 | $ret *= 1024; |
| 591 | 588 | case 'T': |
@@ -610,19 +607,19 @@ discard block |
||
| 610 | 607 | * @param int $action |
| 611 | 608 | * @param array $wp_die_args |
| 612 | 609 | */ |
| 613 | -function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) { |
|
| 610 | +function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) { |
|
| 614 | 611 | |
| 615 | 612 | $default_wp_die_args = array( |
| 616 | - 'message' => esc_html__( 'Nonce verification has failed.', 'give' ), |
|
| 617 | - 'title' => esc_html__( 'Error', 'give' ), |
|
| 613 | + 'message' => esc_html__('Nonce verification has failed.', 'give'), |
|
| 614 | + 'title' => esc_html__('Error', 'give'), |
|
| 618 | 615 | 'args' => array( |
| 619 | 616 | 'response' => 403, |
| 620 | 617 | ), |
| 621 | 618 | ); |
| 622 | 619 | |
| 623 | - $wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args ); |
|
| 620 | + $wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args); |
|
| 624 | 621 | |
| 625 | - if ( ! wp_verify_nonce( $nonce, $action ) ) { |
|
| 622 | + if ( ! wp_verify_nonce($nonce, $action)) { |
|
| 626 | 623 | wp_die( |
| 627 | 624 | $wp_die_args['message'], |
| 628 | 625 | $wp_die_args['title'], |
@@ -644,23 +641,23 @@ discard block |
||
| 644 | 641 | * |
| 645 | 642 | * @return mixed |
| 646 | 643 | */ |
| 647 | -function give_check_variable( $variable, $conditional = '', $default = false ) { |
|
| 644 | +function give_check_variable($variable, $conditional = '', $default = false) { |
|
| 648 | 645 | |
| 649 | - switch ( $conditional ) { |
|
| 646 | + switch ($conditional) { |
|
| 650 | 647 | case 'isset_empty': |
| 651 | - $variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default; |
|
| 648 | + $variable = (isset($variable) && ! empty($variable)) ? $variable : $default; |
|
| 652 | 649 | break; |
| 653 | 650 | |
| 654 | 651 | case 'empty': |
| 655 | - $variable = ! empty( $variable ) ? $variable : $default; |
|
| 652 | + $variable = ! empty($variable) ? $variable : $default; |
|
| 656 | 653 | break; |
| 657 | 654 | |
| 658 | 655 | case 'null': |
| 659 | - $variable = ! is_null( $variable ) ? $variable : $default; |
|
| 656 | + $variable = ! is_null($variable) ? $variable : $default; |
|
| 660 | 657 | break; |
| 661 | 658 | |
| 662 | 659 | default: |
| 663 | - $variable = isset( $variable ) ? $variable : $default; |
|
| 660 | + $variable = isset($variable) ? $variable : $default; |
|
| 664 | 661 | |
| 665 | 662 | } |
| 666 | 663 | |