@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,82 +25,82 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - __( '%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 | - esc_html__( 'No %s found.', 'give' ), |
|
139 | + esc_html__('No %s found.', 'give'), |
|
140 | 140 | give_get_forms_label_plural() |
141 | 141 | ) |
142 | 142 | ); |
143 | - $pdf->Row( array( $title ) ); |
|
143 | + $pdf->Row(array($title)); |
|
144 | 144 | endif; |
145 | 145 | |
146 | 146 | $pdf->Ln(); |
147 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
148 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
149 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
150 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
151 | - |
|
152 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
153 | - $image = str_replace( ' ', '%20', $image ); |
|
154 | - |
|
155 | - $pdf->SetX( 25 ); |
|
156 | - $pdf->Image( $image . '&file=.png' ); |
|
157 | - $pdf->Ln( 7 ); |
|
158 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
147 | + $pdf->SetTextColor(50, 50, 50); |
|
148 | + $pdf->SetFont('Helvetica', '', 14); |
|
149 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
150 | + $pdf->SetFont('Helvetica', '', 12); |
|
151 | + |
|
152 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
153 | + $image = str_replace(' ', '%20', $image); |
|
154 | + |
|
155 | + $pdf->SetX(25); |
|
156 | + $pdf->Image($image.'&file=.png'); |
|
157 | + $pdf->Ln(7); |
|
158 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
159 | 159 | } |
160 | 160 | |
161 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
161 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Draws Chart for PDF Report |
@@ -175,38 +175,38 @@ discard block |
||
175 | 175 | * @return string $chart->getUrl() URL for the Google Chart |
176 | 176 | */ |
177 | 177 | function give_draw_chart_image() { |
178 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
178 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
181 | 181 | |
182 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
182 | + $chart = new GoogleChart('lc', 900, 330); |
|
183 | 183 | |
184 | 184 | $i = 1; |
185 | 185 | $earnings = ""; |
186 | 186 | $sales = ""; |
187 | 187 | |
188 | - while ( $i <= 12 ) : |
|
189 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
190 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
191 | - $i ++; |
|
188 | + while ($i <= 12) : |
|
189 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
190 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
191 | + $i++; |
|
192 | 192 | endwhile; |
193 | 193 | |
194 | - $earnings_array = explode( ",", $earnings ); |
|
195 | - $sales_array = explode( ",", $sales ); |
|
194 | + $earnings_array = explode(",", $earnings); |
|
195 | + $sales_array = explode(",", $sales); |
|
196 | 196 | |
197 | 197 | $i = 0; |
198 | - while ( $i <= 11 ) { |
|
199 | - if ( empty( $sales_array[ $i ] ) ) { |
|
200 | - $sales_array[ $i ] = 0; |
|
198 | + while ($i <= 11) { |
|
199 | + if (empty($sales_array[$i])) { |
|
200 | + $sales_array[$i] = 0; |
|
201 | 201 | } |
202 | - $i ++; |
|
202 | + $i++; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $min_earnings = 0; |
206 | - $max_earnings = max( $earnings_array ); |
|
207 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
206 | + $max_earnings = max($earnings_array); |
|
207 | + $earnings_scale = round($max_earnings, - 1); |
|
208 | 208 | |
209 | - $data = new GoogleChartData( array( |
|
209 | + $data = new GoogleChartData(array( |
|
210 | 210 | $earnings_array[0], |
211 | 211 | $earnings_array[1], |
212 | 212 | $earnings_array[2], |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | $earnings_array[9], |
220 | 220 | $earnings_array[10], |
221 | 221 | $earnings_array[11] |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | |
224 | - $data->setLegend( esc_html__( 'Income', 'give' ) ); |
|
225 | - $data->setColor( '1b58a3' ); |
|
226 | - $chart->addData( $data ); |
|
224 | + $data->setLegend(esc_html__('Income', 'give')); |
|
225 | + $data->setColor('1b58a3'); |
|
226 | + $chart->addData($data); |
|
227 | 227 | |
228 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
229 | - $shape_marker->setColor( '000000' ); |
|
230 | - $shape_marker->setSize( 7 ); |
|
231 | - $shape_marker->setBorder( 2 ); |
|
232 | - $shape_marker->setData( $data ); |
|
233 | - $chart->addMarker( $shape_marker ); |
|
228 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
229 | + $shape_marker->setColor('000000'); |
|
230 | + $shape_marker->setSize(7); |
|
231 | + $shape_marker->setBorder(2); |
|
232 | + $shape_marker->setData($data); |
|
233 | + $chart->addMarker($shape_marker); |
|
234 | 234 | |
235 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
236 | - $value_marker->setColor( '000000' ); |
|
237 | - $value_marker->setData( $data ); |
|
238 | - $chart->addMarker( $value_marker ); |
|
235 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
236 | + $value_marker->setColor('000000'); |
|
237 | + $value_marker->setData($data); |
|
238 | + $chart->addMarker($value_marker); |
|
239 | 239 | |
240 | - $data = new GoogleChartData( array( |
|
240 | + $data = new GoogleChartData(array( |
|
241 | 241 | $sales_array[0], |
242 | 242 | $sales_array[1], |
243 | 243 | $sales_array[2], |
@@ -250,46 +250,46 @@ discard block |
||
250 | 250 | $sales_array[9], |
251 | 251 | $sales_array[10], |
252 | 252 | $sales_array[11] |
253 | - ) ); |
|
254 | - $data->setLegend( esc_html__( 'Donations', 'give' ) ); |
|
255 | - $data->setColor( 'ff6c1c' ); |
|
256 | - $chart->addData( $data ); |
|
257 | - |
|
258 | - $chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
259 | - |
|
260 | - $chart->setScale( 0, $max_earnings ); |
|
261 | - |
|
262 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
263 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
264 | - $chart->addAxis( $y_axis ); |
|
265 | - |
|
266 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
267 | - $x_axis->setTickMarks( 5 ); |
|
268 | - $x_axis->setLabels( array( |
|
269 | - esc_html__( 'Jan', 'give' ), |
|
270 | - esc_html__( 'Feb', 'give' ), |
|
271 | - esc_html__( 'Mar', 'give' ), |
|
272 | - esc_html__( 'Apr', 'give' ), |
|
273 | - esc_html__( 'May', 'give' ), |
|
274 | - esc_html__( 'June', 'give' ), |
|
275 | - esc_html__( 'July', 'give' ), |
|
276 | - esc_html__( 'Aug', 'give' ), |
|
277 | - esc_html__( 'Sept', 'give' ), |
|
278 | - esc_html__( 'Oct', 'give' ), |
|
279 | - esc_html__( 'Nov', 'give' ), |
|
280 | - esc_html__( 'Dec', 'give' ) |
|
281 | - ) ); |
|
282 | - $chart->addAxis( $x_axis ); |
|
283 | - |
|
284 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
285 | - $shape_marker->setSize( 6 ); |
|
286 | - $shape_marker->setBorder( 2 ); |
|
287 | - $shape_marker->setData( $data ); |
|
288 | - $chart->addMarker( $shape_marker ); |
|
289 | - |
|
290 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
291 | - $value_marker->setData( $data ); |
|
292 | - $chart->addMarker( $value_marker ); |
|
253 | + )); |
|
254 | + $data->setLegend(esc_html__('Donations', 'give')); |
|
255 | + $data->setColor('ff6c1c'); |
|
256 | + $chart->addData($data); |
|
257 | + |
|
258 | + $chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
259 | + |
|
260 | + $chart->setScale(0, $max_earnings); |
|
261 | + |
|
262 | + $y_axis = new GoogleChartAxis('y'); |
|
263 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
264 | + $chart->addAxis($y_axis); |
|
265 | + |
|
266 | + $x_axis = new GoogleChartAxis('x'); |
|
267 | + $x_axis->setTickMarks(5); |
|
268 | + $x_axis->setLabels(array( |
|
269 | + esc_html__('Jan', 'give'), |
|
270 | + esc_html__('Feb', 'give'), |
|
271 | + esc_html__('Mar', 'give'), |
|
272 | + esc_html__('Apr', 'give'), |
|
273 | + esc_html__('May', 'give'), |
|
274 | + esc_html__('June', 'give'), |
|
275 | + esc_html__('July', 'give'), |
|
276 | + esc_html__('Aug', 'give'), |
|
277 | + esc_html__('Sept', 'give'), |
|
278 | + esc_html__('Oct', 'give'), |
|
279 | + esc_html__('Nov', 'give'), |
|
280 | + esc_html__('Dec', 'give') |
|
281 | + )); |
|
282 | + $chart->addAxis($x_axis); |
|
283 | + |
|
284 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
285 | + $shape_marker->setSize(6); |
|
286 | + $shape_marker->setBorder(2); |
|
287 | + $shape_marker->setData($data); |
|
288 | + $chart->addMarker($shape_marker); |
|
289 | + |
|
290 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
291 | + $value_marker->setData($data); |
|
292 | + $chart->addMarker($value_marker); |
|
293 | 293 | |
294 | 294 | return $chart->getUrl(); |
295 | 295 | } |
@@ -10,7 +10,7 @@ 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 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html__('Income', 'give') => $earnings_data, |
|
181 | + esc_html__('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 esc_html_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 esc_html_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 esc_html_e( 'Total donations for period shown: ', 'give' ); ?></label> |
|
214 | + <label for="tablecell"><?php esc_html_e('Total donations for period shown: ', 'give'); ?></label> |
|
215 | 215 | </td> |
216 | 216 | <td><?php echo $sales_totals; ?></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 esc_html_e( 'Estimated monthly income: ', 'give' ); ?></label> |
|
221 | + <label for="tablecell"><?php esc_html_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 esc_html_e( 'Estimated monthly donations: ', 'give' ); ?></label> |
|
227 | + <label for="tablecell"><?php esc_html_e('Estimated monthly donations: ', 'give'); ?></label> |
|
228 | 228 | </td> |
229 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
229 | + <td><?php echo floor($estimated['sales']); ?></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 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
424 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
423 | + esc_html__('Income', 'give') => $earnings_data, |
|
424 | + esc_html__('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 | - esc_html__( 'Income Over Time for %s', 'give' ), |
|
432 | - get_the_title( $form_id ) |
|
431 | + esc_html__('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 esc_html_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 esc_html_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 esc_html_e( 'Total donations for period: ', 'give' ); ?></label> |
|
457 | + <label for="tablecell"><?php esc_html_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 esc_html_e( 'Average monthly income: ', 'give' ); ?></label> |
|
463 | + <label for="tablecell"><?php esc_html_e('Average monthly income: ', '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 esc_html_e( 'Average monthly donations: ', 'give' ); ?></label> |
|
469 | + <label for="tablecell"><?php esc_html_e('Average monthly donations: ', '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' => esc_html__( 'Today', 'give' ), |
|
490 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
491 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
492 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
493 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
494 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
495 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
496 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
497 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
498 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
499 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
500 | - ) ); |
|
488 | + $date_options = apply_filters('give_report_date_options', array( |
|
489 | + 'today' => esc_html__('Today', 'give'), |
|
490 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
491 | + 'this_week' => esc_html__('This Week', 'give'), |
|
492 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
493 | + 'this_month' => esc_html__('This Month', 'give'), |
|
494 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
495 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
496 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
497 | + 'this_year' => esc_html__('This Year', 'give'), |
|
498 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
499 | + 'other' => esc_html__('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 esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
531 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
532 | 532 | </div> |
533 | 533 | |
534 | 534 | <div id="give-date-range-options" <?php echo $display; ?>> |
535 | - <span><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <span><?php esc_html_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 esc_html_e( 'To', 'give' ); ?> </span> |
|
551 | + <span><?php esc_html_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 | /** |
@@ -796,16 +796,16 @@ discard block |
||
796 | 796 | */ |
797 | 797 | function give_reports_refresh_button() { |
798 | 798 | |
799 | - $url = wp_nonce_url( add_query_arg( array( |
|
799 | + $url = wp_nonce_url(add_query_arg(array( |
|
800 | 800 | 'give_action' => 'refresh_reports_transients', |
801 | 801 | 'give-message' => 'refreshed-reports' |
802 | - ) ), 'give-refresh-reports' ); |
|
802 | + )), 'give-refresh-reports'); |
|
803 | 803 | |
804 | - echo '<a href="' . $url . '" data-tooltip="' . esc_attr__( '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">' . esc_html__( 'Refresh Reports', 'give' ) . '</a>'; |
|
804 | + echo '<a href="'.$url.'" data-tooltip="'.esc_attr__('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">'.esc_html__('Refresh Reports', 'give').'</a>'; |
|
805 | 805 | |
806 | 806 | } |
807 | 807 | |
808 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
808 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
809 | 809 | |
810 | 810 | /** |
811 | 811 | * Trigger the refresh of reports transients |
@@ -816,18 +816,18 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return void |
818 | 818 | */ |
819 | -function give_run_refresh_reports_transients( $data ) { |
|
819 | +function give_run_refresh_reports_transients($data) { |
|
820 | 820 | |
821 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
821 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
822 | 822 | return; |
823 | 823 | } |
824 | 824 | |
825 | 825 | //Delete transients |
826 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
827 | - delete_transient( 'give_earnings_total' ); |
|
828 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
829 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
826 | + delete_transient('give_estimated_monthly_stats'); |
|
827 | + delete_transient('give_earnings_total'); |
|
828 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
829 | + delete_transient(md5('give_earnings_todaytoday')); |
|
830 | 830 | |
831 | 831 | } |
832 | 832 | |
833 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
834 | 833 | \ No newline at end of file |
834 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
835 | 835 | \ No newline at end of file |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | 50 | 'ajax' => false // Does this table support ajax? |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,37 +64,37 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . get_the_title( $item[ $column_name ] ) . '</a>'; |
|
73 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.get_the_title($item[$column_name]).'</a>'; |
|
74 | 74 | |
75 | 75 | case 'user_id' : |
76 | - return '<a href="' . |
|
77 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
78 | - '">' . $item['user_name'] . '</a>'; |
|
76 | + return '<a href="'. |
|
77 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
78 | + '">'.$item['user_name'].'</a>'; |
|
79 | 79 | |
80 | 80 | case 'amount' : |
81 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
81 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
82 | 82 | |
83 | 83 | case 'status' : |
84 | 84 | |
85 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
85 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
86 | 86 | |
87 | - if ( $payment->mode == 'test' ) { |
|
88 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
87 | + if ($payment->mode == 'test') { |
|
88 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $value; |
92 | 92 | |
93 | 93 | case 'payment_id' : |
94 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
94 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
95 | 95 | |
96 | 96 | default: |
97 | - return $item[ $column_name ]; |
|
97 | + return $item[$column_name]; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function get_columns() { |
109 | 109 | $columns = array( |
110 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
111 | - 'user_id' => esc_html__( 'Donor', 'give' ), |
|
110 | + 'ID' => esc_html__('Log ID', 'give'), |
|
111 | + 'user_id' => esc_html__('Donor', 'give'), |
|
112 | 112 | 'form' => give_get_forms_label_singular(), |
113 | - 'amount' => esc_html__( 'Donation Amount', 'give' ), |
|
114 | - 'status' => esc_html__( 'Status', 'give' ), |
|
115 | - 'payment_id' => esc_html__( 'Transaction ID', 'give' ), |
|
116 | - 'date' => esc_html__( 'Date', 'give' ) |
|
113 | + 'amount' => esc_html__('Donation Amount', 'give'), |
|
114 | + 'status' => esc_html__('Status', 'give'), |
|
115 | + 'payment_id' => esc_html__('Transaction ID', 'give'), |
|
116 | + 'date' => esc_html__('Date', 'give') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | return $columns; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return int Current page number |
128 | 128 | */ |
129 | 129 | public function get_paged() { |
130 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
130 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return mixed int If User ID, string If Email/Login |
139 | 139 | */ |
140 | 140 | public function get_filtered_user() { |
141 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
141 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return int Download ID |
150 | 150 | */ |
151 | 151 | public function get_filtered_give_form() { |
152 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
152 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed string If search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
179 | + protected function display_tablenav($which) { |
|
180 | 180 | |
181 | - if ( 'top' === $which ) { |
|
182 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
181 | + if ('top' === $which) { |
|
182 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
183 | 183 | } |
184 | 184 | ?> |
185 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
185 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
186 | 186 | |
187 | 187 | <div class="alignleft actions bulkactions"> |
188 | - <?php $this->bulk_actions( $which ); ?> |
|
188 | + <?php $this->bulk_actions($which); ?> |
|
189 | 189 | </div> |
190 | 190 | <?php |
191 | - $this->extra_tablenav( $which ); |
|
192 | - $this->pagination( $which ); |
|
191 | + $this->extra_tablenav($which); |
|
192 | + $this->pagination($which); |
|
193 | 193 | ?> |
194 | 194 | |
195 | 195 | <br class="clear"/> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $meta_query = array(); |
214 | 214 | |
215 | - if ( $user ) { |
|
215 | + if ($user) { |
|
216 | 216 | // Show only logs from a specific user |
217 | 217 | $meta_query[] = array( |
218 | 218 | 'key' => '_give_log_user_id', |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | $search = $this->get_search(); |
224 | - if ( $search ) { |
|
225 | - if ( is_email( $search ) ) { |
|
224 | + if ($search) { |
|
225 | + if (is_email($search)) { |
|
226 | 226 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
227 | 227 | $key = '_give_log_user_info'; |
228 | 228 | $compare = 'LIKE'; |
@@ -231,32 +231,32 @@ discard block |
||
231 | 231 | $key = '_give_log_user_id'; |
232 | 232 | $compare = 'LIKE'; |
233 | 233 | |
234 | - if ( ! is_numeric( $search ) ) { |
|
234 | + if ( ! is_numeric($search)) { |
|
235 | 235 | // Searching for user by username |
236 | - $user = get_user_by( 'login', $search ); |
|
236 | + $user = get_user_by('login', $search); |
|
237 | 237 | |
238 | - if ( $user ) { |
|
238 | + if ($user) { |
|
239 | 239 | // Found one, set meta value to user's ID |
240 | 240 | $search = $user->ID; |
241 | 241 | } else { |
242 | 242 | // No user found so let's do a real search query |
243 | - $users = new WP_User_Query( array( |
|
243 | + $users = new WP_User_Query(array( |
|
244 | 244 | 'search' => $search, |
245 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
245 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
246 | 246 | 'number' => 1, |
247 | 247 | 'fields' => 'ids' |
248 | - ) ); |
|
248 | + )); |
|
249 | 249 | |
250 | 250 | $found_user = $users->get_results(); |
251 | 251 | |
252 | - if ( $found_user ) { |
|
252 | + if ($found_user) { |
|
253 | 253 | $search = $found_user[0]; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ( ! $this->file_search ) { |
|
259 | + if ( ! $this->file_search) { |
|
260 | 260 | // Meta query only works for non file name searche |
261 | 261 | $meta_query[] = array( |
262 | 262 | 'key' => $key, |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @since 1.0 |
278 | 278 | * @return void |
279 | 279 | */ |
280 | - function bulk_actions( $which = '' ) { |
|
280 | + function bulk_actions($which = '') { |
|
281 | 281 | give_log_views(); |
282 | 282 | } |
283 | 283 | |
@@ -289,22 +289,22 @@ discard block |
||
289 | 289 | * @return void |
290 | 290 | */ |
291 | 291 | public function give_forms_filter() { |
292 | - $give_forms = get_posts( array( |
|
292 | + $give_forms = get_posts(array( |
|
293 | 293 | 'post_type' => 'give_forms', |
294 | 294 | 'post_status' => 'any', |
295 | - 'posts_per_page' => - 1, |
|
295 | + 'posts_per_page' => -1, |
|
296 | 296 | 'orderby' => 'title', |
297 | 297 | 'order' => 'ASC', |
298 | 298 | 'fields' => 'ids', |
299 | 299 | 'update_post_meta_cache' => false, |
300 | 300 | 'update_post_term_cache' => false |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | |
303 | - if ( $give_forms ) { |
|
303 | + if ($give_forms) { |
|
304 | 304 | echo '<select name="form" id="give-log-form-filter">'; |
305 | - echo '<option value="0">' . esc_html__( 'All', 'give' ) . '</option>'; |
|
306 | - foreach ( $give_forms as $form ) { |
|
307 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( get_the_title( $form ) ) . '</option>'; |
|
305 | + echo '<option value="0">'.esc_html__('All', 'give').'</option>'; |
|
306 | + foreach ($give_forms as $form) { |
|
307 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html(get_the_title($form)).'</option>'; |
|
308 | 308 | } |
309 | 309 | echo '</select>'; |
310 | 310 | } |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | global $give_logs; |
323 | 323 | |
324 | 324 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
325 | - wp_suspend_cache_addition( true ); |
|
325 | + wp_suspend_cache_addition(true); |
|
326 | 326 | |
327 | 327 | $logs_data = array(); |
328 | 328 | $paged = $this->get_paged(); |
329 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
329 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
330 | 330 | $user = $this->get_filtered_user(); |
331 | 331 | |
332 | 332 | $log_query = array( |
@@ -336,26 +336,26 @@ discard block |
||
336 | 336 | 'meta_query' => $this->get_meta_query() |
337 | 337 | ); |
338 | 338 | |
339 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
339 | + $logs = $give_logs->get_connected_logs($log_query); |
|
340 | 340 | |
341 | - if ( $logs ) { |
|
342 | - foreach ( $logs as $log ) { |
|
343 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
341 | + if ($logs) { |
|
342 | + foreach ($logs as $log) { |
|
343 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
344 | 344 | |
345 | 345 | // Make sure this payment hasn't been deleted |
346 | - if ( get_post( $payment_id ) ) : |
|
347 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
348 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
349 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
346 | + if (get_post($payment_id)) : |
|
347 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
348 | + $payment_meta = give_get_payment_meta($payment_id); |
|
349 | + $payment_amount = give_get_payment_amount($payment_id); |
|
350 | 350 | |
351 | 351 | $logs_data[] = array( |
352 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
352 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
353 | 353 | 'payment_id' => $payment_id, |
354 | 354 | 'form' => $log->post_parent, |
355 | 355 | 'amount' => $payment_amount, |
356 | 356 | 'user_id' => $user_info['id'], |
357 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
358 | - 'date' => get_post_field( 'post_date', $payment_id ) |
|
357 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
358 | + 'date' => get_post_field('post_date', $payment_id) |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | endif; |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | $columns = $this->get_columns(); |
385 | 385 | $hidden = array(); |
386 | 386 | $sortable = $this->get_sortable_columns(); |
387 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
387 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
388 | 388 | $current_page = $this->get_pagenum(); |
389 | 389 | $this->items = $this->get_logs(); |
390 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
390 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
391 | 391 | |
392 | - $this->set_pagination_args( array( |
|
392 | + $this->set_pagination_args(array( |
|
393 | 393 | 'total_items' => $total_items, |
394 | 394 | 'per_page' => $this->per_page, |
395 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
395 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
396 | 396 | ) |
397 | 397 | ); |
398 | 398 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ) |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give') |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Request Details', 'give' ); ?> "><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Request Details', 'give'); ?> "><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } else if ( is_email( $search ) ) { |
|
217 | + } else if (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | 'meta_query' => $this->get_meta_query() |
294 | 294 | ); |
295 | 295 | |
296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
297 | 297 | |
298 | - if ( $logs ) { |
|
299 | - foreach ( $logs as $log ) { |
|
298 | + if ($logs) { |
|
299 | + foreach ($logs as $log) { |
|
300 | 300 | |
301 | 301 | $logs_data[] = array( |
302 | 302 | 'ID' => $log->ID, |
303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
304 | 304 | 'date' => $log->post_date |
305 | 305 | ); |
306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $columns = $this->get_columns(); |
329 | 329 | $hidden = array(); // No hidden columns |
330 | 330 | $sortable = $this->get_sortable_columns(); |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | $this->items = $this->get_logs(); |
333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
334 | 334 | |
335 | - $this->set_pagination_args( array( |
|
335 | + $this->set_pagination_args(array( |
|
336 | 336 | 'total_items' => $total_items, |
337 | 337 | 'per_page' => $this->per_page, |
338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | global $status, $page; |
121 | 121 | |
122 | 122 | // Set parent defaults |
123 | - parent::__construct( array( |
|
124 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
125 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
123 | + parent::__construct(array( |
|
124 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
125 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
126 | 126 | 'ajax' => false // Does this table support ajax? |
127 | - ) ); |
|
127 | + )); |
|
128 | 128 | |
129 | 129 | $this->get_payment_counts(); |
130 | 130 | $this->process_bulk_action(); |
131 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
131 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function advanced_filters() { |
135 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
136 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
137 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
135 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
136 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
137 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
138 | 138 | ?> |
139 | 139 | <div id="give-payment-filters"> |
140 | 140 | <span id="give-payment-date-filters"> |
141 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
141 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
142 | 142 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
143 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
143 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
144 | 144 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
145 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
145 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
146 | 146 | </span> |
147 | - <?php if ( ! empty( $status ) ) : ?> |
|
148 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
147 | + <?php if ( ! empty($status)) : ?> |
|
148 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
149 | 149 | <?php endif; ?> |
150 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
151 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
150 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
151 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
152 | 152 | <?php endif; ?> |
153 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
153 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
154 | 154 | </div> |
155 | 155 | |
156 | 156 | <?php |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return void |
169 | 169 | */ |
170 | - public function search_box( $text, $input_id ) { |
|
171 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
170 | + public function search_box($text, $input_id) { |
|
171 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - $input_id = $input_id . '-search-input'; |
|
175 | + $input_id = $input_id.'-search-input'; |
|
176 | 176 | |
177 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
178 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
177 | + if ( ! empty($_REQUEST['orderby'])) { |
|
178 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
179 | 179 | } |
180 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
181 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
180 | + if ( ! empty($_REQUEST['order'])) { |
|
181 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
182 | 182 | } |
183 | 183 | ?> |
184 | 184 | <p class="search-box"> |
185 | - <?php do_action( 'give_payment_history_search' ); ?> |
|
185 | + <?php do_action('give_payment_history_search'); ?> |
|
186 | 186 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
187 | 187 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
188 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
188 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
189 | 189 | </p> |
190 | 190 | <?php |
191 | 191 | } |
@@ -199,52 +199,52 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function get_views() { |
201 | 201 | |
202 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
203 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
204 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
205 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
206 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
207 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
208 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
209 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
210 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
202 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
203 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
204 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
205 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
206 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
207 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
208 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
209 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
210 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
211 | 211 | |
212 | 212 | $views = array( |
213 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
213 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
214 | 214 | 'status', |
215 | 215 | 'paged' |
216 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
217 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
216 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
217 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
218 | 218 | 'status' => 'publish', |
219 | 219 | 'paged' => false |
220 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
221 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
220 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
221 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
222 | 222 | 'status' => 'pending', |
223 | 223 | 'paged' => false |
224 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
225 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
224 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
225 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
226 | 226 | 'status' => 'refunded', |
227 | 227 | 'paged' => false |
228 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
229 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
228 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
229 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
230 | 230 | 'status' => 'revoked', |
231 | 231 | 'paged' => false |
232 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
233 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
232 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
233 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
234 | 234 | 'status' => 'failed', |
235 | 235 | 'paged' => false |
236 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
237 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
236 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
237 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
238 | 238 | 'status' => 'cancelled', |
239 | 239 | 'paged' => false |
240 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
241 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
240 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
241 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
242 | 242 | 'status' => 'abandoned', |
243 | 243 | 'paged' => false |
244 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
244 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
245 | 245 | ); |
246 | 246 | |
247 | - return apply_filters( 'give_payments_table_views', $views ); |
|
247 | + return apply_filters('give_payments_table_views', $views); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -257,17 +257,17 @@ discard block |
||
257 | 257 | public function get_columns() { |
258 | 258 | $columns = array( |
259 | 259 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
260 | - 'email' => esc_html__( 'Email', 'give' ), |
|
261 | - 'details' => esc_html__( 'Details', 'give' ), |
|
262 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
263 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
264 | - 'status' => esc_html__( 'Status', 'give' ), |
|
265 | - 'date' => esc_html__( 'Date', 'give' ), |
|
266 | - 'donor' => esc_html__( 'Donor', 'give' ), |
|
267 | - 'ID' => esc_html__( 'ID', 'give' ), |
|
260 | + 'email' => esc_html__('Email', 'give'), |
|
261 | + 'details' => esc_html__('Details', 'give'), |
|
262 | + 'amount' => esc_html__('Amount', 'give'), |
|
263 | + 'donation' => esc_html__('Donation', 'give'), |
|
264 | + 'status' => esc_html__('Status', 'give'), |
|
265 | + 'date' => esc_html__('Date', 'give'), |
|
266 | + 'donor' => esc_html__('Donor', 'give'), |
|
267 | + 'ID' => esc_html__('ID', 'give'), |
|
268 | 268 | ); |
269 | 269 | |
270 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
270 | + return apply_filters('give_payments_table_columns', $columns); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function get_sortable_columns() { |
281 | 281 | $columns = array( |
282 | - 'ID' => array( 'ID', true ), |
|
283 | - 'amount' => array( 'amount', false ), |
|
284 | - 'date' => array( 'date', false ) |
|
282 | + 'ID' => array('ID', true), |
|
283 | + 'amount' => array('amount', false), |
|
284 | + 'date' => array('date', false) |
|
285 | 285 | ); |
286 | 286 | |
287 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
287 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -310,41 +310,41 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @return string Column Name |
312 | 312 | */ |
313 | - public function column_default( $payment, $column_name ) { |
|
314 | - switch ( $column_name ) { |
|
313 | + public function column_default($payment, $column_name) { |
|
314 | + switch ($column_name) { |
|
315 | 315 | case 'amount' : |
316 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
317 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
316 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
317 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
318 | 318 | break; |
319 | 319 | case 'donation' : |
320 | - $value = '<a href="' . get_permalink( $payment->form_id ) . '">' . $payment->form_title . '</a>'; |
|
321 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
320 | + $value = '<a href="'.get_permalink($payment->form_id).'">'.$payment->form_title.'</a>'; |
|
321 | + $level = give_get_payment_form_title($payment->meta, true); |
|
322 | 322 | |
323 | - if ( ! empty( $level ) ) { |
|
323 | + if ( ! empty($level)) { |
|
324 | 324 | $value .= $level; |
325 | 325 | } |
326 | 326 | |
327 | 327 | break; |
328 | 328 | case 'date' : |
329 | - $date = strtotime( $payment->date ); |
|
330 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
329 | + $date = strtotime($payment->date); |
|
330 | + $value = date_i18n(get_option('date_format'), $date); |
|
331 | 331 | break; |
332 | 332 | case 'status' : |
333 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
334 | - if ( $payment->mode == 'test' ) { |
|
335 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
333 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
334 | + if ($payment->mode == 'test') { |
|
335 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
336 | 336 | } |
337 | 337 | break; |
338 | 338 | case 'details' : |
339 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ) . '" class="give-payment-details-link button button-small">' . esc_html__( 'View Details', 'give' ) . '</a></div>'; |
|
339 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))).'" class="give-payment-details-link button button-small">'.esc_html__('View Details', 'give').'</a></div>'; |
|
340 | 340 | break; |
341 | 341 | default: |
342 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
342 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
343 | 343 | break; |
344 | 344 | |
345 | 345 | } |
346 | 346 | |
347 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
347 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -357,40 +357,40 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return string Data shown in the Email column |
359 | 359 | */ |
360 | - public function column_email( $payment ) { |
|
360 | + public function column_email($payment) { |
|
361 | 361 | |
362 | 362 | $row_actions = array(); |
363 | 363 | |
364 | - $email = give_get_payment_user_email( $payment->ID ); |
|
364 | + $email = give_get_payment_user_email($payment->ID); |
|
365 | 365 | |
366 | 366 | // Add search term string back to base URL |
367 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
368 | - if ( ! empty( $search_terms ) ) { |
|
369 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
367 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
368 | + if ( ! empty($search_terms)) { |
|
369 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
370 | 370 | } |
371 | 371 | |
372 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
373 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
372 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
373 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
374 | 374 | 'give-action' => 'email_links', |
375 | 375 | 'purchase_id' => $payment->ID |
376 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
376 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
380 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
381 | 381 | 'give-action' => 'delete_payment', |
382 | 382 | 'purchase_id' => $payment->ID |
383 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
383 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
384 | 384 | |
385 | - $row_actions = apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
385 | + $row_actions = apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
386 | 386 | |
387 | - if ( empty( $email ) ) { |
|
388 | - $email = esc_html__( '(unknown)', 'give' ); |
|
387 | + if (empty($email)) { |
|
388 | + $email = esc_html__('(unknown)', 'give'); |
|
389 | 389 | } |
390 | 390 | |
391 | - $value = '<span class="give-email-column-value">' . $email . '</span>' . $this->row_actions( $row_actions ); |
|
391 | + $value = '<span class="give-email-column-value">'.$email.'</span>'.$this->row_actions($row_actions); |
|
392 | 392 | |
393 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
393 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * |
404 | 404 | * @return string Displays a checkbox |
405 | 405 | */ |
406 | - public function column_cb( $payment ) { |
|
406 | + public function column_cb($payment) { |
|
407 | 407 | return sprintf( |
408 | 408 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
409 | 409 | 'payment', |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return string Displays a checkbox |
423 | 423 | */ |
424 | - public function column_ID( $payment ) { |
|
425 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
424 | + public function column_ID($payment) { |
|
425 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -435,19 +435,19 @@ discard block |
||
435 | 435 | * |
436 | 436 | * @return string Data shown in the User column |
437 | 437 | */ |
438 | - public function column_donor( $payment ) { |
|
438 | + public function column_donor($payment) { |
|
439 | 439 | |
440 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
440 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
441 | 441 | |
442 | - if ( ! empty( $customer_id ) ) { |
|
443 | - $customer = new Give_Customer( $customer_id ); |
|
444 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
442 | + if ( ! empty($customer_id)) { |
|
443 | + $customer = new Give_Customer($customer_id); |
|
444 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
445 | 445 | } else { |
446 | - $email = give_get_payment_user_email( $payment->ID ); |
|
447 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
446 | + $email = give_get_payment_user_email($payment->ID); |
|
447 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
448 | 448 | } |
449 | 449 | |
450 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
450 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -459,18 +459,18 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function get_bulk_actions() { |
461 | 461 | $actions = array( |
462 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
463 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
464 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
465 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
466 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
467 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
468 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
469 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
470 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
462 | + 'delete' => esc_html__('Delete', 'give'), |
|
463 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
464 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
465 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
466 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
467 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
468 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
469 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
470 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
471 | 471 | ); |
472 | 472 | |
473 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
473 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -481,61 +481,61 @@ discard block |
||
481 | 481 | * @return void |
482 | 482 | */ |
483 | 483 | public function process_bulk_action() { |
484 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
484 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
485 | 485 | $action = $this->current_action(); |
486 | 486 | |
487 | - if ( ! is_array( $ids ) ) { |
|
488 | - $ids = array( $ids ); |
|
487 | + if ( ! is_array($ids)) { |
|
488 | + $ids = array($ids); |
|
489 | 489 | } |
490 | 490 | |
491 | - if ( empty( $action ) ) { |
|
491 | + if (empty($action)) { |
|
492 | 492 | return; |
493 | 493 | } |
494 | 494 | |
495 | - foreach ( $ids as $id ) { |
|
495 | + foreach ($ids as $id) { |
|
496 | 496 | |
497 | 497 | // Detect when a bulk action is being triggered... |
498 | - if ( 'delete' === $this->current_action() ) { |
|
499 | - give_delete_purchase( $id ); |
|
498 | + if ('delete' === $this->current_action()) { |
|
499 | + give_delete_purchase($id); |
|
500 | 500 | } |
501 | 501 | |
502 | - if ( 'set-status-publish' === $this->current_action() ) { |
|
503 | - give_update_payment_status( $id, 'publish' ); |
|
502 | + if ('set-status-publish' === $this->current_action()) { |
|
503 | + give_update_payment_status($id, 'publish'); |
|
504 | 504 | } |
505 | 505 | |
506 | - if ( 'set-status-pending' === $this->current_action() ) { |
|
507 | - give_update_payment_status( $id, 'pending' ); |
|
506 | + if ('set-status-pending' === $this->current_action()) { |
|
507 | + give_update_payment_status($id, 'pending'); |
|
508 | 508 | } |
509 | 509 | |
510 | - if ( 'set-status-refunded' === $this->current_action() ) { |
|
511 | - give_update_payment_status( $id, 'refunded' ); |
|
510 | + if ('set-status-refunded' === $this->current_action()) { |
|
511 | + give_update_payment_status($id, 'refunded'); |
|
512 | 512 | } |
513 | 513 | |
514 | - if ( 'set-status-revoked' === $this->current_action() ) { |
|
515 | - give_update_payment_status( $id, 'revoked' ); |
|
514 | + if ('set-status-revoked' === $this->current_action()) { |
|
515 | + give_update_payment_status($id, 'revoked'); |
|
516 | 516 | } |
517 | 517 | |
518 | - if ( 'set-status-failed' === $this->current_action() ) { |
|
519 | - give_update_payment_status( $id, 'failed' ); |
|
518 | + if ('set-status-failed' === $this->current_action()) { |
|
519 | + give_update_payment_status($id, 'failed'); |
|
520 | 520 | } |
521 | 521 | |
522 | - if ( 'set-status-cancelled' === $this->current_action() ) { |
|
523 | - give_update_payment_status( $id, 'cancelled' ); |
|
522 | + if ('set-status-cancelled' === $this->current_action()) { |
|
523 | + give_update_payment_status($id, 'cancelled'); |
|
524 | 524 | } |
525 | 525 | |
526 | - if ( 'set-status-abandoned' === $this->current_action() ) { |
|
527 | - give_update_payment_status( $id, 'abandoned' ); |
|
526 | + if ('set-status-abandoned' === $this->current_action()) { |
|
527 | + give_update_payment_status($id, 'abandoned'); |
|
528 | 528 | } |
529 | 529 | |
530 | - if ( 'set-status-preapproval' === $this->current_action() ) { |
|
531 | - give_update_payment_status( $id, 'preapproval' ); |
|
530 | + if ('set-status-preapproval' === $this->current_action()) { |
|
531 | + give_update_payment_status($id, 'preapproval'); |
|
532 | 532 | } |
533 | 533 | |
534 | - if ( 'resend-receipt' === $this->current_action() ) { |
|
535 | - give_email_donation_receipt( $id, false ); |
|
534 | + if ('resend-receipt' === $this->current_action()) { |
|
535 | + give_email_donation_receipt($id, false); |
|
536 | 536 | } |
537 | 537 | |
538 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
538 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | } |
@@ -553,27 +553,27 @@ discard block |
||
553 | 553 | |
554 | 554 | $args = array(); |
555 | 555 | |
556 | - if ( isset( $_GET['user'] ) ) { |
|
557 | - $args['user'] = urldecode( $_GET['user'] ); |
|
558 | - } elseif ( isset( $_GET['s'] ) ) { |
|
559 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
560 | - if ( $is_user ) { |
|
561 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
562 | - unset( $args['s'] ); |
|
556 | + if (isset($_GET['user'])) { |
|
557 | + $args['user'] = urldecode($_GET['user']); |
|
558 | + } elseif (isset($_GET['s'])) { |
|
559 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
560 | + if ($is_user) { |
|
561 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
562 | + unset($args['s']); |
|
563 | 563 | } else { |
564 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
564 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
565 | 565 | } |
566 | 566 | } |
567 | 567 | |
568 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
569 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
568 | + if ( ! empty($_GET['start-date'])) { |
|
569 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
570 | 570 | } |
571 | 571 | |
572 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
573 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
572 | + if ( ! empty($_GET['end-date'])) { |
|
573 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
574 | 574 | } |
575 | 575 | |
576 | - $payment_count = give_count_payments( $args ); |
|
576 | + $payment_count = give_count_payments($args); |
|
577 | 577 | $this->complete_count = $payment_count->publish; |
578 | 578 | $this->pending_count = $payment_count->pending; |
579 | 579 | $this->refunded_count = $payment_count->refunded; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $this->cancelled_count = $payment_count->cancelled; |
583 | 583 | $this->abandoned_count = $payment_count->abandoned; |
584 | 584 | |
585 | - foreach ( $payment_count as $count ) { |
|
585 | + foreach ($payment_count as $count) { |
|
586 | 586 | $this->total_count += $count; |
587 | 587 | } |
588 | 588 | } |
@@ -597,26 +597,26 @@ discard block |
||
597 | 597 | public function payments_data() { |
598 | 598 | |
599 | 599 | $per_page = $this->per_page; |
600 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
601 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
602 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
603 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
604 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
605 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
606 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
607 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
608 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
609 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
610 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
611 | - |
|
612 | - if ( ! empty( $search ) ) { |
|
600 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
601 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
602 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
603 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
604 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
605 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
606 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
607 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
608 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
609 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
610 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
611 | + |
|
612 | + if ( ! empty($search)) { |
|
613 | 613 | $status = 'any'; // Force all payment statuses when searching |
614 | 614 | } |
615 | 615 | |
616 | 616 | $args = array( |
617 | 617 | 'output' => 'payments', |
618 | 618 | 'number' => $per_page, |
619 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
619 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
620 | 620 | 'orderby' => $orderby, |
621 | 621 | 'order' => $order, |
622 | 622 | 'user' => $user, |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | 'end_date' => $end_date, |
631 | 631 | ); |
632 | 632 | |
633 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
633 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
634 | 634 | |
635 | 635 | $args['search_in_notes'] = true; |
636 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
636 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
637 | 637 | |
638 | 638 | } |
639 | 639 | |
640 | - $p_query = new Give_Payments_Query( $args ); |
|
640 | + $p_query = new Give_Payments_Query($args); |
|
641 | 641 | |
642 | 642 | return $p_query->get_payments(); |
643 | 643 | |
@@ -657,17 +657,17 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function prepare_items() { |
659 | 659 | |
660 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
660 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
661 | 661 | |
662 | 662 | $columns = $this->get_columns(); |
663 | 663 | $hidden = array(); // No hidden columns |
664 | 664 | $sortable = $this->get_sortable_columns(); |
665 | 665 | $data = $this->payments_data(); |
666 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
666 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
667 | 667 | |
668 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
668 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
669 | 669 | |
670 | - switch ( $status ) { |
|
670 | + switch ($status) { |
|
671 | 671 | case 'publish': |
672 | 672 | $total_items = $this->complete_count; |
673 | 673 | break; |
@@ -694,18 +694,18 @@ discard block |
||
694 | 694 | break; |
695 | 695 | default: |
696 | 696 | // Retrieve the count of the non-default-Give status |
697 | - $count = wp_count_posts( 'give_payment' ); |
|
697 | + $count = wp_count_posts('give_payment'); |
|
698 | 698 | $total_items = $count->{$status}; |
699 | 699 | } |
700 | 700 | |
701 | 701 | $this->items = $data; |
702 | 702 | |
703 | - $this->set_pagination_args( array( |
|
703 | + $this->set_pagination_args(array( |
|
704 | 704 | 'total_items' => $total_items, |
705 | 705 | // WE have to calculate the total number of items |
706 | 706 | 'per_page' => $this->per_page, |
707 | 707 | // WE have to determine how many items to show on a page |
708 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
708 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
709 | 709 | // WE have to calculate the total number of pages |
710 | 710 | ) |
711 | 711 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again', 'give' ), esc_html__( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again', 'give'), esc_html__('Error', 'give')); |
|
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( esc_html__( 'The specified ID does not belong to a payment. Please try again', 'give' ), esc_html__( 'Error', 'give' ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a payment. Please try again', 'give'), esc_html__('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 | - esc_html__( 'Payment %s', 'give' ), |
|
55 | + esc_html__('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="' . esc_attr__( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( '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="'.esc_attr__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('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 esc_html_e( 'Update Payment', 'give' ); ?></span> |
|
78 | + <span><?php esc_html_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 esc_html_e( 'Status:', 'give' ); ?></span> |
|
88 | + <span class="label"><?php esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_e( 'Fees', 'give' ); ?>:</p> |
|
120 | + <p class="strong"><?php esc_html_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 esc_html_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_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
134 | + <span class="label"><?php esc_html_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_decimal(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 esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
156 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_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 esc_html_e( 'Payment Meta', 'give' ); ?></span> |
|
171 | + <span><?php esc_html_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 esc_html_e( 'Gateway:', 'give' ); ?></span> |
|
185 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
184 | + <span class="label"><?php esc_html_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 esc_html_e( 'Key:', 'give' ); ?></span> |
|
193 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
192 | + <span class="label"><?php esc_html_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 esc_html_e( 'IP:', 'give' ); ?></span> |
|
200 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
199 | + <span class="label"><?php esc_html_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 esc_html_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 esc_html_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=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
215 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_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='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
215 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_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 esc_html_e( 'Donation Information', 'give' ); ?></span> |
|
246 | + <span><?php esc_html_e('Donation Information', 'give'); ?></span> |
|
247 | 247 | </h3> |
248 | 248 | |
249 | 249 | <div class="inside"> |
@@ -251,31 +251,31 @@ discard block |
||
251 | 251 | <table style="width:100%;"> |
252 | 252 | <thead> |
253 | 253 | <tr> |
254 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
255 | - <th><?php esc_html_e( 'Donation Form ID', 'give' ) ?></th> |
|
256 | - <th><?php esc_html_e( 'Donation Form Title', 'give' ) ?></th> |
|
257 | - <th><?php esc_html_e( 'Donation Level', 'give' ) ?></th> |
|
258 | - <th><?php esc_html_e( 'Donation Date', 'give' ) ?></th> |
|
259 | - <th><?php esc_html_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 esc_html_e('Donation Form ID', 'give') ?></th> |
|
256 | + <th><?php esc_html_e('Donation Form Title', 'give') ?></th> |
|
257 | + <th><?php esc_html_e('Donation Level', 'give') ?></th> |
|
258 | + <th><?php esc_html_e('Donation Date', 'give') ?></th> |
|
259 | + <th><?php esc_html_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 | - <?php give_get_form_dropdown( array( |
|
269 | + <?php give_get_form_dropdown(array( |
|
270 | 270 | 'id' => $payment_meta['form_id'], |
271 | 271 | 'selected' => $payment_meta['form_id'], |
272 | 272 | 'chosen' => true |
273 | - ), true ); ?> |
|
273 | + ), true); ?> |
|
274 | 274 | </td> |
275 | 275 | <td> |
276 | 276 | <?php |
277 | - if ( empty( give_has_variable_prices( $payment_meta['form_id'] ) ) ) { |
|
278 | - echo esc_html__( 'n/a', 'give' ); |
|
277 | + if (empty(give_has_variable_prices($payment_meta['form_id']))) { |
|
278 | + echo esc_html__('n/a', 'give'); |
|
279 | 279 | } else { |
280 | 280 | // Variable price dropdown options. |
281 | 281 | $variable_price_dropdown_option = array( |
@@ -287,20 +287,20 @@ discard block |
||
287 | 287 | ); |
288 | 288 | |
289 | 289 | // Render variable prices select tag html. |
290 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
290 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
291 | 291 | } |
292 | 292 | ?> |
293 | 293 | </td> |
294 | 294 | <td> |
295 | 295 | <?php |
296 | 296 | //Transaction Date |
297 | - $date_format = get_option( 'date_format' ); |
|
298 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
297 | + $date_format = get_option('date_format'); |
|
298 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
299 | 299 | ?> |
300 | 300 | </td> |
301 | 301 | <td> |
302 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
303 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
302 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
303 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
304 | 304 | |
305 | 305 | </tr> |
306 | 306 | </table> |
@@ -312,64 +312,64 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <!-- /#give-donation-overview --> |
314 | 314 | |
315 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
315 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
316 | 316 | |
317 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
317 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
318 | 318 | |
319 | 319 | |
320 | 320 | <div id="give-customer-details" class="postbox"> |
321 | 321 | <h3 class="hndle"> |
322 | - <span><?php esc_html_e( 'Donor Details', 'give' ); ?></span> |
|
322 | + <span><?php esc_html_e('Donor Details', 'give'); ?></span> |
|
323 | 323 | </h3> |
324 | 324 | |
325 | 325 | <div class="inside give-clearfix"> |
326 | 326 | |
327 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
327 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
328 | 328 | |
329 | 329 | <div class="column-container customer-info"> |
330 | 330 | <div class="column"> |
331 | - <?php echo Give()->html->donor_dropdown( array( |
|
331 | + <?php echo Give()->html->donor_dropdown(array( |
|
332 | 332 | 'selected' => $customer->id, |
333 | 333 | 'name' => 'customer-id' |
334 | - ) ); ?> |
|
334 | + )); ?> |
|
335 | 335 | </div> |
336 | 336 | <div class="column"> |
337 | 337 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
338 | 338 | </div> |
339 | 339 | <div class="column"> |
340 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
341 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
342 | - <a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e( 'View Donor Details', 'give' ); ?>"><?php esc_html_e( 'View Donor Details', 'give' ); ?></a> |
|
340 | + <?php if ( ! empty($customer->id)) : ?> |
|
341 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
342 | + <a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e('View Donor Details', 'give'); ?>"><?php esc_html_e('View Donor Details', 'give'); ?></a> |
|
343 | 343 | | |
344 | 344 | <?php endif; ?> |
345 | - <a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e( 'New Donor', 'give' ); ?>"><?php esc_html_e( 'New Donor', 'give' ); ?></a> |
|
345 | + <a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e('New Donor', 'give'); ?>"><?php esc_html_e('New Donor', 'give'); ?></a> |
|
346 | 346 | </div> |
347 | 347 | </div> |
348 | 348 | |
349 | 349 | <div class="column-container new-customer" style="display: none"> |
350 | 350 | <div class="column"> |
351 | - <label for="give-new-customer-name"><?php esc_html_e( 'Name:', 'give' ); ?></label> |
|
351 | + <label for="give-new-customer-name"><?php esc_html_e('Name:', 'give'); ?></label> |
|
352 | 352 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
353 | 353 | </div> |
354 | 354 | <div class="column"> |
355 | - <label for="give-new-customer-email"><?php esc_html_e( 'Email:', 'give' ); ?></label> |
|
355 | + <label for="give-new-customer-email"><?php esc_html_e('Email:', 'give'); ?></label> |
|
356 | 356 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
357 | 357 | </div> |
358 | 358 | <div class="column"> |
359 | 359 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
360 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
360 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
361 | 361 | </div> |
362 | 362 | <div class="column"> |
363 | 363 | <small> |
364 | - <em>*<?php esc_html_e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
364 | + <em>*<?php esc_html_e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
365 | 365 | </small> |
366 | 366 | </div> |
367 | 367 | </div> |
368 | 368 | |
369 | 369 | <?php |
370 | 370 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
371 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
372 | - do_action( 'give_payment_view_details', $payment_id ); |
|
371 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
372 | + do_action('give_payment_view_details', $payment_id); |
|
373 | 373 | ?> |
374 | 374 | |
375 | 375 | </div> |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | <div id="give-billing-details" class="postbox"> |
382 | 382 | <h3 class="hndle"> |
383 | - <span><?php esc_html_e( 'Billing Address', 'give' ); ?></span> |
|
383 | + <span><?php esc_html_e('Billing Address', 'give'); ?></span> |
|
384 | 384 | </h3> |
385 | 385 | |
386 | 386 | <div class="inside give-clearfix"> |
@@ -391,62 +391,62 @@ discard block |
||
391 | 391 | <div class="data column-container"> |
392 | 392 | <div class="column"> |
393 | 393 | <div class="give-wrap-address-line1"> |
394 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Street Address Line 1:', 'give' ); ?></label> |
|
395 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
394 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Street Address Line 1:', 'give'); ?></label> |
|
395 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="give-wrap-address-line2"> |
399 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Street Address Line 2:', 'give' ); ?></label> |
|
400 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
399 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Street Address Line 2:', 'give'); ?></label> |
|
400 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
401 | 401 | </div> |
402 | 402 | |
403 | 403 | </div> |
404 | 404 | <div class="column"> |
405 | 405 | <div class="give-wrap-address-city"> |
406 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
407 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
406 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
407 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
408 | 408 | |
409 | 409 | </div> |
410 | 410 | |
411 | 411 | <div class="give-wrap-address-zip"> |
412 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
413 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
412 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
413 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
414 | 414 | |
415 | 415 | </div> |
416 | 416 | </div> |
417 | 417 | <div class="column"> |
418 | 418 | <div id="give-order-address-country-wrap"> |
419 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
419 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
420 | 420 | <?php |
421 | - echo Give()->html->select( array( |
|
421 | + echo Give()->html->select(array( |
|
422 | 422 | 'options' => give_get_country_list(), |
423 | 423 | 'name' => 'give-payment-address[0][country]', |
424 | 424 | 'selected' => $address['country'], |
425 | 425 | 'show_option_all' => false, |
426 | 426 | 'show_option_none' => false, |
427 | 427 | 'chosen' => true, |
428 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ) |
|
429 | - ) ); |
|
428 | + 'placeholder' => esc_attr__('Select a country', 'give') |
|
429 | + )); |
|
430 | 430 | ?> |
431 | 431 | </div> |
432 | 432 | |
433 | 433 | <div id="give-order-address-state-wrap"> |
434 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
434 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
435 | 435 | <?php |
436 | - $states = give_get_states( $address['country'] ); |
|
437 | - if ( ! empty( $states ) ) { |
|
438 | - echo Give()->html->select( array( |
|
436 | + $states = give_get_states($address['country']); |
|
437 | + if ( ! empty($states)) { |
|
438 | + echo Give()->html->select(array( |
|
439 | 439 | 'options' => $states, |
440 | 440 | 'name' => 'give-payment-address[0][state]', |
441 | 441 | 'selected' => $address['state'], |
442 | 442 | 'show_option_all' => false, |
443 | 443 | 'show_option_none' => false, |
444 | 444 | 'chosen' => true, |
445 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ) |
|
446 | - ) ); |
|
445 | + 'placeholder' => esc_attr__('Select a state', 'give') |
|
446 | + )); |
|
447 | 447 | } else { |
448 | 448 | ?> |
449 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
449 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
450 | 450 | <?php |
451 | 451 | } ?> |
452 | 452 | </div> |
@@ -456,38 +456,38 @@ discard block |
||
456 | 456 | </div> |
457 | 457 | <!-- /#give-order-address --> |
458 | 458 | |
459 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
459 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
460 | 460 | |
461 | 461 | </div> |
462 | 462 | <!-- /.inside --> |
463 | 463 | </div> |
464 | 464 | <!-- /#give-billing-details --> |
465 | 465 | |
466 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
466 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
467 | 467 | |
468 | 468 | <div id="give-payment-notes" class="postbox"> |
469 | - <h3 class="hndle"><span><?php esc_html_e( 'Payment Notes', 'give' ); ?></span></h3> |
|
469 | + <h3 class="hndle"><span><?php esc_html_e('Payment Notes', 'give'); ?></span></h3> |
|
470 | 470 | |
471 | 471 | <div class="inside"> |
472 | 472 | <div id="give-payment-notes-inner"> |
473 | 473 | <?php |
474 | - $notes = give_get_payment_notes( $payment_id ); |
|
475 | - if ( ! empty( $notes ) ) : |
|
474 | + $notes = give_get_payment_notes($payment_id); |
|
475 | + if ( ! empty($notes)) : |
|
476 | 476 | $no_notes_display = ' style="display:none;"'; |
477 | - foreach ( $notes as $note ) : |
|
477 | + foreach ($notes as $note) : |
|
478 | 478 | |
479 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
479 | + echo give_get_payment_note_html($note, $payment_id); |
|
480 | 480 | |
481 | 481 | endforeach; |
482 | 482 | else : |
483 | 483 | $no_notes_display = ''; |
484 | 484 | endif; |
485 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No payment notes', 'give' ) . '</p>'; ?> |
|
485 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No payment notes', 'give').'</p>'; ?> |
|
486 | 486 | </div> |
487 | 487 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
488 | 488 | |
489 | 489 | <div class="give-clearfix"> |
490 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
490 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
491 | 491 | </div> |
492 | 492 | |
493 | 493 | </div> |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | </div> |
496 | 496 | <!-- /#give-payment-notes --> |
497 | 497 | |
498 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
498 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
499 | 499 | </div> |
500 | 500 | <!-- /#normal-sortables --> |
501 | 501 | </div> |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | <!-- #give-dashboard-widgets-wrap --> |
507 | 507 | </div> |
508 | 508 | <!-- /#post-stuff --> |
509 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
510 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
511 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
509 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
510 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
511 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
512 | 512 | <input type="hidden" name="give_action" value="update_payment_details"/> |
513 | 513 | </form> |
514 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
514 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
515 | 515 | </div><!-- /.wrap --> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views |
25 | 25 | */ |
26 | -function give_register_default_customer_views( $views ) { |
|
26 | +function give_register_default_customer_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_customer_notes_view' |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_customer_tabs( $tabs ) { |
|
49 | +function give_register_default_customer_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ), |
|
53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) ) |
|
52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')), |
|
53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give')) |
|
54 | 54 | ); |
55 | 55 | |
56 | - return array_merge( $tabs, $default_tabs ); |
|
56 | + return array_merge($tabs, $default_tabs); |
|
57 | 57 | } |
58 | 58 | |
59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
69 | 69 | */ |
70 | -function give_register_delete_customer_tab( $tabs ) { |
|
70 | +function give_register_delete_customer_tab($tabs) { |
|
71 | 71 | |
72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) ); |
|
72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give')); |
|
73 | 73 | |
74 | 74 | return $tabs; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |
@@ -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 esc_html_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 esc_html_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( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
80 | + $customers_table->search_box(esc_html__('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', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
108 | + if ( ! current_user_can($customer_view_role)) { |
|
109 | + give_set_error('give-no-access', esc_html__('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', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
114 | + give_set_error('give-invalid_customer', esc_html__('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', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
121 | + if (empty($customer->id)) { |
|
122 | + give_set_error('give-invalid_customer', esc_html__('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 esc_attr_e( $tab['title'] ); ?>" aria-label="<?php esc_attr_e( $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 esc_attr_e($tab['title']); ?>" aria-label="<?php esc_attr_e($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 esc_html_e( $tab['title'] ); ?> |
|
151 | - <?php if ( ! $active ) : ?> |
|
150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($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,20 +198,20 @@ 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 id="customer-name-wrap" class="left"> |
205 | 205 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
206 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
206 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
207 | 207 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
208 | 208 | </div> |
209 | 209 | <p class="customer-since info-item"> |
210 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
211 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
210 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
211 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
212 | 212 | </p> |
213 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
214 | - <a title="<?php esc_attr_e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
213 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
214 | + <a title="<?php esc_attr_e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
215 | 215 | <?php endif; ?> |
216 | 216 | </div> |
217 | 217 | <!-- /donor-bio-header --> |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | <table class="widefat"> |
222 | 222 | <tbody> |
223 | 223 | <tr> |
224 | - <td><label for="tablecell"><?php esc_html_e( 'Email', 'give' ); ?></label>:</td> |
|
224 | + <td><label for="tablecell"><?php esc_html_e('Email', 'give'); ?></label>:</td> |
|
225 | 225 | <td class="row-title"> |
226 | - <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 esc_attr_e( 'Donor Email', 'give' ); ?>" /></span> |
|
226 | + <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 esc_attr_e('Donor Email', 'give'); ?>" /></span> |
|
227 | 227 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
228 | 228 | </td> |
229 | 229 | </tr> |
230 | 230 | <tr class="alternate"> |
231 | - <td><label for="tablecell"><?php esc_html_e( 'User ID', 'give' ); ?></label>:</td> |
|
231 | + <td><label for="tablecell"><?php esc_html_e('User ID', 'give'); ?></label>:</td> |
|
232 | 232 | <td class="row-title"> |
233 | 233 | <span class="customer-user-id info-item edit-item"> |
234 | 234 | <?php |
@@ -244,38 +244,38 @@ discard block |
||
244 | 244 | 'data' => $data_atts, |
245 | 245 | ); |
246 | 246 | |
247 | - if ( ! empty( $user_id ) ) { |
|
248 | - $userdata = get_userdata( $user_id ); |
|
247 | + if ( ! empty($user_id)) { |
|
248 | + $userdata = get_userdata($user_id); |
|
249 | 249 | $user_args['value'] = $userdata->user_login; |
250 | 250 | } |
251 | 251 | |
252 | - echo Give()->html->ajax_user_search( $user_args ); |
|
252 | + echo Give()->html->ajax_user_search($user_args); |
|
253 | 253 | ?> |
254 | 254 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
255 | 255 | </span> |
256 | 256 | |
257 | 257 | <span class="customer-user-id info-item editable"> |
258 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
258 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
259 | 259 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
260 | 260 | <?php else : ?> |
261 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
261 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
262 | 262 | <?php endif; ?> |
263 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
264 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
263 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
264 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
265 | 265 | <?php endif; ?> |
266 | 266 | </span> |
267 | 267 | </td> |
268 | 268 | </tr> |
269 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
269 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
270 | 270 | |
271 | 271 | <tr> |
272 | - <td><?php esc_html_e( 'Address', 'give' ); ?>:</td> |
|
272 | + <td><?php esc_html_e('Address', 'give'); ?>:</td> |
|
273 | 273 | <td class="row-title"> |
274 | 274 | |
275 | 275 | <div class="customer-address-wrapper"> |
276 | 276 | |
277 | 277 | <?php |
278 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
278 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
279 | 279 | $defaults = array( |
280 | 280 | 'line1' => '', |
281 | 281 | 'line2' => '', |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | 'zip' => '' |
286 | 286 | ); |
287 | 287 | |
288 | - $address = wp_parse_args( $address, $defaults ); |
|
288 | + $address = wp_parse_args($address, $defaults); |
|
289 | 289 | ?> |
290 | 290 | |
291 | - <?php if ( ! empty( $address ) ) { ?> |
|
291 | + <?php if ( ! empty($address)) { ?> |
|
292 | 292 | <span class="customer-address info-item editable"> |
293 | 293 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
294 | 294 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -299,38 +299,38 @@ discard block |
||
299 | 299 | </span> |
300 | 300 | <?php } ?> |
301 | 301 | <span class="customer-address info-item edit-item"> |
302 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
303 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
304 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
302 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
303 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
304 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
305 | 305 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
306 | 306 | <?php |
307 | 307 | |
308 | 308 | $selected_country = $address['country']; |
309 | 309 | |
310 | 310 | $countries = give_get_country_list(); |
311 | - foreach ( $countries as $country_code => $country ) { |
|
312 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
311 | + foreach ($countries as $country_code => $country) { |
|
312 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
313 | 313 | } |
314 | 314 | ?> |
315 | 315 | </select> |
316 | 316 | <?php |
317 | 317 | $selected_state = give_get_state(); |
318 | - $states = give_get_states( $selected_country ); |
|
318 | + $states = give_get_states($selected_country); |
|
319 | 319 | |
320 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
320 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
321 | 321 | |
322 | - if ( ! empty( $states ) ) : ?> |
|
322 | + if ( ! empty($states)) : ?> |
|
323 | 323 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
324 | 324 | <?php |
325 | - foreach ( $states as $state_code => $state ) { |
|
326 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
325 | + foreach ($states as $state_code => $state) { |
|
326 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
327 | 327 | } |
328 | 328 | ?> |
329 | 329 | </select> |
330 | 330 | <?php else : ?> |
331 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
331 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
332 | 332 | <?php endif; ?> |
333 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
333 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
334 | 334 | </span> |
335 | 335 | |
336 | 336 | </div> |
@@ -348,112 +348,112 @@ discard block |
||
348 | 348 | |
349 | 349 | <span id="customer-edit-actions" class="edit-item"> |
350 | 350 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
351 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
351 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
352 | 352 | <input type="hidden" name="give_action" value="edit-customer" /> |
353 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
354 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
353 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
354 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
355 | 355 | </span> |
356 | 356 | |
357 | 357 | </form> |
358 | 358 | </div> |
359 | 359 | |
360 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
360 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
361 | 361 | |
362 | 362 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
363 | 363 | <ul> |
364 | 364 | <li> |
365 | - <a title="<?php esc_attr_e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
365 | + <a title="<?php esc_attr_e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
366 | 366 | <span class="dashicons dashicons-heart"></span> |
367 | 367 | <?php |
368 | 368 | //Completed Donations |
369 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
370 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
369 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
370 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
371 | 371 | ?> |
372 | 372 | </a> |
373 | 373 | </li> |
374 | 374 | <li> |
375 | 375 | <span class="dashicons dashicons-chart-area"></span> |
376 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
376 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
377 | 377 | </li> |
378 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
378 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
379 | 379 | </ul> |
380 | 380 | </div> |
381 | 381 | |
382 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
382 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
383 | 383 | |
384 | 384 | <div id="customer-tables-wrapper" class="customer-section"> |
385 | 385 | |
386 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
386 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
387 | 387 | |
388 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
388 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
389 | 389 | <?php |
390 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
391 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
392 | - $payments = array_slice( $payments, 0, 10 ); |
|
390 | + $payment_ids = explode(',', $customer->payment_ids); |
|
391 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
392 | + $payments = array_slice($payments, 0, 10); |
|
393 | 393 | ?> |
394 | 394 | <table class="wp-list-table widefat striped payments"> |
395 | 395 | <thead> |
396 | 396 | <tr> |
397 | - <th><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
398 | - <th><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
399 | - <th><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
400 | - <th><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
401 | - <th><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
397 | + <th><?php esc_html_e('ID', 'give'); ?></th> |
|
398 | + <th><?php esc_html_e('Amount', 'give'); ?></th> |
|
399 | + <th><?php esc_html_e('Date', 'give'); ?></th> |
|
400 | + <th><?php esc_html_e('Status', 'give'); ?></th> |
|
401 | + <th><?php esc_html_e('Actions', 'give'); ?></th> |
|
402 | 402 | </tr> |
403 | 403 | </thead> |
404 | 404 | <tbody> |
405 | - <?php if ( ! empty( $payments ) ) : ?> |
|
406 | - <?php foreach ( $payments as $payment ) : ?> |
|
405 | + <?php if ( ! empty($payments)) : ?> |
|
406 | + <?php foreach ($payments as $payment) : ?> |
|
407 | 407 | <tr> |
408 | 408 | <td><?php echo $payment->ID; ?></td> |
409 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
410 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
411 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
409 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
410 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
411 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
412 | 412 | <td> |
413 | - <a title="<?php esc_attr_e( 'View Details for Donation', 'give' ); |
|
414 | - 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 ); ?>"> |
|
415 | - <?php esc_html_e( 'View Details', 'give' ); ?> |
|
413 | + <a title="<?php esc_attr_e('View Details for Donation', 'give'); |
|
414 | + 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); ?>"> |
|
415 | + <?php esc_html_e('View Details', 'give'); ?> |
|
416 | 416 | </a> |
417 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
417 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
418 | 418 | </td> |
419 | 419 | </tr> |
420 | 420 | <?php endforeach; ?> |
421 | 421 | <?php else: ?> |
422 | 422 | <tr> |
423 | - <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); ?></td> |
|
423 | + <td colspan="5"><?php esc_html_e('No Donations Found', 'give'); ?></td> |
|
424 | 424 | </tr> |
425 | 425 | <?php endif; ?> |
426 | 426 | </tbody> |
427 | 427 | </table> |
428 | 428 | |
429 | - <h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3> |
|
429 | + <h3><?php esc_html_e('Completed Donations', 'give'); ?></h3> |
|
430 | 430 | <?php |
431 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
431 | + $donations = give_get_users_completed_donations($customer->email); |
|
432 | 432 | ?> |
433 | 433 | <table class="wp-list-table widefat striped donations"> |
434 | 434 | <thead> |
435 | 435 | <tr> |
436 | 436 | <th><?php echo give_get_forms_label_singular(); ?></th> |
437 | - <th width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
437 | + <th width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
438 | 438 | </tr> |
439 | 439 | </thead> |
440 | 440 | <tbody> |
441 | - <?php if ( ! empty( $donations ) ) : ?> |
|
442 | - <?php foreach ( $donations as $donation ) : ?> |
|
441 | + <?php if ( ! empty($donations)) : ?> |
|
442 | + <?php foreach ($donations as $donation) : ?> |
|
443 | 443 | <tr> |
444 | 444 | <td><?php echo $donation->post_title; ?></td> |
445 | 445 | <td> |
446 | 446 | <a title="<?php |
447 | 447 | printf( |
448 | 448 | /* translators: %s: post title */ |
449 | - esc_attr__( 'View %s', 'give' ), |
|
449 | + esc_attr__('View %s', 'give'), |
|
450 | 450 | $donation->post_title |
451 | - ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); |
|
451 | + ); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); |
|
452 | 452 | ?>"> |
453 | 453 | <?php |
454 | 454 | printf( |
455 | 455 | /* translators: %s: forms singular label */ |
456 | - esc_html__( 'View %s', 'give' ), |
|
456 | + esc_html__('View %s', 'give'), |
|
457 | 457 | give_get_forms_label_singular() |
458 | 458 | ); |
459 | 459 | ?> |
@@ -463,17 +463,17 @@ discard block |
||
463 | 463 | <?php endforeach; ?> |
464 | 464 | <?php else: ?> |
465 | 465 | <tr> |
466 | - <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td> |
|
466 | + <td colspan="2"><?php esc_html_e('No Completed Donations Found', 'give'); ?></td> |
|
467 | 467 | </tr> |
468 | 468 | <?php endif; ?> |
469 | 469 | </tbody> |
470 | 470 | </table> |
471 | 471 | |
472 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
472 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
473 | 473 | |
474 | 474 | </div> |
475 | 475 | |
476 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
476 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
477 | 477 | |
478 | 478 | <?php |
479 | 479 | } |
@@ -487,30 +487,30 @@ discard block |
||
487 | 487 | * |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_customer_notes_view( $customer ) { |
|
490 | +function give_customer_notes_view($customer) { |
|
491 | 491 | |
492 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
493 | - $paged = absint( $paged ); |
|
492 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
493 | + $paged = absint($paged); |
|
494 | 494 | $note_count = $customer->get_notes_count(); |
495 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
496 | - $total_pages = ceil( $note_count / $per_page ); |
|
497 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
495 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
496 | + $total_pages = ceil($note_count / $per_page); |
|
497 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
498 | 498 | ?> |
499 | 499 | |
500 | 500 | <div id="customer-notes-wrapper"> |
501 | 501 | <div class="customer-notes-header"> |
502 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
502 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
503 | 503 | </div> |
504 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
504 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
505 | 505 | |
506 | - <?php if ( 1 == $paged ) : ?> |
|
506 | + <?php if (1 == $paged) : ?> |
|
507 | 507 | <div style="display: block; margin-bottom: 55px;"> |
508 | - <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 ); ?>"> |
|
508 | + <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); ?>"> |
|
509 | 509 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
510 | 510 | <br /> |
511 | 511 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
512 | 512 | <input type="hidden" name="give_action" value="add-customer-note" /> |
513 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
513 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
514 | 514 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
515 | 515 | </form> |
516 | 516 | </div> |
@@ -525,46 +525,46 @@ discard block |
||
525 | 525 | 'show_all' => true |
526 | 526 | ); |
527 | 527 | |
528 | - echo paginate_links( $pagination_args ); |
|
528 | + echo paginate_links($pagination_args); |
|
529 | 529 | ?> |
530 | 530 | |
531 | 531 | <div id="give-customer-notes" class="postbox"> |
532 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
533 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
532 | + <?php if (count($customer_notes) > 0) : ?> |
|
533 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
534 | 534 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
535 | 535 | <span class="note-content-wrap"> |
536 | - <?php echo stripslashes( $note ); ?> |
|
536 | + <?php echo stripslashes($note); ?> |
|
537 | 537 | </span> |
538 | 538 | </div> |
539 | 539 | <?php endforeach; ?> |
540 | 540 | <?php else: ?> |
541 | 541 | <div class="give-no-customer-notes"> |
542 | - <?php esc_html_e( 'No Donor Notes', 'give' ); ?> |
|
542 | + <?php esc_html_e('No Donor Notes', 'give'); ?> |
|
543 | 543 | </div> |
544 | 544 | <?php endif; ?> |
545 | 545 | </div> |
546 | 546 | |
547 | - <?php echo paginate_links( $pagination_args ); ?> |
|
547 | + <?php echo paginate_links($pagination_args); ?> |
|
548 | 548 | |
549 | 549 | </div> |
550 | 550 | |
551 | 551 | <?php |
552 | 552 | } |
553 | 553 | |
554 | -function give_customers_delete_view( $customer ) { |
|
554 | +function give_customers_delete_view($customer) { |
|
555 | 555 | |
556 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
556 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
557 | 557 | |
558 | 558 | ?> |
559 | 559 | |
560 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
560 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
561 | 561 | |
562 | 562 | <div class="info-wrapper customer-section"> |
563 | 563 | |
564 | - <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 ); ?>"> |
|
564 | + <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); ?>"> |
|
565 | 565 | |
566 | 566 | <div class="customer-notes-header"> |
567 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
567 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
568 | 568 | </div> |
569 | 569 | |
570 | 570 | |
@@ -572,27 +572,27 @@ discard block |
||
572 | 572 | |
573 | 573 | <span class="delete-customer-options"> |
574 | 574 | <p> |
575 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
576 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
575 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
576 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
577 | 577 | </p> |
578 | 578 | |
579 | 579 | <p> |
580 | - <?php echo Give()->html->checkbox( array( |
|
580 | + <?php echo Give()->html->checkbox(array( |
|
581 | 581 | 'name' => 'give-customer-delete-records', |
582 | - 'options' => array( 'disabled' => true ) |
|
583 | - ) ); ?> |
|
584 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
582 | + 'options' => array('disabled' => true) |
|
583 | + )); ?> |
|
584 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label> |
|
585 | 585 | </p> |
586 | 586 | |
587 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
587 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
588 | 588 | </span> |
589 | 589 | |
590 | 590 | <span id="customer-edit-actions"> |
591 | 591 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
592 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
592 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
593 | 593 | <input type="hidden" name="give_action" value="delete-customer" /> |
594 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
595 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
594 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
595 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
596 | 596 | </span> |
597 | 597 | |
598 | 598 | </div> |
@@ -602,5 +602,5 @@ discard block |
||
602 | 602 | |
603 | 603 | <?php |
604 | 604 | |
605 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
605 | + do_action('give_customer_delete_bottom', $customer); |
|
606 | 606 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function search_box( $text, $input_id ) { |
|
85 | - $input_id = $input_id . '-search-input'; |
|
84 | + public function search_box($text, $input_id) { |
|
85 | + $input_id = $input_id.'-search-input'; |
|
86 | 86 | |
87 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
88 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
87 | + if ( ! empty($_REQUEST['orderby'])) { |
|
88 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
89 | 89 | } |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box"> |
95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
97 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
97 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
98 | 98 | </p> |
99 | 99 | <?php |
100 | 100 | } |
@@ -110,42 +110,42 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | - $value = '<a href="' . |
|
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
117 | + $value = '<a href="'. |
|
118 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
119 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
123 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
123 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case 'date_created' : |
127 | - $value = date_i18n( get_option( 'date_format' ), strtotime( $item['date_created'] ) ); |
|
127 | + $value = date_i18n(get_option('date_format'), strtotime($item['date_created'])); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | default: |
131 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
131 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
132 | 132 | break; |
133 | 133 | } |
134 | 134 | |
135 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
135 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
139 | - public function column_name( $item ) { |
|
140 | - $name = '#' . $item['id'] . ' '; |
|
141 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
142 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
139 | + public function column_name($item) { |
|
140 | + $name = '#'.$item['id'].' '; |
|
141 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
142 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
143 | 143 | $actions = array( |
144 | - 'view' => sprintf( '<a href="%1$s">%2$s</a>', $view_url, esc_html__( 'View Donor', 'give' ) ), |
|
145 | - 'delete' => sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), esc_html__( 'Delete', 'give' ) ) |
|
144 | + 'view' => sprintf('<a href="%1$s">%2$s</a>', $view_url, esc_html__('View Donor', 'give')), |
|
145 | + 'delete' => sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), esc_html__('Delete', 'give')) |
|
146 | 146 | ); |
147 | 147 | |
148 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
148 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function get_columns() { |
159 | 159 | $columns = array( |
160 | - 'name' => esc_html__( 'Name', 'give' ), |
|
161 | - 'email' => esc_html__( 'Email', 'give' ), |
|
162 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
163 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
164 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
160 | + 'name' => esc_html__('Name', 'give'), |
|
161 | + 'email' => esc_html__('Email', 'give'), |
|
162 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
163 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
164 | + 'date_created' => esc_html__('Date Created', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
167 | + return apply_filters('give_report_customer_columns', $columns); |
|
168 | 168 | |
169 | 169 | } |
170 | 170 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function get_sortable_columns() { |
179 | 179 | return array( |
180 | - 'date_created' => array( 'date_created', true ), |
|
181 | - 'name' => array( 'name', true ), |
|
182 | - 'num_purchases' => array( 'purchase_count', false ), |
|
183 | - 'amount_spent' => array( 'purchase_value', false ), |
|
180 | + 'date_created' => array('date_created', true), |
|
181 | + 'name' => array('name', true), |
|
182 | + 'num_purchases' => array('purchase_count', false), |
|
183 | + 'amount_spent' => array('purchase_value', false), |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @since 1.0 |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function bulk_actions( $which = '' ) { |
|
194 | + public function bulk_actions($which = '') { |
|
195 | 195 | // These aren't really bulk actions but this outputs the markup in the right place |
196 | 196 | } |
197 | 197 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return int Current page number |
204 | 204 | */ |
205 | 205 | public function get_paged() { |
206 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
206 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return mixed string If search is present, false otherwise |
215 | 215 | */ |
216 | 216 | public function get_search() { |
217 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
217 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | |
232 | 232 | $data = array(); |
233 | 233 | $paged = $this->get_paged(); |
234 | - $offset = $this->per_page * ( $paged - 1 ); |
|
234 | + $offset = $this->per_page * ($paged - 1); |
|
235 | 235 | $search = $this->get_search(); |
236 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
237 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
236 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
237 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
238 | 238 | |
239 | 239 | $args = array( |
240 | 240 | 'number' => $this->per_page, |
@@ -243,21 +243,21 @@ discard block |
||
243 | 243 | 'orderby' => $orderby |
244 | 244 | ); |
245 | 245 | |
246 | - if ( is_email( $search ) ) { |
|
246 | + if (is_email($search)) { |
|
247 | 247 | $args['email'] = $search; |
248 | - } elseif ( is_numeric( $search ) ) { |
|
248 | + } elseif (is_numeric($search)) { |
|
249 | 249 | $args['id'] = $search; |
250 | 250 | } else { |
251 | 251 | $args['name'] = $search; |
252 | 252 | } |
253 | 253 | |
254 | - $customers = Give()->customers->get_customers( $args ); |
|
254 | + $customers = Give()->customers->get_customers($args); |
|
255 | 255 | |
256 | - if ( $customers ) { |
|
256 | + if ($customers) { |
|
257 | 257 | |
258 | - foreach ( $customers as $customer ) { |
|
258 | + foreach ($customers as $customer) { |
|
259 | 259 | |
260 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
260 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
261 | 261 | |
262 | 262 | $data[] = array( |
263 | 263 | 'id' => $customer->id, |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | $hidden = array(); // No hidden columns |
292 | 292 | $sortable = $this->get_sortable_columns(); |
293 | 293 | |
294 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
294 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
295 | 295 | |
296 | 296 | $this->items = $this->reports_data(); |
297 | 297 | |
298 | 298 | $this->total = give_count_total_customers(); |
299 | 299 | |
300 | - $this->set_pagination_args( array( |
|
300 | + $this->set_pagination_args(array( |
|
301 | 301 | 'total_items' => $this->total, |
302 | 302 | 'per_page' => $this->per_page, |
303 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
304 | - ) ); |
|
303 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
304 | + )); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | \ No newline at end of file |