@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Payment History Page |
@@ -63,11 +65,13 @@ discard block |
||
63 | 65 | */ |
64 | 66 | function give_view_order_details_title( $admin_title, $title ) { |
65 | 67 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
67 | - return $admin_title; |
|
68 | + if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
69 | + return $admin_title; |
|
70 | + } |
|
68 | 71 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
70 | - return $admin_title; |
|
72 | + if( ! isset( $_GET['give-action'] ) ) { |
|
73 | + return $admin_title; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | switch( $_GET['give-action'] ) : |
73 | 77 | |
@@ -99,11 +103,13 @@ discard block |
||
99 | 103 | function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
100 | 104 | |
101 | 105 | $post = get_post( $post_id ); |
102 | - if( ! $post ) |
|
103 | - return $url; |
|
106 | + if( ! $post ) { |
|
107 | + return $url; |
|
108 | + } |
|
104 | 109 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
106 | - return $url; |
|
110 | + if( 'give_payment' != $post->post_type ) { |
|
111 | + return $url; |
|
112 | + } |
|
107 | 113 | |
108 | 114 | $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
109 | 115 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Payment History Page |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_payment_history_page() { |
25 | 25 | |
26 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
26 | + $give_payment = get_post_type_object('give_payment'); |
|
27 | 27 | |
28 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
28 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
30 | 30 | } else { |
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
32 | 32 | $payments_table = new Give_Payment_History_Table(); |
33 | 33 | $payments_table->prepare_items(); |
34 | 34 | ?> |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @since 1.7 |
44 | 44 | */ |
45 | - do_action( 'give_donations_page_top' ); |
|
45 | + do_action('give_donations_page_top'); |
|
46 | 46 | ?> |
47 | 47 | |
48 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
48 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
49 | 49 | <input type="hidden" name="post_type" value="give_forms" /> |
50 | 50 | <input type="hidden" name="page" value="give-payment-history" /> |
51 | 51 | <?php $payments_table->views() ?> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 1.7 |
61 | 61 | */ |
62 | - do_action( 'give_donations_page_bottom' ); |
|
62 | + do_action('give_donations_page_bottom'); |
|
63 | 63 | ?> |
64 | 64 | |
65 | 65 | </div> |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | * @param $title |
77 | 77 | * @return string |
78 | 78 | */ |
79 | -function give_view_order_details_title( $admin_title, $title ) { |
|
79 | +function give_view_order_details_title($admin_title, $title) { |
|
80 | 80 | |
81 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
81 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
82 | 82 | return $admin_title; |
83 | 83 | |
84 | - if( ! isset( $_GET['give-action'] ) ) |
|
84 | + if ( ! isset($_GET['give-action'])) |
|
85 | 85 | return $admin_title; |
86 | 86 | |
87 | - switch( $_GET['give-action'] ) : |
|
87 | + switch ($_GET['give-action']) : |
|
88 | 88 | |
89 | 89 | case 'view-order-details' : |
90 | 90 | $title = sprintf( |
91 | 91 | /* translators: %s: admin title */ |
92 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
92 | + esc_html__('View Donation Details - %s', 'give'), |
|
93 | 93 | $admin_title |
94 | 94 | ); |
95 | 95 | break; |
96 | 96 | case 'edit-payment' : |
97 | 97 | $title = sprintf( |
98 | 98 | /* translators: %s: admin title */ |
99 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
99 | + esc_html__('Edit Donation - %s', 'give'), |
|
100 | 100 | $admin_title |
101 | 101 | ); |
102 | 102 | break; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | return $title; |
109 | 109 | } |
110 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
110 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | * @param $context |
120 | 120 | * @return string |
121 | 121 | */ |
122 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
122 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
123 | 123 | |
124 | - $post = get_post( $post_id ); |
|
125 | - if( ! $post ) |
|
124 | + $post = get_post($post_id); |
|
125 | + if ( ! $post) |
|
126 | 126 | return $url; |
127 | 127 | |
128 | - if( 'give_payment' != $post->post_type ) |
|
128 | + if ('give_payment' != $post->post_type) |
|
129 | 129 | return $url; |
130 | 130 | |
131 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
131 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
132 | 132 | |
133 | 133 | return $url; |
134 | 134 | } |
135 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
135 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -440,8 +440,10 @@ |
||
440 | 440 | echo give_get_payment_note_html( $note, $payment_id ); |
441 | 441 | |
442 | 442 | endforeach; |
443 | - else : |
|
443 | + else { |
|
444 | + : |
|
444 | 445 | $no_notes_display = ''; |
446 | + } |
|
445 | 447 | endif; |
446 | 448 | echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
447 | 449 | ?> |
@@ -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 | $customer_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 | $gateway = $payment->gateway; |
46 | 46 | $currency_code = $payment->currency; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | <h1 id="transaction-details-heading"><?php |
54 | 54 | printf( |
55 | 55 | /* translators: %s: donation number */ |
56 | - esc_html__( 'Donation %s', 'give' ), |
|
56 | + esc_html__('Donation %s', 'give'), |
|
57 | 57 | $number |
58 | 58 | ); |
59 | - if ( $payment_mode == 'test' ) { |
|
60 | - 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>'; |
|
59 | + if ($payment_mode == 'test') { |
|
60 | + 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>'; |
|
61 | 61 | } |
62 | 62 | ?></h1> |
63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @param int $payment_id Payment id. |
71 | 71 | */ |
72 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
72 | + do_action('give_view_order_details_before', $payment_id); |
|
73 | 73 | ?> |
74 | 74 | <form id="give-edit-order-form" method="post"> |
75 | 75 | <?php |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id Payment id. |
82 | 82 | */ |
83 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
83 | + do_action('give_view_order_details_form_top', $payment_id); |
|
84 | 84 | ?> |
85 | 85 | <div id="poststuff"> |
86 | 86 | <div id="give-dashboard-widgets-wrap"> |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param int $payment_id Payment id. |
98 | 98 | */ |
99 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
99 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
100 | 100 | ?> |
101 | 101 | |
102 | 102 | <div id="give-order-update" class="postbox give-order-data"> |
103 | 103 | |
104 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
104 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
105 | 105 | |
106 | 106 | <div class="inside"> |
107 | 107 | <div class="give-admin-box"> |
@@ -114,33 +114,33 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param int $payment_id Payment id. |
116 | 116 | */ |
117 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
117 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <div class="give-admin-box-inside"> |
121 | 121 | <p> |
122 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
122 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
123 | 123 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
124 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
125 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
124 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
125 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
126 | 126 | <?php endforeach; ?> |
127 | 127 | </select> |
128 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
129 | 129 | </p> |
130 | 130 | </div> |
131 | 131 | |
132 | 132 | <div class="give-admin-box-inside"> |
133 | 133 | <p> |
134 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
135 | - <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"/> |
|
134 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
135 | + <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"/> |
|
136 | 136 | </p> |
137 | 137 | </div> |
138 | 138 | |
139 | 139 | <div class="give-admin-box-inside"> |
140 | 140 | <p> |
141 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
142 | - <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"/> : |
|
143 | - <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"/> |
|
141 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
142 | + <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"/> : |
|
143 | + <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"/> |
|
144 | 144 | </p> |
145 | 145 | </div> |
146 | 146 | |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param int $payment_id Payment id. |
156 | 156 | */ |
157 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
157 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
158 | 158 | |
159 | 159 | //@TODO: Fees |
160 | - $fees = give_get_payment_fees( $payment_id ); |
|
161 | - if ( ! empty( $fees ) ) : ?> |
|
160 | + $fees = give_get_payment_fees($payment_id); |
|
161 | + if ( ! empty($fees)) : ?> |
|
162 | 162 | <div class="give-order-fees give-admin-box-inside"> |
163 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
163 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
164 | 164 | <ul class="give-payment-fees"> |
165 | - <?php foreach ( $fees as $fee ) : ?> |
|
165 | + <?php foreach ($fees as $fee) : ?> |
|
166 | 166 | <li> |
167 | 167 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
168 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
168 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
169 | 169 | </li> |
170 | 170 | <?php endforeach; ?> |
171 | 171 | </ul> |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | |
175 | 175 | <div class="give-order-payment give-admin-box-inside"> |
176 | 176 | <p> |
177 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
178 | - <?php echo give_currency_symbol( $payment->currency ); ?> <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 ) ) ); ?>"/> |
|
177 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
178 | + <?php echo give_currency_symbol($payment->currency); ?> <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
179 | 179 | </p> |
180 | 180 | </div> |
181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @param int $payment_id Payment id. |
189 | 189 | */ |
190 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
190 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | </div> |
@@ -205,17 +205,17 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @param int $payment_id Payment id. |
207 | 207 | */ |
208 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
208 | + do_action('give_view_order_details_update_before', $payment_id); |
|
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <div id="major-publishing-actions"> |
212 | 212 | <div id="publishing-action"> |
213 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
214 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
215 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
213 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
214 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
215 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
216 | 216 | 'give-action' => 'email_links', |
217 | 217 | 'purchase_id' => $payment_id |
218 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
218 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
219 | 219 | <?php endif; ?> |
220 | 220 | </div> |
221 | 221 | <div class="clear"></div> |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @param int $payment_id Payment id. |
231 | 231 | */ |
232 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
232 | + do_action('give_view_order_details_update_after', $payment_id); |
|
233 | 233 | ?> |
234 | 234 | |
235 | 235 | </div> |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | <div id="give-order-details" class="postbox give-order-data"> |
242 | 242 | |
243 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
243 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
244 | 244 | |
245 | 245 | <div class="inside"> |
246 | 246 | <div class="give-admin-box"> |
@@ -253,44 +253,44 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param int $payment_id Payment id. |
255 | 255 | */ |
256 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
256 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
257 | 257 | |
258 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
259 | - if ( $gateway ) : ?> |
|
258 | + $gateway = give_get_payment_gateway($payment_id); |
|
259 | + if ($gateway) : ?> |
|
260 | 260 | <div class="give-order-gateway give-admin-box-inside"> |
261 | 261 | <p> |
262 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
263 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
262 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
263 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
264 | 264 | </p> |
265 | 265 | </div> |
266 | 266 | <?php endif; ?> |
267 | 267 | |
268 | 268 | <div class="give-order-payment-key give-admin-box-inside"> |
269 | 269 | <p> |
270 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
271 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
270 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
271 | + <?php echo give_get_payment_key($payment_id); ?> |
|
272 | 272 | </p> |
273 | 273 | </div> |
274 | 274 | |
275 | 275 | <div class="give-order-ip give-admin-box-inside"> |
276 | 276 | <p> |
277 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
278 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
277 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
278 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
279 | 279 | </p> |
280 | 280 | </div> |
281 | 281 | |
282 | - <?php if ( $transaction_id ) : ?> |
|
282 | + <?php if ($transaction_id) : ?> |
|
283 | 283 | <div class="give-order-tx-id give-admin-box-inside"> |
284 | 284 | <p> |
285 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
286 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
285 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
286 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
287 | 287 | </p> |
288 | 288 | </div> |
289 | 289 | <?php endif; ?> |
290 | 290 | |
291 | 291 | <div class="give-admin-box-inside"> |
292 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
293 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
292 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
293 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
294 | 294 | </p> |
295 | 295 | </div> |
296 | 296 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param int $payment_id Payment id. |
304 | 304 | */ |
305 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
305 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
306 | 306 | ?> |
307 | 307 | |
308 | 308 | </div> |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @param int $payment_id Payment id. |
324 | 324 | */ |
325 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
325 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
326 | 326 | ?> |
327 | 327 | |
328 | 328 | </div> |
@@ -342,50 +342,50 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @param int $payment_id Payment id. |
344 | 344 | */ |
345 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
345 | + do_action('give_view_order_details_main_before', $payment_id); |
|
346 | 346 | ?> |
347 | 347 | |
348 | 348 | <?php $column_count = 'columns-3'; ?> |
349 | 349 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
350 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
350 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
351 | 351 | |
352 | 352 | <div class="inside"> |
353 | 353 | |
354 | 354 | <div class="column-container"> |
355 | 355 | <div class="column"> |
356 | 356 | <p> |
357 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
357 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
358 | 358 | <?php |
359 | - if ( $payment_meta['form_id'] ) : |
|
359 | + if ($payment_meta['form_id']) : |
|
360 | 360 | printf( |
361 | 361 | '<a href="%1$s" target="_blank">#%2$s</a>', |
362 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
362 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
363 | 363 | $payment_meta['form_id'] |
364 | 364 | ); |
365 | 365 | endif; |
366 | 366 | ?> |
367 | 367 | </p> |
368 | 368 | <p> |
369 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
370 | - <?php give_get_form_dropdown( array( |
|
369 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
370 | + <?php give_get_form_dropdown(array( |
|
371 | 371 | 'id' => $payment_meta['form_id'], |
372 | 372 | 'selected' => $payment_meta['form_id'], |
373 | 373 | 'chosen' => true |
374 | - ), true ); ?> |
|
374 | + ), true); ?> |
|
375 | 375 | </p> |
376 | 376 | </div> |
377 | 377 | <div class="column"> |
378 | 378 | <p> |
379 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
380 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
379 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
380 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
381 | 381 | </p> |
382 | 382 | <p> |
383 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
383 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
384 | 384 | <span class="give-donation-level"> |
385 | 385 | <?php |
386 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
387 | - if ( empty( $var_prices ) ) { |
|
388 | - echo esc_html__( 'n/a', 'give' ); |
|
386 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
387 | + if (empty($var_prices)) { |
|
388 | + echo esc_html__('n/a', 'give'); |
|
389 | 389 | } else { |
390 | 390 | // Variable price dropdown options. |
391 | 391 | $variable_price_dropdown_option = array( |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | 'selected' => $payment_meta['price_id'], |
397 | 397 | ); |
398 | 398 | // Render variable prices select tag html. |
399 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
399 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
400 | 400 | } |
401 | 401 | ?> |
402 | 402 | </span> |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | </div> |
405 | 405 | <div class="column"> |
406 | 406 | <p> |
407 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
408 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
407 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
408 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
409 | 409 | </p> |
410 | 410 | <p> |
411 | 411 | <?php |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param int $payment_id Payment id. |
420 | 420 | */ |
421 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
421 | + do_action('give_donation_details_thead_before', $payment_id); |
|
422 | 422 | |
423 | 423 | |
424 | 424 | /** |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @param int $payment_id Payment id. |
432 | 432 | */ |
433 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
433 | + do_action('give_donation_details_thead_after', $payment_id); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param int $payment_id Payment id. |
443 | 443 | */ |
444 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
444 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @param int $payment_id Payment id. |
454 | 454 | */ |
455 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
455 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
456 | 456 | ?> |
457 | 457 | </p> |
458 | 458 | </div> |
@@ -472,57 +472,57 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param int $payment_id Payment id. |
474 | 474 | */ |
475 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
475 | + do_action('give_view_order_details_files_after', $payment_id); |
|
476 | 476 | ?> |
477 | 477 | |
478 | 478 | <div id="give-donor-details" class="postbox"> |
479 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
479 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
480 | 480 | |
481 | 481 | <div class="inside"> |
482 | 482 | |
483 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
483 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
484 | 484 | |
485 | 485 | <div class="column-container customer-info"> |
486 | 486 | <div class="column"> |
487 | 487 | <p> |
488 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
488 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
489 | 489 | <?php |
490 | - if ( ! empty( $customer->id ) ) : |
|
490 | + if ( ! empty($customer->id)) : |
|
491 | 491 | printf( |
492 | 492 | '<a href="%1$s" target="_blank">#%2$s</a>', |
493 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
493 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
494 | 494 | $customer->id |
495 | 495 | ); |
496 | 496 | endif; |
497 | 497 | ?> |
498 | 498 | </p> |
499 | 499 | <p> |
500 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
501 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
500 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
501 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
502 | 502 | </p> |
503 | 503 | </div> |
504 | 504 | <div class="column"> |
505 | 505 | <p> |
506 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
506 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
507 | 507 | <?php echo $customer->name; ?> |
508 | 508 | </p> |
509 | 509 | <p> |
510 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
510 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
511 | 511 | <?php echo $customer->email; ?> |
512 | 512 | </p> |
513 | 513 | </div> |
514 | 514 | <div class="column"> |
515 | 515 | <p> |
516 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
516 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
517 | 517 | <?php |
518 | - echo Give()->html->donor_dropdown( array( |
|
518 | + echo Give()->html->donor_dropdown(array( |
|
519 | 519 | 'selected' => $customer->id, |
520 | 520 | 'name' => 'customer-id' |
521 | - ) ); |
|
521 | + )); |
|
522 | 522 | ?> |
523 | 523 | </p> |
524 | 524 | <p> |
525 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
525 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
526 | 526 | </p> |
527 | 527 | </div> |
528 | 528 | </div> |
@@ -530,13 +530,13 @@ discard block |
||
530 | 530 | <div class="column-container new-customer" style="display: none"> |
531 | 531 | <div class="column"> |
532 | 532 | <p> |
533 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
533 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
534 | 534 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
535 | 535 | </p> |
536 | 536 | </div> |
537 | 537 | <div class="column"> |
538 | 538 | <p> |
539 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
539 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
540 | 540 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
541 | 541 | </p> |
542 | 542 | </div> |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | <p> |
545 | 545 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
546 | 546 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
547 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
547 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
548 | 548 | <br> |
549 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
549 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
550 | 550 | </p> |
551 | 551 | </div> |
552 | 552 | </div> |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * @param array $payment_meta Payment meta. |
563 | 563 | * @param array $user_info User information. |
564 | 564 | */ |
565 | - do_action( 'give_donation_personal_details_list', $payment_meta, $user_info ); |
|
565 | + do_action('give_donation_personal_details_list', $payment_meta, $user_info); |
|
566 | 566 | |
567 | 567 | /** |
568 | 568 | * Fires in order details page, in the donor-details metabox. |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * |
572 | 572 | * @param int $payment_id Payment id. |
573 | 573 | */ |
574 | - do_action( 'give_donation_view_details', $payment_id ); |
|
574 | + do_action('give_donation_view_details', $payment_id); |
|
575 | 575 | ?> |
576 | 576 | |
577 | 577 | </div> |
@@ -587,11 +587,11 @@ discard block |
||
587 | 587 | * |
588 | 588 | * @param int $payment_id Payment id. |
589 | 589 | */ |
590 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
590 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
591 | 591 | ?> |
592 | 592 | |
593 | 593 | <div id="give-billing-details" class="postbox"> |
594 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
594 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
595 | 595 | |
596 | 596 | <div class="inside"> |
597 | 597 | |
@@ -601,57 +601,57 @@ discard block |
||
601 | 601 | <div class="data column-container"> |
602 | 602 | <div class="column"> |
603 | 603 | <div class="give-wrap-address-line1"> |
604 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
605 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
604 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
605 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
606 | 606 | </div> |
607 | 607 | <div class="give-wrap-address-line2"> |
608 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
609 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
608 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
609 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
610 | 610 | </div> |
611 | 611 | </div> |
612 | 612 | <div class="column"> |
613 | 613 | <div class="give-wrap-address-city"> |
614 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
615 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
614 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
615 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
616 | 616 | </div> |
617 | 617 | <div class="give-wrap-address-zip"> |
618 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
619 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
618 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
619 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
620 | 620 | |
621 | 621 | </div> |
622 | 622 | </div> |
623 | 623 | <div class="column"> |
624 | 624 | <div id="give-order-address-country-wrap"> |
625 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
625 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
626 | 626 | <?php |
627 | - echo Give()->html->select( array( |
|
627 | + echo Give()->html->select(array( |
|
628 | 628 | 'options' => give_get_country_list(), |
629 | 629 | 'name' => 'give-payment-address[0][country]', |
630 | 630 | 'selected' => $address['country'], |
631 | 631 | 'show_option_all' => false, |
632 | 632 | 'show_option_none' => false, |
633 | 633 | 'chosen' => true, |
634 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ) |
|
635 | - ) ); |
|
634 | + 'placeholder' => esc_attr__('Select a country', 'give') |
|
635 | + )); |
|
636 | 636 | ?> |
637 | 637 | </div> |
638 | 638 | <div id="give-order-address-state-wrap"> |
639 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
639 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
640 | 640 | <?php |
641 | - $states = give_get_states( $address['country'] ); |
|
642 | - if ( ! empty( $states ) ) { |
|
643 | - echo Give()->html->select( array( |
|
641 | + $states = give_get_states($address['country']); |
|
642 | + if ( ! empty($states)) { |
|
643 | + echo Give()->html->select(array( |
|
644 | 644 | 'options' => $states, |
645 | 645 | 'name' => 'give-payment-address[0][state]', |
646 | 646 | 'selected' => $address['state'], |
647 | 647 | 'show_option_all' => false, |
648 | 648 | 'show_option_none' => false, |
649 | 649 | 'chosen' => true, |
650 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ) |
|
651 | - ) ); |
|
650 | + 'placeholder' => esc_attr__('Select a state', 'give') |
|
651 | + )); |
|
652 | 652 | } else { |
653 | 653 | ?> |
654 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
654 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
655 | 655 | <?php |
656 | 656 | } ?> |
657 | 657 | </div> |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | * |
672 | 672 | * @param int $payment_id Payment id. |
673 | 673 | */ |
674 | - do_action( 'give_donation_billing_details', $payment_id ); |
|
674 | + do_action('give_donation_billing_details', $payment_id); |
|
675 | 675 | ?> |
676 | 676 | |
677 | 677 | </div> |
@@ -687,32 +687,32 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @param int $payment_id Payment id. |
689 | 689 | */ |
690 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
690 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
691 | 691 | ?> |
692 | 692 | |
693 | 693 | <div id="give-payment-notes" class="postbox"> |
694 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
694 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
695 | 695 | |
696 | 696 | <div class="inside"> |
697 | 697 | <div id="give-payment-notes-inner"> |
698 | 698 | <?php |
699 | - $notes = give_get_payment_notes( $payment_id ); |
|
700 | - if ( ! empty( $notes ) ) : |
|
699 | + $notes = give_get_payment_notes($payment_id); |
|
700 | + if ( ! empty($notes)) : |
|
701 | 701 | $no_notes_display = ' style="display:none;"'; |
702 | - foreach ( $notes as $note ) : |
|
702 | + foreach ($notes as $note) : |
|
703 | 703 | |
704 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
704 | + echo give_get_payment_note_html($note, $payment_id); |
|
705 | 705 | |
706 | 706 | endforeach; |
707 | 707 | else : |
708 | 708 | $no_notes_display = ''; |
709 | 709 | endif; |
710 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
710 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
711 | 711 | </div> |
712 | 712 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
713 | 713 | |
714 | 714 | <div class="give-clearfix"> |
715 | - <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> |
|
715 | + <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> |
|
716 | 716 | </div> |
717 | 717 | |
718 | 718 | </div> |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * |
729 | 729 | * @param int $payment_id Payment id. |
730 | 730 | */ |
731 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
731 | + do_action('give_view_order_details_main_after', $payment_id); |
|
732 | 732 | ?> |
733 | 733 | |
734 | 734 | </div> |
@@ -750,11 +750,11 @@ discard block |
||
750 | 750 | * |
751 | 751 | * @param int $payment_id Payment id. |
752 | 752 | */ |
753 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
753 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
754 | 754 | |
755 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
755 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
756 | 756 | ?> |
757 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
757 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
758 | 758 | <input type="hidden" name="give_action" value="update_payment_details"/> |
759 | 759 | </form> |
760 | 760 | <?php |
@@ -765,6 +765,6 @@ discard block |
||
765 | 765 | * |
766 | 766 | * @param int $payment_id Payment id. |
767 | 767 | */ |
768 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
768 | + do_action('give_view_order_details_after', $payment_id); |
|
769 | 769 | ?> |
770 | 770 | </div><!-- /.wrap --> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - public function __construct( $_data ) { |
|
81 | + public function __construct($_data) { |
|
82 | 82 | |
83 | 83 | $this->data = $_data; |
84 | 84 | |
85 | 85 | // Generate unique ID |
86 | - $this->id = md5( rand() ); |
|
86 | + $this->id = md5(rand()); |
|
87 | 87 | |
88 | 88 | // Setup default options; |
89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
89 | + $this->options = apply_filters('give_graph_args', array( |
|
90 | 90 | 'y_mode' => null, |
91 | 91 | 'x_mode' => null, |
92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'bars' => true, |
104 | 104 | 'lines' => false, |
105 | 105 | 'points' => true |
106 | - ) ); |
|
106 | + )); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | - public function set( $key, $value ) { |
|
119 | - $this->options[ $key ] = $value; |
|
118 | + public function set($key, $value) { |
|
119 | + $this->options[$key] = $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - public function get( $key ) { |
|
130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
129 | + public function get($key) { |
|
130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | 138 | public function get_data() { |
139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function load_scripts() { |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
153 | 153 | |
154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
155 | + wp_enqueue_script('jquery-flot-time'); |
|
156 | 156 | |
157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
158 | + wp_enqueue_script('jquery-flot-resize'); |
|
159 | 159 | |
160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
161 | - wp_enqueue_script( 'jquery-flot' ); |
|
160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
161 | + wp_enqueue_script('jquery-flot'); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | [ |
186 | 186 | <?php |
187 | 187 | $order = 0; |
188 | - foreach( $this->get_data() as $label => $data ) : |
|
188 | + foreach ($this->get_data() as $label => $data) : |
|
189 | 189 | ?> |
190 | 190 | { |
191 | - label : "<?php echo esc_attr( $label ); ?>", |
|
192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
191 | + label : "<?php echo esc_attr($label); ?>", |
|
192 | + id : "<?php echo sanitize_key($label); ?>", |
|
193 | 193 | // data format is: [ point on x, value on y ] |
194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
195 | 195 | points: { |
196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | fill : true, |
207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
208 | 208 | }, |
209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | grid: { |
221 | 221 | show : true, |
222 | 222 | aboveData : false, |
223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
223 | + color : "<?php echo $this->options['color']; ?>", |
|
224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
227 | 227 | clickable : false, |
228 | 228 | hoverable : true |
229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
239 | 239 | <?php endif; ?> |
240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | min : 0, |
244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
248 | 248 | <?php endif; ?> |
249 | 249 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | 305 | public function display() { |
306 | - do_action( 'give_before_graph', $this ); |
|
306 | + do_action('give_before_graph', $this); |
|
307 | 307 | echo $this->build_graph(); |
308 | - do_action( 'give_after_graph', $this ); |
|
308 | + do_action('give_after_graph', $this); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | } |
@@ -124,8 +124,10 @@ |
||
124 | 124 | |
125 | 125 | $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
126 | 126 | endforeach; |
127 | - else: |
|
127 | + else { |
|
128 | + : |
|
128 | 129 | $pdf->SetWidths( array( 280 ) ); |
130 | + } |
|
129 | 131 | $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
130 | 132 | $pdf->Row( array( $title ) ); |
131 | 133 | endif; |
@@ -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,82 +25,82 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( give_date_format() ) |
|
44 | + esc_html__('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(give_date_format()) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | 50 | $pdf = new give_pdf(); |
51 | - $pdf->AddPage( 'L', 'A4' ); |
|
51 | + $pdf->AddPage('L', 'A4'); |
|
52 | 52 | |
53 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
54 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
55 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
53 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
54 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
55 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
56 | 56 | |
57 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
57 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
58 | 58 | |
59 | - $pdf->SetMargins( 8, 8, 8 ); |
|
60 | - $pdf->SetX( 8 ); |
|
59 | + $pdf->SetMargins(8, 8, 8); |
|
60 | + $pdf->SetX(8); |
|
61 | 61 | |
62 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
63 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
64 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
62 | + $pdf->SetFont('Helvetica', '', 16); |
|
63 | + $pdf->SetTextColor(50, 50, 50); |
|
64 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
65 | 65 | |
66 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
66 | + $pdf->SetFont('Helvetica', '', 13); |
|
67 | 67 | $pdf->Ln(); |
68 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
69 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
68 | + $pdf->SetTextColor(150, 150, 150); |
|
69 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
70 | 70 | $pdf->Ln(); |
71 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
72 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
73 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
74 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
71 | + $pdf->SetTextColor(50, 50, 50); |
|
72 | + $pdf->SetFont('Helvetica', '', 14); |
|
73 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
74 | + $pdf->SetFont('Helvetica', '', 12); |
|
75 | 75 | |
76 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
77 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
78 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
79 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
80 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
81 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
82 | - $pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
76 | + $pdf->SetFillColor(238, 238, 238); |
|
77 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
78 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
79 | + $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
80 | + $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
81 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
82 | + $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
83 | 83 | |
84 | - $year = date( 'Y' ); |
|
85 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
84 | + $year = date('Y'); |
|
85 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
86 | 86 | |
87 | - if ( $give_forms ): |
|
88 | - $pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) ); |
|
87 | + if ($give_forms): |
|
88 | + $pdf->SetWidths(array(70, 30, 50, 50, 45, 35)); |
|
89 | 89 | |
90 | - foreach ( $give_forms as $form ): |
|
91 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
90 | + foreach ($give_forms as $form): |
|
91 | + $pdf->SetFillColor(255, 255, 255); |
|
92 | 92 | |
93 | 93 | $title = $form->post_title; |
94 | 94 | |
95 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
95 | + if (give_has_variable_prices($form->ID)) { |
|
96 | 96 | |
97 | - $prices = give_get_variable_prices( $form->ID ); |
|
97 | + $prices = give_get_variable_prices($form->ID); |
|
98 | 98 | |
99 | 99 | $first = $prices[0]['_give_amount']; |
100 | - $last = array_pop( $prices ); |
|
100 | + $last = array_pop($prices); |
|
101 | 101 | $last = $last['_give_amount']; |
102 | 102 | |
103 | - if ( $first < $last ) { |
|
103 | + if ($first < $last) { |
|
104 | 104 | $min = $first; |
105 | 105 | $max = $last; |
106 | 106 | } else { |
@@ -108,57 +108,57 @@ discard block |
||
108 | 108 | $max = $first; |
109 | 109 | } |
110 | 110 | |
111 | - $price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) ); |
|
111 | + $price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max))); |
|
112 | 112 | } else { |
113 | - $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
|
113 | + $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID))); |
|
114 | 114 | } |
115 | 115 | |
116 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
117 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
116 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
117 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
118 | 118 | |
119 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
120 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
119 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
120 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
121 | 121 | |
122 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
123 | - $link = get_permalink( $form->ID ); |
|
124 | - $earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) ); |
|
122 | + $sales = give_get_form_sales_stats($form->ID); |
|
123 | + $link = get_permalink($form->ID); |
|
124 | + $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID))); |
|
125 | 125 | |
126 | - if ( function_exists( 'iconv' ) ) { |
|
126 | + if (function_exists('iconv')) { |
|
127 | 127 | // Ensure characters like euro; are properly converted. |
128 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
129 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
128 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
129 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
130 | 130 | } |
131 | 131 | |
132 | - $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
|
132 | + $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings)); |
|
133 | 133 | endforeach; |
134 | 134 | else: |
135 | - $pdf->SetWidths( array( 280 ) ); |
|
135 | + $pdf->SetWidths(array(280)); |
|
136 | 136 | $title = utf8_decode( |
137 | 137 | sprintf( |
138 | 138 | /* translators: %s: form plural label */ |
139 | - esc_html__( 'No %s found.', 'give' ), |
|
139 | + esc_html__('No %s found.', 'give'), |
|
140 | 140 | give_get_forms_label_plural() |
141 | 141 | ) |
142 | 142 | ); |
143 | - $pdf->Row( array( $title ) ); |
|
143 | + $pdf->Row(array($title)); |
|
144 | 144 | endif; |
145 | 145 | |
146 | 146 | $pdf->Ln(); |
147 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
148 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
149 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
150 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
151 | - |
|
152 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
153 | - $image = str_replace( ' ', '%20', $image ); |
|
154 | - |
|
155 | - $pdf->SetX( 25 ); |
|
156 | - $pdf->Image( $image . '&file=.png' ); |
|
157 | - $pdf->Ln( 7 ); |
|
158 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
147 | + $pdf->SetTextColor(50, 50, 50); |
|
148 | + $pdf->SetFont('Helvetica', '', 14); |
|
149 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
150 | + $pdf->SetFont('Helvetica', '', 12); |
|
151 | + |
|
152 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
153 | + $image = str_replace(' ', '%20', $image); |
|
154 | + |
|
155 | + $pdf->SetX(25); |
|
156 | + $pdf->Image($image.'&file=.png'); |
|
157 | + $pdf->Ln(7); |
|
158 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
159 | 159 | } |
160 | 160 | |
161 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
161 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Draws Chart for PDF Report. |
@@ -175,38 +175,38 @@ discard block |
||
175 | 175 | * @return string $chart->getUrl() URL for the Google Chart |
176 | 176 | */ |
177 | 177 | function give_draw_chart_image() { |
178 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
178 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
181 | 181 | |
182 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
182 | + $chart = new GoogleChart('lc', 900, 330); |
|
183 | 183 | |
184 | 184 | $i = 1; |
185 | 185 | $earnings = ""; |
186 | 186 | $sales = ""; |
187 | 187 | |
188 | - while ( $i <= 12 ) : |
|
189 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
190 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
191 | - $i ++; |
|
188 | + while ($i <= 12) : |
|
189 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
190 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
191 | + $i++; |
|
192 | 192 | endwhile; |
193 | 193 | |
194 | - $earnings_array = explode( ",", $earnings ); |
|
195 | - $sales_array = explode( ",", $sales ); |
|
194 | + $earnings_array = explode(",", $earnings); |
|
195 | + $sales_array = explode(",", $sales); |
|
196 | 196 | |
197 | 197 | $i = 0; |
198 | - while ( $i <= 11 ) { |
|
199 | - if ( empty( $sales_array[ $i ] ) ) { |
|
200 | - $sales_array[ $i ] = 0; |
|
198 | + while ($i <= 11) { |
|
199 | + if (empty($sales_array[$i])) { |
|
200 | + $sales_array[$i] = 0; |
|
201 | 201 | } |
202 | - $i ++; |
|
202 | + $i++; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $min_earnings = 0; |
206 | - $max_earnings = max( $earnings_array ); |
|
207 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
206 | + $max_earnings = max($earnings_array); |
|
207 | + $earnings_scale = round($max_earnings, - 1); |
|
208 | 208 | |
209 | - $data = new GoogleChartData( array( |
|
209 | + $data = new GoogleChartData(array( |
|
210 | 210 | $earnings_array[0], |
211 | 211 | $earnings_array[1], |
212 | 212 | $earnings_array[2], |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | $earnings_array[9], |
220 | 220 | $earnings_array[10], |
221 | 221 | $earnings_array[11] |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | |
224 | - $data->setLegend( esc_html__( 'Income', 'give' ) ); |
|
225 | - $data->setColor( '1b58a3' ); |
|
226 | - $chart->addData( $data ); |
|
224 | + $data->setLegend(esc_html__('Income', 'give')); |
|
225 | + $data->setColor('1b58a3'); |
|
226 | + $chart->addData($data); |
|
227 | 227 | |
228 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
229 | - $shape_marker->setColor( '000000' ); |
|
230 | - $shape_marker->setSize( 7 ); |
|
231 | - $shape_marker->setBorder( 2 ); |
|
232 | - $shape_marker->setData( $data ); |
|
233 | - $chart->addMarker( $shape_marker ); |
|
228 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
229 | + $shape_marker->setColor('000000'); |
|
230 | + $shape_marker->setSize(7); |
|
231 | + $shape_marker->setBorder(2); |
|
232 | + $shape_marker->setData($data); |
|
233 | + $chart->addMarker($shape_marker); |
|
234 | 234 | |
235 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
236 | - $value_marker->setColor( '000000' ); |
|
237 | - $value_marker->setData( $data ); |
|
238 | - $chart->addMarker( $value_marker ); |
|
235 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
236 | + $value_marker->setColor('000000'); |
|
237 | + $value_marker->setData($data); |
|
238 | + $chart->addMarker($value_marker); |
|
239 | 239 | |
240 | - $data = new GoogleChartData( array( |
|
240 | + $data = new GoogleChartData(array( |
|
241 | 241 | $sales_array[0], |
242 | 242 | $sales_array[1], |
243 | 243 | $sales_array[2], |
@@ -250,46 +250,46 @@ discard block |
||
250 | 250 | $sales_array[9], |
251 | 251 | $sales_array[10], |
252 | 252 | $sales_array[11] |
253 | - ) ); |
|
254 | - $data->setLegend( esc_html__( 'Donations', 'give' ) ); |
|
255 | - $data->setColor( 'ff6c1c' ); |
|
256 | - $chart->addData( $data ); |
|
257 | - |
|
258 | - $chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
259 | - |
|
260 | - $chart->setScale( 0, $max_earnings ); |
|
261 | - |
|
262 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
263 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
264 | - $chart->addAxis( $y_axis ); |
|
265 | - |
|
266 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
267 | - $x_axis->setTickMarks( 5 ); |
|
268 | - $x_axis->setLabels( array( |
|
269 | - esc_html__( 'Jan', 'give' ), |
|
270 | - esc_html__( 'Feb', 'give' ), |
|
271 | - esc_html__( 'Mar', 'give' ), |
|
272 | - esc_html__( 'Apr', 'give' ), |
|
273 | - esc_html__( 'May', 'give' ), |
|
274 | - esc_html__( 'June', 'give' ), |
|
275 | - esc_html__( 'July', 'give' ), |
|
276 | - esc_html__( 'Aug', 'give' ), |
|
277 | - esc_html__( 'Sept', 'give' ), |
|
278 | - esc_html__( 'Oct', 'give' ), |
|
279 | - esc_html__( 'Nov', 'give' ), |
|
280 | - esc_html__( 'Dec', 'give' ) |
|
281 | - ) ); |
|
282 | - $chart->addAxis( $x_axis ); |
|
283 | - |
|
284 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
285 | - $shape_marker->setSize( 6 ); |
|
286 | - $shape_marker->setBorder( 2 ); |
|
287 | - $shape_marker->setData( $data ); |
|
288 | - $chart->addMarker( $shape_marker ); |
|
289 | - |
|
290 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
291 | - $value_marker->setData( $data ); |
|
292 | - $chart->addMarker( $value_marker ); |
|
253 | + )); |
|
254 | + $data->setLegend(esc_html__('Donations', 'give')); |
|
255 | + $data->setColor('ff6c1c'); |
|
256 | + $chart->addData($data); |
|
257 | + |
|
258 | + $chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
259 | + |
|
260 | + $chart->setScale(0, $max_earnings); |
|
261 | + |
|
262 | + $y_axis = new GoogleChartAxis('y'); |
|
263 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
264 | + $chart->addAxis($y_axis); |
|
265 | + |
|
266 | + $x_axis = new GoogleChartAxis('x'); |
|
267 | + $x_axis->setTickMarks(5); |
|
268 | + $x_axis->setLabels(array( |
|
269 | + esc_html__('Jan', 'give'), |
|
270 | + esc_html__('Feb', 'give'), |
|
271 | + esc_html__('Mar', 'give'), |
|
272 | + esc_html__('Apr', 'give'), |
|
273 | + esc_html__('May', 'give'), |
|
274 | + esc_html__('June', 'give'), |
|
275 | + esc_html__('July', 'give'), |
|
276 | + esc_html__('Aug', 'give'), |
|
277 | + esc_html__('Sept', 'give'), |
|
278 | + esc_html__('Oct', 'give'), |
|
279 | + esc_html__('Nov', 'give'), |
|
280 | + esc_html__('Dec', 'give') |
|
281 | + )); |
|
282 | + $chart->addAxis($x_axis); |
|
283 | + |
|
284 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
285 | + $shape_marker->setSize(6); |
|
286 | + $shape_marker->setBorder(2); |
|
287 | + $shape_marker->setData($data); |
|
288 | + $chart->addMarker($shape_marker); |
|
289 | + |
|
290 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
291 | + $value_marker->setData($data); |
|
292 | + $chart->addMarker($value_marker); |
|
293 | 293 | |
294 | 294 | return $chart->getUrl(); |
295 | 295 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Give_API_V1 Class |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Give_API_V1 Class |
@@ -97,10 +97,10 @@ |
||
97 | 97 | |
98 | 98 | //Single Form settings varies compared to the Global default settings |
99 | 99 | if ( ! empty( $form_default ) && |
100 | - $form_id !== null && |
|
101 | - $default !== $form_default && |
|
102 | - $form_default !== 'global' && |
|
103 | - give_is_gateway_active( $form_default ) |
|
100 | + $form_id !== null && |
|
101 | + $default !== $form_default && |
|
102 | + $form_default !== 'global' && |
|
103 | + give_is_gateway_active( $form_default ) |
|
104 | 104 | ) { |
105 | 105 | $default = $form_default; |
106 | 106 | } |
@@ -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,17 +24,17 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => esc_html__( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => esc_html__( 'PayPal', 'give' ), |
|
29 | - 'supports' => array( 'buy_now' ) |
|
27 | + 'admin_label' => esc_html__('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => esc_html__('PayPal', 'give'), |
|
29 | + 'supports' => array('buy_now') |
|
30 | 30 | ), |
31 | 31 | 'manual' => array( |
32 | - 'admin_label' => esc_html__( 'Test Donation', 'give' ), |
|
33 | - 'checkout_label' => esc_html__( 'Test Donation', 'give' ) |
|
32 | + 'admin_label' => esc_html__('Test Donation', 'give'), |
|
33 | + 'checkout_label' => esc_html__('Test Donation', 'give') |
|
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - return apply_filters( 'give_donation_gateways', $gateways ); |
|
37 | + return apply_filters('give_donation_gateways', $gateways); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | |
49 | 49 | $gateways = give_get_payment_gateways(); |
50 | 50 | |
51 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
51 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
52 | 52 | |
53 | 53 | $gateway_list = array(); |
54 | 54 | |
55 | - foreach ( $gateways as $key => $gateway ) { |
|
56 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
57 | - $gateway_list[ $key ] = $gateway; |
|
55 | + foreach ($gateways as $key => $gateway) { |
|
56 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
57 | + $gateway_list[$key] = $gateway; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Set order of payment gateway in list. |
62 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
62 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
63 | 63 | |
64 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list ); |
|
64 | + return apply_filters('give_enabled_payment_gateways', $gateway_list); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return boolean true if enabled, false otherwise |
75 | 75 | */ |
76 | -function give_is_gateway_active( $gateway ) { |
|
76 | +function give_is_gateway_active($gateway) { |
|
77 | 77 | $gateways = give_get_enabled_payment_gateways(); |
78 | 78 | |
79 | - $ret = array_key_exists( $gateway, $gateways ); |
|
79 | + $ret = array_key_exists($gateway, $gateways); |
|
80 | 80 | |
81 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
81 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -91,24 +91,24 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return string Gateway ID |
93 | 93 | */ |
94 | -function give_get_default_gateway( $form_id ) { |
|
94 | +function give_get_default_gateway($form_id) { |
|
95 | 95 | |
96 | 96 | global $give_options; |
97 | 97 | |
98 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | - $form_default = get_post_meta( $form_id, '_give_default_gateway', true ); |
|
98 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | + $form_default = get_post_meta($form_id, '_give_default_gateway', true); |
|
100 | 100 | |
101 | 101 | //Single Form settings varies compared to the Global default settings |
102 | - if ( ! empty( $form_default ) && |
|
102 | + if ( ! empty($form_default) && |
|
103 | 103 | $form_id !== null && |
104 | 104 | $default !== $form_default && |
105 | 105 | $form_default !== 'global' && |
106 | - give_is_gateway_active( $form_default ) |
|
106 | + give_is_gateway_active($form_default) |
|
107 | 107 | ) { |
108 | 108 | $default = $form_default; |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_default_gateway', $default ); |
|
111 | + return apply_filters('give_default_gateway', $default); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string Gateway admin label |
122 | 122 | */ |
123 | -function give_get_gateway_admin_label( $gateway ) { |
|
123 | +function give_get_gateway_admin_label($gateway) { |
|
124 | 124 | $gateways = give_get_enabled_payment_gateways(); |
125 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
126 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
125 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
126 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
127 | 127 | |
128 | - if ( $gateway == 'manual' && $payment ) { |
|
129 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
130 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
128 | + if ($gateway == 'manual' && $payment) { |
|
129 | + if (give_get_payment_amount($payment) == 0) { |
|
130 | + $label = esc_html__('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
134 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string Checkout label for the gateway |
145 | 145 | */ |
146 | -function give_get_gateway_checkout_label( $gateway ) { |
|
146 | +function give_get_gateway_checkout_label($gateway) { |
|
147 | 147 | $gateways = give_get_enabled_payment_gateways(); |
148 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
148 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
149 | 149 | |
150 | - if ( $gateway == 'manual' ) { |
|
151 | - $label = esc_html__( 'Test Donation', 'give' ); |
|
150 | + if ($gateway == 'manual') { |
|
151 | + $label = esc_html__('Test Donation', 'give'); |
|
152 | 152 | } |
153 | 153 | |
154 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
154 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array Options the gateway supports |
165 | 165 | */ |
166 | -function give_get_gateway_supports( $gateway ) { |
|
166 | +function give_get_gateway_supports($gateway) { |
|
167 | 167 | $gateways = give_get_enabled_payment_gateways(); |
168 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
168 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
169 | 169 | |
170 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
170 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return bool |
181 | 181 | */ |
182 | -function give_gateway_supports_buy_now( $gateway ) { |
|
183 | - $supports = give_get_gateway_supports( $gateway ); |
|
184 | - $ret = in_array( 'buy_now', $supports ); |
|
182 | +function give_gateway_supports_buy_now($gateway) { |
|
183 | + $supports = give_get_gateway_supports($gateway); |
|
184 | + $ret = in_array('buy_now', $supports); |
|
185 | 185 | |
186 | - return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway ); |
|
186 | + return apply_filters('give_gateway_supports_buy_now', $ret, $gateway); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | $gateways = give_get_enabled_payment_gateways(); |
197 | 197 | $ret = false; |
198 | 198 | |
199 | - if ( $gateways ) { |
|
200 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
201 | - if ( give_gateway_supports_buy_now( $gateway_id ) ) { |
|
199 | + if ($gateways) { |
|
200 | + foreach ($gateways as $gateway_id => $gateway) { |
|
201 | + if (give_gateway_supports_buy_now($gateway_id)) { |
|
202 | 202 | $ret = true; |
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - return apply_filters( 'give_give_supports_buy_now', $ret ); |
|
208 | + return apply_filters('give_give_supports_buy_now', $ret); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return void |
220 | 220 | */ |
221 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
221 | +function give_send_to_gateway($gateway, $payment_data) { |
|
222 | 222 | |
223 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
223 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Fires while loading payment gateway via AJAX. |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @param array $payment_data All the payment data to be sent to the gateway. |
233 | 233 | */ |
234 | - do_action( "give_gateway_{$gateway}", $payment_data ); |
|
234 | + do_action("give_gateway_{$gateway}", $payment_data); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | |
@@ -248,32 +248,32 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return string $enabled_gateway The slug of the gateway |
250 | 250 | */ |
251 | -function give_get_chosen_gateway( $form_id ) { |
|
251 | +function give_get_chosen_gateway($form_id) { |
|
252 | 252 | $gateways = give_get_enabled_payment_gateways(); |
253 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
254 | - if ( empty( $request_form_id ) ) { |
|
255 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
253 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
254 | + if (empty($request_form_id)) { |
|
255 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
256 | 256 | } |
257 | - $chosen = give_get_default_gateway( $form_id ); |
|
257 | + $chosen = give_get_default_gateway($form_id); |
|
258 | 258 | $enabled_gateway = ''; |
259 | 259 | |
260 | 260 | //Take into account request Form ID args |
261 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
262 | - $chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
261 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
262 | + $chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( $chosen ) { |
|
266 | - $enabled_gateway = urldecode( $chosen ); |
|
267 | - } else if ( count( $gateways ) >= 1 && ! $chosen ) { |
|
268 | - foreach ( $gateways as $gateway_id => $gateway ): |
|
265 | + if ($chosen) { |
|
266 | + $enabled_gateway = urldecode($chosen); |
|
267 | + } else if (count($gateways) >= 1 && ! $chosen) { |
|
268 | + foreach ($gateways as $gateway_id => $gateway): |
|
269 | 269 | $enabled_gateway = $gateway_id; |
270 | 270 | endforeach; |
271 | 271 | } else { |
272 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
272 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
276 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
276 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return int ID of the new log entry |
292 | 292 | */ |
293 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
294 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
293 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
294 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return int |
306 | 306 | */ |
307 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
307 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
308 | 308 | |
309 | 309 | $ret = 0; |
310 | 310 | $args = array( |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | 'fields' => 'ids' |
317 | 317 | ); |
318 | 318 | |
319 | - $payments = new WP_Query( $args ); |
|
319 | + $payments = new WP_Query($args); |
|
320 | 320 | |
321 | - if ( $payments ) { |
|
321 | + if ($payments) { |
|
322 | 322 | $ret = $payments->post_count; |
323 | 323 | } |
324 | 324 | |
@@ -335,27 +335,27 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return array $gateways All the available gateways |
337 | 337 | */ |
338 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
338 | +function give_get_ordered_payment_gateways($gateways) { |
|
339 | 339 | |
340 | 340 | // Get gateways setting. |
341 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
341 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
342 | 342 | |
343 | 343 | // Return from here if we do not have gateways setting. |
344 | - if ( empty( $gateways_setting ) ) { |
|
344 | + if (empty($gateways_setting)) { |
|
345 | 345 | return $gateways; |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Reverse array to order payment gateways. |
349 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
349 | + $gateways_setting = array_reverse($gateways_setting); |
|
350 | 350 | |
351 | 351 | // Reorder gateways array |
352 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
352 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
353 | 353 | |
354 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
355 | - unset( $gateways[ $gateway_key ] ); |
|
354 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
355 | + unset($gateways[$gateway_key]); |
|
356 | 356 | |
357 | - if ( ! empty( $new_gateway_value ) ) { |
|
358 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
357 | + if ( ! empty($new_gateway_value)) { |
|
358 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -366,5 +366,5 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @param array $gateways All the available gateways |
368 | 368 | */ |
369 | - return apply_filters( 'give_donation_gateways_order', $gateways ); |
|
369 | + return apply_filters('give_donation_gateways_order', $gateways); |
|
370 | 370 | } |
@@ -117,8 +117,8 @@ |
||
117 | 117 | $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
118 | 118 | // Only run in admin post/page creation and edit screens |
119 | 119 | if ( in_array( $pagenow, $shortcode_button_pages ) |
120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | - && ! empty( self::$shortcodes ) |
|
120 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | + && ! empty( self::$shortcodes ) |
|
122 | 122 | ) { |
123 | 123 | |
124 | 124 | $shortcodes = array(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 1.3.0 |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) or exit; |
|
14 | +defined('ABSPATH') or exit; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class Give_Shortcode_Button |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | 32 | |
33 | - if ( is_admin() ) { |
|
34 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
33 | + if (is_admin()) { |
|
34 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
35 | 35 | |
36 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
37 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
38 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
36 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
37 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
38 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
39 | 39 | } |
40 | 40 | |
41 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
42 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
41 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
42 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @since 1.0 |
53 | 53 | */ |
54 | - public function mce_external_plugins( $plugin_array ) { |
|
54 | + public function mce_external_plugins($plugin_array) { |
|
55 | 55 | |
56 | - if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { |
|
56 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { |
|
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | |
60 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
60 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
61 | 61 | |
62 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
62 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
63 | 63 | |
64 | 64 | return $plugin_array; |
65 | 65 | } |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function admin_enqueue_assets() { |
75 | 75 | |
76 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
76 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
77 | 77 | |
78 | 78 | wp_enqueue_script( |
79 | 79 | 'give_shortcode', |
80 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
81 | - array( 'jquery' ), |
|
80 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
81 | + array('jquery'), |
|
82 | 82 | GIVE_VERSION, |
83 | 83 | true |
84 | 84 | ); |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function admin_localize_scripts() { |
95 | 95 | |
96 | - if ( ! empty( self::$shortcodes ) ) { |
|
96 | + if ( ! empty(self::$shortcodes)) { |
|
97 | 97 | |
98 | 98 | $variables = array(); |
99 | 99 | |
100 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
101 | - if ( ! empty( $values['required'] ) ) { |
|
102 | - $variables[ $shortcode ] = $values['required']; |
|
100 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
101 | + if ( ! empty($values['required'])) { |
|
102 | + $variables[$shortcode] = $values['required']; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
106 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -118,31 +118,31 @@ discard block |
||
118 | 118 | |
119 | 119 | global $pagenow, $wp_version; |
120 | 120 | |
121 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( |
|
121 | + $shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( |
|
122 | 122 | 'post.php', |
123 | 123 | 'page.php', |
124 | 124 | 'post-new.php', |
125 | 125 | 'post-edit.php' |
126 | - ) ); |
|
126 | + )); |
|
127 | 127 | |
128 | 128 | // Only run in admin post/page creation and edit screens |
129 | - if ( in_array( $pagenow, $shortcode_button_pages ) |
|
130 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
131 | - && ! empty( self::$shortcodes ) |
|
129 | + if (in_array($pagenow, $shortcode_button_pages) |
|
130 | + && apply_filters('give_shortcode_button_condition', true) |
|
131 | + && ! empty(self::$shortcodes) |
|
132 | 132 | ) { |
133 | 133 | |
134 | 134 | $shortcodes = array(); |
135 | 135 | |
136 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
136 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Filters the condition for including the current shortcode |
140 | 140 | * |
141 | 141 | * @since 1.0 |
142 | 142 | */ |
143 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
143 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
144 | 144 | |
145 | - $shortcodes[ $shortcode ] = sprintf( |
|
145 | + $shortcodes[$shortcode] = sprintf( |
|
146 | 146 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', |
147 | 147 | $shortcode, |
148 | 148 | $values['label'], |
@@ -151,37 +151,37 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - if ( ! empty( $shortcodes ) ) { |
|
154 | + if ( ! empty($shortcodes)) { |
|
155 | 155 | |
156 | 156 | // check current WP version |
157 | - $img = ( version_compare( $wp_version, '3.5', '<' ) ) |
|
158 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
159 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
157 | + $img = (version_compare($wp_version, '3.5', '<')) |
|
158 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
159 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
160 | 160 | |
161 | - reset( $shortcodes ); |
|
161 | + reset($shortcodes); |
|
162 | 162 | |
163 | - if ( count( $shortcodes ) == 1 ) { |
|
163 | + if (count($shortcodes) == 1) { |
|
164 | 164 | |
165 | - $shortcode = key( $shortcodes ); |
|
165 | + $shortcode = key($shortcodes); |
|
166 | 166 | |
167 | 167 | printf( |
168 | 168 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
169 | 169 | $shortcode, |
170 | - sprintf( '%s %s %s', |
|
170 | + sprintf('%s %s %s', |
|
171 | 171 | $img, |
172 | - esc_html__( 'Insert', 'give' ), |
|
173 | - self::$shortcodes[ $shortcode ]['label'] |
|
172 | + esc_html__('Insert', 'give'), |
|
173 | + self::$shortcodes[$shortcode]['label'] |
|
174 | 174 | ) |
175 | 175 | ); |
176 | 176 | } else { |
177 | 177 | printf( |
178 | - '<div class="sc-wrap">' . |
|
179 | - '<button class="button sc-button">%s %s</button>' . |
|
180 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
178 | + '<div class="sc-wrap">'. |
|
179 | + '<button class="button sc-button">%s %s</button>'. |
|
180 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
181 | 181 | '</div>', |
182 | 182 | $img, |
183 | - esc_html__( 'Give Shortcodes', 'give' ), |
|
184 | - implode( '', array_values( $shortcodes ) ) |
|
183 | + esc_html__('Give Shortcodes', 'give'), |
|
184 | + implode('', array_values($shortcodes)) |
|
185 | 185 | ); |
186 | 186 | } |
187 | 187 | } |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function shortcode_ajax() { |
199 | 199 | |
200 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
200 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
201 | 201 | $response = false; |
202 | 202 | |
203 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
203 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
204 | 204 | |
205 | - $data = self::$shortcodes[ $shortcode ]; |
|
205 | + $data = self::$shortcodes[$shortcode]; |
|
206 | 206 | |
207 | - if ( ! empty( $data['errors'] ) ) { |
|
208 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
207 | + if ( ! empty($data['errors'])) { |
|
208 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $response = array( |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | ); |
218 | 218 | } else { |
219 | 219 | // todo: handle error |
220 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
220 | + error_log(print_r('AJAX error!', 1)); |
|
221 | 221 | } |
222 | 222 | |
223 | - wp_send_json( $response ); |
|
223 | + wp_send_json($response); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 |
@@ -115,8 +115,8 @@ |
||
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | 117 | $value = '<a href="' . |
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
118 | + admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
@@ -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 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults |
64 | - parent::__construct( array( |
|
65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
66 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
67 | 67 | 'ajax' => false // Does this table support ajax? |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
88 | 88 | } |
89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
89 | + if ( ! empty($_REQUEST['order'])) { |
|
90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | <p class="search-box" role="search"> |
94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
97 | 97 | </p> |
98 | 98 | <?php |
99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string Column Name. |
111 | 111 | */ |
112 | - public function column_default( $item, $column_name ) { |
|
113 | - switch ( $column_name ) { |
|
112 | + public function column_default($item, $column_name) { |
|
113 | + switch ($column_name) { |
|
114 | 114 | |
115 | 115 | case 'num_purchases' : |
116 | - $value = '<a href="' . |
|
117 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
118 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
116 | + $value = '<a href="'. |
|
117 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
118 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
119 | 119 | break; |
120 | 120 | |
121 | 121 | case 'amount_spent' : |
122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
123 | 123 | break; |
124 | 124 | |
125 | 125 | case 'date_created' : |
126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
127 | 127 | break; |
128 | 128 | |
129 | 129 | default: |
130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function column_name( $item ) { |
|
146 | - $name = '#' . $item['id'] . ' '; |
|
147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
149 | - $actions = $this->get_row_actions( $item ); |
|
145 | + public function column_name($item) { |
|
146 | + $name = '#'.$item['id'].' '; |
|
147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
149 | + $actions = $this->get_row_actions($item); |
|
150 | 150 | |
151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_columns() { |
162 | 162 | $columns = array( |
163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
165 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
163 | + 'name' => esc_html__('Name', 'give'), |
|
164 | + 'email' => esc_html__('Email', 'give'), |
|
165 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
168 | 168 | ); |
169 | 169 | |
170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
170 | + return apply_filters('give_report_customer_columns', $columns); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function get_sortable_columns() { |
182 | 182 | return array( |
183 | - 'date_created' => array( 'date_created', true ), |
|
184 | - 'name' => array( 'name', true ), |
|
185 | - 'num_purchases' => array( 'purchase_count', false ), |
|
186 | - 'amount_spent' => array( 'purchase_value', false ), |
|
183 | + 'date_created' => array('date_created', true), |
|
184 | + 'name' => array('name', true), |
|
185 | + 'num_purchases' => array('purchase_count', false), |
|
186 | + 'amount_spent' => array('purchase_value', false), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
@@ -195,34 +195,34 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array An array of action links. |
197 | 197 | */ |
198 | - public function get_row_actions( $item ) { |
|
198 | + public function get_row_actions($item) { |
|
199 | 199 | |
200 | 200 | $actions = array( |
201 | 201 | |
202 | 202 | 'view' => sprintf( |
203 | 203 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
204 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
205 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
206 | - esc_html__( 'View Donor', 'give' ) |
|
204 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
205 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
206 | + esc_html__('View Donor', 'give') |
|
207 | 207 | ), |
208 | 208 | |
209 | 209 | 'notes' => sprintf( |
210 | 210 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
211 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
212 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
213 | - esc_html__( 'Notes', 'give' ) |
|
211 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
212 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
213 | + esc_html__('Notes', 'give') |
|
214 | 214 | ), |
215 | 215 | |
216 | 216 | 'delete' => sprintf( |
217 | 217 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
218 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
219 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
220 | - esc_html__( 'Delete', 'give' ) |
|
218 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
219 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
220 | + esc_html__('Delete', 'give') |
|
221 | 221 | ) |
222 | 222 | |
223 | 223 | ); |
224 | 224 | |
225 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
225 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @since 1.0 |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function bulk_actions( $which = '' ) { |
|
236 | + public function bulk_actions($which = '') { |
|
237 | 237 | // These aren't really bulk actions but this outputs the markup in the right place. |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number. |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise. |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } else { |
293 | 293 | $args['name'] = $search; |
294 | 294 | } |
295 | 295 | |
296 | - $customers = Give()->customers->get_customers( $args ); |
|
296 | + $customers = Give()->customers->get_customers($args); |
|
297 | 297 | |
298 | - if ( $customers ) { |
|
298 | + if ($customers) { |
|
299 | 299 | |
300 | - foreach ( $customers as $customer ) { |
|
300 | + foreach ($customers as $customer) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
302 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $customer->id, |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | $hidden = array(); // No hidden columns |
334 | 334 | $sortable = $this->get_sortable_columns(); |
335 | 335 | |
336 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
336 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
337 | 337 | |
338 | 338 | $this->items = $this->reports_data(); |
339 | 339 | |
340 | 340 | $this->total = give_count_total_customers(); |
341 | 341 | |
342 | - $this->set_pagination_args( array( |
|
342 | + $this->set_pagination_args(array( |
|
343 | 343 | 'total_items' => $this->total, |
344 | 344 | 'per_page' => $this->per_page, |
345 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
346 | - ) ); |
|
345 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
346 | + )); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | \ No newline at end of file |
@@ -71,9 +71,9 @@ |
||
71 | 71 | ) ); |
72 | 72 | |
73 | 73 | add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
74 | - 'read' => true, |
|
75 | - 'edit_posts' => false, |
|
76 | - 'delete_posts' => false |
|
74 | + 'read' => true, |
|
75 | + 'edit_posts' => false, |
|
76 | + 'delete_posts' => false |
|
77 | 77 | ) ); |
78 | 78 | |
79 | 79 | add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
40 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | public function add_roles() { |
54 | - add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array( |
|
54 | + add_role('give_manager', esc_html__('Give Manager', 'give'), array( |
|
55 | 55 | 'read' => true, |
56 | 56 | 'edit_posts' => true, |
57 | 57 | 'delete_posts' => true, |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | 'publish_posts' => true, |
81 | 81 | 'read_private_pages' => true, |
82 | 82 | 'read_private_posts' => true |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | - add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array( |
|
85 | + add_role('give_accountant', esc_html__('Give Accountant', 'give'), array( |
|
86 | 86 | 'read' => true, |
87 | 87 | 'edit_posts' => false, |
88 | 88 | 'delete_posts' => false |
89 | - ) ); |
|
89 | + )); |
|
90 | 90 | |
91 | - add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array( |
|
91 | + add_role('give_worker', esc_html__('Give Worker', 'give'), array( |
|
92 | 92 | 'read' => true, |
93 | 93 | 'edit_posts' => false, |
94 | 94 | 'upload_files' => true, |
95 | 95 | 'delete_posts' => false |
96 | - ) ); |
|
96 | + )); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -112,38 +112,38 @@ discard block |
||
112 | 112 | public function add_caps() { |
113 | 113 | global $wp_roles; |
114 | 114 | |
115 | - if ( class_exists('WP_Roles') ) { |
|
116 | - if ( ! isset( $wp_roles ) ) { |
|
115 | + if (class_exists('WP_Roles')) { |
|
116 | + if ( ! isset($wp_roles)) { |
|
117 | 117 | $wp_roles = new WP_Roles(); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - if ( is_object( $wp_roles ) ) { |
|
122 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
123 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
124 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
125 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
121 | + if (is_object($wp_roles)) { |
|
122 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
123 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
124 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
125 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
126 | 126 | |
127 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
129 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
130 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
127 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
128 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
129 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
130 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
131 | 131 | |
132 | 132 | // Add the main post type capabilities |
133 | 133 | $capabilities = $this->get_core_caps(); |
134 | - foreach ( $capabilities as $cap_group ) { |
|
135 | - foreach ( $cap_group as $cap ) { |
|
136 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
137 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
138 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
134 | + foreach ($capabilities as $cap_group) { |
|
135 | + foreach ($cap_group as $cap) { |
|
136 | + $wp_roles->add_cap('administrator', $cap); |
|
137 | + $wp_roles->add_cap('give_manager', $cap); |
|
138 | + $wp_roles->add_cap('give_worker', $cap); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
143 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
144 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
145 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
146 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
142 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
143 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
144 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
145 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
146 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | } |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | public function get_core_caps() { |
162 | 162 | $capabilities = array(); |
163 | 163 | |
164 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
164 | + $capability_types = array('give_form', 'give_payment'); |
|
165 | 165 | |
166 | - foreach ( $capability_types as $capability_type ) { |
|
167 | - $capabilities[ $capability_type ] = array( |
|
166 | + foreach ($capability_types as $capability_type) { |
|
167 | + $capabilities[$capability_type] = array( |
|
168 | 168 | // Post type |
169 | 169 | "edit_{$capability_type}", |
170 | 170 | "read_{$capability_type}", |
@@ -204,22 +204,22 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array $caps Meta capabilities. |
206 | 206 | */ |
207 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
207 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
208 | 208 | |
209 | - switch( $cap ) { |
|
209 | + switch ($cap) { |
|
210 | 210 | |
211 | 211 | case 'view_give_forms_stats' : |
212 | 212 | |
213 | - if( empty( $args[0] ) ) { |
|
213 | + if (empty($args[0])) { |
|
214 | 214 | break; |
215 | 215 | } |
216 | 216 | |
217 | - $form = get_post( $args[0] ); |
|
218 | - if ( empty( $form ) ) { |
|
217 | + $form = get_post($args[0]); |
|
218 | + if (empty($form)) { |
|
219 | 219 | break; |
220 | 220 | } |
221 | 221 | |
222 | - if( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
222 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
223 | 223 | $caps = array(); |
224 | 224 | } |
225 | 225 | |
@@ -244,41 +244,41 @@ discard block |
||
244 | 244 | |
245 | 245 | global $wp_roles; |
246 | 246 | |
247 | - if ( class_exists( 'WP_Roles' ) ) { |
|
248 | - if ( ! isset( $wp_roles ) ) { |
|
247 | + if (class_exists('WP_Roles')) { |
|
248 | + if ( ! isset($wp_roles)) { |
|
249 | 249 | $wp_roles = new WP_Roles(); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | - if ( is_object( $wp_roles ) ) { |
|
253 | + if (is_object($wp_roles)) { |
|
254 | 254 | /** Give Manager Capabilities */ |
255 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
256 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
257 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
258 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
255 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
256 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
257 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
258 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
259 | 259 | |
260 | 260 | /** Site Administrator Capabilities */ |
261 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
262 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
263 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
264 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
261 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
262 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
263 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
264 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
265 | 265 | |
266 | 266 | /** Remove the Main Post Type Capabilities */ |
267 | 267 | $capabilities = $this->get_core_caps(); |
268 | 268 | |
269 | - foreach ( $capabilities as $cap_group ) { |
|
270 | - foreach ( $cap_group as $cap ) { |
|
271 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
272 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
273 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
269 | + foreach ($capabilities as $cap_group) { |
|
270 | + foreach ($cap_group as $cap) { |
|
271 | + $wp_roles->remove_cap('give_manager', $cap); |
|
272 | + $wp_roles->remove_cap('administrator', $cap); |
|
273 | + $wp_roles->remove_cap('give_worker', $cap); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | 277 | /** Give Accountant Capabilities */ |
278 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
279 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
280 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
281 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
278 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
279 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
280 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
281 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | } |