1
1
<?php
2
2
3
- /*
3
+ /**
4
4
* List of contributors and useful stats around it.
5
5
*/
6
6
18
18
add_action ( 'admin_enqueue_scripts ' , __NAMESPACE__ . '\enqueue_assets ' );
19
19
add_action ( 'admin_init ' , __NAMESPACE__ . '\export_csv ' );
20
20
21
- /*
21
+ /**
22
22
* Register admin page.
23
23
*/
24
24
function add_admin_pages () {
@@ -32,7 +32,7 @@ function add_admin_pages() {
32
32
);
33
33
}
34
34
35
- /*
35
+ /**
36
36
* Enqueue assets/
37
37
*/
38
38
function enqueue_assets () {
@@ -51,14 +51,14 @@ function enqueue_assets() {
51
51
}
52
52
}
53
53
54
- /*
54
+ /**
55
55
* Render results and download button.
56
56
*/
57
57
function render_company_report_page () {
58
58
59
59
$ status = sanitize_title ( $ _GET ['status ' ] );
60
60
61
- if ( ! in_array ( $ status , [ 'draft ' , '5ftf-deactivated ' , 'publish ' ] ) ) {
61
+ if ( ! in_array ( $ status , array ( 'draft ' ,'5ftf-deactivated ' ,'publish ' ) ) ) {
62
62
$ status = 'all ' ;
63
63
}
64
64
@@ -87,9 +87,9 @@ function render_company_report_page() {
87
87
88
88
<form action="#" method="post">
89
89
<input type="hidden" name="wporg-5ftf-cr" value="1">
90
- <input type="hidden" name="status" value="<?php echo $ status ; ?> ">
90
+ <input type="hidden" name="status" value="<?php echo esc_attr ( $ status ) ; ?> ">
91
91
<input type="submit" value="Export">
92
- <?php echo wp_nonce_field ( '5ftf_download_company_report ' ); ?>
92
+ <?php wp_nonce_field ( '5ftf_download_company_report ' ); ?>
93
93
</form>
94
94
95
95
<table id="wporg-5ftf-company-report">
@@ -140,10 +140,8 @@ function render_company_report_page() {
140
140
echo ' <td> ' . esc_html ( $ email ). '</td> ' ;
141
141
echo ' <td> ' . esc_html ( $ date_created ) . '</td> ' ;
142
142
echo ' <td> ' . esc_html ( $ date_modified ) . '</td> ' ;
143
-
144
143
echo '</tr> ' ;
145
- $ export_data [] = [ $ pledge ->post_title , $ pledge ->post_status , $ hours , $ contributors , $ usernames , $ teams , $ company_url , $ pledge_url , $ email , $ date_created , $ date_modified ];
146
-
144
+ $ export_data [] = array ( $ pledge ->post_title , $ pledge ->post_status , $ hours , $ contributors , $ usernames , $ teams , $ company_url , $ pledge_url , $ email , $ date_created , $ date_modified );
147
145
}
148
146
echo '</table> ' ;
149
147
echo '<p>Total contributors: ' . esc_html ( $ all_contributors ) . '</p> ' ;
@@ -152,7 +150,7 @@ function render_company_report_page() {
152
150
set_transient ( 'wporg_5ftf_company_report_ ' . $ status , $ export_data , 60 );
153
151
}
154
152
155
- /*
153
+ /**
156
154
* CSV export runner, grabs data lazily from a transient.
157
155
* @param $data array.
158
156
*/
@@ -172,7 +170,7 @@ function export_csv() {
172
170
173
171
$ exporter = new Export_CSV ( array (
174
172
'filename ' => 'company-report- ' . $ status ,
175
- 'headers ' => array ( 'Company ' , 'Status ' , 'Hours ' , 'Contributors ' , 'Users ' , 'Teams ' , 'Company URL ' , 'Pledge URL ' , 'Email ' , 'Created ' , 'Last updated ' ),
173
+ 'headers ' => array ( 'Company ' ,'Status ' ,'Hours ' ,'Contributors ' ,'Users ' ,'Teams ' ,'Company URL ' ,'Pledge URL ' ,'Email ' ,'Created ' ,'Last updated ' ),
176
174
'data ' => $ data ,
177
175
) );
178
176
0 commit comments