@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,39 +29,39 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function give_reports_page() { |
| 32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
| 34 | 34 | ?> |
| 35 | 35 | <div class="wrap"> |
| 36 | 36 | |
| 37 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Give Reports', 'give' ); ?></h1> |
|
| 37 | + <h1 class="screen-reader-text"><?php esc_html_e('Give Reports', 'give'); ?></h1> |
|
| 38 | 38 | |
| 39 | 39 | <h2 class="nav-tab-wrapper"> |
| 40 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 40 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 41 | 41 | 'tab' => 'reports', |
| 42 | 42 | 'settings-updated' => false |
| 43 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
| 44 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 45 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 43 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
| 44 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 45 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 46 | 46 | 'tab' => 'export', |
| 47 | 47 | 'settings-updated' => false |
| 48 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 48 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 49 | 49 | <?php } ?> |
| 50 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 50 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 51 | 51 | 'tab' => 'logs', |
| 52 | 52 | 'settings-updated' => false |
| 53 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a> |
|
| 54 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 53 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a> |
|
| 54 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 55 | 55 | 'tab' => 'tools', |
| 56 | 56 | 'settings-updated' => false |
| 57 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a> |
|
| 58 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
| 57 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a> |
|
| 58 | + <?php do_action('give_reports_tabs'); ?> |
|
| 59 | 59 | </h2> |
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | - do_action( 'give_reports_page_top' ); |
|
| 63 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
| 64 | - do_action( 'give_reports_page_bottom' ); |
|
| 62 | + do_action('give_reports_page_top'); |
|
| 63 | + do_action('give_reports_tab_'.$active_tab); |
|
| 64 | + do_action('give_reports_page_bottom'); |
|
| 65 | 65 | ?> |
| 66 | 66 | </div><!-- .wrap --> |
| 67 | 67 | <?php |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function give_reports_default_views() { |
| 77 | 77 | $views = array( |
| 78 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 78 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 79 | 79 | 'forms' => give_get_forms_label_plural(), |
| 80 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
| 81 | - 'gateways' => esc_html__( 'Payment Methods', 'give' ) |
|
| 80 | + 'donors' => esc_html__('Donors', 'give'), |
|
| 81 | + 'gateways' => esc_html__('Payment Methods', 'give') |
|
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 84 | + $views = apply_filters('give_report_views', $views); |
|
| 85 | 85 | |
| 86 | 86 | return $views; |
| 87 | 87 | } |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | * @return string $view Report View |
| 98 | 98 | * |
| 99 | 99 | */ |
| 100 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 100 | +function give_get_reporting_view($default = 'earnings') { |
|
| 101 | 101 | |
| 102 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 102 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 103 | 103 | $view = $default; |
| 104 | 104 | } else { |
| 105 | 105 | $view = $_GET['view']; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 108 | + return apply_filters('give_get_reporting_view', $view); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | $current_view = 'earnings'; |
| 119 | 119 | $views = give_reports_default_views(); |
| 120 | 120 | |
| 121 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
| 121 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
| 122 | 122 | $current_view = $_GET['view']; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - do_action( 'give_reports_view_' . $current_view ); |
|
| 125 | + do_action('give_reports_view_'.$current_view); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 128 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * Renders the Reports Page Views Drop Downs |
@@ -135,25 +135,25 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function give_report_views() { |
| 137 | 137 | $views = give_reports_default_views(); |
| 138 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 139 | - do_action( 'give_report_view_actions_before' ); |
|
| 138 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 139 | + do_action('give_report_view_actions_before'); |
|
| 140 | 140 | ?> |
| 141 | 141 | <form id="give-reports-filter" method="get"> |
| 142 | 142 | <select id="give-reports-view" name="view"> |
| 143 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 144 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 145 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 143 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 144 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 145 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 146 | 146 | <?php endforeach; ?> |
| 147 | 147 | </select> |
| 148 | 148 | |
| 149 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
| 149 | + <?php do_action('give_report_view_actions'); ?> |
|
| 150 | 150 | |
| 151 | 151 | <input type="hidden" name="post_type" value="give_forms"/> |
| 152 | 152 | <input type="hidden" name="page" value="give-reports"/> |
| 153 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 153 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 154 | 154 | </form> |
| 155 | 155 | <?php |
| 156 | - do_action( 'give_report_view_actions_after' ); |
|
| 156 | + do_action('give_report_view_actions_after'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | function give_reports_forms_table() { |
| 168 | 168 | |
| 169 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 169 | + if (isset($_GET['form-id'])) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 173 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 174 | 174 | |
| 175 | 175 | $give_table = new Give_Form_Reports_Table(); |
| 176 | 176 | $give_table->prepare_items(); |
| 177 | 177 | $give_table->display(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 180 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * Renders the detailed report for a specific give form |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return void |
| 187 | 187 | */ |
| 188 | 188 | function give_reports_form_details() { |
| 189 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 189 | + if ( ! isset($_GET['form-id'])) { |
|
| 190 | 190 | return; |
| 191 | 191 | } |
| 192 | 192 | ?> |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | <div class="actions bulkactions"> |
| 195 | 195 | <?php give_report_views(); ?> |
| 196 | 196 | |
| 197 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 197 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 198 | 198 | </div> |
| 199 | 199 | </div> |
| 200 | 200 | <?php |
| 201 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 201 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 204 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * Renders the Reports Donors Table |
@@ -212,28 +212,28 @@ discard block |
||
| 212 | 212 | * @return void |
| 213 | 213 | */ |
| 214 | 214 | function give_reports_donors_table() { |
| 215 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 215 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 216 | 216 | |
| 217 | 217 | $give_table = new Give_Donor_Reports_Table(); |
| 218 | 218 | $give_table->prepare_items(); |
| 219 | 219 | ?> |
| 220 | 220 | <div class="wrap give-reports-donors-wrap"> |
| 221 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
| 222 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
| 221 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
| 222 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
| 223 | 223 | <?php |
| 224 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
| 224 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
| 225 | 225 | $give_table->display(); |
| 226 | 226 | ?> |
| 227 | 227 | <input type="hidden" name="post_type" value="give_forms"/> |
| 228 | 228 | <input type="hidden" name="page" value="give-reports"/> |
| 229 | 229 | <input type="hidden" name="view" value="donors"/> |
| 230 | 230 | </form> |
| 231 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
| 231 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
| 232 | 232 | </div> |
| 233 | 233 | <?php |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 236 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | * @return void |
| 246 | 246 | */ |
| 247 | 247 | function give_reports_gateways_table() { |
| 248 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 248 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 249 | 249 | |
| 250 | 250 | $give_table = new Give_Gateawy_Reports_Table(); |
| 251 | 251 | $give_table->prepare_items(); |
| 252 | 252 | $give_table->display(); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 255 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | function give_reports_earnings() { |
| 265 | 265 | ?> |
| 266 | 266 | <div class="tablenav top reports-table-nav"> |
| 267 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
| 267 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
| 268 | 268 | |
| 269 | 269 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
| 270 | 270 | </div> |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | give_reports_graph(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 275 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -287,53 +287,53 @@ discard block |
||
| 287 | 287 | <div id="post-body"> |
| 288 | 288 | <div id="post-body-content"> |
| 289 | 289 | |
| 290 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
| 290 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
| 291 | 291 | |
| 292 | 292 | <table class="widefat export-options-table give-table"> |
| 293 | 293 | <thead> |
| 294 | 294 | <tr> |
| 295 | - <th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
| 296 | - <th><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
| 295 | + <th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
| 296 | + <th><?php esc_html_e('Export Options', 'give'); ?></th> |
|
| 297 | 297 | </tr> |
| 298 | 298 | </thead> |
| 299 | 299 | <tbody> |
| 300 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
| 300 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
| 301 | 301 | <tr class="give-export-pdf-sales-earnings"> |
| 302 | 302 | <td class="row-title"> |
| 303 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
| 303 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
| 304 | 304 | |
| 305 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 305 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 306 | 306 | </td> |
| 307 | 307 | <td> |
| 308 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
| 308 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
| 309 | 309 | </td> |
| 310 | 310 | </tr> |
| 311 | 311 | <tr class="alternate give-export-sales-earnings"> |
| 312 | 312 | <td class="row-title"> |
| 313 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
| 313 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
| 314 | 314 | |
| 315 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 315 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 316 | 316 | </td> |
| 317 | 317 | <td> |
| 318 | 318 | <form method="post"> |
| 319 | 319 | <?php |
| 320 | 320 | printf( |
| 321 | 321 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 322 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
| 323 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
| 324 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
| 322 | + esc_html__('%1$s to %2$s', 'give'), |
|
| 323 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
| 324 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
| 325 | 325 | ); |
| 326 | 326 | ?> |
| 327 | 327 | <input type="hidden" name="give-action" value="earnings_export"/> |
| 328 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 328 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 329 | 329 | </form> |
| 330 | 330 | </td> |
| 331 | 331 | </tr> |
| 332 | 332 | <tr class="give-export-payment-history"> |
| 333 | 333 | <td class="row-title"> |
| 334 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
| 334 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
| 335 | 335 | |
| 336 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 336 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 337 | 337 | </td> |
| 338 | 338 | <td> |
| 339 | 339 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -341,29 +341,29 @@ discard block |
||
| 341 | 341 | $args = array( |
| 342 | 342 | 'id' => 'give-payment-export-start', |
| 343 | 343 | 'name' => 'start', |
| 344 | - 'placeholder' => esc_attr__( 'Start date', 'give' ) |
|
| 344 | + 'placeholder' => esc_attr__('Start date', 'give') |
|
| 345 | 345 | ); |
| 346 | - echo Give()->html->date_field( $args ); ?> |
|
| 346 | + echo Give()->html->date_field($args); ?> |
|
| 347 | 347 | <?php |
| 348 | 348 | $args = array( |
| 349 | 349 | 'id' => 'give-payment-export-end', |
| 350 | 350 | 'name' => 'end', |
| 351 | - 'placeholder' => esc_attr__( 'End date', 'give' ) |
|
| 351 | + 'placeholder' => esc_attr__('End date', 'give') |
|
| 352 | 352 | ); |
| 353 | - echo Give()->html->date_field( $args ); ?> |
|
| 353 | + echo Give()->html->date_field($args); ?> |
|
| 354 | 354 | <select name="status"> |
| 355 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
| 355 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
| 356 | 356 | <?php |
| 357 | 357 | $statuses = give_get_payment_statuses(); |
| 358 | - foreach ( $statuses as $status => $label ) { |
|
| 359 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
| 358 | + foreach ($statuses as $status => $label) { |
|
| 359 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
| 360 | 360 | } |
| 361 | 361 | ?> |
| 362 | 362 | </select> |
| 363 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 363 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 364 | 364 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
| 365 | 365 | <span> |
| 366 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 366 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 367 | 367 | <span class="spinner"></span> |
| 368 | 368 | </span> |
| 369 | 369 | </form> |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | </tr> |
| 373 | 373 | <tr class="alternate give-export-donors"> |
| 374 | 374 | <td class="row-title"> |
| 375 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
| 375 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
| 376 | 376 | |
| 377 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
| 377 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
| 378 | 378 | </td> |
| 379 | 379 | <td> |
| 380 | 380 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -385,65 +385,65 @@ discard block |
||
| 385 | 385 | 'id' => 'give_customer_export_form', |
| 386 | 386 | 'chosen' => true |
| 387 | 387 | ); |
| 388 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
| 388 | + echo Give()->html->forms_dropdown($args); ?> |
|
| 389 | 389 | |
| 390 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 390 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 391 | 391 | |
| 392 | 392 | <div id="export-donor-options-wrap" class="give-clearfix"> |
| 393 | - <p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p> |
|
| 393 | + <p><?php esc_html_e('Export Columns', 'give'); ?>:</p> |
|
| 394 | 394 | <ul id="give-export-option-ul"> |
| 395 | 395 | <li> |
| 396 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
| 396 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
| 397 | 397 | </label> |
| 398 | 398 | </li> |
| 399 | 399 | <li> |
| 400 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
| 400 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
| 401 | 401 | </label> |
| 402 | 402 | </li> |
| 403 | 403 | <li> |
| 404 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
| 404 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
| 405 | 405 | </label> |
| 406 | 406 | </li> |
| 407 | 407 | <li> |
| 408 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
| 408 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
| 409 | 409 | </label> |
| 410 | 410 | </li> |
| 411 | 411 | <li> |
| 412 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
| 412 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
| 413 | 413 | </label> |
| 414 | 414 | </li> |
| 415 | 415 | <li> |
| 416 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
| 416 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
| 417 | 417 | </label> |
| 418 | 418 | </li> |
| 419 | 419 | <li> |
| 420 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
| 420 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
| 421 | 421 | </label> |
| 422 | 422 | </li> |
| 423 | 423 | <?php |
| 424 | 424 | $custom_cols = []; |
| 425 | - $custom_cols = apply_filters( 'give_export_csv_cols_customers', $custom_cols ); |
|
| 426 | - foreach($custom_cols as $col_id => $col_name): |
|
| 425 | + $custom_cols = apply_filters('give_export_csv_cols_customers', $custom_cols); |
|
| 426 | + foreach ($custom_cols as $col_id => $col_name): |
|
| 427 | 427 | ?> |
| 428 | 428 | <li> |
| 429 | - <label for="give-export-<?= str_replace('_','-',$col_id) ?>"><input type="checkbox" class="give_custom_field" checked="checked" readonly="readonly" name="give_export_option[<?= $col_id ?>]" id="give-export-<?= str_replace('_','-',$col_id) ?>"><?php esc_html_e( $col_name, 'give' ); ?> |
|
| 429 | + <label for="give-export-<?= str_replace('_', '-', $col_id) ?>"><input type="checkbox" class="give_custom_field" checked="checked" readonly="readonly" name="give_export_option[<?= $col_id ?>]" id="give-export-<?= str_replace('_', '-', $col_id) ?>"><?php esc_html_e($col_name, 'give'); ?> |
|
| 430 | 430 | </label> |
| 431 | 431 | </li> |
| 432 | 432 | <?php endforeach; ?> |
| 433 | 433 | </ul> |
| 434 | 434 | </div> |
| 435 | 435 | |
| 436 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 436 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 437 | 437 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
| 438 | 438 | <input type="hidden" name="give-action" value="email_export"/> |
| 439 | 439 | </form> |
| 440 | 440 | </td> |
| 441 | 441 | </tr> |
| 442 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
| 442 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
| 443 | 443 | </tbody> |
| 444 | 444 | </table> |
| 445 | 445 | |
| 446 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
| 446 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
| 447 | 447 | |
| 448 | 448 | </div> |
| 449 | 449 | <!-- .post-body-content --> |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | <?php |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
| 456 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Renders the Reports page |
@@ -463,19 +463,19 @@ discard block |
||
| 463 | 463 | */ |
| 464 | 464 | function give_reports_tab_logs() { |
| 465 | 465 | |
| 466 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
| 466 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
| 467 | 467 | |
| 468 | 468 | $current_view = 'sales'; |
| 469 | 469 | $log_views = give_log_default_views(); |
| 470 | 470 | |
| 471 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
| 471 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
| 472 | 472 | $current_view = $_GET['view']; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - do_action( 'give_logs_view_' . $current_view ); |
|
| 475 | + do_action('give_logs_view_'.$current_view); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
| 478 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
| 479 | 479 | |
| 480 | 480 | /** |
| 481 | 481 | * Retrieves estimated monthly earnings and sales |
@@ -485,9 +485,9 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | function give_estimated_monthly_stats() { |
| 487 | 487 | |
| 488 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
| 488 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
| 489 | 489 | |
| 490 | - if ( false === $estimated ) { |
|
| 490 | + if (false === $estimated) { |
|
| 491 | 491 | |
| 492 | 492 | $estimated = array( |
| 493 | 493 | 'earnings' => 0, |
@@ -496,20 +496,20 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | $stats = new Give_Payment_Stats; |
| 498 | 498 | |
| 499 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 500 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 499 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 500 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 501 | 501 | |
| 502 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 503 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 504 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 505 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 502 | + $current_day = date('d', current_time('timestamp')); |
|
| 503 | + $current_month = date('n', current_time('timestamp')); |
|
| 504 | + $current_year = date('Y', current_time('timestamp')); |
|
| 505 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 506 | 506 | |
| 507 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 508 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 507 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 508 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 509 | 509 | |
| 510 | 510 | // Cache for one day |
| 511 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
| 511 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - return maybe_unserialize( $estimated ); |
|
| 514 | + return maybe_unserialize($estimated); |
|
| 515 | 515 | } |