@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,82 +25,82 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( give_date_format() ) |
|
44 | + esc_html__('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(give_date_format()) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | 50 | $pdf = new give_pdf(); |
51 | - $pdf->AddPage( 'L', 'A4' ); |
|
51 | + $pdf->AddPage('L', 'A4'); |
|
52 | 52 | |
53 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
54 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
55 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
53 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
54 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
55 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
56 | 56 | |
57 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
57 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
58 | 58 | |
59 | - $pdf->SetMargins( 8, 8, 8 ); |
|
60 | - $pdf->SetX( 8 ); |
|
59 | + $pdf->SetMargins(8, 8, 8); |
|
60 | + $pdf->SetX(8); |
|
61 | 61 | |
62 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
63 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
64 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
62 | + $pdf->SetFont('Helvetica', '', 16); |
|
63 | + $pdf->SetTextColor(50, 50, 50); |
|
64 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
65 | 65 | |
66 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
66 | + $pdf->SetFont('Helvetica', '', 13); |
|
67 | 67 | $pdf->Ln(); |
68 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
69 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
68 | + $pdf->SetTextColor(150, 150, 150); |
|
69 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
70 | 70 | $pdf->Ln(); |
71 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
72 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
73 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
74 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
71 | + $pdf->SetTextColor(50, 50, 50); |
|
72 | + $pdf->SetFont('Helvetica', '', 14); |
|
73 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
74 | + $pdf->SetFont('Helvetica', '', 12); |
|
75 | 75 | |
76 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
77 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
78 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
79 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
80 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
81 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
82 | - $pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
76 | + $pdf->SetFillColor(238, 238, 238); |
|
77 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
78 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
79 | + $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
80 | + $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
81 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
82 | + $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
83 | 83 | |
84 | - $year = date( 'Y' ); |
|
85 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
84 | + $year = date('Y'); |
|
85 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
86 | 86 | |
87 | - if ( $give_forms ) { |
|
88 | - $pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) ); |
|
87 | + if ($give_forms) { |
|
88 | + $pdf->SetWidths(array(70, 30, 50, 50, 45, 35)); |
|
89 | 89 | |
90 | - foreach ( $give_forms as $form ): |
|
91 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
90 | + foreach ($give_forms as $form): |
|
91 | + $pdf->SetFillColor(255, 255, 255); |
|
92 | 92 | |
93 | 93 | $title = $form->post_title; |
94 | 94 | |
95 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
95 | + if (give_has_variable_prices($form->ID)) { |
|
96 | 96 | |
97 | - $prices = give_get_variable_prices( $form->ID ); |
|
97 | + $prices = give_get_variable_prices($form->ID); |
|
98 | 98 | |
99 | 99 | $first = $prices[0]['_give_amount']; |
100 | - $last = array_pop( $prices ); |
|
100 | + $last = array_pop($prices); |
|
101 | 101 | $last = $last['_give_amount']; |
102 | 102 | |
103 | - if ( $first < $last ) { |
|
103 | + if ($first < $last) { |
|
104 | 104 | $min = $first; |
105 | 105 | $max = $last; |
106 | 106 | } else { |
@@ -108,51 +108,51 @@ 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 ) ); |
|
136 | - $title = utf8_decode( esc_html__( 'No forms found.', 'give' ) ); |
|
137 | - $pdf->Row( array( $title ) ); |
|
135 | + $pdf->SetWidths(array(280)); |
|
136 | + $title = utf8_decode(esc_html__('No forms found.', 'give')); |
|
137 | + $pdf->Row(array($title)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $pdf->Ln(); |
141 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
142 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
143 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
144 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
145 | - |
|
146 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
147 | - $image = str_replace( ' ', '%20', $image ); |
|
148 | - |
|
149 | - $pdf->SetX( 25 ); |
|
150 | - $pdf->Image( $image . '&file=.png' ); |
|
151 | - $pdf->Ln( 7 ); |
|
152 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
141 | + $pdf->SetTextColor(50, 50, 50); |
|
142 | + $pdf->SetFont('Helvetica', '', 14); |
|
143 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
144 | + $pdf->SetFont('Helvetica', '', 12); |
|
145 | + |
|
146 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
147 | + $image = str_replace(' ', '%20', $image); |
|
148 | + |
|
149 | + $pdf->SetX(25); |
|
150 | + $pdf->Image($image.'&file=.png'); |
|
151 | + $pdf->Ln(7); |
|
152 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
153 | 153 | } |
154 | 154 | |
155 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
155 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Draws Chart for PDF Report. |
@@ -169,38 +169,38 @@ discard block |
||
169 | 169 | * @return string $chart->getUrl() URL for the Google Chart |
170 | 170 | */ |
171 | 171 | function give_draw_chart_image() { |
172 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
173 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
174 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
172 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
173 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
174 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
175 | 175 | |
176 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
176 | + $chart = new GoogleChart('lc', 900, 330); |
|
177 | 177 | |
178 | 178 | $i = 1; |
179 | 179 | $earnings = ""; |
180 | 180 | $sales = ""; |
181 | 181 | |
182 | - while ( $i <= 12 ) : |
|
183 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
184 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
185 | - $i ++; |
|
182 | + while ($i <= 12) : |
|
183 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
184 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
185 | + $i++; |
|
186 | 186 | endwhile; |
187 | 187 | |
188 | - $earnings_array = explode( ",", $earnings ); |
|
189 | - $sales_array = explode( ",", $sales ); |
|
188 | + $earnings_array = explode(",", $earnings); |
|
189 | + $sales_array = explode(",", $sales); |
|
190 | 190 | |
191 | 191 | $i = 0; |
192 | - while ( $i <= 11 ) { |
|
193 | - if ( empty( $sales_array[ $i ] ) ) { |
|
194 | - $sales_array[ $i ] = 0; |
|
192 | + while ($i <= 11) { |
|
193 | + if (empty($sales_array[$i])) { |
|
194 | + $sales_array[$i] = 0; |
|
195 | 195 | } |
196 | - $i ++; |
|
196 | + $i++; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $min_earnings = 0; |
200 | - $max_earnings = max( $earnings_array ); |
|
201 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
200 | + $max_earnings = max($earnings_array); |
|
201 | + $earnings_scale = round($max_earnings, - 1); |
|
202 | 202 | |
203 | - $data = new GoogleChartData( array( |
|
203 | + $data = new GoogleChartData(array( |
|
204 | 204 | $earnings_array[0], |
205 | 205 | $earnings_array[1], |
206 | 206 | $earnings_array[2], |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | $earnings_array[9], |
214 | 214 | $earnings_array[10], |
215 | 215 | $earnings_array[11] |
216 | - ) ); |
|
216 | + )); |
|
217 | 217 | |
218 | - $data->setLegend( esc_html__( 'Income', 'give' ) ); |
|
219 | - $data->setColor( '1b58a3' ); |
|
220 | - $chart->addData( $data ); |
|
218 | + $data->setLegend(esc_html__('Income', 'give')); |
|
219 | + $data->setColor('1b58a3'); |
|
220 | + $chart->addData($data); |
|
221 | 221 | |
222 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
223 | - $shape_marker->setColor( '000000' ); |
|
224 | - $shape_marker->setSize( 7 ); |
|
225 | - $shape_marker->setBorder( 2 ); |
|
226 | - $shape_marker->setData( $data ); |
|
227 | - $chart->addMarker( $shape_marker ); |
|
222 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
223 | + $shape_marker->setColor('000000'); |
|
224 | + $shape_marker->setSize(7); |
|
225 | + $shape_marker->setBorder(2); |
|
226 | + $shape_marker->setData($data); |
|
227 | + $chart->addMarker($shape_marker); |
|
228 | 228 | |
229 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
230 | - $value_marker->setColor( '000000' ); |
|
231 | - $value_marker->setData( $data ); |
|
232 | - $chart->addMarker( $value_marker ); |
|
229 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
230 | + $value_marker->setColor('000000'); |
|
231 | + $value_marker->setData($data); |
|
232 | + $chart->addMarker($value_marker); |
|
233 | 233 | |
234 | - $data = new GoogleChartData( array( |
|
234 | + $data = new GoogleChartData(array( |
|
235 | 235 | $sales_array[0], |
236 | 236 | $sales_array[1], |
237 | 237 | $sales_array[2], |
@@ -244,46 +244,46 @@ discard block |
||
244 | 244 | $sales_array[9], |
245 | 245 | $sales_array[10], |
246 | 246 | $sales_array[11] |
247 | - ) ); |
|
248 | - $data->setLegend( esc_html__( 'Donations', 'give' ) ); |
|
249 | - $data->setColor( 'ff6c1c' ); |
|
250 | - $chart->addData( $data ); |
|
251 | - |
|
252 | - $chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
253 | - |
|
254 | - $chart->setScale( 0, $max_earnings ); |
|
255 | - |
|
256 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
257 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
258 | - $chart->addAxis( $y_axis ); |
|
259 | - |
|
260 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
261 | - $x_axis->setTickMarks( 5 ); |
|
262 | - $x_axis->setLabels( array( |
|
263 | - esc_html__( 'Jan', 'give' ), |
|
264 | - esc_html__( 'Feb', 'give' ), |
|
265 | - esc_html__( 'Mar', 'give' ), |
|
266 | - esc_html__( 'Apr', 'give' ), |
|
267 | - esc_html__( 'May', 'give' ), |
|
268 | - esc_html__( 'June', 'give' ), |
|
269 | - esc_html__( 'July', 'give' ), |
|
270 | - esc_html__( 'Aug', 'give' ), |
|
271 | - esc_html__( 'Sept', 'give' ), |
|
272 | - esc_html__( 'Oct', 'give' ), |
|
273 | - esc_html__( 'Nov', 'give' ), |
|
274 | - esc_html__( 'Dec', 'give' ) |
|
275 | - ) ); |
|
276 | - $chart->addAxis( $x_axis ); |
|
277 | - |
|
278 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
279 | - $shape_marker->setSize( 6 ); |
|
280 | - $shape_marker->setBorder( 2 ); |
|
281 | - $shape_marker->setData( $data ); |
|
282 | - $chart->addMarker( $shape_marker ); |
|
283 | - |
|
284 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
285 | - $value_marker->setData( $data ); |
|
286 | - $chart->addMarker( $value_marker ); |
|
247 | + )); |
|
248 | + $data->setLegend(esc_html__('Donations', 'give')); |
|
249 | + $data->setColor('ff6c1c'); |
|
250 | + $chart->addData($data); |
|
251 | + |
|
252 | + $chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
253 | + |
|
254 | + $chart->setScale(0, $max_earnings); |
|
255 | + |
|
256 | + $y_axis = new GoogleChartAxis('y'); |
|
257 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
258 | + $chart->addAxis($y_axis); |
|
259 | + |
|
260 | + $x_axis = new GoogleChartAxis('x'); |
|
261 | + $x_axis->setTickMarks(5); |
|
262 | + $x_axis->setLabels(array( |
|
263 | + esc_html__('Jan', 'give'), |
|
264 | + esc_html__('Feb', 'give'), |
|
265 | + esc_html__('Mar', 'give'), |
|
266 | + esc_html__('Apr', 'give'), |
|
267 | + esc_html__('May', 'give'), |
|
268 | + esc_html__('June', 'give'), |
|
269 | + esc_html__('July', 'give'), |
|
270 | + esc_html__('Aug', 'give'), |
|
271 | + esc_html__('Sept', 'give'), |
|
272 | + esc_html__('Oct', 'give'), |
|
273 | + esc_html__('Nov', 'give'), |
|
274 | + esc_html__('Dec', 'give') |
|
275 | + )); |
|
276 | + $chart->addAxis($x_axis); |
|
277 | + |
|
278 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
279 | + $shape_marker->setSize(6); |
|
280 | + $shape_marker->setBorder(2); |
|
281 | + $shape_marker->setData($data); |
|
282 | + $chart->addMarker($shape_marker); |
|
283 | + |
|
284 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
285 | + $value_marker->setData($data); |
|
286 | + $chart->addMarker($value_marker); |
|
287 | 287 | |
288 | 288 | return $chart->getUrl(); |
289 | 289 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @since 1.5 |
33 | 33 | */ |
34 | - do_action( 'give_tools_recount_stats_before' ); |
|
34 | + do_action('give_tools_recount_stats_before'); |
|
35 | 35 | ?> |
36 | 36 | <div id="poststuff"> |
37 | 37 | <div class="postbox"> |
38 | 38 | |
39 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
39 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
40 | 40 | |
41 | 41 | <div class="inside recount-stats-controls"> |
42 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
42 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
43 | 43 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
44 | 44 | |
45 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
45 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
46 | 46 | |
47 | 47 | <select name="give-export-class" id="recount-stats-type"> |
48 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
49 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
50 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
51 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
52 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
53 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
54 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
48 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
49 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
50 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
51 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
52 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
53 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
54 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
55 | 55 | <?php |
56 | 56 | /** |
57 | 57 | * Fires in the recount stats selectbox. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.5 |
62 | 62 | */ |
63 | - do_action( 'give_recount_tool_options' ); |
|
63 | + do_action('give_recount_tool_options'); |
|
64 | 64 | ?> |
65 | 65 | </select> |
66 | 66 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | $args = array( |
70 | 70 | 'name' => 'form_id', |
71 | - 'number' => - 1, |
|
71 | + 'number' => -1, |
|
72 | 72 | 'chosen' => true, |
73 | 73 | ); |
74 | - echo Give()->html->forms_dropdown( $args ); |
|
74 | + echo Give()->html->forms_dropdown($args); |
|
75 | 75 | ?> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | - do_action( 'give_tools_recount_stats_after' ); |
|
123 | + do_action('give_tools_recount_stats_after'); |
|
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
126 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @param $_step int The step to process |
107 | 107 | * @since 1.5 |
108 | 108 | */ |
109 | - public function __construct( $_step = 1 ) { |
|
109 | + public function __construct($_step = 1) { |
|
110 | 110 | |
111 | 111 | $upload_dir = wp_upload_dir(); |
112 | 112 | $this->filetype = '.csv'; |
113 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
114 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
113 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
114 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
115 | 115 | |
116 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
116 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
117 | 117 | $this->is_writable = false; |
118 | 118 | } |
119 | 119 | |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function process_step() { |
131 | 131 | |
132 | - if ( ! $this->can_export() ) { |
|
133 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
132 | + if ( ! $this->can_export()) { |
|
133 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
134 | 134 | } |
135 | 135 | |
136 | - if( $this->step < 2 ) { |
|
136 | + if ($this->step < 2) { |
|
137 | 137 | |
138 | 138 | // Make sure we start with a fresh file on step 1 |
139 | - @unlink( $this->file ); |
|
139 | + @unlink($this->file); |
|
140 | 140 | $this->print_csv_cols(); |
141 | 141 | } |
142 | 142 | |
143 | 143 | $rows = $this->print_csv_rows(); |
144 | 144 | |
145 | - if( $rows ) { |
|
145 | + if ($rows) { |
|
146 | 146 | return true; |
147 | 147 | } else { |
148 | 148 | return false; |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $col_data = ''; |
163 | 163 | $cols = $this->get_csv_cols(); |
164 | 164 | $i = 1; |
165 | - foreach( $cols as $col_id => $column ) { |
|
166 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
167 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
165 | + foreach ($cols as $col_id => $column) { |
|
166 | + $col_data .= '"'.addslashes($column).'"'; |
|
167 | + $col_data .= $i == count($cols) ? '' : ','; |
|
168 | 168 | $i++; |
169 | 169 | } |
170 | 170 | $col_data .= "\r\n"; |
171 | 171 | |
172 | - $this->stash_step_data( $col_data ); |
|
172 | + $this->stash_step_data($col_data); |
|
173 | 173 | |
174 | 174 | return $col_data; |
175 | 175 | |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | $data = $this->get_data(); |
189 | 189 | $cols = $this->get_csv_cols(); |
190 | 190 | |
191 | - if( $data ) { |
|
191 | + if ($data) { |
|
192 | 192 | |
193 | 193 | // Output each row |
194 | - foreach ( $data as $row ) { |
|
194 | + foreach ($data as $row) { |
|
195 | 195 | $i = 1; |
196 | - foreach ( $row as $col_id => $column ) { |
|
196 | + foreach ($row as $col_id => $column) { |
|
197 | 197 | // Make sure the column is valid |
198 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
199 | - $row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"'; |
|
200 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
198 | + if (array_key_exists($col_id, $cols)) { |
|
199 | + $row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"'; |
|
200 | + $row_data .= $i == count($cols) ? '' : ','; |
|
201 | 201 | $i++; |
202 | 202 | } |
203 | 203 | } |
204 | 204 | $row_data .= "\r\n"; |
205 | 205 | } |
206 | 206 | |
207 | - $this->stash_step_data( $row_data ); |
|
207 | + $this->stash_step_data($row_data); |
|
208 | 208 | |
209 | 209 | return $row_data; |
210 | 210 | } |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | |
233 | 233 | $file = ''; |
234 | 234 | |
235 | - if ( @file_exists( $this->file ) ) { |
|
235 | + if (@file_exists($this->file)) { |
|
236 | 236 | |
237 | - if ( ! is_writeable( $this->file ) ) { |
|
237 | + if ( ! is_writeable($this->file)) { |
|
238 | 238 | $this->is_writable = false; |
239 | 239 | } |
240 | 240 | |
241 | - $file = @file_get_contents( $this->file ); |
|
241 | + $file = @file_get_contents($this->file); |
|
242 | 242 | |
243 | 243 | } else { |
244 | 244 | |
245 | - @file_put_contents( $this->file, '' ); |
|
246 | - @chmod( $this->file, 0664 ); |
|
245 | + @file_put_contents($this->file, ''); |
|
246 | + @chmod($this->file, 0664); |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | * @param $data string The data to add to the file |
258 | 258 | * @return void |
259 | 259 | */ |
260 | - protected function stash_step_data( $data = '' ) { |
|
260 | + protected function stash_step_data($data = '') { |
|
261 | 261 | |
262 | 262 | $file = $this->get_file(); |
263 | 263 | $file .= $data; |
264 | - @file_put_contents( $this->file, $file ); |
|
264 | + @file_put_contents($this->file, $file); |
|
265 | 265 | |
266 | 266 | // If we have no rows after this step, mark it as an empty export |
267 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES); |
|
267 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
268 | 268 | $default_cols = $this->get_csv_cols(); |
269 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
269 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
270 | 270 | |
271 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
271 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $file = $this->get_file(); |
288 | 288 | |
289 | - @unlink( $this->file ); |
|
289 | + @unlink($this->file); |
|
290 | 290 | |
291 | 291 | echo $file; |
292 | 292 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @since 1.5 |
300 | 300 | * @param array $request The Form Data passed into the batch processing |
301 | 301 | */ |
302 | - public function set_properties( $request ) {} |
|
302 | + public function set_properties($request) {} |
|
303 | 303 | |
304 | 304 | /** |
305 | 305 | * Allow for prefetching of data for the remainder of the exporter |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -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 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -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,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -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 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -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,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - esc_html__( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + esc_html__('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,35 +48,35 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( $plugin_file != GIVE_PLUGIN_BASENAME ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if ($plugin_file != GIVE_PLUGIN_BASENAME) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
56 | 56 | $new_meta_links = array( |
57 | 57 | sprintf( |
58 | 58 | '<a href="%1$s" target="_blank">%2$s</a>', |
59 | - esc_url( add_query_arg( array( |
|
59 | + esc_url(add_query_arg(array( |
|
60 | 60 | 'utm_source' => 'plugins-page', |
61 | 61 | 'utm_medium' => 'plugin-row', |
62 | 62 | 'utm_campaign' => 'admin', |
63 | - ), 'https://givewp.com/documentation/' ) |
|
63 | + ), 'https://givewp.com/documentation/') |
|
64 | 64 | ), |
65 | - esc_html__( 'Documentation', 'give' ) |
|
65 | + esc_html__('Documentation', 'give') |
|
66 | 66 | ), |
67 | 67 | sprintf( |
68 | 68 | '<a href="%1$s" target="_blank">%2$s</a>', |
69 | - esc_url( add_query_arg( array( |
|
69 | + esc_url(add_query_arg(array( |
|
70 | 70 | 'utm_source' => 'plugins-page', |
71 | 71 | 'utm_medium' => 'plugin-row', |
72 | 72 | 'utm_campaign' => 'admin', |
73 | - ), 'https://givewp.com/addons/' ) |
|
73 | + ), 'https://givewp.com/addons/') |
|
74 | 74 | ), |
75 | - esc_html__( 'Add-ons', 'give' ) |
|
75 | + esc_html__('Add-ons', 'give') |
|
76 | 76 | ), |
77 | 77 | ); |
78 | 78 | |
79 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
79 | + return array_merge($plugin_meta, $new_meta_links); |
|
80 | 80 | } |
81 | 81 | |
82 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
82 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |