@@ -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,125 +25,125 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php'; |
|
39 | 39 | |
40 | 40 | $daterange = utf8_decode( |
41 | 41 | sprintf( |
42 | 42 | /* translators: 1: start date 2: end date */ |
43 | - __( '%1$s to %2$s', 'give' ), |
|
44 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
45 | - date_i18n( give_date_format() ) |
|
43 | + __('%1$s to %2$s', 'give'), |
|
44 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
45 | + date_i18n(give_date_format()) |
|
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | |
49 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
50 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
49 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
50 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
51 | 51 | |
52 | - $pdf = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false ); |
|
53 | - $default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' ); |
|
52 | + $pdf = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false); |
|
53 | + $default_font = apply_filters('give_pdf_default_font', 'Helvetica'); |
|
54 | 54 | $custom_font = 'dejavusans'; |
55 | 55 | $font_style = ''; |
56 | 56 | |
57 | - if ( in_array( give_get_currency(), array( 'RIAL', 'RUB' ) ) ) { |
|
58 | - TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' ); |
|
57 | + if (in_array(give_get_currency(), array('RIAL', 'RUB'))) { |
|
58 | + TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', ''); |
|
59 | 59 | $custom_font = 'CODE2000'; |
60 | 60 | $font_style = 'B'; |
61 | 61 | } |
62 | 62 | |
63 | - $pdf->AddPage( 'L', 'A4' ); |
|
64 | - $pdf->setImageScale( 1.5 ); |
|
65 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
66 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
67 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
63 | + $pdf->AddPage('L', 'A4'); |
|
64 | + $pdf->setImageScale(1.5); |
|
65 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
66 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
67 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
68 | 68 | |
69 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
69 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
70 | 70 | |
71 | - $pdf->SetMargins( 8, 8, 8 ); |
|
72 | - $pdf->SetX( 8 ); |
|
71 | + $pdf->SetMargins(8, 8, 8); |
|
72 | + $pdf->SetX(8); |
|
73 | 73 | |
74 | - $pdf->SetFont( $default_font, '', 16 ); |
|
75 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
76 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
74 | + $pdf->SetFont($default_font, '', 16); |
|
75 | + $pdf->SetTextColor(50, 50, 50); |
|
76 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
77 | 77 | |
78 | - $pdf->SetFont( $default_font, '', 13 ); |
|
79 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
80 | - $pdf->Ln( 1 ); |
|
81 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
78 | + $pdf->SetFont($default_font, '', 13); |
|
79 | + $pdf->SetTextColor(150, 150, 150); |
|
80 | + $pdf->Ln(1); |
|
81 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
82 | 82 | $pdf->Ln(); |
83 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
84 | - $pdf->SetFont( $default_font, '', 14 ); |
|
85 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
86 | - $pdf->SetFont( $default_font, '', 12 ); |
|
83 | + $pdf->SetTextColor(50, 50, 50); |
|
84 | + $pdf->SetFont($default_font, '', 14); |
|
85 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
86 | + $pdf->SetFont($default_font, '', 12); |
|
87 | 87 | |
88 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
89 | - $pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color. |
|
90 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
91 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
88 | + $pdf->SetFillColor(238, 238, 238); |
|
89 | + $pdf->SetTextColor(0, 0, 0, 100); // Set Black color. |
|
90 | + $pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
91 | + $pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
92 | 92 | |
93 | 93 | // Display Categories Heading only, if user has opted for it. |
94 | - if ( $categories_enabled ) { |
|
95 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
94 | + if ($categories_enabled) { |
|
95 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Display Tags Heading only, if user has opted for it. |
99 | - if ( $tags_enabled ) { |
|
100 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
99 | + if ($tags_enabled) { |
|
100 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
101 | 101 | } |
102 | 102 | |
103 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
104 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
103 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
104 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
105 | 105 | |
106 | 106 | // Set Custom Font to support various currencies. |
107 | - $pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 ); |
|
107 | + $pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12); |
|
108 | 108 | |
109 | - $year = date( 'Y' ); |
|
110 | - $give_forms = get_posts( array( |
|
109 | + $year = date('Y'); |
|
110 | + $give_forms = get_posts(array( |
|
111 | 111 | 'post_type' => 'give_forms', |
112 | 112 | 'year' => $year, |
113 | - 'posts_per_page' => - 1, |
|
113 | + 'posts_per_page' => -1, |
|
114 | 114 | 'supply_filter' => false, |
115 | - ) ); |
|
115 | + )); |
|
116 | 116 | |
117 | - if ( $give_forms ) { |
|
118 | - $pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) ); |
|
117 | + if ($give_forms) { |
|
118 | + $pdf->SetWidths(array(50, 50, 45, 45, 45, 45)); |
|
119 | 119 | |
120 | - foreach ( $give_forms as $form ): |
|
121 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
120 | + foreach ($give_forms as $form): |
|
121 | + $pdf->SetFillColor(255, 255, 255); |
|
122 | 122 | |
123 | 123 | $title = $form->post_title; |
124 | 124 | |
125 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
126 | - $price = html_entity_decode( give_price_range( $form->ID, false ) ); |
|
125 | + if (give_has_variable_prices($form->ID)) { |
|
126 | + $price = html_entity_decode(give_price_range($form->ID, false)); |
|
127 | 127 | } else { |
128 | - $price = give_currency_filter( give_get_form_price( $form->ID ), '', true ); |
|
128 | + $price = give_currency_filter(give_get_form_price($form->ID), '', true); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Display Categories Data only, if user has opted for it. |
132 | 132 | $categories = array(); |
133 | - if ( $categories_enabled ) { |
|
134 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
135 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
133 | + if ($categories_enabled) { |
|
134 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
135 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // Display Tags Data only, if user has opted for it. |
139 | 139 | $tags = array(); |
140 | - if ( $tags_enabled ) { |
|
141 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
142 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
140 | + if ($tags_enabled) { |
|
141 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
142 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
143 | 143 | } |
144 | 144 | |
145 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
146 | - $earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), '', true ); |
|
145 | + $sales = give_get_form_sales_stats($form->ID); |
|
146 | + $earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), '', true); |
|
147 | 147 | |
148 | 148 | // This will help filter data before appending it to PDF Receipt. |
149 | 149 | $prepare_pdf_data = array(); |
@@ -151,53 +151,53 @@ discard block |
||
151 | 151 | $prepare_pdf_data[] = $price; |
152 | 152 | |
153 | 153 | // Append Categories Data only, if user has opted for it. |
154 | - if ( $categories_enabled ) { |
|
154 | + if ($categories_enabled) { |
|
155 | 155 | $prepare_pdf_data[] = $categories; |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Append Tags Data only, if user has opted for it. |
159 | - if ( $tags_enabled ) { |
|
159 | + if ($tags_enabled) { |
|
160 | 160 | $prepare_pdf_data[] = $tags; |
161 | 161 | } |
162 | 162 | |
163 | 163 | $prepare_pdf_data[] = $sales; |
164 | 164 | $prepare_pdf_data[] = $earnings; |
165 | 165 | |
166 | - $pdf->Row( $prepare_pdf_data ); |
|
166 | + $pdf->Row($prepare_pdf_data); |
|
167 | 167 | |
168 | 168 | endforeach; |
169 | 169 | } else { |
170 | 170 | |
171 | 171 | // Fix: Minor Styling Alignment Issue for PDF. |
172 | - if ( $categories_enabled && $tags_enabled ) { |
|
172 | + if ($categories_enabled && $tags_enabled) { |
|
173 | 173 | $no_found_width = 280; |
174 | - } elseif ( $categories_enabled || $tags_enabled ) { |
|
174 | + } elseif ($categories_enabled || $tags_enabled) { |
|
175 | 175 | $no_found_width = 235; |
176 | 176 | } else { |
177 | 177 | $no_found_width = 190; |
178 | 178 | } |
179 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
180 | - $pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false ); |
|
179 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
180 | + $pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false); |
|
181 | 181 | }// End if(). |
182 | 182 | $pdf->Ln(); |
183 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
184 | - $pdf->SetFont( $default_font, '', 14 ); |
|
183 | + $pdf->SetTextColor(50, 50, 50); |
|
184 | + $pdf->SetFont($default_font, '', 14); |
|
185 | 185 | |
186 | 186 | // Output Graph on a new page. |
187 | - $pdf->AddPage( 'L', 'A4' ); |
|
188 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
189 | - $pdf->SetFont( $default_font, '', 12 ); |
|
187 | + $pdf->AddPage('L', 'A4'); |
|
188 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
189 | + $pdf->SetFont($default_font, '', 12); |
|
190 | 190 | |
191 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
192 | - $image = str_replace( ' ', '%20', $image ); |
|
191 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
192 | + $image = str_replace(' ', '%20', $image); |
|
193 | 193 | |
194 | - $pdf->SetX( 25 ); |
|
195 | - $pdf->Image( $image . '&file=.png' ); |
|
196 | - $pdf->Ln( 7 ); |
|
197 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
194 | + $pdf->SetX(25); |
|
195 | + $pdf->Image($image.'&file=.png'); |
|
196 | + $pdf->Ln(7); |
|
197 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
198 | 198 | } |
199 | 199 | |
200 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
200 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Draws Chart for PDF Report. |
@@ -214,38 +214,38 @@ discard block |
||
214 | 214 | * @return string $chart->getUrl() URL for the Google Chart |
215 | 215 | */ |
216 | 216 | function give_draw_chart_image() { |
217 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
218 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
219 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
217 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
218 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
219 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
220 | 220 | |
221 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
221 | + $chart = new GoogleChart('lc', 900, 330); |
|
222 | 222 | |
223 | 223 | $i = 1; |
224 | 224 | $earnings = ""; |
225 | 225 | $sales = ""; |
226 | 226 | |
227 | - while ( $i <= 12 ) : |
|
228 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
229 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
230 | - $i ++; |
|
227 | + while ($i <= 12) : |
|
228 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
229 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
230 | + $i++; |
|
231 | 231 | endwhile; |
232 | 232 | |
233 | - $earnings_array = explode( ",", $earnings ); |
|
234 | - $sales_array = explode( ",", $sales ); |
|
233 | + $earnings_array = explode(",", $earnings); |
|
234 | + $sales_array = explode(",", $sales); |
|
235 | 235 | |
236 | 236 | $i = 0; |
237 | - while ( $i <= 11 ) { |
|
238 | - if ( empty( $sales_array[ $i ] ) ) { |
|
239 | - $sales_array[ $i ] = 0; |
|
237 | + while ($i <= 11) { |
|
238 | + if (empty($sales_array[$i])) { |
|
239 | + $sales_array[$i] = 0; |
|
240 | 240 | } |
241 | - $i ++; |
|
241 | + $i++; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $min_earnings = 0; |
245 | - $max_earnings = max( $earnings_array ); |
|
246 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
245 | + $max_earnings = max($earnings_array); |
|
246 | + $earnings_scale = round($max_earnings, - 1); |
|
247 | 247 | |
248 | - $data = new GoogleChartData( array( |
|
248 | + $data = new GoogleChartData(array( |
|
249 | 249 | $earnings_array[0], |
250 | 250 | $earnings_array[1], |
251 | 251 | $earnings_array[2], |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | $earnings_array[9], |
259 | 259 | $earnings_array[10], |
260 | 260 | $earnings_array[11], |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | |
263 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
264 | - $data->setColor( '1b58a3' ); |
|
265 | - $chart->addData( $data ); |
|
263 | + $data->setLegend(__('Income', 'give')); |
|
264 | + $data->setColor('1b58a3'); |
|
265 | + $chart->addData($data); |
|
266 | 266 | |
267 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
268 | - $shape_marker->setColor( '000000' ); |
|
269 | - $shape_marker->setSize( 7 ); |
|
270 | - $shape_marker->setBorder( 2 ); |
|
271 | - $shape_marker->setData( $data ); |
|
272 | - $chart->addMarker( $shape_marker ); |
|
267 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
268 | + $shape_marker->setColor('000000'); |
|
269 | + $shape_marker->setSize(7); |
|
270 | + $shape_marker->setBorder(2); |
|
271 | + $shape_marker->setData($data); |
|
272 | + $chart->addMarker($shape_marker); |
|
273 | 273 | |
274 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
275 | - $value_marker->setColor( '000000' ); |
|
276 | - $value_marker->setData( $data ); |
|
277 | - $chart->addMarker( $value_marker ); |
|
274 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
275 | + $value_marker->setColor('000000'); |
|
276 | + $value_marker->setData($data); |
|
277 | + $chart->addMarker($value_marker); |
|
278 | 278 | |
279 | - $data = new GoogleChartData( array( |
|
279 | + $data = new GoogleChartData(array( |
|
280 | 280 | $sales_array[0], |
281 | 281 | $sales_array[1], |
282 | 282 | $sales_array[2], |
@@ -289,46 +289,46 @@ discard block |
||
289 | 289 | $sales_array[9], |
290 | 290 | $sales_array[10], |
291 | 291 | $sales_array[11], |
292 | - ) ); |
|
293 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
294 | - $data->setColor( 'ff6c1c' ); |
|
295 | - $chart->addData( $data ); |
|
296 | - |
|
297 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
298 | - |
|
299 | - $chart->setScale( 0, $max_earnings ); |
|
300 | - |
|
301 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
302 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
303 | - $chart->addAxis( $y_axis ); |
|
304 | - |
|
305 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
306 | - $x_axis->setTickMarks( 5 ); |
|
307 | - $x_axis->setLabels( array( |
|
308 | - __( 'Jan', 'give' ), |
|
309 | - __( 'Feb', 'give' ), |
|
310 | - __( 'Mar', 'give' ), |
|
311 | - __( 'Apr', 'give' ), |
|
312 | - __( 'May', 'give' ), |
|
313 | - __( 'June', 'give' ), |
|
314 | - __( 'July', 'give' ), |
|
315 | - __( 'Aug', 'give' ), |
|
316 | - __( 'Sept', 'give' ), |
|
317 | - __( 'Oct', 'give' ), |
|
318 | - __( 'Nov', 'give' ), |
|
319 | - __( 'Dec', 'give' ), |
|
320 | - ) ); |
|
321 | - $chart->addAxis( $x_axis ); |
|
322 | - |
|
323 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
324 | - $shape_marker->setSize( 6 ); |
|
325 | - $shape_marker->setBorder( 2 ); |
|
326 | - $shape_marker->setData( $data ); |
|
327 | - $chart->addMarker( $shape_marker ); |
|
328 | - |
|
329 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
330 | - $value_marker->setData( $data ); |
|
331 | - $chart->addMarker( $value_marker ); |
|
292 | + )); |
|
293 | + $data->setLegend(__('Donations', 'give')); |
|
294 | + $data->setColor('ff6c1c'); |
|
295 | + $chart->addData($data); |
|
296 | + |
|
297 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
298 | + |
|
299 | + $chart->setScale(0, $max_earnings); |
|
300 | + |
|
301 | + $y_axis = new GoogleChartAxis('y'); |
|
302 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
303 | + $chart->addAxis($y_axis); |
|
304 | + |
|
305 | + $x_axis = new GoogleChartAxis('x'); |
|
306 | + $x_axis->setTickMarks(5); |
|
307 | + $x_axis->setLabels(array( |
|
308 | + __('Jan', 'give'), |
|
309 | + __('Feb', 'give'), |
|
310 | + __('Mar', 'give'), |
|
311 | + __('Apr', 'give'), |
|
312 | + __('May', 'give'), |
|
313 | + __('June', 'give'), |
|
314 | + __('July', 'give'), |
|
315 | + __('Aug', 'give'), |
|
316 | + __('Sept', 'give'), |
|
317 | + __('Oct', 'give'), |
|
318 | + __('Nov', 'give'), |
|
319 | + __('Dec', 'give'), |
|
320 | + )); |
|
321 | + $chart->addAxis($x_axis); |
|
322 | + |
|
323 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
324 | + $shape_marker->setSize(6); |
|
325 | + $shape_marker->setBorder(2); |
|
326 | + $shape_marker->setData($data); |
|
327 | + $chart->addMarker($shape_marker); |
|
328 | + |
|
329 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
330 | + $value_marker->setData($data); |
|
331 | + $chart->addMarker($value_marker); |
|
332 | 332 | |
333 | 333 | return $chart->getUrl(); |
334 | 334 | } |