@@ -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 | |
@@ -22,80 +22,80 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - do_action( 'give_tools_recount_stats_before' ); |
|
29 | + do_action('give_tools_recount_stats_before'); |
|
30 | 30 | ?> |
31 | 31 | <div id="poststuff"> |
32 | 32 | <div class="postbox"> |
33 | 33 | |
34 | - <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Recount Stats', 'give' ); ?></span></h2> |
|
34 | + <h2 class="hndle ui-sortable-handle"><span><?php _e('Recount Stats', 'give'); ?></span></h2> |
|
35 | 35 | |
36 | 36 | <div class="inside recount-stats-controls"> |
37 | - <p><?php _e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
37 | + <p><?php _e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
38 | 38 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
39 | 39 | |
40 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
40 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
41 | 41 | |
42 | 42 | <select name="give-export-class" id="recount-stats-type"> |
43 | - <option value="0" selected="selected" disabled="disabled"><?php _e( 'Please select an option', 'give' ); ?></option> |
|
44 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
45 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
46 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
47 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
48 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e( 'Delete Test Transactions', 'give' ); ?></option> |
|
49 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e( 'Delete All Data', 'give' ); ?></option> |
|
50 | - <?php do_action( 'give_recount_tool_options' ); ?> |
|
43 | + <option value="0" selected="selected" disabled="disabled"><?php _e('Please select an option', 'give'); ?></option> |
|
44 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
45 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
46 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
47 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e('Recalculate Donor Statistics', 'give'); ?></option> |
|
48 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e('Delete Test Transactions', 'give'); ?></option> |
|
49 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e('Delete All Data', 'give'); ?></option> |
|
50 | + <?php do_action('give_recount_tool_options'); ?> |
|
51 | 51 | </select> |
52 | 52 | |
53 | 53 | <span id="tools-form-dropdown" style="display: none"> |
54 | 54 | <?php |
55 | 55 | $args = array( |
56 | 56 | 'name' => 'form_id', |
57 | - 'number' => - 1, |
|
57 | + 'number' => -1, |
|
58 | 58 | 'chosen' => true, |
59 | 59 | ); |
60 | - echo Give()->html->forms_dropdown( $args ); |
|
60 | + echo Give()->html->forms_dropdown($args); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | |
64 | - <input type="submit" id="recount-stats-submit" value="<?php _e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
64 | + <input type="submit" id="recount-stats-submit" value="<?php _e('Submit', 'give'); ?>" class="button-secondary"/> |
|
65 | 65 | |
66 | 66 | <br/> |
67 | 67 | |
68 | 68 | <span class="give-recount-stats-descriptions"> |
69 | - <span id="recount-stats"><?php _e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | + <span id="recount-stats"><?php _e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
70 | 70 | <span id="recount-form"><?php |
71 | 71 | printf( |
72 | 72 | /* translators: %s: form singular label */ |
73 | - __( 'Recalculates the donation and income stats for a specific %s.', 'give' ), |
|
74 | - give_get_forms_label_singular( true ) |
|
73 | + __('Recalculates the donation and income stats for a specific %s.', 'give'), |
|
74 | + give_get_forms_label_singular(true) |
|
75 | 75 | ); |
76 | 76 | ?></span> |
77 | 77 | <span id="recount-all"><?php |
78 | 78 | printf( |
79 | 79 | /* translators: %s: form plural label */ |
80 | - __( 'Recalculates the earnings and sales stats for all %s.', 'give' ), |
|
81 | - give_get_forms_label_plural( true ) |
|
80 | + __('Recalculates the earnings and sales stats for all %s.', 'give'), |
|
81 | + give_get_forms_label_plural(true) |
|
82 | 82 | ); |
83 | 83 | ?></span> |
84 | - <span id="recount-customer-stats"><?php _e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
85 | - <?php do_action( 'give_recount_tool_descriptions' ); ?> |
|
86 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span> |
|
87 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php _e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | + <?php do_action('give_recount_tool_descriptions'); ?> |
|
86 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span> |
|
87 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
88 | 88 | </span> |
89 | 89 | |
90 | 90 | <span class="spinner"></span> |
91 | 91 | |
92 | 92 | </form> |
93 | - <?php do_action( 'give_tools_recount_forms' ); ?> |
|
93 | + <?php do_action('give_tools_recount_forms'); ?> |
|
94 | 94 | </div><!-- .inside --> |
95 | 95 | </div><!-- .postbox --> |
96 | 96 | </div><!-- #poststuff --> |
97 | 97 | <?php |
98 | - do_action( 'give_tools_recount_stats_after' ); |
|
98 | + do_action('give_tools_recount_stats_after'); |
|
99 | 99 | } |
100 | 100 | |
101 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
101 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -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,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) : |
|
117 | + if ($day_by_day) : |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | else : |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | endif; |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - __( 'Income', 'give' ) => $earnings_data, |
|
181 | - __( 'Donations', 'give' ) => $sales_data |
|
180 | + __('Income', 'give') => $earnings_data, |
|
181 | + __('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | <div class="postbox"> |
191 | 191 | <div class="inside"> |
192 | 192 | <?php |
193 | - $graph = new Give_Graph( $data ); |
|
194 | - $graph->set( 'x_mode', 'time' ); |
|
195 | - $graph->set( 'multiple_y_axes', true ); |
|
193 | + $graph = new Give_Graph($data); |
|
194 | + $graph->set('x_mode', 'time'); |
|
195 | + $graph->set('multiple_y_axes', true); |
|
196 | 196 | $graph->display(); |
197 | 197 | |
198 | - if ( 'this_month' == $dates['range'] ) { |
|
198 | + if ('this_month' == $dates['range']) { |
|
199 | 199 | $estimated = give_estimated_monthly_stats(); |
200 | 200 | } |
201 | 201 | ?> |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | 208 | <td class="row-title"> |
209 | - <label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td> |
|
210 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
209 | + <label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td> |
|
210 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
211 | 211 | </tr> |
212 | 212 | <tr class="alternate"> |
213 | 213 | <td class="row-title"> |
214 | - <label for="tablecell"><?php _e( 'Total donations for period shown: ', 'give' ); ?></label> |
|
214 | + <label for="tablecell"><?php _e('Total donations for period shown: ', 'give'); ?></label> |
|
215 | 215 | </td> |
216 | - <td><?php echo give_format_amount( $sales_totals, false ); ?></td> |
|
216 | + <td><?php echo give_format_amount($sales_totals, false); ?></td> |
|
217 | 217 | </tr> |
218 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
218 | + <?php if ('this_month' == $dates['range']) : ?> |
|
219 | 219 | <tr> |
220 | 220 | <td class="row-title"> |
221 | - <label for="tablecell"><?php _e( 'Estimated monthly income: ', 'give' ); ?></label> |
|
221 | + <label for="tablecell"><?php _e('Estimated monthly income: ', 'give'); ?></label> |
|
222 | 222 | </td> |
223 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
223 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
224 | 224 | </tr> |
225 | 225 | <tr class="alternate"> |
226 | 226 | <td class="row-title"> |
227 | - <label for="tablecell"><?php _e( 'Estimated monthly donations: ', 'give' ); ?></label> |
|
227 | + <label for="tablecell"><?php _e('Estimated monthly donations: ', 'give'); ?></label> |
|
228 | 228 | </td> |
229 | - <td><?php echo give_format_amount( $estimated['sales'], false ); ?></td> |
|
229 | + <td><?php echo give_format_amount($estimated['sales'], false); ?></td> |
|
230 | 230 | </tr> |
231 | 231 | <?php endif; ?> |
232 | 232 | </table> |
233 | 233 | |
234 | - <?php do_action( 'give_reports_graph_additional_stats' ); ?> |
|
234 | + <?php do_action('give_reports_graph_additional_stats'); ?> |
|
235 | 235 | |
236 | 236 | </div> |
237 | 237 | </div> |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | * @since 1.0 |
250 | 250 | * @return void |
251 | 251 | */ |
252 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
252 | +function give_reports_graph_of_form($form_id = 0) { |
|
253 | 253 | // Retrieve the queried dates |
254 | 254 | $dates = give_get_report_dates(); |
255 | 255 | |
256 | 256 | // Determine graph options |
257 | - switch ( $dates['range'] ) : |
|
257 | + switch ($dates['range']) : |
|
258 | 258 | case 'today' : |
259 | 259 | case 'yesterday' : |
260 | 260 | $day_by_day = true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $day_by_day = false; |
273 | 273 | break; |
274 | 274 | case 'other' : |
275 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
275 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
276 | 276 | $day_by_day = false; |
277 | 277 | } else { |
278 | 278 | $day_by_day = true; |
@@ -284,75 +284,75 @@ discard block |
||
284 | 284 | endswitch; |
285 | 285 | |
286 | 286 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
287 | - $sales_totals = 0; // Total sales for time period shown |
|
287 | + $sales_totals = 0; // Total sales for time period shown |
|
288 | 288 | |
289 | 289 | $earnings_data = array(); |
290 | 290 | $sales_data = array(); |
291 | 291 | $stats = new Give_Payment_Stats; |
292 | 292 | |
293 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
293 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
294 | 294 | |
295 | 295 | // Hour by hour |
296 | 296 | $month = $dates['m_start']; |
297 | 297 | $hour = 1; |
298 | 298 | $minute = 0; |
299 | 299 | $second = 0; |
300 | - while ( $hour <= 23 ) : |
|
300 | + while ($hour <= 23) : |
|
301 | 301 | |
302 | - if ( $hour == 23 ) { |
|
302 | + if ($hour == 23) { |
|
303 | 303 | $minute = $second = 59; |
304 | 304 | } |
305 | 305 | |
306 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
307 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
306 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
307 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
308 | 308 | |
309 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
309 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
310 | 310 | $sales_totals += $sales; |
311 | 311 | |
312 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
312 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
313 | 313 | $earnings_totals += $earnings; |
314 | 314 | |
315 | - $sales_data[] = array( $date * 1000, $sales ); |
|
316 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
315 | + $sales_data[] = array($date * 1000, $sales); |
|
316 | + $earnings_data[] = array($date * 1000, $earnings); |
|
317 | 317 | |
318 | - $hour ++; |
|
318 | + $hour++; |
|
319 | 319 | endwhile; |
320 | 320 | |
321 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
321 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
322 | 322 | |
323 | 323 | //Day by day |
324 | 324 | $day = $dates['day']; |
325 | 325 | $day_end = $dates['day_end']; |
326 | 326 | $month = $dates['m_start']; |
327 | - while ( $day <= $day_end ) : |
|
327 | + while ($day <= $day_end) : |
|
328 | 328 | |
329 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
330 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
331 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
329 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
330 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
331 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
332 | 332 | $sales_totals += $sales; |
333 | 333 | |
334 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
334 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
335 | 335 | $earnings_totals += $earnings; |
336 | 336 | |
337 | - $sales_data[] = array( $date * 1000, $sales ); |
|
338 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
337 | + $sales_data[] = array($date * 1000, $sales); |
|
338 | + $earnings_data[] = array($date * 1000, $earnings); |
|
339 | 339 | |
340 | - $day ++; |
|
340 | + $day++; |
|
341 | 341 | endwhile; |
342 | 342 | |
343 | 343 | } else { |
344 | 344 | |
345 | 345 | $y = $dates['year']; |
346 | 346 | |
347 | - while ( $y <= $dates['year_end'] ) : |
|
347 | + while ($y <= $dates['year_end']) : |
|
348 | 348 | |
349 | 349 | $last_year = false; |
350 | 350 | |
351 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
351 | + if ($dates['year'] == $dates['year_end']) { |
|
352 | 352 | $month_start = $dates['m_start']; |
353 | 353 | $month_end = $dates['m_end']; |
354 | 354 | $last_year = true; |
355 | - } elseif ( $y == $dates['year'] ) { |
|
355 | + } elseif ($y == $dates['year']) { |
|
356 | 356 | $month_start = $dates['m_start']; |
357 | 357 | $month_end = 12; |
358 | 358 | } else { |
@@ -361,75 +361,75 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | $i = $month_start; |
364 | - while ( $i <= $month_end ) : |
|
364 | + while ($i <= $month_end) : |
|
365 | 365 | |
366 | - if ( $day_by_day ) : |
|
366 | + if ($day_by_day) : |
|
367 | 367 | |
368 | - if ( $i == $month_end && $last_year ) { |
|
368 | + if ($i == $month_end && $last_year) { |
|
369 | 369 | |
370 | 370 | $num_of_days = $dates['day_end']; |
371 | 371 | |
372 | 372 | } else { |
373 | 373 | |
374 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
374 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
378 | 378 | $d = $dates['day']; |
379 | - while ( $d <= $num_of_days ) : |
|
379 | + while ($d <= $num_of_days) : |
|
380 | 380 | |
381 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
382 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
381 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
382 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
383 | 383 | |
384 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
384 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
385 | 385 | $sales_totals += $sales; |
386 | 386 | |
387 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
387 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
388 | 388 | $earnings_totals += $earnings; |
389 | 389 | |
390 | - $sales_data[] = array( $date * 1000, $sales ); |
|
391 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
392 | - $d ++; |
|
390 | + $sales_data[] = array($date * 1000, $sales); |
|
391 | + $earnings_data[] = array($date * 1000, $earnings); |
|
392 | + $d++; |
|
393 | 393 | |
394 | 394 | endwhile; |
395 | 395 | |
396 | 396 | else : |
397 | 397 | |
398 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
398 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
399 | 399 | |
400 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
401 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
400 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
401 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
402 | 402 | |
403 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
403 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
404 | 404 | $sales_totals += $sales; |
405 | 405 | |
406 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
406 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
407 | 407 | $earnings_totals += $earnings; |
408 | 408 | |
409 | - $sales_data[] = array( $date * 1000, $sales ); |
|
410 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
409 | + $sales_data[] = array($date * 1000, $sales); |
|
410 | + $earnings_data[] = array($date * 1000, $earnings); |
|
411 | 411 | endif; |
412 | 412 | |
413 | - $i ++; |
|
413 | + $i++; |
|
414 | 414 | |
415 | 415 | endwhile; |
416 | 416 | |
417 | - $y ++; |
|
417 | + $y++; |
|
418 | 418 | endwhile; |
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | 422 | $data = array( |
423 | - __( 'Income', 'give' ) => $earnings_data, |
|
424 | - __( 'Donations', 'give' ) => $sales_data |
|
423 | + __('Income', 'give') => $earnings_data, |
|
424 | + __('Donations', 'give') => $sales_data |
|
425 | 425 | ); |
426 | 426 | |
427 | 427 | ?> |
428 | 428 | <h3><span><?php |
429 | 429 | printf( |
430 | 430 | /* translators: %s: form title */ |
431 | - __( 'Income Over Time for %s', 'give' ), |
|
432 | - get_the_title( $form_id ) |
|
431 | + __('Income Over Time for %s', 'give'), |
|
432 | + get_the_title($form_id) |
|
433 | 433 | ); |
434 | 434 | ?></span></h3> |
435 | 435 | |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | <div class="postbox"> |
438 | 438 | <div class="inside"> |
439 | 439 | <?php |
440 | - $graph = new Give_Graph( $data ); |
|
441 | - $graph->set( 'x_mode', 'time' ); |
|
442 | - $graph->set( 'multiple_y_axes', true ); |
|
440 | + $graph = new Give_Graph($data); |
|
441 | + $graph->set('x_mode', 'time'); |
|
442 | + $graph->set('multiple_y_axes', true); |
|
443 | 443 | $graph->display(); |
444 | 444 | ?> |
445 | 445 | </div> |
@@ -449,26 +449,26 @@ discard block |
||
449 | 449 | <tbody> |
450 | 450 | <tr> |
451 | 451 | <td class="row-title"> |
452 | - <label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td> |
|
453 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
452 | + <label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td> |
|
453 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
454 | 454 | </tr> |
455 | 455 | <tr class="alternate"> |
456 | 456 | <td class="row-title"> |
457 | - <label for="tablecell"><?php _e( 'Total donations for period: ', 'give' ); ?></label> |
|
457 | + <label for="tablecell"><?php _e('Total donations for period: ', 'give'); ?></label> |
|
458 | 458 | </td> |
459 | 459 | <td><?php echo $sales_totals; ?></td> |
460 | 460 | </tr> |
461 | 461 | <tr> |
462 | 462 | <td class="row-title"> |
463 | - <label for="tablecell"><?php _e( 'Average monthly income: %s', 'give' ); ?></label> |
|
463 | + <label for="tablecell"><?php _e('Average monthly income: %s', 'give'); ?></label> |
|
464 | 464 | </td> |
465 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
465 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
466 | 466 | </tr> |
467 | 467 | <tr class="alternate"> |
468 | 468 | <td class="row-title"> |
469 | - <label for="tablecell"><?php _e( 'Average monthly donations: %s', 'give' ); ?></label> |
|
469 | + <label for="tablecell"><?php _e('Average monthly donations: %s', 'give'); ?></label> |
|
470 | 470 | </td> |
471 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
471 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
472 | 472 | </tr> |
473 | 473 | </tbody> |
474 | 474 | </table> |
@@ -485,29 +485,29 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | function give_reports_graph_controls() { |
488 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
489 | - 'today' => __( 'Today', 'give' ), |
|
490 | - 'yesterday' => __( 'Yesterday', 'give' ), |
|
491 | - 'this_week' => __( 'This Week', 'give' ), |
|
492 | - 'last_week' => __( 'Last Week', 'give' ), |
|
493 | - 'this_month' => __( 'This Month', 'give' ), |
|
494 | - 'last_month' => __( 'Last Month', 'give' ), |
|
495 | - 'this_quarter' => __( 'This Quarter', 'give' ), |
|
496 | - 'last_quarter' => __( 'Last Quarter', 'give' ), |
|
497 | - 'this_year' => __( 'This Year', 'give' ), |
|
498 | - 'last_year' => __( 'Last Year', 'give' ), |
|
499 | - 'other' => __( 'Custom', 'give' ) |
|
500 | - ) ); |
|
488 | + $date_options = apply_filters('give_report_date_options', array( |
|
489 | + 'today' => __('Today', 'give'), |
|
490 | + 'yesterday' => __('Yesterday', 'give'), |
|
491 | + 'this_week' => __('This Week', 'give'), |
|
492 | + 'last_week' => __('Last Week', 'give'), |
|
493 | + 'this_month' => __('This Month', 'give'), |
|
494 | + 'last_month' => __('Last Month', 'give'), |
|
495 | + 'this_quarter' => __('This Quarter', 'give'), |
|
496 | + 'last_quarter' => __('Last Quarter', 'give'), |
|
497 | + 'this_year' => __('This Year', 'give'), |
|
498 | + 'last_year' => __('Last Year', 'give'), |
|
499 | + 'other' => __('Custom', 'give') |
|
500 | + )); |
|
501 | 501 | |
502 | 502 | $dates = give_get_report_dates(); |
503 | 503 | $display = $dates['range'] == 'other' ? '' : 'style="display:none;"'; |
504 | 504 | $view = give_get_reporting_view(); |
505 | 505 | |
506 | - if ( empty( $dates['day_end'] ) ) { |
|
507 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
506 | + if (empty($dates['day_end'])) { |
|
507 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
508 | 508 | } |
509 | 509 | |
510 | - do_action( 'give_report_graph_controls_before' ); |
|
510 | + do_action('give_report_graph_controls_before'); |
|
511 | 511 | ?> |
512 | 512 | <form id="give-graphs-filter" method="get" class="alignright"> |
513 | 513 | <div class="tablenav top alignright"> |
@@ -515,53 +515,53 @@ discard block |
||
515 | 515 | |
516 | 516 | <input type="hidden" name="post_type" value="give_forms" /> |
517 | 517 | <input type="hidden" name="page" value="give-reports" /> |
518 | - <input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" /> |
|
518 | + <input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" /> |
|
519 | 519 | |
520 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
521 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
520 | + <?php if (isset($_GET['form-id'])) : ?> |
|
521 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
522 | 522 | <?php endif; ?> |
523 | 523 | |
524 | 524 | <div id="give-graphs-date-options-wrap" class="alignright"> |
525 | 525 | <select id="give-graphs-date-options" name="range"> |
526 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
527 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
526 | + <?php foreach ($date_options as $key => $option) : ?> |
|
527 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
528 | 528 | <?php endforeach; ?> |
529 | 529 | </select> |
530 | 530 | |
531 | - <input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" /> |
|
531 | + <input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" /> |
|
532 | 532 | </div> |
533 | 533 | |
534 | 534 | <div id="give-date-range-options" <?php echo $display; ?>> |
535 | - <span><?php _e( 'From', 'give' ); ?> </span> |
|
535 | + <span><?php _e('From', 'give'); ?> </span> |
|
536 | 536 | <select id="give-graphs-month-start" name="m_start"> |
537 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
538 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
537 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
538 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
539 | 539 | <?php endfor; ?> |
540 | 540 | </select> |
541 | 541 | <select id="give-graphs-day-start" name="day"> |
542 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
543 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option> |
|
542 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
543 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option> |
|
544 | 544 | <?php endfor; ?> |
545 | 545 | </select> |
546 | 546 | <select id="give-graphs-year-start" name="year"> |
547 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
548 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option> |
|
547 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
548 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option> |
|
549 | 549 | <?php endfor; ?> |
550 | 550 | </select> |
551 | - <span><?php _e( 'To', 'give' ); ?> </span> |
|
551 | + <span><?php _e('To', 'give'); ?> </span> |
|
552 | 552 | <select id="give-graphs-month-end" name="m_end"> |
553 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
554 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
553 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
554 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
555 | 555 | <?php endfor; ?> |
556 | 556 | </select> |
557 | 557 | <select id="give-graphs-day-end" name="day_end"> |
558 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
559 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option> |
|
558 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
559 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option> |
|
560 | 560 | <?php endfor; ?> |
561 | 561 | </select> |
562 | 562 | <select id="give-graphs-year-end" name="year_end"> |
563 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
564 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option> |
|
563 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
564 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option> |
|
565 | 565 | <?php endfor; ?> |
566 | 566 | </select> |
567 | 567 | </div> |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | </div> |
572 | 572 | </form> |
573 | 573 | <?php |
574 | - do_action( 'give_report_graph_controls_after' ); |
|
574 | + do_action('give_report_graph_controls_after'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -586,65 +586,65 @@ discard block |
||
586 | 586 | function give_get_report_dates() { |
587 | 587 | $dates = array(); |
588 | 588 | |
589 | - $current_time = current_time( 'timestamp' ); |
|
589 | + $current_time = current_time('timestamp'); |
|
590 | 590 | |
591 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
592 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
593 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
594 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
595 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
596 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
597 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
591 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
592 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
593 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
594 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
595 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
596 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
597 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
598 | 598 | |
599 | 599 | // Modify dates based on predefined ranges |
600 | - switch ( $dates['range'] ) : |
|
600 | + switch ($dates['range']) : |
|
601 | 601 | |
602 | 602 | case 'this_month' : |
603 | - $dates['m_start'] = date( 'n', $current_time ); |
|
604 | - $dates['m_end'] = date( 'n', $current_time ); |
|
603 | + $dates['m_start'] = date('n', $current_time); |
|
604 | + $dates['m_end'] = date('n', $current_time); |
|
605 | 605 | $dates['day'] = 1; |
606 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
607 | - $dates['year'] = date( 'Y' ); |
|
608 | - $dates['year_end'] = date( 'Y' ); |
|
606 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
607 | + $dates['year'] = date('Y'); |
|
608 | + $dates['year_end'] = date('Y'); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | case 'last_month' : |
612 | - if ( date( 'n' ) == 1 ) { |
|
612 | + if (date('n') == 1) { |
|
613 | 613 | $dates['m_start'] = 12; |
614 | 614 | $dates['m_end'] = 12; |
615 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
616 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
615 | + $dates['year'] = date('Y', $current_time) - 1; |
|
616 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
617 | 617 | } else { |
618 | - $dates['m_start'] = date( 'n' ) - 1; |
|
619 | - $dates['m_end'] = date( 'n' ) - 1; |
|
618 | + $dates['m_start'] = date('n') - 1; |
|
619 | + $dates['m_end'] = date('n') - 1; |
|
620 | 620 | $dates['year_end'] = $dates['year']; |
621 | 621 | } |
622 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
622 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
623 | 623 | break; |
624 | 624 | |
625 | 625 | case 'today' : |
626 | - $dates['day'] = date( 'd', $current_time ); |
|
627 | - $dates['m_start'] = date( 'n', $current_time ); |
|
628 | - $dates['m_end'] = date( 'n', $current_time ); |
|
629 | - $dates['year'] = date( 'Y', $current_time ); |
|
626 | + $dates['day'] = date('d', $current_time); |
|
627 | + $dates['m_start'] = date('n', $current_time); |
|
628 | + $dates['m_end'] = date('n', $current_time); |
|
629 | + $dates['year'] = date('Y', $current_time); |
|
630 | 630 | break; |
631 | 631 | |
632 | 632 | case 'yesterday' : |
633 | 633 | |
634 | - $year = date( 'Y', $current_time ); |
|
635 | - $month = date( 'n', $current_time ); |
|
636 | - $day = date( 'd', $current_time ); |
|
634 | + $year = date('Y', $current_time); |
|
635 | + $month = date('n', $current_time); |
|
636 | + $day = date('d', $current_time); |
|
637 | 637 | |
638 | - if ( $month == 1 && $day == 1 ) { |
|
638 | + if ($month == 1 && $day == 1) { |
|
639 | 639 | |
640 | 640 | $year -= 1; |
641 | 641 | $month = 12; |
642 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
642 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
643 | 643 | |
644 | - } elseif ( $month > 1 && $day == 1 ) { |
|
644 | + } elseif ($month > 1 && $day == 1) { |
|
645 | 645 | |
646 | 646 | $month -= 1; |
647 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
647 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
648 | 648 | |
649 | 649 | } else { |
650 | 650 | |
@@ -660,91 +660,91 @@ discard block |
||
660 | 660 | break; |
661 | 661 | |
662 | 662 | case 'this_week' : |
663 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
664 | - $dates['day'] += get_option( 'start_of_week' ); |
|
663 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
664 | + $dates['day'] += get_option('start_of_week'); |
|
665 | 665 | $dates['day_end'] = $dates['day'] + 6; |
666 | - $dates['m_start'] = date( 'n', $current_time ); |
|
667 | - $dates['m_end'] = date( 'n', $current_time ); |
|
668 | - $dates['year'] = date( 'Y', $current_time ); |
|
666 | + $dates['m_start'] = date('n', $current_time); |
|
667 | + $dates['m_end'] = date('n', $current_time); |
|
668 | + $dates['year'] = date('Y', $current_time); |
|
669 | 669 | break; |
670 | 670 | |
671 | 671 | case 'last_week' : |
672 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
673 | - $dates['day'] += get_option( 'start_of_week' ); |
|
672 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
673 | + $dates['day'] += get_option('start_of_week'); |
|
674 | 674 | $dates['day_end'] = $dates['day'] + 6; |
675 | - $dates['year'] = date( 'Y' ); |
|
676 | - |
|
677 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
678 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
679 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
680 | - if ( $dates['m_start'] <= 1 ) { |
|
681 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
682 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
675 | + $dates['year'] = date('Y'); |
|
676 | + |
|
677 | + if (date('j', $current_time) <= 7) { |
|
678 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
679 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
680 | + if ($dates['m_start'] <= 1) { |
|
681 | + $dates['year'] = date('Y', $current_time) - 1; |
|
682 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
683 | 683 | } |
684 | 684 | } else { |
685 | - $dates['m_start'] = date( 'n', $current_time ); |
|
686 | - $dates['m_end'] = date( 'n', $current_time ); |
|
685 | + $dates['m_start'] = date('n', $current_time); |
|
686 | + $dates['m_end'] = date('n', $current_time); |
|
687 | 687 | } |
688 | 688 | break; |
689 | 689 | |
690 | 690 | case 'this_quarter' : |
691 | - $month_now = date( 'n', $current_time ); |
|
691 | + $month_now = date('n', $current_time); |
|
692 | 692 | |
693 | - if ( $month_now <= 3 ) { |
|
693 | + if ($month_now <= 3) { |
|
694 | 694 | |
695 | 695 | $dates['m_start'] = 1; |
696 | 696 | $dates['m_end'] = 4; |
697 | - $dates['year'] = date( 'Y', $current_time ); |
|
697 | + $dates['year'] = date('Y', $current_time); |
|
698 | 698 | |
699 | - } else if ( $month_now <= 6 ) { |
|
699 | + } else if ($month_now <= 6) { |
|
700 | 700 | |
701 | 701 | $dates['m_start'] = 4; |
702 | 702 | $dates['m_end'] = 7; |
703 | - $dates['year'] = date( 'Y', $current_time ); |
|
703 | + $dates['year'] = date('Y', $current_time); |
|
704 | 704 | |
705 | - } else if ( $month_now <= 9 ) { |
|
705 | + } else if ($month_now <= 9) { |
|
706 | 706 | |
707 | 707 | $dates['m_start'] = 7; |
708 | 708 | $dates['m_end'] = 10; |
709 | - $dates['year'] = date( 'Y', $current_time ); |
|
709 | + $dates['year'] = date('Y', $current_time); |
|
710 | 710 | |
711 | 711 | } else { |
712 | 712 | |
713 | 713 | $dates['m_start'] = 10; |
714 | 714 | $dates['m_end'] = 1; |
715 | - $dates['year'] = date( 'Y', $current_time ); |
|
716 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
715 | + $dates['year'] = date('Y', $current_time); |
|
716 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | break; |
720 | 720 | |
721 | 721 | case 'last_quarter' : |
722 | - $month_now = date( 'n' ); |
|
722 | + $month_now = date('n'); |
|
723 | 723 | |
724 | - if ( $month_now <= 3 ) { |
|
724 | + if ($month_now <= 3) { |
|
725 | 725 | |
726 | 726 | $dates['m_start'] = 10; |
727 | 727 | $dates['m_end'] = 12; |
728 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
729 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
728 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
729 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
730 | 730 | |
731 | - } else if ( $month_now <= 6 ) { |
|
731 | + } else if ($month_now <= 6) { |
|
732 | 732 | |
733 | 733 | $dates['m_start'] = 1; |
734 | 734 | $dates['m_end'] = 3; |
735 | - $dates['year'] = date( 'Y', $current_time ); |
|
735 | + $dates['year'] = date('Y', $current_time); |
|
736 | 736 | |
737 | - } else if ( $month_now <= 9 ) { |
|
737 | + } else if ($month_now <= 9) { |
|
738 | 738 | |
739 | 739 | $dates['m_start'] = 4; |
740 | 740 | $dates['m_end'] = 6; |
741 | - $dates['year'] = date( 'Y', $current_time ); |
|
741 | + $dates['year'] = date('Y', $current_time); |
|
742 | 742 | |
743 | 743 | } else { |
744 | 744 | |
745 | 745 | $dates['m_start'] = 7; |
746 | 746 | $dates['m_end'] = 9; |
747 | - $dates['year'] = date( 'Y', $current_time ); |
|
747 | + $dates['year'] = date('Y', $current_time); |
|
748 | 748 | |
749 | 749 | } |
750 | 750 | break; |
@@ -752,19 +752,19 @@ discard block |
||
752 | 752 | case 'this_year' : |
753 | 753 | $dates['m_start'] = 1; |
754 | 754 | $dates['m_end'] = 12; |
755 | - $dates['year'] = date( 'Y', $current_time ); |
|
755 | + $dates['year'] = date('Y', $current_time); |
|
756 | 756 | break; |
757 | 757 | |
758 | 758 | case 'last_year' : |
759 | 759 | $dates['m_start'] = 1; |
760 | 760 | $dates['m_end'] = 12; |
761 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
762 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
761 | + $dates['year'] = date('Y', $current_time) - 1; |
|
762 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
763 | 763 | break; |
764 | 764 | |
765 | 765 | endswitch; |
766 | 766 | |
767 | - return apply_filters( 'give_report_dates', $dates ); |
|
767 | + return apply_filters('give_report_dates', $dates); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | /** |
@@ -774,17 +774,17 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @param $data |
776 | 776 | */ |
777 | -function give_parse_report_dates( $data ) { |
|
777 | +function give_parse_report_dates($data) { |
|
778 | 778 | $dates = give_get_report_dates(); |
779 | 779 | |
780 | 780 | $view = give_get_reporting_view(); |
781 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
781 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
782 | 782 | |
783 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
783 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
784 | 784 | give_die(); |
785 | 785 | } |
786 | 786 | |
787 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
787 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
@@ -794,16 +794,16 @@ discard block |
||
794 | 794 | */ |
795 | 795 | function give_reports_refresh_button() { |
796 | 796 | |
797 | - $url = wp_nonce_url( add_query_arg( array( |
|
797 | + $url = wp_nonce_url(add_query_arg(array( |
|
798 | 798 | 'give_action' => 'refresh_reports_transients', |
799 | 799 | 'give-message' => 'refreshed-reports' |
800 | - ) ), 'give-refresh-reports' ); |
|
800 | + )), 'give-refresh-reports'); |
|
801 | 801 | |
802 | - echo '<a href="' . $url . '" data-tooltip="' . __( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . __( 'Refresh Reports', 'give' ) . '</a>'; |
|
802 | + echo '<a href="'.$url.'" data-tooltip="'.__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.__('Refresh Reports', 'give').'</a>'; |
|
803 | 803 | |
804 | 804 | } |
805 | 805 | |
806 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
806 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * Trigger the refresh of reports transients |
@@ -814,18 +814,18 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return void |
816 | 816 | */ |
817 | -function give_run_refresh_reports_transients( $data ) { |
|
817 | +function give_run_refresh_reports_transients($data) { |
|
818 | 818 | |
819 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
819 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
823 | 823 | //Delete transients |
824 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
825 | - delete_transient( 'give_earnings_total' ); |
|
826 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
827 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
824 | + delete_transient('give_estimated_monthly_stats'); |
|
825 | + delete_transient('give_earnings_total'); |
|
826 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
827 | + delete_transient(md5('give_earnings_todaytoday')); |
|
828 | 828 | |
829 | 829 | } |
830 | 830 | |
831 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
832 | 831 | \ No newline at end of file |
832 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
833 | 833 | \ No newline at end of file |
@@ -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 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => __( 'Date', 'give' ), |
|
65 | - 'donations' => __( 'Donations', 'give' ), |
|
64 | + 'date' => __('Date', 'give'), |
|
65 | + 'donations' => __('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) ) |
|
67 | + 'earnings' => sprintf(__('Income (%s)', 'give'), html_entity_decode(give_currency_filter(''))) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |
@@ -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( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give')); |
|
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 purchase ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give')); |
|
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; |
@@ -52,76 +52,76 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: payment number */ |
55 | - __( 'Payment %s', 'give' ), |
|
55 | + __('Payment %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
63 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
63 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
64 | 64 | <form id="give-edit-order-form" method="post"> |
65 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
65 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
66 | 66 | <div id="poststuff"> |
67 | 67 | <div id="give-dashboard-widgets-wrap"> |
68 | 68 | <div id="post-body" class="metabox-holder columns-2"> |
69 | 69 | <div id="postbox-container-1" class="postbox-container"> |
70 | 70 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
71 | 71 | |
72 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
72 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
73 | 73 | |
74 | 74 | |
75 | 75 | <div id="give-order-update" class="postbox give-order-data"> |
76 | 76 | |
77 | 77 | <h3 class="hndle"> |
78 | - <span><?php _e( 'Update Payment', 'give' ); ?></span> |
|
78 | + <span><?php _e('Update Payment', 'give'); ?></span> |
|
79 | 79 | </h3> |
80 | 80 | |
81 | 81 | <div class="inside"> |
82 | 82 | <div class="give-admin-box"> |
83 | 83 | |
84 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
84 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
85 | 85 | |
86 | 86 | <div class="give-admin-box-inside"> |
87 | 87 | <p> |
88 | - <span class="label"><?php _e( 'Status:', 'give' ); ?></span> |
|
88 | + <span class="label"><?php _e('Status:', 'give'); ?></span> |
|
89 | 89 | <select name="give-payment-status" class="medium-text"> |
90 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
91 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
90 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
91 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
92 | 92 | <?php endforeach; ?> |
93 | 93 | </select> |
94 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
94 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
95 | 95 | </p> |
96 | 96 | </div> |
97 | 97 | |
98 | 98 | <div class="give-admin-box-inside"> |
99 | 99 | <p> |
100 | - <span class="label"><?php _e( 'Date:', 'give' ); ?></span> |
|
101 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
100 | + <span class="label"><?php _e('Date:', 'give'); ?></span> |
|
101 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
102 | 102 | </p> |
103 | 103 | </div> |
104 | 104 | |
105 | 105 | <div class="give-admin-box-inside"> |
106 | 106 | <p> |
107 | - <span class="label"><?php _e( 'Time:', 'give' ); ?></span> |
|
108 | - <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
109 | - <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
107 | + <span class="label"><?php _e('Time:', 'give'); ?></span> |
|
108 | + <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
109 | + <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
110 | 110 | </p> |
111 | 111 | </div> |
112 | 112 | |
113 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
113 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
114 | 114 | |
115 | 115 | <?php |
116 | 116 | //@TODO: Fees |
117 | - $fees = give_get_payment_fees( $payment_id ); |
|
118 | - if ( ! empty( $fees ) ) : ?> |
|
117 | + $fees = give_get_payment_fees($payment_id); |
|
118 | + if ( ! empty($fees)) : ?> |
|
119 | 119 | <div class="give-order-fees give-admin-box-inside"> |
120 | - <p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p> |
|
120 | + <p class="strong"><?php _e('Fees', 'give'); ?>:</p> |
|
121 | 121 | <ul class="give-payment-fees"> |
122 | - <?php foreach ( $fees as $fee ) : ?> |
|
122 | + <?php foreach ($fees as $fee) : ?> |
|
123 | 123 | <li> |
124 | - <span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
124 | + <span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
125 | 125 | </li> |
126 | 126 | <?php endforeach; ?> |
127 | 127 | </ul> |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | |
132 | 132 | <div class="give-order-payment give-admin-box-inside"> |
133 | 133 | <p> |
134 | - <span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span> |
|
135 | - <?php echo give_currency_symbol( $payment->currency ); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
134 | + <span class="label"><?php _e('Total Donation', 'give'); ?>:</span> |
|
135 | + <?php echo give_currency_symbol($payment->currency); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>"/> |
|
136 | 136 | </p> |
137 | 137 | </div> |
138 | 138 | |
139 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
139 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
140 | 140 | |
141 | 141 | </div> |
142 | 142 | <!-- /.give-admin-box --> |
@@ -145,20 +145,20 @@ discard block |
||
145 | 145 | <!-- /.inside --> |
146 | 146 | |
147 | 147 | <div class="give-order-update-box give-admin-box"> |
148 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
148 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
149 | 149 | <div id="major-publishing-actions"> |
150 | 150 | <div id="publishing-action"> |
151 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/> |
|
152 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
153 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
151 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/> |
|
152 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
153 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
154 | 154 | 'give-action' => 'email_links', |
155 | 155 | 'purchase_id' => $payment_id |
156 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a> |
|
156 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a> |
|
157 | 157 | <?php endif; ?> |
158 | 158 | </div> |
159 | 159 | <div class="clear"></div> |
160 | 160 | </div> |
161 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
161 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
162 | 162 | </div> |
163 | 163 | <!-- /.give-order-update-box --> |
164 | 164 | |
@@ -168,55 +168,55 @@ discard block |
||
168 | 168 | <div id="give-order-details" class="postbox give-order-data"> |
169 | 169 | |
170 | 170 | <h3 class="hndle"> |
171 | - <span><?php _e( 'Payment Meta', 'give' ); ?></span> |
|
171 | + <span><?php _e('Payment Meta', 'give'); ?></span> |
|
172 | 172 | </h3> |
173 | 173 | |
174 | 174 | <div class="inside"> |
175 | 175 | <div class="give-admin-box"> |
176 | 176 | |
177 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
177 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
178 | 178 | |
179 | 179 | <?php |
180 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
181 | - if ( $gateway ) : ?> |
|
180 | + $gateway = give_get_payment_gateway($payment_id); |
|
181 | + if ($gateway) : ?> |
|
182 | 182 | <div class="give-order-gateway give-admin-box-inside"> |
183 | 183 | <p> |
184 | - <span class="label"><?php _e( 'Gateway:', 'give' ); ?></span> |
|
185 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
184 | + <span class="label"><?php _e('Gateway:', 'give'); ?></span> |
|
185 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
186 | 186 | </p> |
187 | 187 | </div> |
188 | 188 | <?php endif; ?> |
189 | 189 | |
190 | 190 | <div class="give-order-payment-key give-admin-box-inside"> |
191 | 191 | <p> |
192 | - <span class="label"><?php _e( 'Key:', 'give' ); ?></span> |
|
193 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
192 | + <span class="label"><?php _e('Key:', 'give'); ?></span> |
|
193 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
194 | 194 | </p> |
195 | 195 | </div> |
196 | 196 | |
197 | 197 | <div class="give-order-ip give-admin-box-inside"> |
198 | 198 | <p> |
199 | - <span class="label"><?php _e( 'IP:', 'give' ); ?></span> |
|
200 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
199 | + <span class="label"><?php _e('IP:', 'give'); ?></span> |
|
200 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
201 | 201 | </p> |
202 | 202 | </div> |
203 | 203 | |
204 | - <?php if ( $transaction_id ) : ?> |
|
204 | + <?php if ($transaction_id) : ?> |
|
205 | 205 | <div class="give-order-tx-id give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span> |
|
208 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
207 | + <span class="label"><?php _e('Transaction ID:', 'give'); ?></span> |
|
208 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
213 | 213 | <div class="give-admin-box-inside"> |
214 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?> |
|
215 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
214 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?> |
|
215 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> »</a> |
|
216 | 216 | </p> |
217 | 217 | </div> |
218 | 218 | |
219 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
219 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
220 | 220 | |
221 | 221 | </div> |
222 | 222 | <!-- /.column-container --> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | </div> |
228 | 228 | <!-- /#give-order-data --> |
229 | 229 | |
230 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
230 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
231 | 231 | |
232 | 232 | </div> |
233 | 233 | <!-- /#side-sortables --> |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | |
239 | 239 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
240 | 240 | |
241 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
241 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
242 | 242 | |
243 | 243 | <?php $column_count = 'columns-3'; ?> |
244 | 244 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
245 | 245 | <h3 class="hndle"> |
246 | - <span><?php _e( 'Donation Information', 'give' ); ?></span> |
|
246 | + <span><?php _e('Donation Information', 'give'); ?></span> |
|
247 | 247 | </h3> |
248 | 248 | |
249 | 249 | <div class="inside"> |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | <table style="width:100%;text-align:left;"> |
252 | 252 | <thead> |
253 | 253 | <tr> |
254 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
255 | - <th><?php _e( 'Donation Form ID', 'give' ) ?></th> |
|
256 | - <th><?php _e( 'Donation Form Title', 'give' ) ?></th> |
|
257 | - <th><?php _e( 'Donation Level', 'give' ) ?></th> |
|
258 | - <th><?php _e( 'Donation Date', 'give' ) ?></th> |
|
259 | - <th><?php _e( 'Total Donation', 'give' ) ?></th> |
|
260 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
254 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
255 | + <th><?php _e('Donation Form ID', 'give') ?></th> |
|
256 | + <th><?php _e('Donation Form Title', 'give') ?></th> |
|
257 | + <th><?php _e('Donation Level', 'give') ?></th> |
|
258 | + <th><?php _e('Donation Date', 'give') ?></th> |
|
259 | + <th><?php _e('Total Donation', 'give') ?></th> |
|
260 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
261 | 261 | </tr> |
262 | 262 | </thead> |
263 | 263 | <tr> |
264 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
264 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
265 | 265 | <td> |
266 | 266 | <?php echo $payment_meta['form_id']; ?> |
267 | 267 | </td> |
268 | 268 | <td> |
269 | - <a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
269 | + <a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
270 | 270 | </td> |
271 | 271 | <td> |
272 | 272 | <?php |
273 | 273 | //Level ID |
274 | - $level_title = give_get_payment_form_title( $payment_meta, true ); |
|
275 | - if ( empty( $level_title ) ) { |
|
276 | - echo __( 'n/a', 'give' ); |
|
274 | + $level_title = give_get_payment_form_title($payment_meta, true); |
|
275 | + if (empty($level_title)) { |
|
276 | + echo __('n/a', 'give'); |
|
277 | 277 | } else { |
278 | 278 | echo $level_title; |
279 | 279 | } ?> |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | <td> |
282 | 282 | <?php |
283 | 283 | //Transaction Date |
284 | - $date_format = get_option( 'date_format' ); |
|
285 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
284 | + $date_format = get_option('date_format'); |
|
285 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
286 | 286 | ?> |
287 | 287 | </td> |
288 | 288 | <td> |
289 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
290 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
289 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
290 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
291 | 291 | |
292 | 292 | </tr> |
293 | 293 | </table> |
@@ -299,64 +299,64 @@ discard block |
||
299 | 299 | </div> |
300 | 300 | <!-- /#give-donation-overview --> |
301 | 301 | |
302 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
302 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
303 | 303 | |
304 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
304 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
305 | 305 | |
306 | 306 | |
307 | 307 | <div id="give-customer-details" class="postbox"> |
308 | 308 | <h3 class="hndle"> |
309 | - <span><?php _e( 'Donor Details', 'give' ); ?></span> |
|
309 | + <span><?php _e('Donor Details', 'give'); ?></span> |
|
310 | 310 | </h3> |
311 | 311 | |
312 | 312 | <div class="inside give-clearfix"> |
313 | 313 | |
314 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
314 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
315 | 315 | |
316 | 316 | <div class="column-container customer-info"> |
317 | 317 | <div class="column"> |
318 | - <?php echo Give()->html->donor_dropdown( array( |
|
318 | + <?php echo Give()->html->donor_dropdown(array( |
|
319 | 319 | 'selected' => $customer->id, |
320 | 320 | 'name' => 'customer-id' |
321 | - ) ); ?> |
|
321 | + )); ?> |
|
322 | 322 | </div> |
323 | 323 | <div class="column"> |
324 | 324 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
325 | 325 | </div> |
326 | 326 | <div class="column"> |
327 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
328 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
329 | - <a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a> |
|
327 | + <?php if ( ! empty($customer->id)) : ?> |
|
328 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
329 | + <a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a> |
|
330 | 330 | | |
331 | 331 | <?php endif; ?> |
332 | - <a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a> |
|
332 | + <a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a> |
|
333 | 333 | </div> |
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="column-container new-customer" style="display: none"> |
337 | 337 | <div class="column"> |
338 | - <strong><?php _e( 'Name:', 'give' ); ?></strong> |
|
338 | + <strong><?php _e('Name:', 'give'); ?></strong> |
|
339 | 339 | <input type="text" name="give-new-customer-name" value="" class="medium-text"/> |
340 | 340 | </div> |
341 | 341 | <div class="column"> |
342 | - <strong><?php _e( 'Email:', 'give' ); ?></strong> |
|
342 | + <strong><?php _e('Email:', 'give'); ?></strong> |
|
343 | 343 | <input type="email" name="give-new-customer-email" value="" class="medium-text"/> |
344 | 344 | </div> |
345 | 345 | <div class="column"> |
346 | 346 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
347 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
347 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
348 | 348 | </div> |
349 | 349 | <div class="column"> |
350 | 350 | <small> |
351 | - <em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
351 | + <em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
352 | 352 | </small> |
353 | 353 | </div> |
354 | 354 | </div> |
355 | 355 | |
356 | 356 | <?php |
357 | 357 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
358 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
359 | - do_action( 'give_payment_view_details', $payment_id ); |
|
358 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
359 | + do_action('give_payment_view_details', $payment_id); |
|
360 | 360 | ?> |
361 | 361 | |
362 | 362 | </div> |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | <div id="give-billing-details" class="postbox"> |
369 | 369 | <h3 class="hndle"> |
370 | - <span><?php _e( 'Billing Address', 'give' ); ?></span> |
|
370 | + <span><?php _e('Billing Address', 'give'); ?></span> |
|
371 | 371 | </h3> |
372 | 372 | |
373 | 373 | <div class="inside give-clearfix"> |
@@ -378,62 +378,62 @@ discard block |
||
378 | 378 | <div class="data column-container"> |
379 | 379 | <div class="column"> |
380 | 380 | <p> |
381 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br/> |
|
382 | - <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
381 | + <strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br/> |
|
382 | + <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
383 | 383 | </p> |
384 | 384 | |
385 | 385 | <p> |
386 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br/> |
|
387 | - <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
386 | + <strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br/> |
|
387 | + <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
388 | 388 | </p> |
389 | 389 | |
390 | 390 | </div> |
391 | 391 | <div class="column"> |
392 | 392 | <p> |
393 | - <strong class="order-data-address-line"><?php _e( 'City:', 'give' ); ?></strong><br/> |
|
394 | - <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
393 | + <strong class="order-data-address-line"><?php _e('City:', 'give'); ?></strong><br/> |
|
394 | + <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
395 | 395 | |
396 | 396 | </p> |
397 | 397 | |
398 | 398 | <p> |
399 | - <strong class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></strong><br/> |
|
400 | - <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
399 | + <strong class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></strong><br/> |
|
400 | + <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
401 | 401 | |
402 | 402 | </p> |
403 | 403 | </div> |
404 | 404 | <div class="column"> |
405 | 405 | <p id="give-order-address-country-wrap"> |
406 | - <strong class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></strong><br/> |
|
406 | + <strong class="order-data-address-line"><?php _e('Country:', 'give'); ?></strong><br/> |
|
407 | 407 | <?php |
408 | - echo Give()->html->select( array( |
|
408 | + echo Give()->html->select(array( |
|
409 | 409 | 'options' => give_get_country_list(), |
410 | 410 | 'name' => 'give-payment-address[0][country]', |
411 | 411 | 'selected' => $address['country'], |
412 | 412 | 'show_option_all' => false, |
413 | 413 | 'show_option_none' => false, |
414 | 414 | 'chosen' => true, |
415 | - 'placeholder' => __( 'Select a country', 'give' ) |
|
416 | - ) ); |
|
415 | + 'placeholder' => __('Select a country', 'give') |
|
416 | + )); |
|
417 | 417 | ?> |
418 | 418 | </p> |
419 | 419 | |
420 | 420 | <p id="give-order-address-state-wrap"> |
421 | - <strong class="order-data-address-line"><?php _e( 'State / Province:', 'give' ); ?></strong><br/> |
|
421 | + <strong class="order-data-address-line"><?php _e('State / Province:', 'give'); ?></strong><br/> |
|
422 | 422 | <?php |
423 | - $states = give_get_states( $address['country'] ); |
|
424 | - if ( ! empty( $states ) ) { |
|
425 | - echo Give()->html->select( array( |
|
423 | + $states = give_get_states($address['country']); |
|
424 | + if ( ! empty($states)) { |
|
425 | + echo Give()->html->select(array( |
|
426 | 426 | 'options' => $states, |
427 | 427 | 'name' => 'give-payment-address[0][state]', |
428 | 428 | 'selected' => $address['state'], |
429 | 429 | 'show_option_all' => false, |
430 | 430 | 'show_option_none' => false, |
431 | 431 | 'chosen' => true, |
432 | - 'placeholder' => __( 'Select a state', 'give' ) |
|
433 | - ) ); |
|
432 | + 'placeholder' => __('Select a state', 'give') |
|
433 | + )); |
|
434 | 434 | } else { |
435 | 435 | ?> |
436 | - <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
436 | + <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
437 | 437 | <?php |
438 | 438 | } ?> |
439 | 439 | </p> |
@@ -443,39 +443,39 @@ discard block |
||
443 | 443 | </div> |
444 | 444 | <!-- /#give-order-address --> |
445 | 445 | |
446 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
446 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
447 | 447 | |
448 | 448 | </div> |
449 | 449 | <!-- /.inside --> |
450 | 450 | </div> |
451 | 451 | <!-- /#give-billing-details --> |
452 | 452 | |
453 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
453 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
454 | 454 | |
455 | 455 | <div id="give-payment-notes" class="postbox"> |
456 | - <h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3> |
|
456 | + <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3> |
|
457 | 457 | |
458 | 458 | <div class="inside"> |
459 | 459 | <div id="give-payment-notes-inner"> |
460 | 460 | <?php |
461 | - $notes = give_get_payment_notes( $payment_id ); |
|
462 | - if ( ! empty( $notes ) ) : |
|
461 | + $notes = give_get_payment_notes($payment_id); |
|
462 | + if ( ! empty($notes)) : |
|
463 | 463 | $no_notes_display = ' style="display:none;"'; |
464 | - foreach ( $notes as $note ) : |
|
464 | + foreach ($notes as $note) : |
|
465 | 465 | |
466 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
466 | + echo give_get_payment_note_html($note, $payment_id); |
|
467 | 467 | |
468 | 468 | endforeach; |
469 | 469 | else : |
470 | 470 | $no_notes_display = ''; |
471 | 471 | endif; |
472 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
|
472 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; |
|
473 | 473 | ?> |
474 | 474 | </div> |
475 | 475 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
476 | 476 | |
477 | 477 | <p class="give-clearfix"> |
478 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
478 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
479 | 479 | </p> |
480 | 480 | |
481 | 481 | <div class="clear"></div> |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | </div> |
485 | 485 | <!-- /#give-payment-notes --> |
486 | 486 | |
487 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
487 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
488 | 488 | </div> |
489 | 489 | <!-- /#normal-sortables --> |
490 | 490 | </div> |
@@ -495,10 +495,10 @@ discard block |
||
495 | 495 | <!-- #give-dashboard-widgets-wrap --> |
496 | 496 | </div> |
497 | 497 | <!-- /#post-stuff --> |
498 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
499 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
500 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
498 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
499 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
500 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
501 | 501 | <input type="hidden" name="give_action" value="update_payment_details"/> |
502 | 502 | </form> |
503 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
503 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
504 | 504 | </div><!-- /.wrap --> |
@@ -13,330 +13,330 @@ |
||
13 | 13 | * @version 1.6 |
14 | 14 | */ |
15 | 15 | class EDD_SL_Plugin_Updater { |
16 | - private $api_url = ''; |
|
17 | - private $api_data = array(); |
|
18 | - private $name = ''; |
|
19 | - private $slug = ''; |
|
20 | - |
|
21 | - /** |
|
22 | - * Class constructor. |
|
23 | - * |
|
24 | - * @uses plugin_basename() |
|
25 | - * @uses hook() |
|
26 | - * |
|
27 | - * @param string $_api_url The URL pointing to the custom API endpoint. |
|
28 | - * @param string $_plugin_file Path to the plugin file. |
|
29 | - * @param array $_api_data Optional data to send with API calls. |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
33 | - $this->api_url = trailingslashit( $_api_url ); |
|
34 | - $this->api_data = $_api_data; |
|
35 | - $this->name = plugin_basename( $_plugin_file ); |
|
36 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
37 | - $this->version = $_api_data['version']; |
|
38 | - |
|
39 | - // Set up hooks. |
|
40 | - $this->init(); |
|
41 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Set up WordPress filters to hook into WP's update process. |
|
46 | - * |
|
47 | - * @uses add_filter() |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function init() { |
|
16 | + private $api_url = ''; |
|
17 | + private $api_data = array(); |
|
18 | + private $name = ''; |
|
19 | + private $slug = ''; |
|
20 | + |
|
21 | + /** |
|
22 | + * Class constructor. |
|
23 | + * |
|
24 | + * @uses plugin_basename() |
|
25 | + * @uses hook() |
|
26 | + * |
|
27 | + * @param string $_api_url The URL pointing to the custom API endpoint. |
|
28 | + * @param string $_plugin_file Path to the plugin file. |
|
29 | + * @param array $_api_data Optional data to send with API calls. |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
33 | + $this->api_url = trailingslashit( $_api_url ); |
|
34 | + $this->api_data = $_api_data; |
|
35 | + $this->name = plugin_basename( $_plugin_file ); |
|
36 | + $this->slug = basename( $_plugin_file, '.php' ); |
|
37 | + $this->version = $_api_data['version']; |
|
38 | + |
|
39 | + // Set up hooks. |
|
40 | + $this->init(); |
|
41 | + add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Set up WordPress filters to hook into WP's update process. |
|
46 | + * |
|
47 | + * @uses add_filter() |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function init() { |
|
52 | 52 | |
53 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
54 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
53 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
54 | + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
55 | 55 | |
56 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
57 | - } |
|
56 | + add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Check for Updates at the defined API endpoint and modify the update array. |
|
61 | - * |
|
62 | - * This function dives into the update API just when WordPress creates its update array, |
|
63 | - * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
64 | - * It is reassembled from parts of the native WordPress plugin update code. |
|
65 | - * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
66 | - * |
|
67 | - * @uses api_request() |
|
68 | - * |
|
69 | - * @param array $_transient_data Update array build by WordPress. |
|
70 | - * @return array Modified update array with custom plugin data. |
|
71 | - */ |
|
72 | - function check_update( $_transient_data ) { |
|
59 | + /** |
|
60 | + * Check for Updates at the defined API endpoint and modify the update array. |
|
61 | + * |
|
62 | + * This function dives into the update API just when WordPress creates its update array, |
|
63 | + * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
64 | + * It is reassembled from parts of the native WordPress plugin update code. |
|
65 | + * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
66 | + * |
|
67 | + * @uses api_request() |
|
68 | + * |
|
69 | + * @param array $_transient_data Update array build by WordPress. |
|
70 | + * @return array Modified update array with custom plugin data. |
|
71 | + */ |
|
72 | + function check_update( $_transient_data ) { |
|
73 | 73 | |
74 | - global $pagenow; |
|
74 | + global $pagenow; |
|
75 | 75 | |
76 | - if( ! is_object( $_transient_data ) ) { |
|
77 | - $_transient_data = new stdClass; |
|
78 | - } |
|
76 | + if( ! is_object( $_transient_data ) ) { |
|
77 | + $_transient_data = new stdClass; |
|
78 | + } |
|
79 | 79 | |
80 | - if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
81 | - return $_transient_data; |
|
82 | - } |
|
80 | + if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
81 | + return $_transient_data; |
|
82 | + } |
|
83 | 83 | |
84 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
84 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
85 | 85 | |
86 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
86 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
87 | 87 | |
88 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
88 | + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
89 | 89 | |
90 | - $this->did_check = true; |
|
90 | + $this->did_check = true; |
|
91 | 91 | |
92 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
92 | + if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
93 | 93 | |
94 | - $_transient_data->response[ $this->name ] = $version_info; |
|
94 | + $_transient_data->response[ $this->name ] = $version_info; |
|
95 | 95 | |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - $_transient_data->last_checked = time(); |
|
99 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
98 | + $_transient_data->last_checked = time(); |
|
99 | + $_transient_data->checked[ $this->name ] = $this->version; |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - return $_transient_data; |
|
106 | - } |
|
105 | + return $_transient_data; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise! |
|
110 | - * |
|
111 | - * @param string $file |
|
112 | - * @param array $plugin |
|
113 | - */ |
|
114 | - public function show_update_notification( $file, $plugin ) { |
|
108 | + /** |
|
109 | + * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise! |
|
110 | + * |
|
111 | + * @param string $file |
|
112 | + * @param array $plugin |
|
113 | + */ |
|
114 | + public function show_update_notification( $file, $plugin ) { |
|
115 | 115 | |
116 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
117 | - return; |
|
118 | - } |
|
116 | + if( ! current_user_can( 'update_plugins' ) ) { |
|
117 | + return; |
|
118 | + } |
|
119 | 119 | |
120 | - if( ! is_multisite() ) { |
|
121 | - return; |
|
122 | - } |
|
120 | + if( ! is_multisite() ) { |
|
121 | + return; |
|
122 | + } |
|
123 | 123 | |
124 | - if ( $this->name != $file ) { |
|
125 | - return; |
|
126 | - } |
|
124 | + if ( $this->name != $file ) { |
|
125 | + return; |
|
126 | + } |
|
127 | 127 | |
128 | - // Remove our filter on the site transient |
|
129 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
128 | + // Remove our filter on the site transient |
|
129 | + remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
130 | 130 | |
131 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
131 | + $update_cache = get_site_transient( 'update_plugins' ); |
|
132 | 132 | |
133 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
133 | + if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
134 | 134 | |
135 | - $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
136 | - $version_info = get_transient( $cache_key ); |
|
135 | + $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
136 | + $version_info = get_transient( $cache_key ); |
|
137 | 137 | |
138 | - if( false === $version_info ) { |
|
138 | + if( false === $version_info ) { |
|
139 | 139 | |
140 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
140 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
141 | 141 | |
142 | - set_transient( $cache_key, $version_info, 3600 ); |
|
143 | - } |
|
142 | + set_transient( $cache_key, $version_info, 3600 ); |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | - if( ! is_object( $version_info ) ) { |
|
147 | - return; |
|
148 | - } |
|
146 | + if( ! is_object( $version_info ) ) { |
|
147 | + return; |
|
148 | + } |
|
149 | 149 | |
150 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
150 | + if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
151 | 151 | |
152 | - $update_cache->response[ $this->name ] = $version_info; |
|
152 | + $update_cache->response[ $this->name ] = $version_info; |
|
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | - $update_cache->last_checked = time(); |
|
157 | - $update_cache->checked[ $this->name ] = $this->version; |
|
156 | + $update_cache->last_checked = time(); |
|
157 | + $update_cache->checked[ $this->name ] = $this->version; |
|
158 | 158 | |
159 | - set_site_transient( 'update_plugins', $update_cache ); |
|
159 | + set_site_transient( 'update_plugins', $update_cache ); |
|
160 | 160 | |
161 | - } else { |
|
161 | + } else { |
|
162 | 162 | |
163 | - $version_info = $update_cache->response[ $this->name ]; |
|
163 | + $version_info = $update_cache->response[ $this->name ]; |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - // Restore our filter |
|
168 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
167 | + // Restore our filter |
|
168 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
169 | 169 | |
170 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
170 | + if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
171 | 171 | |
172 | - // build a plugin list row, with update notification |
|
173 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
174 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
172 | + // build a plugin list row, with update notification |
|
173 | + $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
174 | + echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
175 | 175 | |
176 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
176 | + $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
177 | 177 | |
178 | - if ( empty( $version_info->download_link ) ) { |
|
179 | - printf( |
|
178 | + if ( empty( $version_info->download_link ) ) { |
|
179 | + printf( |
|
180 | 180 | /* translators: 1: name 2: changelog URL 3: version */ |
181 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
182 | - esc_html( $version_info->name ), |
|
183 | - esc_url( $changelog_link ), |
|
184 | - esc_html( $version_info->new_version ) |
|
185 | - ); |
|
186 | - } else { |
|
187 | - printf( |
|
181 | + __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
182 | + esc_html( $version_info->name ), |
|
183 | + esc_url( $changelog_link ), |
|
184 | + esc_html( $version_info->new_version ) |
|
185 | + ); |
|
186 | + } else { |
|
187 | + printf( |
|
188 | 188 | /* translators: 1: name 2: changelog URL 3: version 4: update URL */ |
189 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
190 | - esc_html( $version_info->name ), |
|
191 | - esc_url( $changelog_link ), |
|
192 | - esc_html( $version_info->new_version ), |
|
193 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
194 | - ); |
|
195 | - } |
|
196 | - |
|
197 | - echo '</div></td></tr>'; |
|
198 | - } |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * Updates information on the "View version x.x details" page with custom data. |
|
204 | - * |
|
205 | - * @uses api_request() |
|
206 | - * |
|
207 | - * @param mixed $_data |
|
208 | - * @param string $_action |
|
209 | - * @param object $_args |
|
210 | - * @return object $_data |
|
211 | - */ |
|
212 | - function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
213 | - |
|
214 | - |
|
215 | - if ( $_action != 'plugin_information' ) { |
|
216 | - |
|
217 | - return $_data; |
|
218 | - |
|
219 | - } |
|
220 | - |
|
221 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
222 | - |
|
223 | - return $_data; |
|
224 | - |
|
225 | - } |
|
226 | - |
|
227 | - $to_send = array( |
|
228 | - 'slug' => $this->slug, |
|
229 | - 'is_ssl' => is_ssl(), |
|
230 | - 'fields' => array( |
|
231 | - 'banners' => false, // These will be supported soon hopefully |
|
232 | - 'reviews' => false |
|
233 | - ) |
|
234 | - ); |
|
235 | - |
|
236 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
237 | - |
|
238 | - if ( false !== $api_response ) { |
|
239 | - $_data = $api_response; |
|
240 | - } |
|
241 | - |
|
242 | - return $_data; |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * Disable SSL verification in order to prevent download update failures |
|
248 | - * |
|
249 | - * @param array $args |
|
250 | - * @param string $url |
|
251 | - * @return object $array |
|
252 | - */ |
|
253 | - function http_request_args( $args, $url ) { |
|
254 | - // If it is an https request and we are performing a package download, disable ssl verification |
|
255 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
256 | - $args['sslverify'] = false; |
|
257 | - } |
|
258 | - return $args; |
|
259 | - } |
|
260 | - |
|
261 | - /** |
|
262 | - * Calls the API and, if successfull, returns the object delivered by the API. |
|
263 | - * |
|
264 | - * @uses get_bloginfo() |
|
265 | - * @uses wp_remote_post() |
|
266 | - * @uses is_wp_error() |
|
267 | - * |
|
268 | - * @param string $_action The requested action. |
|
269 | - * @param array $_data Parameters for the API action. |
|
270 | - * @return false||object |
|
271 | - */ |
|
272 | - private function api_request( $_action, $_data ) { |
|
273 | - |
|
274 | - global $wp_version; |
|
275 | - |
|
276 | - $data = array_merge( $this->api_data, $_data ); |
|
277 | - |
|
278 | - if ( $data['slug'] != $this->slug ) |
|
279 | - return; |
|
280 | - |
|
281 | - if ( empty( $data['license'] ) ) |
|
282 | - return; |
|
283 | - |
|
284 | - if( $this->api_url == home_url() ) { |
|
285 | - return false; // Don't allow a plugin to ping itself |
|
286 | - } |
|
287 | - |
|
288 | - $api_params = array( |
|
289 | - 'edd_action' => 'get_version', |
|
290 | - 'license' => $data['license'], |
|
291 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
292 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
293 | - 'slug' => $data['slug'], |
|
294 | - 'author' => $data['author'], |
|
295 | - 'url' => home_url() |
|
296 | - ); |
|
189 | + __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
190 | + esc_html( $version_info->name ), |
|
191 | + esc_url( $changelog_link ), |
|
192 | + esc_html( $version_info->new_version ), |
|
193 | + esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
194 | + ); |
|
195 | + } |
|
196 | + |
|
197 | + echo '</div></td></tr>'; |
|
198 | + } |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * Updates information on the "View version x.x details" page with custom data. |
|
204 | + * |
|
205 | + * @uses api_request() |
|
206 | + * |
|
207 | + * @param mixed $_data |
|
208 | + * @param string $_action |
|
209 | + * @param object $_args |
|
210 | + * @return object $_data |
|
211 | + */ |
|
212 | + function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
213 | + |
|
214 | + |
|
215 | + if ( $_action != 'plugin_information' ) { |
|
216 | + |
|
217 | + return $_data; |
|
218 | + |
|
219 | + } |
|
220 | + |
|
221 | + if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
222 | + |
|
223 | + return $_data; |
|
224 | + |
|
225 | + } |
|
226 | + |
|
227 | + $to_send = array( |
|
228 | + 'slug' => $this->slug, |
|
229 | + 'is_ssl' => is_ssl(), |
|
230 | + 'fields' => array( |
|
231 | + 'banners' => false, // These will be supported soon hopefully |
|
232 | + 'reviews' => false |
|
233 | + ) |
|
234 | + ); |
|
235 | + |
|
236 | + $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
237 | + |
|
238 | + if ( false !== $api_response ) { |
|
239 | + $_data = $api_response; |
|
240 | + } |
|
241 | + |
|
242 | + return $_data; |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * Disable SSL verification in order to prevent download update failures |
|
248 | + * |
|
249 | + * @param array $args |
|
250 | + * @param string $url |
|
251 | + * @return object $array |
|
252 | + */ |
|
253 | + function http_request_args( $args, $url ) { |
|
254 | + // If it is an https request and we are performing a package download, disable ssl verification |
|
255 | + if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
256 | + $args['sslverify'] = false; |
|
257 | + } |
|
258 | + return $args; |
|
259 | + } |
|
260 | + |
|
261 | + /** |
|
262 | + * Calls the API and, if successfull, returns the object delivered by the API. |
|
263 | + * |
|
264 | + * @uses get_bloginfo() |
|
265 | + * @uses wp_remote_post() |
|
266 | + * @uses is_wp_error() |
|
267 | + * |
|
268 | + * @param string $_action The requested action. |
|
269 | + * @param array $_data Parameters for the API action. |
|
270 | + * @return false||object |
|
271 | + */ |
|
272 | + private function api_request( $_action, $_data ) { |
|
273 | + |
|
274 | + global $wp_version; |
|
275 | + |
|
276 | + $data = array_merge( $this->api_data, $_data ); |
|
277 | + |
|
278 | + if ( $data['slug'] != $this->slug ) |
|
279 | + return; |
|
280 | + |
|
281 | + if ( empty( $data['license'] ) ) |
|
282 | + return; |
|
283 | + |
|
284 | + if( $this->api_url == home_url() ) { |
|
285 | + return false; // Don't allow a plugin to ping itself |
|
286 | + } |
|
287 | + |
|
288 | + $api_params = array( |
|
289 | + 'edd_action' => 'get_version', |
|
290 | + 'license' => $data['license'], |
|
291 | + 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
292 | + 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
293 | + 'slug' => $data['slug'], |
|
294 | + 'author' => $data['author'], |
|
295 | + 'url' => home_url() |
|
296 | + ); |
|
297 | 297 | |
298 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
298 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
299 | 299 | |
300 | - if ( ! is_wp_error( $request ) ) { |
|
301 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
302 | - } |
|
300 | + if ( ! is_wp_error( $request ) ) { |
|
301 | + $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
302 | + } |
|
303 | 303 | |
304 | - if ( $request && isset( $request->sections ) ) { |
|
305 | - $request->sections = maybe_unserialize( $request->sections ); |
|
306 | - } else { |
|
307 | - $request = false; |
|
308 | - } |
|
304 | + if ( $request && isset( $request->sections ) ) { |
|
305 | + $request->sections = maybe_unserialize( $request->sections ); |
|
306 | + } else { |
|
307 | + $request = false; |
|
308 | + } |
|
309 | 309 | |
310 | - return $request; |
|
311 | - } |
|
310 | + return $request; |
|
311 | + } |
|
312 | 312 | |
313 | - public function show_changelog() { |
|
313 | + public function show_changelog() { |
|
314 | 314 | |
315 | 315 | |
316 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
317 | - return; |
|
318 | - } |
|
316 | + if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
317 | + return; |
|
318 | + } |
|
319 | 319 | |
320 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
321 | - return; |
|
322 | - } |
|
323 | - |
|
324 | - if( empty( $_REQUEST['slug'] ) ) { |
|
325 | - return; |
|
326 | - } |
|
327 | - |
|
328 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
329 | - wp_die( __( 'You do not have permission to install plugin updates.', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
330 | - } |
|
331 | - |
|
332 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
333 | - |
|
334 | - if( $response && isset( $response->sections['changelog'] ) ) { |
|
335 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - exit; |
|
340 | - } |
|
320 | + if( empty( $_REQUEST['plugin'] ) ) { |
|
321 | + return; |
|
322 | + } |
|
323 | + |
|
324 | + if( empty( $_REQUEST['slug'] ) ) { |
|
325 | + return; |
|
326 | + } |
|
327 | + |
|
328 | + if( ! current_user_can( 'update_plugins' ) ) { |
|
329 | + wp_die( __( 'You do not have permission to install plugin updates.', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
330 | + } |
|
331 | + |
|
332 | + $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
333 | + |
|
334 | + if( $response && isset( $response->sections['changelog'] ) ) { |
|
335 | + echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + exit; |
|
340 | + } |
|
341 | 341 | |
342 | 342 | } |
@@ -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 | abstract class Give_Shortcode_Generator { |
17 | 17 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - public function __construct( $shortcode ) { |
|
60 | + public function __construct($shortcode) { |
|
61 | 61 | |
62 | 62 | |
63 | 63 | $this->shortcode_tag = $shortcode; |
64 | 64 | |
65 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
65 | + add_action('admin_init', array($this, 'init')); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function init() { |
75 | 75 | |
76 | - if ( $this->shortcode_tag ) { |
|
76 | + if ($this->shortcode_tag) { |
|
77 | 77 | |
78 | - $this->self = get_class( $this ); |
|
78 | + $this->self = get_class($this); |
|
79 | 79 | |
80 | 80 | $this->errors = array(); |
81 | 81 | $this->required = array(); |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $fields = $this->get_fields(); |
85 | 85 | |
86 | 86 | $defaults = array( |
87 | - 'btn_close' => __( 'Close', 'give' ), |
|
88 | - 'btn_okay' => __( 'Insert Shortcode', 'give' ), |
|
87 | + 'btn_close' => __('Close', 'give'), |
|
88 | + 'btn_okay' => __('Insert Shortcode', 'give'), |
|
89 | 89 | 'errors' => $this->errors, |
90 | 90 | 'fields' => $fields, |
91 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
91 | + 'label' => '['.$this->shortcode_tag.']', |
|
92 | 92 | 'required' => $this->required, |
93 | - 'title' => __( 'Insert Shortcode', 'give' ), |
|
93 | + 'title' => __('Insert Shortcode', 'give'), |
|
94 | 94 | ); |
95 | 95 | |
96 | - if ( user_can_richedit() ) { |
|
96 | + if (user_can_richedit()) { |
|
97 | 97 | |
98 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
98 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @since 1.0 |
126 | 126 | */ |
127 | - protected function generate_fields( $defined_fields ) { |
|
127 | + protected function generate_fields($defined_fields) { |
|
128 | 128 | |
129 | 129 | $fields = array(); |
130 | 130 | |
131 | - if ( is_array( $defined_fields ) ) { |
|
131 | + if (is_array($defined_fields)) { |
|
132 | 132 | |
133 | - foreach ( $defined_fields as $field ) { |
|
133 | + foreach ($defined_fields as $field) { |
|
134 | 134 | |
135 | 135 | $defaults = array( |
136 | 136 | 'label' => false, |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | 'type' => '', |
142 | 142 | ); |
143 | 143 | |
144 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
145 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
144 | + $field = wp_parse_args((array) $field, $defaults); |
|
145 | + $method = 'generate_'.strtolower($field['type']); |
|
146 | 146 | |
147 | - if ( method_exists( $this, $method ) ) { |
|
147 | + if (method_exists($this, $method)) { |
|
148 | 148 | |
149 | - $field = call_user_func( array( $this, $method ), $field ); |
|
149 | + $field = call_user_func(array($this, $method), $field); |
|
150 | 150 | |
151 | - if ( $field ) { |
|
151 | + if ($field) { |
|
152 | 152 | $fields[] = $field; |
153 | 153 | } |
154 | 154 | } |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | protected function get_fields() { |
169 | 169 | |
170 | 170 | $defined_fields = $this->define_fields(); |
171 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
171 | + $generated_fields = $this->generate_fields($defined_fields); |
|
172 | 172 | |
173 | 173 | $errors = array(); |
174 | 174 | |
175 | - if ( ! empty( $this->errors ) ) { |
|
176 | - foreach ( $this->required as $name => $alert ) { |
|
177 | - if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) { |
|
175 | + if ( ! empty($this->errors)) { |
|
176 | + foreach ($this->required as $name => $alert) { |
|
177 | + if (false === array_search($name, array_column($generated_fields, 'name'))) { |
|
178 | 178 | |
179 | - $errors[] = $this->errors[ $name ]; |
|
179 | + $errors[] = $this->errors[$name]; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | 183 | $this->errors = $errors; |
184 | 184 | } |
185 | 185 | |
186 | - if ( ! empty( $errors ) ) { |
|
186 | + if ( ! empty($errors)) { |
|
187 | 187 | |
188 | 188 | return $errors; |
189 | 189 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 1.0 |
202 | 202 | */ |
203 | - protected function generate_container( $field ) { |
|
203 | + protected function generate_container($field) { |
|
204 | 204 | |
205 | - if ( array_key_exists( 'html', $field ) ) { |
|
205 | + if (array_key_exists('html', $field)) { |
|
206 | 206 | |
207 | 207 | return array( |
208 | 208 | 'type' => $field['type'], |
@@ -222,36 +222,36 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @since 1.0 |
224 | 224 | */ |
225 | - protected function generate_listbox( $field ) { |
|
225 | + protected function generate_listbox($field) { |
|
226 | 226 | |
227 | - $listbox = shortcode_atts( array( |
|
227 | + $listbox = shortcode_atts(array( |
|
228 | 228 | 'label' => '', |
229 | 229 | 'minWidth' => '', |
230 | 230 | 'name' => false, |
231 | 231 | 'tooltip' => '', |
232 | 232 | 'type' => '', |
233 | 233 | 'value' => '', |
234 | - ), $field ); |
|
234 | + ), $field); |
|
235 | 235 | |
236 | - if ( $this->validate( $field ) ) { |
|
236 | + if ($this->validate($field)) { |
|
237 | 237 | |
238 | 238 | $new_listbox = array(); |
239 | 239 | |
240 | - foreach ( $listbox as $key => $value ) { |
|
240 | + foreach ($listbox as $key => $value) { |
|
241 | 241 | |
242 | - if ( $key == 'value' && empty( $value ) ) { |
|
243 | - $new_listbox[ $key ] = $listbox['name']; |
|
244 | - } else if ( $value ) { |
|
245 | - $new_listbox[ $key ] = $value; |
|
242 | + if ($key == 'value' && empty($value)) { |
|
243 | + $new_listbox[$key] = $listbox['name']; |
|
244 | + } else if ($value) { |
|
245 | + $new_listbox[$key] = $value; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | 249 | // do not reindex array! |
250 | 250 | $field['options'] = array( |
251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : __( '- Select -', 'give' ) ), |
|
251 | + '' => ($field['placeholder'] ? $field['placeholder'] : __('- Select -', 'give')), |
|
252 | 252 | ) + $field['options']; |
253 | 253 | |
254 | - foreach ( $field['options'] as $value => $text ) { |
|
254 | + foreach ($field['options'] as $value => $text) { |
|
255 | 255 | $new_listbox['values'][] = array( |
256 | 256 | 'text' => $text, |
257 | 257 | 'value' => $value, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @since 1.0 |
275 | 275 | */ |
276 | - protected function generate_post( $field ) { |
|
276 | + protected function generate_post($field) { |
|
277 | 277 | |
278 | 278 | $args = array( |
279 | 279 | 'post_type' => 'post', |
@@ -282,23 +282,23 @@ discard block |
||
282 | 282 | 'posts_per_page' => 30, |
283 | 283 | ); |
284 | 284 | |
285 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
286 | - $posts = get_posts( $args ); |
|
285 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
286 | + $posts = get_posts($args); |
|
287 | 287 | $options = array(); |
288 | 288 | |
289 | - if ( $posts ) { |
|
290 | - foreach ( $posts as $post ) { |
|
291 | - $options[ absint( $post->ID ) ] = esc_html( $post->post_title ); |
|
289 | + if ($posts) { |
|
290 | + foreach ($posts as $post) { |
|
291 | + $options[absint($post->ID)] = esc_html($post->post_title); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | $field['type'] = 'listbox'; |
295 | 295 | $field['options'] = $options; |
296 | 296 | |
297 | - return $this->generate_listbox( $field ); |
|
297 | + return $this->generate_listbox($field); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // perform validation here before returning false |
301 | - $this->validate( $field ); |
|
301 | + $this->validate($field); |
|
302 | 302 | |
303 | 303 | return false; |
304 | 304 | } |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 1.0 |
314 | 314 | */ |
315 | - protected function generate_textbox( $field ) { |
|
315 | + protected function generate_textbox($field) { |
|
316 | 316 | |
317 | - $textbox = shortcode_atts( array( |
|
317 | + $textbox = shortcode_atts(array( |
|
318 | 318 | 'label' => '', |
319 | 319 | 'maxLength' => '', |
320 | 320 | 'minHeight' => '', |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | 'tooltip' => '', |
325 | 325 | 'type' => '', |
326 | 326 | 'value' => '', |
327 | - ), $field ); |
|
327 | + ), $field); |
|
328 | 328 | |
329 | - if ( $this->validate( $field ) ) { |
|
330 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
329 | + if ($this->validate($field)) { |
|
330 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return false; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return bool |
342 | 342 | */ |
343 | - function return_textbox_value( $value ) { |
|
343 | + function return_textbox_value($value) { |
|
344 | 344 | return $value !== ''; |
345 | 345 | } |
346 | 346 | |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - protected function validate( $field ) { |
|
359 | + protected function validate($field) { |
|
360 | 360 | |
361 | - extract( shortcode_atts( |
|
361 | + extract(shortcode_atts( |
|
362 | 362 | array( |
363 | 363 | 'name' => false, |
364 | 364 | 'required' => false, |
@@ -366,36 +366,36 @@ discard block |
||
366 | 366 | ), $field ) |
367 | 367 | ); |
368 | 368 | |
369 | - if ( $name ) { |
|
369 | + if ($name) { |
|
370 | 370 | |
371 | - if ( isset( $required['error'] ) ) { |
|
371 | + if (isset($required['error'])) { |
|
372 | 372 | |
373 | 373 | $error = array( |
374 | 374 | 'type' => 'container', |
375 | 375 | 'html' => $required['error'], |
376 | 376 | ); |
377 | 377 | |
378 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
378 | + $this->errors[$name] = $this->generate_container($error); |
|
379 | 379 | } |
380 | 380 | |
381 | - if ( ! ! $required || is_array( $required ) ) { |
|
381 | + if ( ! ! $required || is_array($required)) { |
|
382 | 382 | |
383 | - $alert = __( 'Some of the Shortcode options are required.', 'give' ); |
|
383 | + $alert = __('Some of the Shortcode options are required.', 'give'); |
|
384 | 384 | |
385 | - if ( isset( $required['alert'] ) ) { |
|
385 | + if (isset($required['alert'])) { |
|
386 | 386 | |
387 | 387 | $alert = $required['alert']; |
388 | 388 | |
389 | - } else if ( ! empty( $label ) ) { |
|
389 | + } else if ( ! empty($label)) { |
|
390 | 390 | |
391 | 391 | $alert = sprintf( |
392 | 392 | /* translators: %s: option lable */ |
393 | - __( 'The "%s" option is required.', 'give' ), |
|
394 | - str_replace( ':', '', $label ) |
|
393 | + __('The "%s" option is required.', 'give'), |
|
394 | + str_replace(':', '', $label) |
|
395 | 395 | ); |
396 | 396 | } |
397 | 397 | |
398 | - $this->required[ $name ] = $alert; |
|
398 | + $this->required[$name] = $alert; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | return true; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | //Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => __( 'Name', 'give' ), |
|
36 | - 'form_category' => __( 'Categories', 'give' ), |
|
37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
38 | - 'price' => __( 'Price', 'give' ), |
|
39 | - 'goal' => __( 'Goal', 'give' ), |
|
40 | - 'donations' => __( 'Donations', 'give' ), |
|
41 | - 'earnings' => __( 'Income', 'give' ), |
|
42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
43 | - 'date' => __( 'Date', 'give' ) |
|
35 | + 'title' => __('Name', 'give'), |
|
36 | + 'form_category' => __('Categories', 'give'), |
|
37 | + 'form_tag' => __('Tags', 'give'), |
|
38 | + 'price' => __('Price', 'give'), |
|
39 | + 'goal' => __('Goal', 'give'), |
|
40 | + 'donations' => __('Donations', 'give'), |
|
41 | + 'earnings' => __('Income', 'give'), |
|
42 | + 'shortcode' => __('Shortcode', 'give'), |
|
43 | + 'date' => __('Date', 'give') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | //Does the user want categories / tags? |
47 | - if ( give_get_option( 'enable_categories' ) !== 'on' ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if (give_get_option('enable_categories') !== 'on') { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( give_get_option( 'enable_tags' ) !== 'on' ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if (give_get_option('enable_tags') !== 'on') { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,67 +66,67 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | global $give_options; |
72 | 72 | |
73 | - $style = isset( $give_options['button_style'] ) ? $give_options['button_style'] : 'button'; |
|
74 | - $color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'blue'; |
|
75 | - $color = ( $color == 'inherit' ) ? '' : $color; |
|
73 | + $style = isset($give_options['button_style']) ? $give_options['button_style'] : 'button'; |
|
74 | + $color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'blue'; |
|
75 | + $color = ($color == 'inherit') ? '' : $color; |
|
76 | 76 | |
77 | - $purchase_text = ! empty( $give_options['add_to_cart_text'] ) ? $give_options['add_to_cart_text'] : __( 'Purchase', 'give' ); |
|
77 | + $purchase_text = ! empty($give_options['add_to_cart_text']) ? $give_options['add_to_cart_text'] : __('Purchase', 'give'); |
|
78 | 78 | |
79 | - switch ( $column_name ) { |
|
79 | + switch ($column_name) { |
|
80 | 80 | case 'form_category': |
81 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
81 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
82 | 82 | break; |
83 | 83 | case 'form_tag': |
84 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
84 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
85 | 85 | break; |
86 | 86 | case 'price': |
87 | - if ( give_has_variable_prices( $post_id ) ) { |
|
88 | - echo give_price_range( $post_id ); |
|
87 | + if (give_has_variable_prices($post_id)) { |
|
88 | + echo give_price_range($post_id); |
|
89 | 89 | } else { |
90 | - echo give_price( $post_id, false ); |
|
91 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
90 | + echo give_price($post_id, false); |
|
91 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
92 | 92 | } |
93 | 93 | break; |
94 | 94 | case 'goal': |
95 | - $goal_option = get_post_meta( $post_id, '_give_goal_option', true ); |
|
96 | - if ( ! empty( $goal_option ) && $goal_option === 'yes' ) { |
|
97 | - echo give_goal( $post_id, false ); |
|
95 | + $goal_option = get_post_meta($post_id, '_give_goal_option', true); |
|
96 | + if ( ! empty($goal_option) && $goal_option === 'yes') { |
|
97 | + echo give_goal($post_id, false); |
|
98 | 98 | } else { |
99 | - echo __( 'No Goal Set', 'give' ); |
|
99 | + echo __('No Goal Set', 'give'); |
|
100 | 100 | } |
101 | 101 | |
102 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
102 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
103 | 103 | break; |
104 | 104 | case 'donations': |
105 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
106 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form=' . $post_id ) ) . '">'; |
|
107 | - echo give_get_form_sales_stats( $post_id ); |
|
105 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
106 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form='.$post_id)).'">'; |
|
107 | + echo give_get_form_sales_stats($post_id); |
|
108 | 108 | echo '</a>'; |
109 | 109 | } else { |
110 | 110 | echo '-'; |
111 | 111 | } |
112 | 112 | break; |
113 | 113 | case 'earnings': |
114 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
115 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">'; |
|
116 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
114 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
115 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">'; |
|
116 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
117 | 117 | echo '</a>'; |
118 | 118 | } else { |
119 | 119 | echo '-'; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | case 'shortcode': |
123 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
123 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
129 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Registers the sortable columns in the list table |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array $columns Array of sortable columns |
139 | 139 | */ |
140 | -function give_sortable_form_columns( $columns ) { |
|
140 | +function give_sortable_form_columns($columns) { |
|
141 | 141 | $columns['price'] = 'price'; |
142 | 142 | $columns['sales'] = 'sales'; |
143 | 143 | $columns['earnings'] = 'earnings'; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | return $columns; |
147 | 147 | } |
148 | 148 | |
149 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
149 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Sorts Columns in the Forms List Table |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return array $vars Array of all the sort variables |
159 | 159 | */ |
160 | -function give_sort_forms( $vars ) { |
|
160 | +function give_sort_forms($vars) { |
|
161 | 161 | // Check if we're viewing the "give_forms" post type |
162 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
162 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
163 | 163 | // Check if 'orderby' is set to "sales" |
164 | - if ( isset( $vars['orderby'] ) && 'sales' == $vars['orderby'] ) { |
|
164 | + if (isset($vars['orderby']) && 'sales' == $vars['orderby']) { |
|
165 | 165 | $vars = array_merge( |
166 | 166 | $vars, |
167 | 167 | array( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | // Check if "orderby" is set to "earnings" |
175 | - if ( isset( $vars['orderby'] ) && 'earnings' == $vars['orderby'] ) { |
|
175 | + if (isset($vars['orderby']) && 'earnings' == $vars['orderby']) { |
|
176 | 176 | $vars = array_merge( |
177 | 177 | $vars, |
178 | 178 | array( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | // Check if "orderby" is set to "price" |
186 | - if ( isset( $vars['orderby'] ) && 'price' == $vars['orderby'] ) { |
|
186 | + if (isset($vars['orderby']) && 'price' == $vars['orderby']) { |
|
187 | 187 | $vars = array_merge( |
188 | 188 | $vars, |
189 | 189 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | // Check if "orderby" is set to "goal" |
197 | - if ( isset( $vars['orderby'] ) && 'goal' == $vars['orderby'] ) { |
|
197 | + if (isset($vars['orderby']) && 'goal' == $vars['orderby']) { |
|
198 | 198 | $vars = array_merge( |
199 | 199 | $vars, |
200 | 200 | array( |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return array Array of all sort variables |
219 | 219 | */ |
220 | -function give_filter_forms( $vars ) { |
|
221 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
220 | +function give_filter_forms($vars) { |
|
221 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
222 | 222 | |
223 | 223 | // If an author ID was passed, use it |
224 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
224 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
225 | 225 | |
226 | 226 | $author_id = $_REQUEST['author']; |
227 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
227 | + if ((int) $author_id !== get_current_user_id()) { |
|
228 | 228 | // Tried to view the products of another person, sorry |
229 | - wp_die( __( 'You do not have permission to view this data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
229 | + wp_die(__('You do not have permission to view this data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
230 | 230 | } |
231 | 231 | $vars = array_merge( |
232 | 232 | $vars, |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | */ |
253 | 253 | function give_forms_load() { |
254 | - add_filter( 'request', 'give_sort_forms' ); |
|
255 | - add_filter( 'request', 'give_filter_forms' ); |
|
254 | + add_filter('request', 'give_sort_forms'); |
|
255 | + add_filter('request', 'give_filter_forms'); |
|
256 | 256 | } |
257 | 257 | |
258 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
258 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Remove Forms Month Filter |
@@ -269,17 +269,17 @@ discard block |
||
269 | 269 | * @global $typenow The post type we are viewing |
270 | 270 | * @return array Empty array disables the dropdown |
271 | 271 | */ |
272 | -function give_remove_month_filter( $dates ) { |
|
272 | +function give_remove_month_filter($dates) { |
|
273 | 273 | global $typenow; |
274 | 274 | |
275 | - if ( $typenow == 'give_forms' ) { |
|
275 | + if ($typenow == 'give_forms') { |
|
276 | 276 | $dates = array(); |
277 | 277 | } |
278 | 278 | |
279 | 279 | return $dates; |
280 | 280 | } |
281 | 281 | |
282 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
282 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Adds price field to Quick Edit options |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return void |
293 | 293 | */ |
294 | -function give_price_field_quick_edit( $column_name, $post_type ) { |
|
295 | - if ( $column_name != 'price' || $post_type != 'give_forms' ) { |
|
294 | +function give_price_field_quick_edit($column_name, $post_type) { |
|
295 | + if ($column_name != 'price' || $post_type != 'give_forms') { |
|
296 | 296 | return; |
297 | 297 | } |
298 | 298 | ?> |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | <h4><?php |
302 | 302 | printf( |
303 | 303 | /* translators: %s: forms singular label */ |
304 | - __( '%s Configuration', 'give' ), |
|
304 | + __('%s Configuration', 'give'), |
|
305 | 305 | give_get_forms_label_singular() |
306 | 306 | ); |
307 | 307 | ?></h4> |
308 | 308 | <label> |
309 | - <span class="title"><?php _e( 'Price', 'give' ); ?></span> |
|
309 | + <span class="title"><?php _e('Price', 'give'); ?></span> |
|
310 | 310 | <span class="input-text-wrap"> |
311 | 311 | <input type="text" name="_give_regprice" class="text regprice" /> |
312 | 312 | </span> |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | <?php |
318 | 318 | } |
319 | 319 | |
320 | -add_action( 'quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
321 | -add_action( 'bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
320 | +add_action('quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
321 | +add_action('bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * Updates price when saving post |
@@ -329,23 +329,23 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return void |
331 | 331 | */ |
332 | -function give_price_save_quick_edit( $post_id ) { |
|
333 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
332 | +function give_price_save_quick_edit($post_id) { |
|
333 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
334 | 334 | return; |
335 | 335 | } |
336 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
336 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
337 | 337 | return $post_id; |
338 | 338 | } |
339 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
339 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
340 | 340 | return $post_id; |
341 | 341 | } |
342 | 342 | |
343 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
344 | - update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
343 | + if (isset($_REQUEST['_give_regprice'])) { |
|
344 | + update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
348 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
348 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Process bulk edit actions via AJAX |
@@ -355,18 +355,18 @@ discard block |
||
355 | 355 | */ |
356 | 356 | function give_save_bulk_edit() { |
357 | 357 | |
358 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
358 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
359 | 359 | |
360 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
361 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
362 | - foreach ( $post_ids as $post_id ) { |
|
360 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
361 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
362 | + foreach ($post_ids as $post_id) { |
|
363 | 363 | |
364 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
364 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
365 | 365 | continue; |
366 | 366 | } |
367 | 367 | |
368 | - if ( ! empty( $price ) ) { |
|
369 | - update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
368 | + if ( ! empty($price)) { |
|
369 | + update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
@@ -374,4 +374,4 @@ discard block |
||
374 | 374 | die(); |
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
377 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_customers_page() { |
26 | 26 | $default_views = give_customer_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_customer_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_customer_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_customers_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_customer_views', $views ); |
|
45 | + return apply_filters('give_customer_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
59 | + return apply_filters('give_customer_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_customers_list() { |
70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
71 | 71 | |
72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
73 | 73 | $customers_table->prepare_items(); |
74 | 74 | ?> |
75 | 75 | <div class="wrap"> |
76 | - <h2><?php _e( 'Donors', 'give' ); ?></h2> |
|
77 | - <?php do_action( 'give_donors_table_top' ); ?> |
|
78 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
76 | + <h2><?php _e('Donors', 'give'); ?></h2> |
|
77 | + <?php do_action('give_donors_table_top'); ?> |
|
78 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
79 | 79 | <?php |
80 | - $customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
80 | + $customers_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
81 | 81 | $customers_table->display(); |
82 | 82 | ?> |
83 | 83 | <input type="hidden" name="post_type" value="give_forms" /> |
84 | 84 | <input type="hidden" name="page" value="give-donors" /> |
85 | 85 | <input type="hidden" name="view" value="customers" /> |
86 | 86 | </form> |
87 | - <?php do_action( 'give_donors_table_bottom' ); ?> |
|
87 | + <?php do_action('give_donors_table_bottom'); ?> |
|
88 | 88 | </div> |
89 | 89 | <?php |
90 | 90 | } |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_render_customer_view( $view, $callbacks ) { |
|
102 | +function give_render_customer_view($view, $callbacks) { |
|
103 | 103 | |
104 | 104 | $render = true; |
105 | 105 | |
106 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
106 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
107 | 107 | |
108 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
109 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
108 | + if ( ! current_user_can($customer_view_role)) { |
|
109 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
110 | 110 | $render = false; |
111 | 111 | } |
112 | 112 | |
113 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
114 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
114 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
115 | 115 | $render = false; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $customer_id = (int) $_GET['id']; |
119 | - $customer = new Give_Customer( $customer_id ); |
|
119 | + $customer = new Give_Customer($customer_id); |
|
120 | 120 | |
121 | - if ( empty( $customer->id ) ) { |
|
122 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
121 | + if (empty($customer->id)) { |
|
122 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
123 | 123 | $render = false; |
124 | 124 | } |
125 | 125 | |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | |
129 | 129 | <div class='wrap'> |
130 | 130 | |
131 | - <?php if ( give_get_errors() ) : ?> |
|
131 | + <?php if (give_get_errors()) : ?> |
|
132 | 132 | <div class="error settings-error"> |
133 | - <?php give_print_errors( 0 ); ?> |
|
133 | + <?php give_print_errors(0); ?> |
|
134 | 134 | </div> |
135 | 135 | <?php endif; ?> |
136 | 136 | |
137 | - <?php if ( $customer && $render ) : ?> |
|
137 | + <?php if ($customer && $render) : ?> |
|
138 | 138 | |
139 | 139 | <div id="customer-tab-wrapper"> |
140 | 140 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
141 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
141 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
142 | 142 | <?php $active = $key === $view ? true : false; ?> |
143 | 143 | <?php $class = $active ? 'active' : 'inactive'; ?> |
144 | 144 | |
145 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
146 | - <?php if ( ! $active ) : ?> |
|
147 | - <a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
145 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
146 | + <?php if ( ! $active) : ?> |
|
147 | + <a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
148 | 148 | <?php endif; ?> |
149 | 149 | |
150 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?> |
|
151 | - <?php if ( ! $active ) : ?> |
|
150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?> |
|
151 | + <?php if ( ! $active) : ?> |
|
152 | 152 | </a> |
153 | 153 | <?php endif; ?> |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | </div> |
161 | 161 | |
162 | 162 | <div id="give-customer-card-wrapper"> |
163 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
163 | + <?php $callbacks[$view]($customer) ?> |
|
164 | 164 | </div> |
165 | 165 | |
166 | 166 | <?php endif; ?> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_customers_view( $customer ) { |
|
183 | +function give_customers_view($customer) { |
|
184 | 184 | |
185 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
185 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
186 | 186 | |
187 | 187 | ?> |
188 | 188 | |
189 | - <?php do_action( 'give_donor_card_top', $customer ); ?> |
|
189 | + <?php do_action('give_donor_card_top', $customer); ?> |
|
190 | 190 | |
191 | 191 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
192 | 192 | |
193 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
193 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
194 | 194 | |
195 | 195 | <div class="customer-info"> |
196 | 196 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | <div class="donor-bio-header clearfix"> |
199 | 199 | |
200 | 200 | <div class="avatar-wrap left" id="customer-avatar"> |
201 | - <?php echo get_avatar( $customer->email ); ?> |
|
201 | + <?php echo get_avatar($customer->email); ?> |
|
202 | 202 | </div> |
203 | 203 | |
204 | 204 | <div class="customer-id" class="left"> |
205 | 205 | #<?php echo $customer->id; ?> |
206 | 206 | </div> |
207 | 207 | <div id="customer-name-wrap" class="left"> |
208 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
208 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
209 | 209 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
210 | 210 | </div> |
211 | 211 | <p class="customer-since info-item"> |
212 | - <?php _e( 'Donor since', 'give' ); ?> |
|
213 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
212 | + <?php _e('Donor since', 'give'); ?> |
|
213 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
214 | 214 | </p> |
215 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
216 | - <a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
215 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
216 | + <a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
217 | 217 | <?php endif; ?> |
218 | 218 | </div> |
219 | 219 | <!-- /donor-bio-header --> |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | <table class="widefat"> |
224 | 224 | <tbody> |
225 | 225 | <tr> |
226 | - <td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td> |
|
226 | + <td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td> |
|
227 | 227 | <td class="row-title"> |
228 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span> |
|
228 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span> |
|
229 | 229 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
230 | 230 | </td> |
231 | 231 | </tr> |
232 | 232 | <tr class="alternate"> |
233 | - <td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td> |
|
233 | + <td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td> |
|
234 | 234 | <td class="row-title"> |
235 | 235 | <span class="customer-user-id info-item edit-item"> |
236 | 236 | <?php |
@@ -246,38 +246,38 @@ discard block |
||
246 | 246 | 'data' => $data_atts, |
247 | 247 | ); |
248 | 248 | |
249 | - if ( ! empty( $user_id ) ) { |
|
250 | - $userdata = get_userdata( $user_id ); |
|
249 | + if ( ! empty($user_id)) { |
|
250 | + $userdata = get_userdata($user_id); |
|
251 | 251 | $user_args['value'] = $userdata->user_login; |
252 | 252 | } |
253 | 253 | |
254 | - echo Give()->html->ajax_user_search( $user_args ); |
|
254 | + echo Give()->html->ajax_user_search($user_args); |
|
255 | 255 | ?> |
256 | 256 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
257 | 257 | </span> |
258 | 258 | |
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
260 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | 262 | <?php else : ?> |
263 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
263 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
264 | 264 | <?php endif; ?> |
265 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
266 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
|
265 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
266 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span> |
|
267 | 267 | <?php endif; ?> |
268 | 268 | </span> |
269 | 269 | </td> |
270 | 270 | </tr> |
271 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
271 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
272 | 272 | |
273 | 273 | <tr> |
274 | - <td><?php esc_attr_e( 'Address', 'give' ); ?>:</td> |
|
274 | + <td><?php esc_attr_e('Address', 'give'); ?>:</td> |
|
275 | 275 | <td class="row-title"> |
276 | 276 | |
277 | 277 | <div class="customer-address-wrapper"> |
278 | 278 | |
279 | 279 | <?php |
280 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
280 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
281 | 281 | $defaults = array( |
282 | 282 | 'line1' => '', |
283 | 283 | 'line2' => '', |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | 'zip' => '' |
288 | 288 | ); |
289 | 289 | |
290 | - $address = wp_parse_args( $address, $defaults ); |
|
290 | + $address = wp_parse_args($address, $defaults); |
|
291 | 291 | ?> |
292 | 292 | |
293 | - <?php if ( ! empty( $address ) ) { ?> |
|
293 | + <?php if ( ! empty($address)) { ?> |
|
294 | 294 | <span class="customer-address info-item editable"> |
295 | 295 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
296 | 296 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -301,38 +301,38 @@ discard block |
||
301 | 301 | </span> |
302 | 302 | <?php } ?> |
303 | 303 | <span class="customer-address info-item edit-item"> |
304 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
304 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
307 | 307 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
308 | 308 | <?php |
309 | 309 | |
310 | 310 | $selected_country = $address['country']; |
311 | 311 | |
312 | 312 | $countries = give_get_country_list(); |
313 | - foreach ( $countries as $country_code => $country ) { |
|
314 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
313 | + foreach ($countries as $country_code => $country) { |
|
314 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
315 | 315 | } |
316 | 316 | ?> |
317 | 317 | </select> |
318 | 318 | <?php |
319 | 319 | $selected_state = give_get_state(); |
320 | - $states = give_get_states( $selected_country ); |
|
320 | + $states = give_get_states($selected_country); |
|
321 | 321 | |
322 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
322 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
323 | 323 | |
324 | - if ( ! empty( $states ) ) : ?> |
|
324 | + if ( ! empty($states)) : ?> |
|
325 | 325 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
326 | 326 | <?php |
327 | - foreach ( $states as $state_code => $state ) { |
|
328 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
327 | + foreach ($states as $state_code => $state) { |
|
328 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
329 | 329 | } |
330 | 330 | ?> |
331 | 331 | </select> |
332 | 332 | <?php else : ?> |
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
333 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" /> |
|
334 | 334 | <?php endif; ?> |
335 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
335 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
336 | 336 | </span> |
337 | 337 | |
338 | 338 | </div> |
@@ -350,98 +350,98 @@ discard block |
||
350 | 350 | |
351 | 351 | <span id="customer-edit-actions" class="edit-item"> |
352 | 352 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
353 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
353 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
354 | 354 | <input type="hidden" name="give_action" value="edit-customer" /> |
355 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
356 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
355 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
356 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
357 | 357 | </span> |
358 | 358 | |
359 | 359 | </form> |
360 | 360 | </div> |
361 | 361 | |
362 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
362 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
363 | 363 | |
364 | 364 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
365 | 365 | <ul> |
366 | 366 | <li> |
367 | - <a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
367 | + <a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
368 | 368 | <span class="dashicons dashicons-heart"></span> |
369 | 369 | <?php |
370 | 370 | //Completed Donations |
371 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
372 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
371 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
372 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
373 | 373 | ?> |
374 | 374 | </a> |
375 | 375 | </li> |
376 | 376 | <li> |
377 | 377 | <span class="dashicons dashicons-chart-area"></span> |
378 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
378 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
379 | 379 | </li> |
380 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
380 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
381 | 381 | </ul> |
382 | 382 | </div> |
383 | 383 | |
384 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
384 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
385 | 385 | |
386 | 386 | <div id="customer-tables-wrapper" class="customer-section"> |
387 | 387 | |
388 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
388 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
389 | 389 | |
390 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
390 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
391 | 391 | <?php |
392 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
393 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
394 | - $payments = array_slice( $payments, 0, 10 ); |
|
392 | + $payment_ids = explode(',', $customer->payment_ids); |
|
393 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
394 | + $payments = array_slice($payments, 0, 10); |
|
395 | 395 | ?> |
396 | 396 | <table class="wp-list-table widefat striped payments"> |
397 | 397 | <thead> |
398 | 398 | <tr> |
399 | - <th><?php _e( 'ID', 'give' ); ?></th> |
|
400 | - <th><?php _e( 'Amount', 'give' ); ?></th> |
|
401 | - <th><?php _e( 'Date', 'give' ); ?></th> |
|
402 | - <th><?php _e( 'Status', 'give' ); ?></th> |
|
403 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
399 | + <th><?php _e('ID', 'give'); ?></th> |
|
400 | + <th><?php _e('Amount', 'give'); ?></th> |
|
401 | + <th><?php _e('Date', 'give'); ?></th> |
|
402 | + <th><?php _e('Status', 'give'); ?></th> |
|
403 | + <th><?php _e('Actions', 'give'); ?></th> |
|
404 | 404 | </tr> |
405 | 405 | </thead> |
406 | 406 | <tbody> |
407 | - <?php if ( ! empty( $payments ) ) : ?> |
|
408 | - <?php foreach ( $payments as $payment ) : ?> |
|
407 | + <?php if ( ! empty($payments)) : ?> |
|
408 | + <?php foreach ($payments as $payment) : ?> |
|
409 | 409 | <tr> |
410 | 410 | <td><?php echo $payment->ID; ?></td> |
411 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
412 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
413 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
411 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
412 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
413 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
414 | 414 | <td> |
415 | - <a title="<?php _e( 'View Details for Donation', 'give' ); |
|
416 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
417 | - <?php _e( 'View Details', 'give' ); ?> |
|
415 | + <a title="<?php _e('View Details for Donation', 'give'); |
|
416 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
417 | + <?php _e('View Details', 'give'); ?> |
|
418 | 418 | </a> |
419 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
419 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
420 | 420 | </td> |
421 | 421 | </tr> |
422 | 422 | <?php endforeach; ?> |
423 | 423 | <?php else: ?> |
424 | 424 | <tr> |
425 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
425 | + <td colspan="5"><?php _e('No Donations Found', 'give'); ?></td> |
|
426 | 426 | </tr> |
427 | 427 | <?php endif; ?> |
428 | 428 | </tbody> |
429 | 429 | </table> |
430 | 430 | |
431 | - <h3><?php _e( 'Completed Donations', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('Completed Donations', 'give'); ?></h3> |
|
432 | 432 | <?php |
433 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
433 | + $donations = give_get_users_completed_donations($customer->email); |
|
434 | 434 | ?> |
435 | 435 | <table class="wp-list-table widefat striped donations"> |
436 | 436 | <thead> |
437 | 437 | <tr> |
438 | 438 | <th><?php echo give_get_forms_label_singular(); ?></th> |
439 | - <th width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
439 | + <th width="120px"><?php _e('Actions', 'give'); ?></th> |
|
440 | 440 | </tr> |
441 | 441 | </thead> |
442 | 442 | <tbody> |
443 | - <?php if ( ! empty( $donations ) ) : ?> |
|
444 | - <?php foreach ( $donations as $donation ) : ?> |
|
443 | + <?php if ( ! empty($donations)) : ?> |
|
444 | + <?php foreach ($donations as $donation) : ?> |
|
445 | 445 | <tr> |
446 | 446 | <td><?php echo $donation->post_title; ?></td> |
447 | 447 | <td> |
@@ -449,15 +449,15 @@ discard block |
||
449 | 449 | echo esc_attr( |
450 | 450 | sprintf( |
451 | 451 | /* translators: %s: post title */ |
452 | - __( 'View %s', 'give' ), |
|
452 | + __('View %s', 'give'), |
|
453 | 453 | $donation->post_title |
454 | 454 | ) |
455 | - ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); |
|
455 | + ); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); |
|
456 | 456 | ?>"> |
457 | 457 | <?php |
458 | 458 | printf( |
459 | 459 | /* translators: %s: forms singular label */ |
460 | - __( 'View %s', 'give' ), |
|
460 | + __('View %s', 'give'), |
|
461 | 461 | give_get_forms_label_singular() |
462 | 462 | ); |
463 | 463 | ?> |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | <?php endforeach; ?> |
468 | 468 | <?php else: ?> |
469 | 469 | <tr> |
470 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
470 | + <td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td> |
|
471 | 471 | </tr> |
472 | 472 | <?php endif; ?> |
473 | 473 | </tbody> |
474 | 474 | </table> |
475 | 475 | |
476 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
476 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
477 | 477 | |
478 | 478 | </div> |
479 | 479 | |
480 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
480 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
481 | 481 | |
482 | 482 | <?php |
483 | 483 | } |
@@ -491,30 +491,30 @@ discard block |
||
491 | 491 | * |
492 | 492 | * @return void |
493 | 493 | */ |
494 | -function give_customer_notes_view( $customer ) { |
|
494 | +function give_customer_notes_view($customer) { |
|
495 | 495 | |
496 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
497 | - $paged = absint( $paged ); |
|
496 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
497 | + $paged = absint($paged); |
|
498 | 498 | $note_count = $customer->get_notes_count(); |
499 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
500 | - $total_pages = ceil( $note_count / $per_page ); |
|
501 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
499 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
500 | + $total_pages = ceil($note_count / $per_page); |
|
501 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
502 | 502 | ?> |
503 | 503 | |
504 | 504 | <div id="customer-notes-wrapper"> |
505 | 505 | <div class="customer-notes-header"> |
506 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
506 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
507 | 507 | </div> |
508 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
508 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
509 | 509 | |
510 | - <?php if ( 1 == $paged ) : ?> |
|
510 | + <?php if (1 == $paged) : ?> |
|
511 | 511 | <div style="display: block; margin-bottom: 55px;"> |
512 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
512 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
513 | 513 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
514 | 514 | <br /> |
515 | 515 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
516 | 516 | <input type="hidden" name="give_action" value="add-customer-note" /> |
517 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
517 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
518 | 518 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
519 | 519 | </form> |
520 | 520 | </div> |
@@ -529,46 +529,46 @@ discard block |
||
529 | 529 | 'show_all' => true |
530 | 530 | ); |
531 | 531 | |
532 | - echo paginate_links( $pagination_args ); |
|
532 | + echo paginate_links($pagination_args); |
|
533 | 533 | ?> |
534 | 534 | |
535 | 535 | <div id="give-customer-notes" class="postbox"> |
536 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
537 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
536 | + <?php if (count($customer_notes) > 0) : ?> |
|
537 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
538 | 538 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
539 | 539 | <span class="note-content-wrap"> |
540 | - <?php echo stripslashes( $note ); ?> |
|
540 | + <?php echo stripslashes($note); ?> |
|
541 | 541 | </span> |
542 | 542 | </div> |
543 | 543 | <?php endforeach; ?> |
544 | 544 | <?php else: ?> |
545 | 545 | <div class="give-no-customer-notes"> |
546 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
546 | + <?php _e('No Donor Notes', 'give'); ?> |
|
547 | 547 | </div> |
548 | 548 | <?php endif; ?> |
549 | 549 | </div> |
550 | 550 | |
551 | - <?php echo paginate_links( $pagination_args ); ?> |
|
551 | + <?php echo paginate_links($pagination_args); ?> |
|
552 | 552 | |
553 | 553 | </div> |
554 | 554 | |
555 | 555 | <?php |
556 | 556 | } |
557 | 557 | |
558 | -function give_customers_delete_view( $customer ) { |
|
558 | +function give_customers_delete_view($customer) { |
|
559 | 559 | |
560 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
560 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
561 | 561 | |
562 | 562 | ?> |
563 | 563 | |
564 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
564 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
565 | 565 | |
566 | 566 | <div class="info-wrapper customer-section"> |
567 | 567 | |
568 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
568 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
569 | 569 | |
570 | 570 | <div class="customer-notes-header"> |
571 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
571 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
572 | 572 | </div> |
573 | 573 | |
574 | 574 | |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | |
577 | 577 | <span class="delete-customer-options"> |
578 | 578 | <p> |
579 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
580 | - <label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
579 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
580 | + <label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
581 | 581 | </p> |
582 | 582 | |
583 | 583 | <p> |
584 | - <?php echo Give()->html->checkbox( array( |
|
584 | + <?php echo Give()->html->checkbox(array( |
|
585 | 585 | 'name' => 'give-customer-delete-records', |
586 | - 'options' => array( 'disabled' => true ) |
|
587 | - ) ); ?> |
|
588 | - <label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
586 | + 'options' => array('disabled' => true) |
|
587 | + )); ?> |
|
588 | + <label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label> |
|
589 | 589 | </p> |
590 | 590 | |
591 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
591 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
592 | 592 | </span> |
593 | 593 | |
594 | 594 | <span id="customer-edit-actions"> |
595 | 595 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
596 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
596 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
597 | 597 | <input type="hidden" name="give_action" value="delete-customer" /> |
598 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
599 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
598 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
599 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
600 | 600 | </span> |
601 | 601 | |
602 | 602 | </div> |
@@ -606,5 +606,5 @@ discard block |
||
606 | 606 | |
607 | 607 | <?php |
608 | 608 | |
609 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
609 | + do_action('give_customer_delete_bottom', $customer); |
|
610 | 610 | } |
@@ -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( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('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 | - __( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( get_option( 'date_format' ) ) |
|
44 | + __('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(get_option('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( GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png', 247, 8 ); |
|
57 | + $pdf->Image(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 | - __( 'No %s found.', 'give' ), |
|
139 | + __('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( __( 'Income', 'give' ) ); |
|
225 | - $data->setColor( '1b58a3' ); |
|
226 | - $chart->addData( $data ); |
|
224 | + $data->setLegend(__('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( __( 'Donations', 'give' ) ); |
|
255 | - $data->setColor( 'ff6c1c' ); |
|
256 | - $chart->addData( $data ); |
|
257 | - |
|
258 | - $chart->setTitle( __( '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 | - __( 'Jan', 'give' ), |
|
270 | - __( 'Feb', 'give' ), |
|
271 | - __( 'Mar', 'give' ), |
|
272 | - __( 'Apr', 'give' ), |
|
273 | - __( 'May', 'give' ), |
|
274 | - __( 'June', 'give' ), |
|
275 | - __( 'July', 'give' ), |
|
276 | - __( 'Aug', 'give' ), |
|
277 | - __( 'Sept', 'give' ), |
|
278 | - __( 'Oct', 'give' ), |
|
279 | - __( 'Nov', 'give' ), |
|
280 | - __( '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(__('Donations', 'give')); |
|
255 | + $data->setColor('ff6c1c'); |
|
256 | + $chart->addData($data); |
|
257 | + |
|
258 | + $chart->setTitle(__('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 | + __('Jan', 'give'), |
|
270 | + __('Feb', 'give'), |
|
271 | + __('Mar', 'give'), |
|
272 | + __('Apr', 'give'), |
|
273 | + __('May', 'give'), |
|
274 | + __('June', 'give'), |
|
275 | + __('July', 'give'), |
|
276 | + __('Aug', 'give'), |
|
277 | + __('Sept', 'give'), |
|
278 | + __('Oct', 'give'), |
|
279 | + __('Nov', 'give'), |
|
280 | + __('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 | } |