@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | global $status, $page; |
| 51 | 51 | |
| 52 | 52 | // Set parent defaults |
| 53 | - parent::__construct( array( |
|
| 54 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 55 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 53 | + parent::__construct(array( |
|
| 54 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 55 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 56 | 56 | 'ajax' => false // Does this table support ajax? |
| 57 | - ) ); |
|
| 57 | + )); |
|
| 58 | 58 | |
| 59 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
| 59 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
| 60 | 60 | $this->query(); |
| 61 | 61 | |
| 62 | 62 | } |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return string Column Name |
| 74 | 74 | */ |
| 75 | - public function column_default( $item, $column_name ) { |
|
| 76 | - switch ( $column_name ) { |
|
| 75 | + public function column_default($item, $column_name) { |
|
| 76 | + switch ($column_name) { |
|
| 77 | 77 | case 'earnings' : |
| 78 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 78 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 79 | 79 | case 'average_sales' : |
| 80 | - return round( $item[ $column_name ] ); |
|
| 80 | + return round($item[$column_name]); |
|
| 81 | 81 | case 'average_earnings' : |
| 82 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 82 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 83 | 83 | case 'details' : |
| 84 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . esc_html( 'View Detailed Report', 'give' ) . '</a>'; |
|
| 84 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.esc_html('View Detailed Report', 'give').'</a>'; |
|
| 85 | 85 | default: |
| 86 | - return $item[ $column_name ]; |
|
| 86 | + return $item[$column_name]; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | public function get_columns() { |
| 98 | 98 | $columns = array( |
| 99 | 99 | 'title' => give_get_forms_label_singular(), |
| 100 | - 'sales' => esc_html( 'Donations', 'give' ), |
|
| 101 | - 'earnings' => esc_html( 'Income', 'give' ), |
|
| 102 | - 'average_sales' => esc_html( 'Monthly Average Donations', 'give' ), |
|
| 103 | - 'average_earnings' => esc_html( 'Monthly Average Income', 'give' ), |
|
| 104 | - 'details' => esc_html( 'Detailed Report', 'give' ) |
|
| 100 | + 'sales' => esc_html('Donations', 'give'), |
|
| 101 | + 'earnings' => esc_html('Income', 'give'), |
|
| 102 | + 'average_sales' => esc_html('Monthly Average Donations', 'give'), |
|
| 103 | + 'average_earnings' => esc_html('Monthly Average Income', 'give'), |
|
| 104 | + 'details' => esc_html('Detailed Report', 'give') |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | return $columns; |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function get_sortable_columns() { |
| 118 | 118 | return array( |
| 119 | - 'title' => array( 'title', true ), |
|
| 120 | - 'sales' => array( 'sales', false ), |
|
| 121 | - 'earnings' => array( 'earnings', false ), |
|
| 119 | + 'title' => array('title', true), |
|
| 120 | + 'sales' => array('sales', false), |
|
| 121 | + 'earnings' => array('earnings', false), |
|
| 122 | 122 | ); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @return int Current page number |
| 131 | 131 | */ |
| 132 | 132 | public function get_paged() { |
| 133 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 133 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @return int Category ID |
| 143 | 143 | */ |
| 144 | 144 | public function get_category() { |
| 145 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
| 145 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function get_total_forms() { |
| 157 | 157 | $total = 0; |
| 158 | - $counts = wp_count_posts( 'give_forms', 'readable' ); |
|
| 159 | - foreach ( $counts as $status => $count ) { |
|
| 158 | + $counts = wp_count_posts('give_forms', 'readable'); |
|
| 159 | + foreach ($counts as $status => $count) { |
|
| 160 | 160 | $total += $count; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @since 1.0 |
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | - public function bulk_actions( $which = '' ) { |
|
| 173 | + public function bulk_actions($which = '') { |
|
| 174 | 174 | // These aren't really bulk actions but this outputs the markup in the right place |
| 175 | 175 | give_report_views(); |
| 176 | 176 | } |
@@ -183,23 +183,23 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @param string $which |
| 185 | 185 | */ |
| 186 | - protected function display_tablenav( $which ) { |
|
| 186 | + protected function display_tablenav($which) { |
|
| 187 | 187 | |
| 188 | - if ( 'top' == $which ) { |
|
| 189 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 188 | + if ('top' == $which) { |
|
| 189 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 190 | 190 | } |
| 191 | 191 | ?> |
| 192 | - <div class="tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
| 192 | + <div class="tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
| 193 | 193 | |
| 194 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span></h3> |
|
| 194 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Forms Report', 'give'); ?></span></h3> |
|
| 195 | 195 | |
| 196 | 196 | <div class="alignright tablenav-right"> |
| 197 | 197 | <div class="actions bulkactions"> |
| 198 | - <?php $this->bulk_actions( $which ); ?> |
|
| 198 | + <?php $this->bulk_actions($which); ?> |
|
| 199 | 199 | </div> |
| 200 | 200 | <?php |
| 201 | - $this->extra_tablenav( $which ); |
|
| 202 | - $this->pagination( $which ); |
|
| 201 | + $this->extra_tablenav($which); |
|
| 202 | + $this->pagination($which); |
|
| 203 | 203 | ?> |
| 204 | 204 | </div> |
| 205 | 205 | |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function category_filter() { |
| 221 | 221 | |
| 222 | - $categories = get_terms( 'form_category' ); |
|
| 223 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
| 224 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
| 222 | + $categories = get_terms('form_category'); |
|
| 223 | + if ($categories && ! is_wp_error($categories)) { |
|
| 224 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function query() { |
| 237 | 237 | |
| 238 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
| 239 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 238 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
| 239 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 240 | 240 | $category = $this->get_category(); |
| 241 | 241 | |
| 242 | 242 | $args = array( |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | 'suppress_filters' => true |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - if ( ! empty( $category ) ) { |
|
| 252 | + if ( ! empty($category)) { |
|
| 253 | 253 | $args['tax_query'] = array( |
| 254 | 254 | array( |
| 255 | 255 | 'taxonomy' => 'form_category', |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - switch ( $orderby ) : |
|
| 261 | + switch ($orderby) : |
|
| 262 | 262 | case 'title' : |
| 263 | 263 | $args['orderby'] = 'title'; |
| 264 | 264 | break; |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | break; |
| 275 | 275 | endswitch; |
| 276 | 276 | |
| 277 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
| 277 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
| 278 | 278 | |
| 279 | - $this->products = new WP_Query( $args ); |
|
| 279 | + $this->products = new WP_Query($args); |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $give_forms = $this->products->posts; |
| 294 | 294 | |
| 295 | - if ( $give_forms ) { |
|
| 296 | - foreach ( $give_forms as $form ) { |
|
| 295 | + if ($give_forms) { |
|
| 296 | + foreach ($give_forms as $form) { |
|
| 297 | 297 | $reports_data[] = array( |
| 298 | 298 | 'ID' => $form, |
| 299 | - 'title' => get_the_title( $form ), |
|
| 300 | - 'sales' => give_get_form_sales_stats( $form ), |
|
| 301 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
| 302 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
| 303 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
| 299 | + 'title' => get_the_title($form), |
|
| 300 | + 'sales' => give_get_form_sales_stats($form), |
|
| 301 | + 'earnings' => give_get_form_earnings_stats($form), |
|
| 302 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
| 303 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
| 304 | 304 | ); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $sortable = $this->get_sortable_columns(); |
| 330 | 330 | |
| 331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 332 | 332 | |
| 333 | 333 | $data = $this->reports_data(); |
| 334 | 334 | |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | $this->items = $data; |
| 338 | 338 | |
| 339 | - $this->set_pagination_args( array( |
|
| 339 | + $this->set_pagination_args(array( |
|
| 340 | 340 | 'total_items' => $total_items, |
| 341 | 341 | 'per_page' => $this->per_page, |
| 342 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 342 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 343 | 343 | ) |
| 344 | 344 | ); |
| 345 | 345 | } |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => esc_attr( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => esc_attr( 'Complete Transactions', 'give' ), |
|
| 85 | - 'pending_sales' => esc_attr( 'Pending / Failed Transactions', 'give' ), |
|
| 86 | - 'total_sales' => esc_attr( 'Total Transactions', 'give' ), |
|
| 87 | - 'total_donations' => esc_attr( 'Total Donations', 'give' ) |
|
| 83 | + 'label' => esc_attr('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => esc_attr('Complete Transactions', 'give'), |
|
| 85 | + 'pending_sales' => esc_attr('Pending / Failed Transactions', 'give'), |
|
| 86 | + 'total_sales' => esc_attr('Total Transactions', 'give'), |
|
| 87 | + 'total_donations' => esc_attr('Total Donations', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return int Current page number |
| 100 | 100 | */ |
| 101 | 101 | public function get_paged() { |
| 102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @since 1.0 |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function bulk_actions( $which = '' ) { |
|
| 113 | + public function bulk_actions($which = '') { |
|
| 114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
| 115 | 115 | give_report_views(); |
| 116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param string $which |
| 125 | 125 | */ |
| 126 | - protected function display_tablenav( $which ) { |
|
| 126 | + protected function display_tablenav($which) { |
|
| 127 | 127 | |
| 128 | - if ( 'top' == $which ) { |
|
| 129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 128 | + if ('top' == $which) { |
|
| 129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 130 | 130 | } |
| 131 | 131 | ?> |
| 132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
| 132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
| 133 | 133 | |
| 134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
| 134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3> |
|
| 135 | 135 | |
| 136 | 136 | <div class="alignright tablenav-right"> |
| 137 | 137 | <div class="actions bulkactions"> |
| 138 | - <?php $this->bulk_actions( $which ); ?> |
|
| 138 | + <?php $this->bulk_actions($which); ?> |
|
| 139 | 139 | </div> |
| 140 | 140 | <?php |
| 141 | - $this->extra_tablenav( $which ); |
|
| 142 | - $this->pagination( $which ); |
|
| 141 | + $this->extra_tablenav($which); |
|
| 142 | + $this->pagination($which); |
|
| 143 | 143 | ?> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
| 164 | 164 | $gateways = give_get_payment_gateways(); |
| 165 | 165 | $stats = new Give_Payment_Stats(); |
| 166 | 166 | |
| 167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 168 | 168 | |
| 169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 171 | 171 | |
| 172 | 172 | $reports_data[] = array( |
| 173 | 173 | 'ID' => $gateway_id, |
| 174 | 174 | 'label' => $gateway['admin_label'], |
| 175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
| 176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
| 177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
| 178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
| 175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
| 176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
| 177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
| 178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
| 179 | 179 | ); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $columns = $this->get_columns(); |
| 198 | 198 | $hidden = array(); // No hidden columns |
| 199 | 199 | $sortable = $this->get_sortable_columns(); |
| 200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 201 | 201 | $this->items = $this->reports_data(); |
| 202 | 202 | |
| 203 | 203 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_logs_view_sales() { |
| 26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
| 26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
| 27 | 27 | |
| 28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
| 29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | function give_logs_view_gateway_errors() { |
| 46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
| 46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
| 47 | 47 | |
| 48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 49 | 49 | $logs_table->prepare_items(); |
| 50 | 50 | $logs_table->display(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * API Request Logs |
@@ -62,28 +62,28 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | 64 | function give_logs_view_api_requests() { |
| 65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
| 65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
| 66 | 66 | |
| 67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
| 68 | 68 | $logs_table->prepare_items(); |
| 69 | 69 | ?> |
| 70 | 70 | <div class="wrap"> |
| 71 | - <?php do_action( 'give_logs_api_requests_top' ); ?> |
|
| 72 | - <form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>"> |
|
| 71 | + <?php do_action('give_logs_api_requests_top'); ?> |
|
| 72 | + <form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>"> |
|
| 73 | 73 | <?php |
| 74 | - $logs_table->search_box( esc_html( 'Search', 'give' ), 'give-api-requests' ); |
|
| 74 | + $logs_table->search_box(esc_html('Search', 'give'), 'give-api-requests'); |
|
| 75 | 75 | $logs_table->display(); |
| 76 | 76 | ?> |
| 77 | 77 | <input type="hidden" name="post_type" value="give_forms"/> |
| 78 | 78 | <input type="hidden" name="page" value="give-reports"/> |
| 79 | 79 | <input type="hidden" name="tab" value="logs"/> |
| 80 | 80 | </form> |
| 81 | - <?php do_action( 'give_logs_api_requests_bottom' ); ?> |
|
| 81 | + <?php do_action('give_logs_api_requests_bottom'); ?> |
|
| 82 | 82 | </div> |
| 83 | 83 | <?php |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 86 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function give_log_default_views() { |
| 96 | 96 | $views = array( |
| 97 | - 'sales' => esc_html( 'Donations', 'give' ), |
|
| 98 | - 'gateway_errors' => esc_html( 'Payment Errors', 'give' ), |
|
| 99 | - 'api_requests' => esc_html( 'API Requests', 'give' ) |
|
| 97 | + 'sales' => esc_html('Donations', 'give'), |
|
| 98 | + 'gateway_errors' => esc_html('Payment Errors', 'give'), |
|
| 99 | + 'api_requests' => esc_html('API Requests', 'give') |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - $views = apply_filters( 'give_log_views', $views ); |
|
| 102 | + $views = apply_filters('give_log_views', $views); |
|
| 103 | 103 | |
| 104 | 104 | return $views; |
| 105 | 105 | } |
@@ -112,24 +112,24 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function give_log_views() { |
| 114 | 114 | $views = give_log_default_views(); |
| 115 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
| 115 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
| 116 | 116 | ?> |
| 117 | 117 | <form id="give-logs-filter" method="get" action="edit.php"> |
| 118 | 118 | <select id="give-logs-view" name="view"> |
| 119 | 119 | <optgroup label="Log Type:"> |
| 120 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
| 121 | - <option value="<?php esc_attr_e( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 120 | + <?php foreach ($views as $view_id => $label): ?> |
|
| 121 | + <option value="<?php esc_attr_e($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 122 | 122 | <?php endforeach; ?> |
| 123 | 123 | </optgroup> |
| 124 | 124 | </select> |
| 125 | 125 | |
| 126 | - <?php do_action( 'give_log_view_actions' ); ?> |
|
| 126 | + <?php do_action('give_log_view_actions'); ?> |
|
| 127 | 127 | |
| 128 | 128 | <input type="hidden" name="post_type" value="give_forms"/> |
| 129 | 129 | <input type="hidden" name="page" value="give-reports"/> |
| 130 | 130 | <input type="hidden" name="tab" value="logs"/> |
| 131 | 131 | |
| 132 | - <?php submit_button( esc_html( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 132 | + <?php submit_button(esc_html('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 133 | 133 | </form> |
| 134 | 134 | <?php |
| 135 | 135 | } |
| 136 | 136 | \ No newline at end of file |
@@ -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,36 +29,36 @@ 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 | <h1 class="nav-tab-wrapper"> |
| 37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 38 | 38 | 'tab' => 'reports', |
| 39 | 39 | 'settings-updated' => false |
| 40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
| 41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
| 41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => 'export', |
| 44 | 44 | 'settings-updated' => false |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 48 | 48 | 'tab' => 'logs', |
| 49 | 49 | 'settings-updated' => false |
| 50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a> |
|
| 51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a> |
|
| 51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 52 | 52 | 'tab' => 'tools', |
| 53 | 53 | 'settings-updated' => false |
| 54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a> |
|
| 55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
| 54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a> |
|
| 55 | + <?php do_action('give_reports_tabs'); ?> |
|
| 56 | 56 | </h1> |
| 57 | 57 | |
| 58 | 58 | <?php |
| 59 | - do_action( 'give_reports_page_top' ); |
|
| 60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
| 61 | - do_action( 'give_reports_page_bottom' ); |
|
| 59 | + do_action('give_reports_page_top'); |
|
| 60 | + do_action('give_reports_tab_'.$active_tab); |
|
| 61 | + do_action('give_reports_page_bottom'); |
|
| 62 | 62 | ?> |
| 63 | 63 | </div><!-- .wrap --> |
| 64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function give_reports_default_views() { |
| 74 | 74 | $views = array( |
| 75 | - 'earnings' => esc_html( 'Income', 'give' ), |
|
| 75 | + 'earnings' => esc_html('Income', 'give'), |
|
| 76 | 76 | 'forms' => give_get_forms_label_plural(), |
| 77 | - 'donors' => esc_html( 'Donors', 'give' ), |
|
| 78 | - 'gateways' => esc_html( 'Payment Methods', 'give' ) |
|
| 77 | + 'donors' => esc_html('Donors', 'give'), |
|
| 78 | + 'gateways' => esc_html('Payment Methods', 'give') |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 81 | + $views = apply_filters('give_report_views', $views); |
|
| 82 | 82 | |
| 83 | 83 | return $views; |
| 84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | * @return string $view Report View |
| 95 | 95 | * |
| 96 | 96 | */ |
| 97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 97 | +function give_get_reporting_view($default = 'earnings') { |
|
| 98 | 98 | |
| 99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 100 | 100 | $view = $default; |
| 101 | 101 | } else { |
| 102 | 102 | $view = $_GET['view']; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 105 | + return apply_filters('give_get_reporting_view', $view); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | $current_view = 'earnings'; |
| 116 | 116 | $views = give_reports_default_views(); |
| 117 | 117 | |
| 118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
| 118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
| 119 | 119 | $current_view = $_GET['view']; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - do_action( 'give_reports_view_' . $current_view ); |
|
| 122 | + do_action('give_reports_view_'.$current_view); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function give_report_views() { |
| 134 | 134 | $views = give_reports_default_views(); |
| 135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 136 | - do_action( 'give_report_view_actions_before' ); |
|
| 135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 136 | + do_action('give_report_view_actions_before'); |
|
| 137 | 137 | ?> |
| 138 | 138 | <form id="give-reports-filter" method="get"> |
| 139 | 139 | <select id="give-reports-view" name="view"> |
| 140 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 142 | - <option value="<?php esc_attr_e( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 140 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 142 | + <option value="<?php esc_attr_e($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 143 | 143 | <?php endforeach; ?> |
| 144 | 144 | </select> |
| 145 | 145 | |
| 146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
| 146 | + <?php do_action('give_report_view_actions'); ?> |
|
| 147 | 147 | |
| 148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
| 149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
| 150 | - <?php submit_button( esc_html( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 150 | + <?php submit_button(esc_html('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 151 | 151 | </form> |
| 152 | 152 | <?php |
| 153 | - do_action( 'give_report_view_actions_after' ); |
|
| 153 | + do_action('give_report_view_actions_after'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | function give_reports_forms_table() { |
| 165 | 165 | |
| 166 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 166 | + if (isset($_GET['form-id'])) { |
|
| 167 | 167 | return; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 171 | 171 | |
| 172 | 172 | $give_table = new Give_Form_Reports_Table(); |
| 173 | 173 | $give_table->prepare_items(); |
| 174 | 174 | $give_table->display(); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @return void |
| 184 | 184 | */ |
| 185 | 185 | function give_reports_form_details() { |
| 186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 186 | + if ( ! isset($_GET['form-id'])) { |
|
| 187 | 187 | return; |
| 188 | 188 | } |
| 189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | <div class="actions bulkactions"> |
| 192 | 192 | <?php give_report_views(); ?> |
| 193 | 193 | |
| 194 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 194 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 195 | 195 | </div> |
| 196 | 196 | </div> |
| 197 | 197 | <?php |
| 198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
| 209 | 209 | * @return void |
| 210 | 210 | */ |
| 211 | 211 | function give_reports_donors_table() { |
| 212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 213 | 213 | |
| 214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
| 215 | 215 | $give_table->prepare_items(); |
| 216 | 216 | ?> |
| 217 | 217 | <div class="wrap give-reports-donors-wrap"> |
| 218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
| 219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
| 218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
| 219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
| 220 | 220 | <?php |
| 221 | - $give_table->search_box( esc_html( 'Search', 'give' ), 'give-donors' ); |
|
| 221 | + $give_table->search_box(esc_html('Search', 'give'), 'give-donors'); |
|
| 222 | 222 | $give_table->display(); |
| 223 | 223 | ?> |
| 224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
| 225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
| 226 | 226 | <input type="hidden" name="view" value="donors"/> |
| 227 | 227 | </form> |
| 228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
| 228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
| 229 | 229 | </div> |
| 230 | 230 | <?php |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
| 242 | 242 | * @return void |
| 243 | 243 | */ |
| 244 | 244 | function give_reports_gateways_table() { |
| 245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 246 | 246 | |
| 247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
| 248 | 248 | $give_table->prepare_items(); |
| 249 | 249 | $give_table->display(); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | function give_reports_earnings() { |
| 262 | 262 | ?> |
| 263 | 263 | <div class="tablenav top reports-table-nav"> |
| 264 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
| 264 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
| 265 | 265 | |
| 266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
| 267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | give_reports_graph(); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -284,53 +284,53 @@ discard block |
||
| 284 | 284 | <div id="post-body"> |
| 285 | 285 | <div id="post-body-content"> |
| 286 | 286 | |
| 287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
| 287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
| 288 | 288 | |
| 289 | 289 | <table class="widefat export-options-table give-table"> |
| 290 | 290 | <thead> |
| 291 | 291 | <tr> |
| 292 | - <th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
| 293 | - <th><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
| 292 | + <th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
| 293 | + <th><?php esc_html_e('Export Options', 'give'); ?></th> |
|
| 294 | 294 | </tr> |
| 295 | 295 | </thead> |
| 296 | 296 | <tbody> |
| 297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
| 297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
| 298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
| 299 | 299 | <td class="row-title"> |
| 300 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
| 300 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
| 301 | 301 | |
| 302 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 302 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 303 | 303 | </td> |
| 304 | 304 | <td> |
| 305 | - <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> |
|
| 305 | + <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> |
|
| 306 | 306 | </td> |
| 307 | 307 | </tr> |
| 308 | 308 | <tr class="alternate give-export-sales-earnings"> |
| 309 | 309 | <td class="row-title"> |
| 310 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
| 310 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
| 311 | 311 | |
| 312 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 312 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 313 | 313 | </td> |
| 314 | 314 | <td> |
| 315 | 315 | <form method="post"> |
| 316 | 316 | <?php |
| 317 | 317 | printf( |
| 318 | 318 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 319 | - esc_html( '%1$s to %2$s', 'give' ), |
|
| 320 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
| 321 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
| 319 | + esc_html('%1$s to %2$s', 'give'), |
|
| 320 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
| 321 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
| 322 | 322 | ); |
| 323 | 323 | ?> |
| 324 | 324 | <input type="hidden" name="give-action" value="earnings_export"/> |
| 325 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 325 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 326 | 326 | </form> |
| 327 | 327 | </td> |
| 328 | 328 | </tr> |
| 329 | 329 | <tr class="give-export-payment-history"> |
| 330 | 330 | <td class="row-title"> |
| 331 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
| 331 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
| 332 | 332 | |
| 333 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 333 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 334 | 334 | </td> |
| 335 | 335 | <td> |
| 336 | 336 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -338,29 +338,29 @@ discard block |
||
| 338 | 338 | $args = array( |
| 339 | 339 | 'id' => 'give-payment-export-start', |
| 340 | 340 | 'name' => 'start', |
| 341 | - 'placeholder' => esc_attr( 'Start date', 'give' ) |
|
| 341 | + 'placeholder' => esc_attr('Start date', 'give') |
|
| 342 | 342 | ); |
| 343 | - echo Give()->html->date_field( $args ); ?> |
|
| 343 | + echo Give()->html->date_field($args); ?> |
|
| 344 | 344 | <?php |
| 345 | 345 | $args = array( |
| 346 | 346 | 'id' => 'give-payment-export-end', |
| 347 | 347 | 'name' => 'end', |
| 348 | - 'placeholder' => esc_attr( 'End date', 'give' ) |
|
| 348 | + 'placeholder' => esc_attr('End date', 'give') |
|
| 349 | 349 | ); |
| 350 | - echo Give()->html->date_field( $args ); ?> |
|
| 350 | + echo Give()->html->date_field($args); ?> |
|
| 351 | 351 | <select name="status"> |
| 352 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
| 352 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
| 353 | 353 | <?php |
| 354 | 354 | $statuses = give_get_payment_statuses(); |
| 355 | - foreach ( $statuses as $status => $label ) { |
|
| 356 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
| 355 | + foreach ($statuses as $status => $label) { |
|
| 356 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
| 357 | 357 | } |
| 358 | 358 | ?> |
| 359 | 359 | </select> |
| 360 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 360 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 361 | 361 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
| 362 | 362 | <span> |
| 363 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 363 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 364 | 364 | <span class="spinner"></span> |
| 365 | 365 | </span> |
| 366 | 366 | </form> |
@@ -369,9 +369,9 @@ discard block |
||
| 369 | 369 | </tr> |
| 370 | 370 | <tr class="alternate give-export-donors"> |
| 371 | 371 | <td class="row-title"> |
| 372 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
| 372 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
| 373 | 373 | |
| 374 | - <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> |
|
| 374 | + <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> |
|
| 375 | 375 | </td> |
| 376 | 376 | <td> |
| 377 | 377 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -382,54 +382,54 @@ discard block |
||
| 382 | 382 | 'id' => 'give_customer_export_form', |
| 383 | 383 | 'chosen' => true |
| 384 | 384 | ); |
| 385 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
| 385 | + echo Give()->html->forms_dropdown($args); ?> |
|
| 386 | 386 | |
| 387 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 387 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 388 | 388 | |
| 389 | 389 | <div id="export-donor-options-wrap" class="give-clearfix"> |
| 390 | - <p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p> |
|
| 390 | + <p><?php esc_html_e('Export Columns', 'give'); ?>:</p> |
|
| 391 | 391 | <ul id="give-export-option-ul"> |
| 392 | 392 | <li> |
| 393 | - <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' ); ?> |
|
| 393 | + <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'); ?> |
|
| 394 | 394 | </label> |
| 395 | 395 | </li> |
| 396 | 396 | <li> |
| 397 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
| 397 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
| 398 | 398 | </label> |
| 399 | 399 | </li> |
| 400 | 400 | <li> |
| 401 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
| 401 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
| 402 | 402 | </label> |
| 403 | 403 | </li> |
| 404 | 404 | <li> |
| 405 | - <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' ); ?> |
|
| 405 | + <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'); ?> |
|
| 406 | 406 | </label> |
| 407 | 407 | </li> |
| 408 | 408 | <li> |
| 409 | - <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' ); ?> |
|
| 409 | + <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'); ?> |
|
| 410 | 410 | </label> |
| 411 | 411 | </li> |
| 412 | 412 | <li> |
| 413 | - <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' ); ?> |
|
| 413 | + <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'); ?> |
|
| 414 | 414 | </label> |
| 415 | 415 | </li> |
| 416 | 416 | <li> |
| 417 | - <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' ); ?> |
|
| 417 | + <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'); ?> |
|
| 418 | 418 | </label> |
| 419 | 419 | </li> |
| 420 | 420 | </ul> |
| 421 | 421 | </div> |
| 422 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 422 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 423 | 423 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
| 424 | 424 | <input type="hidden" name="give-action" value="email_export"/> |
| 425 | 425 | </form> |
| 426 | 426 | </td> |
| 427 | 427 | </tr> |
| 428 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
| 428 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
| 429 | 429 | </tbody> |
| 430 | 430 | </table> |
| 431 | 431 | |
| 432 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
| 432 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
| 433 | 433 | |
| 434 | 434 | </div> |
| 435 | 435 | <!-- .post-body-content --> |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | <?php |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
| 442 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
| 443 | 443 | |
| 444 | 444 | /** |
| 445 | 445 | * Renders the Reports page |
@@ -449,19 +449,19 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | function give_reports_tab_logs() { |
| 451 | 451 | |
| 452 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
| 452 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
| 453 | 453 | |
| 454 | 454 | $current_view = 'sales'; |
| 455 | 455 | $log_views = give_log_default_views(); |
| 456 | 456 | |
| 457 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
| 457 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
| 458 | 458 | $current_view = $_GET['view']; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - do_action( 'give_logs_view_' . $current_view ); |
|
| 461 | + do_action('give_logs_view_'.$current_view); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
| 464 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
| 465 | 465 | |
| 466 | 466 | /** |
| 467 | 467 | * Retrieves estimated monthly earnings and sales |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | function give_estimated_monthly_stats() { |
| 473 | 473 | |
| 474 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
| 474 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
| 475 | 475 | |
| 476 | - if ( false === $estimated ) { |
|
| 476 | + if (false === $estimated) { |
|
| 477 | 477 | |
| 478 | 478 | $estimated = array( |
| 479 | 479 | 'earnings' => 0, |
@@ -482,20 +482,20 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | $stats = new Give_Payment_Stats; |
| 484 | 484 | |
| 485 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 486 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 485 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 486 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 487 | 487 | |
| 488 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 489 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 490 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 491 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 488 | + $current_day = date('d', current_time('timestamp')); |
|
| 489 | + $current_month = date('n', current_time('timestamp')); |
|
| 490 | + $current_year = date('Y', current_time('timestamp')); |
|
| 491 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 492 | 492 | |
| 493 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 494 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 493 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 494 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 495 | 495 | |
| 496 | 496 | // Cache for one day |
| 497 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
| 497 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - return maybe_unserialize( $estimated ); |
|
| 500 | + return maybe_unserialize($estimated); |
|
| 501 | 501 | } |
@@ -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 | |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @since 1.0 |
| 80 | 80 | */ |
| 81 | - public function __construct( $_data ) { |
|
| 81 | + public function __construct($_data) { |
|
| 82 | 82 | |
| 83 | 83 | $this->data = $_data; |
| 84 | 84 | |
| 85 | 85 | // Generate unique ID |
| 86 | - $this->id = md5( rand() ); |
|
| 86 | + $this->id = md5(rand()); |
|
| 87 | 87 | |
| 88 | 88 | // Setup default options; |
| 89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
| 89 | + $this->options = apply_filters('give_graph_args', array( |
|
| 90 | 90 | 'y_mode' => null, |
| 91 | 91 | 'x_mode' => null, |
| 92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'bars' => true, |
| 104 | 104 | 'lines' => false, |
| 105 | 105 | 'points' => true |
| 106 | - ) ); |
|
| 106 | + )); |
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @since 1.0 |
| 117 | 117 | */ |
| 118 | - public function set( $key, $value ) { |
|
| 119 | - $this->options[ $key ] = $value; |
|
| 118 | + public function set($key, $value) { |
|
| 119 | + $this->options[$key] = $value; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @since 1.0 |
| 128 | 128 | */ |
| 129 | - public function get( $key ) { |
|
| 130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
| 129 | + public function get($key) { |
|
| 130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @since 1.0 |
| 137 | 137 | */ |
| 138 | 138 | public function get_data() { |
| 139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
| 139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function load_scripts() { |
| 148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 150 | 150 | |
| 151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
| 151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
| 153 | 153 | |
| 154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
| 154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 155 | + wp_enqueue_script('jquery-flot-time'); |
|
| 156 | 156 | |
| 157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
| 158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
| 157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
| 158 | + wp_enqueue_script('jquery-flot-resize'); |
|
| 159 | 159 | |
| 160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
| 161 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
| 161 | + wp_enqueue_script('jquery-flot'); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | [ |
| 186 | 186 | <?php |
| 187 | 187 | $order = 0; |
| 188 | - foreach( $this->get_data() as $label => $data ) : |
|
| 188 | + foreach ($this->get_data() as $label => $data) : |
|
| 189 | 189 | ?> |
| 190 | 190 | { |
| 191 | - label : "<?php esc_attr_e( $label ); ?>", |
|
| 192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
| 191 | + label : "<?php esc_attr_e($label); ?>", |
|
| 192 | + id : "<?php echo sanitize_key($label); ?>", |
|
| 193 | 193 | // data format is: [ point on x, value on y ] |
| 194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
| 194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
| 195 | 195 | points: { |
| 196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
| 197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | fill : true, |
| 207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
| 208 | 208 | }, |
| 209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
| 209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
| 210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
| 211 | 211 | <?php endif; ?> |
| 212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | grid: { |
| 221 | 221 | show : true, |
| 222 | 222 | aboveData : false, |
| 223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
| 224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
| 225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
| 226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
| 223 | + color : "<?php echo $this->options['color']; ?>", |
|
| 224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
| 225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
| 226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
| 227 | 227 | clickable : false, |
| 228 | 228 | hoverable : true |
| 229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
| 235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
| 236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
| 237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
| 237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
| 238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
| 239 | 239 | <?php endif; ?> |
| 240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | min : 0, |
| 244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
| 245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
| 246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
| 246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
| 247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
| 248 | 248 | <?php endif; ?> |
| 249 | 249 | } |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * @since 1.0 |
| 307 | 307 | */ |
| 308 | 308 | public function display() { |
| 309 | - do_action( 'give_before_graph', $this ); |
|
| 309 | + do_action('give_before_graph', $this); |
|
| 310 | 310 | echo $this->build_graph(); |
| 311 | - do_action( 'give_after_graph', $this ); |
|
| 311 | + do_action('give_after_graph', $this); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | } |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Load WP_List_Table if not loaded |
| 17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 17 | +if ( ! class_exists('WP_List_Table')) { |
|
| 18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return string Column Name |
| 65 | 65 | */ |
| 66 | - public function column_default( $item, $column_name ) { |
|
| 67 | - switch ( $column_name ) { |
|
| 66 | + public function column_default($item, $column_name) { |
|
| 67 | + switch ($column_name) { |
|
| 68 | 68 | case 'ID' : |
| 69 | 69 | return $item['ID_label']; |
| 70 | 70 | case 'error' : |
| 71 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html( 'Payment Error', 'give' ); |
|
| 71 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html('Payment Error', 'give'); |
|
| 72 | 72 | default: |
| 73 | - return $item[ $column_name ]; |
|
| 73 | + return $item[$column_name]; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | - public function column_message( $item ) { |
|
| 87 | + public function column_message($item) { |
|
| 88 | 88 | |
| 89 | 89 | ?> |
| 90 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Log Message', 'give' ); ?> "><?php esc_html_e( 'View Log Message', 'give' ); ?></a> |
|
| 90 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Log Message', 'give'); ?> "><?php esc_html_e('View Log Message', 'give'); ?></a> |
|
| 91 | 91 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
| 92 | 92 | <?php |
| 93 | 93 | |
| 94 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
| 94 | + $log_message = get_post_field('post_content', $item['ID']); |
|
| 95 | 95 | |
| 96 | - $serialized = strpos( $log_message, '{"' ); |
|
| 96 | + $serialized = strpos($log_message, '{"'); |
|
| 97 | 97 | |
| 98 | 98 | // Check to see if the log message contains serialized information |
| 99 | - if ( $serialized !== false ) { |
|
| 100 | - $length = strlen( $log_message ) - $serialized; |
|
| 101 | - $intro = substr( $log_message, 0, - $length ); |
|
| 102 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
| 99 | + if ($serialized !== false) { |
|
| 100 | + $length = strlen($log_message) - $serialized; |
|
| 101 | + $intro = substr($log_message, 0, - $length); |
|
| 102 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
| 103 | 103 | |
| 104 | - echo wpautop( $intro ); |
|
| 105 | - echo wpautop( '<strong>' . esc_html( 'Log data:', 'give' ) . '</strong>' ); |
|
| 106 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
| 104 | + echo wpautop($intro); |
|
| 105 | + echo wpautop('<strong>'.esc_html('Log data:', 'give').'</strong>'); |
|
| 106 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
| 107 | 107 | } else { |
| 108 | 108 | // No serialized data found |
| 109 | - echo wpautop( $log_message ); |
|
| 109 | + echo wpautop($log_message); |
|
| 110 | 110 | } |
| 111 | 111 | ?> |
| 112 | 112 | </div> |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function get_columns() { |
| 124 | 124 | $columns = array( |
| 125 | - 'ID' => esc_html( 'Log ID', 'give' ), |
|
| 126 | - 'payment_id' => esc_html( 'Payment ID', 'give' ), |
|
| 127 | - 'error' => esc_html( 'Error', 'give' ), |
|
| 128 | - 'message' => esc_html( 'Error Message', 'give' ), |
|
| 129 | - 'gateway' => esc_html( 'Gateway', 'give' ), |
|
| 130 | - 'date' => esc_html( 'Date', 'give' ) |
|
| 125 | + 'ID' => esc_html('Log ID', 'give'), |
|
| 126 | + 'payment_id' => esc_html('Payment ID', 'give'), |
|
| 127 | + 'error' => esc_html('Error', 'give'), |
|
| 128 | + 'message' => esc_html('Error Message', 'give'), |
|
| 129 | + 'gateway' => esc_html('Gateway', 'give'), |
|
| 130 | + 'date' => esc_html('Date', 'give') |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | return $columns; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @return int Current page number |
| 142 | 142 | */ |
| 143 | 143 | public function get_paged() { |
| 144 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 144 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @since 1.0 |
| 152 | 152 | * @return void |
| 153 | 153 | */ |
| 154 | - public function bulk_actions( $which = '' ) { |
|
| 154 | + public function bulk_actions($which = '') { |
|
| 155 | 155 | give_log_views(); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | global $give_logs; |
| 168 | 168 | |
| 169 | 169 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
| 170 | - wp_suspend_cache_addition( true ); |
|
| 170 | + wp_suspend_cache_addition(true); |
|
| 171 | 171 | |
| 172 | 172 | $logs_data = array(); |
| 173 | 173 | $paged = $this->get_paged(); |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | 'paged' => $paged |
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 179 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 180 | 180 | |
| 181 | - if ( $logs ) { |
|
| 182 | - foreach ( $logs as $log ) { |
|
| 181 | + if ($logs) { |
|
| 182 | + foreach ($logs as $log) { |
|
| 183 | 183 | |
| 184 | 184 | $logs_data[] = array( |
| 185 | 185 | 'ID' => $log->ID, |
| 186 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
| 186 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
| 187 | 187 | 'payment_id' => $log->post_parent, |
| 188 | 188 | 'error' => 'error', |
| 189 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
| 189 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
| 190 | 190 | 'date' => $log->post_date |
| 191 | 191 | ); |
| 192 | 192 | } |
@@ -207,19 +207,19 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param string $which |
| 209 | 209 | */ |
| 210 | - protected function display_tablenav( $which ) { |
|
| 211 | - if ( 'top' === $which ) { |
|
| 212 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 210 | + protected function display_tablenav($which) { |
|
| 211 | + if ('top' === $which) { |
|
| 212 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 213 | 213 | } |
| 214 | 214 | ?> |
| 215 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
| 215 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
| 216 | 216 | |
| 217 | 217 | <div class="alignleft actions bulkactions"> |
| 218 | - <?php $this->bulk_actions( $which ); ?> |
|
| 218 | + <?php $this->bulk_actions($which); ?> |
|
| 219 | 219 | </div> |
| 220 | 220 | <?php |
| 221 | - $this->extra_tablenav( $which ); |
|
| 222 | - $this->pagination( $which ); |
|
| 221 | + $this->extra_tablenav($which); |
|
| 222 | + $this->pagination($which); |
|
| 223 | 223 | ?> |
| 224 | 224 | |
| 225 | 225 | <br class="clear"/> |
@@ -246,15 +246,15 @@ discard block |
||
| 246 | 246 | $columns = $this->get_columns(); |
| 247 | 247 | $hidden = array(); // No hidden columns |
| 248 | 248 | $sortable = $this->get_sortable_columns(); |
| 249 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 249 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 250 | 250 | $current_page = $this->get_pagenum(); |
| 251 | 251 | $this->items = $this->get_logs(); |
| 252 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
| 252 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
| 253 | 253 | |
| 254 | - $this->set_pagination_args( array( |
|
| 254 | + $this->set_pagination_args(array( |
|
| 255 | 255 | 'total_items' => $total_items, |
| 256 | 256 | 'per_page' => $this->per_page, |
| 257 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 257 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 258 | 258 | ) |
| 259 | 259 | ); |
| 260 | 260 | } |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return bool Whether we can export or not |
| 38 | 38 | */ |
| 39 | 39 | public function can_export() { |
| 40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
| 40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
| 48 | 48 | * @return void |
| 49 | 49 | */ |
| 50 | 50 | public function headers() { |
| 51 | - ignore_user_abort( true ); |
|
| 51 | + ignore_user_abort(true); |
|
| 52 | 52 | |
| 53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 54 | - set_time_limit( 0 ); |
|
| 53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 54 | + set_time_limit(0); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | nocache_headers(); |
| 58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
| 60 | - header( "Expires: 0" ); |
|
| 58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
| 60 | + header("Expires: 0"); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function csv_cols() { |
| 71 | 71 | $cols = array( |
| 72 | - 'id' => esc_html( 'ID', 'give' ), |
|
| 73 | - 'date' => esc_html( 'Date', 'give' ) |
|
| 72 | + 'id' => esc_html('ID', 'give'), |
|
| 73 | + 'date' => esc_html('Date', 'give') |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function get_csv_cols() { |
| 87 | 87 | $cols = $this->csv_cols(); |
| 88 | 88 | |
| 89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
| 89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | public function csv_cols_out() { |
| 101 | 101 | $cols = $this->get_csv_cols(); |
| 102 | 102 | $i = 1; |
| 103 | - foreach ( $cols as $col_id => $column ) { |
|
| 104 | - echo '"' . addslashes( $column ) . '"'; |
|
| 105 | - echo $i == count( $cols ) ? '' : ','; |
|
| 106 | - $i ++; |
|
| 103 | + foreach ($cols as $col_id => $column) { |
|
| 104 | + echo '"'.addslashes($column).'"'; |
|
| 105 | + echo $i == count($cols) ? '' : ','; |
|
| 106 | + $i++; |
|
| 107 | 107 | } |
| 108 | 108 | echo "\r\n"; |
| 109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
| 120 | 120 | $data = array( |
| 121 | 121 | 0 => array( |
| 122 | 122 | 'id' => '', |
| 123 | - 'data' => date( 'F j, Y' ) |
|
| 123 | + 'data' => date('F j, Y') |
|
| 124 | 124 | ), |
| 125 | 125 | 1 => array( |
| 126 | 126 | 'id' => '', |
| 127 | - 'data' => date( 'F j, Y' ) |
|
| 127 | + 'data' => date('F j, Y') |
|
| 128 | 128 | ) |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 131 | + $data = apply_filters('give_export_get_data', $data); |
|
| 132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 133 | 133 | |
| 134 | 134 | return $data; |
| 135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $cols = $this->get_csv_cols(); |
| 148 | 148 | |
| 149 | 149 | // Output each row |
| 150 | - foreach ( $data as $row ) { |
|
| 150 | + foreach ($data as $row) { |
|
| 151 | 151 | $i = 1; |
| 152 | - foreach ( $row as $col_id => $column ) { |
|
| 152 | + foreach ($row as $col_id => $column) { |
|
| 153 | 153 | // Make sure the column is valid |
| 154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
| 155 | - echo '"' . addslashes( $column ) . '"'; |
|
| 156 | - echo $i == count( $cols ) ? '' : ','; |
|
| 157 | - $i ++; |
|
| 154 | + if (array_key_exists($col_id, $cols)) { |
|
| 155 | + echo '"'.addslashes($column).'"'; |
|
| 156 | + echo $i == count($cols) ? '' : ','; |
|
| 157 | + $i++; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @return void |
| 174 | 174 | */ |
| 175 | 175 | public function export() { |
| 176 | - if ( ! $this->can_export() ) { |
|
| 177 | - wp_die( esc_html( 'You do not have permission to export data.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 176 | + if ( ! $this->can_export()) { |
|
| 177 | + wp_die(esc_html('You do not have permission to export data.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Set headers |
@@ -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 | |
@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | 40 | public function headers() { |
| 41 | - ignore_user_abort( true ); |
|
| 41 | + ignore_user_abort(true); |
|
| 42 | 42 | |
| 43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 44 | - set_time_limit( 0 ); |
|
| 43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 44 | + set_time_limit(0); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | nocache_headers(); |
| 48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
| 50 | - header( "Expires: 0" ); |
|
| 48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
| 50 | + header("Expires: 0"); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | public function csv_cols() { |
| 62 | 62 | |
| 63 | 63 | $cols = array( |
| 64 | - 'date' => esc_html( 'Date', 'give' ), |
|
| 65 | - 'donations' => esc_html( 'Donations', 'give' ), |
|
| 64 | + 'date' => esc_html('Date', 'give'), |
|
| 65 | + 'donations' => esc_html('Donations', 'give'), |
|
| 66 | 66 | /* translators: %s: currency */ |
| 67 | - 'earnings' => sprintf( esc_html( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) ) |
|
| 67 | + 'earnings' => sprintf(esc_html('Income (%s)', 'give'), html_entity_decode(give_currency_filter(''))) |
|
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function get_data() { |
| 81 | 81 | |
| 82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
| 83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
| 84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
| 85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
| 82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
| 83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
| 84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
| 85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
| 86 | 86 | |
| 87 | 87 | $data = array(); |
| 88 | 88 | $year = $start_year; |
| 89 | 89 | $stats = new Give_Payment_Stats; |
| 90 | 90 | |
| 91 | - while ( $year <= $end_year ) { |
|
| 91 | + while ($year <= $end_year) { |
|
| 92 | 92 | |
| 93 | - if ( $year == $start_year && $year == $end_year ) { |
|
| 93 | + if ($year == $start_year && $year == $end_year) { |
|
| 94 | 94 | |
| 95 | 95 | $m1 = $start_month; |
| 96 | 96 | $m2 = $end_month; |
| 97 | 97 | |
| 98 | - } elseif ( $year == $start_year ) { |
|
| 98 | + } elseif ($year == $start_year) { |
|
| 99 | 99 | |
| 100 | 100 | $m1 = $start_month; |
| 101 | 101 | $m2 = 12; |
| 102 | 102 | |
| 103 | - } elseif ( $year == $end_year ) { |
|
| 103 | + } elseif ($year == $end_year) { |
|
| 104 | 104 | |
| 105 | 105 | $m1 = 1; |
| 106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - while ( $m1 <= $m2 ) { |
|
| 115 | + while ($m1 <= $m2) { |
|
| 116 | 116 | |
| 117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
| 118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
| 117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
| 118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
| 119 | 119 | |
| 120 | 120 | $data[] = array( |
| 121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
| 122 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
| 123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
| 121 | + 'date' => date_i18n('F Y', $date1), |
|
| 122 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
| 123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | - $m1 ++; |
|
| 126 | + $m1++; |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | - $year ++; |
|
| 131 | + $year++; |
|
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 136 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 135 | + $data = apply_filters('give_export_get_data', $data); |
|
| 136 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 137 | 137 | |
| 138 | 138 | return $data; |
| 139 | 139 | } |
@@ -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 | |
@@ -39,29 +39,29 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function csv_cols() { |
| 41 | 41 | $cols = array( |
| 42 | - 'id' => esc_html( 'ID', 'give' ), // unaltered payment ID (use for querying) |
|
| 43 | - 'seq_id' => esc_html( 'Payment Number', 'give' ), // sequential payment ID |
|
| 44 | - 'email' => esc_html( 'Email', 'give' ), |
|
| 45 | - 'first' => esc_html( 'First Name', 'give' ), |
|
| 46 | - 'last' => esc_html( 'Last Name', 'give' ), |
|
| 47 | - 'address1' => esc_html( 'Address', 'give' ), |
|
| 48 | - 'address2' => esc_html( 'Address (Line 2)', 'give' ), |
|
| 49 | - 'city' => esc_html( 'City', 'give' ), |
|
| 50 | - 'state' => esc_html( 'State', 'give' ), |
|
| 51 | - 'country' => esc_html( 'Country', 'give' ), |
|
| 52 | - 'zip' => esc_html( 'Zip / Postal Code', 'give' ), |
|
| 53 | - 'products' => esc_html( 'Products', 'give' ), |
|
| 54 | - 'amount' => esc_html( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
| 55 | - 'gateway' => esc_html( 'Payment Method', 'give' ), |
|
| 56 | - 'trans_id' => esc_html( 'Transaction ID', 'give' ), |
|
| 57 | - 'key' => esc_html( 'Purchase Key', 'give' ), |
|
| 58 | - 'date' => esc_html( 'Date', 'give' ), |
|
| 59 | - 'user' => esc_html( 'User', 'give' ), |
|
| 60 | - 'status' => esc_html( 'Status', 'give' ) |
|
| 42 | + 'id' => esc_html('ID', 'give'), // unaltered payment ID (use for querying) |
|
| 43 | + 'seq_id' => esc_html('Payment Number', 'give'), // sequential payment ID |
|
| 44 | + 'email' => esc_html('Email', 'give'), |
|
| 45 | + 'first' => esc_html('First Name', 'give'), |
|
| 46 | + 'last' => esc_html('Last Name', 'give'), |
|
| 47 | + 'address1' => esc_html('Address', 'give'), |
|
| 48 | + 'address2' => esc_html('Address (Line 2)', 'give'), |
|
| 49 | + 'city' => esc_html('City', 'give'), |
|
| 50 | + 'state' => esc_html('State', 'give'), |
|
| 51 | + 'country' => esc_html('Country', 'give'), |
|
| 52 | + 'zip' => esc_html('Zip / Postal Code', 'give'), |
|
| 53 | + 'products' => esc_html('Products', 'give'), |
|
| 54 | + 'amount' => esc_html('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
| 55 | + 'gateway' => esc_html('Payment Method', 'give'), |
|
| 56 | + 'trans_id' => esc_html('Transaction ID', 'give'), |
|
| 57 | + 'key' => esc_html('Purchase Key', 'give'), |
|
| 58 | + 'date' => esc_html('Date', 'give'), |
|
| 59 | + 'user' => esc_html('User', 'give'), |
|
| 60 | + 'status' => esc_html('Status', 'give') |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 64 | - unset( $cols['seq_id'] ); |
|
| 63 | + if ( ! give_get_option('enable_sequential')) { |
|
| 64 | + unset($cols['seq_id']); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | 'status' => $this->status |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
| 90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
| 91 | 91 | |
| 92 | 92 | $args['date_query'] = array( |
| 93 | 93 | array( |
| 94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
| 95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
| 94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
| 95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
| 96 | 96 | 'inclusive' => true |
| 97 | 97 | ) |
| 98 | 98 | ); |
@@ -101,104 +101,104 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | //echo json_encode($args ); exit; |
| 103 | 103 | |
| 104 | - $payments = give_get_payments( $args ); |
|
| 104 | + $payments = give_get_payments($args); |
|
| 105 | 105 | |
| 106 | - if ( $payments ) { |
|
| 106 | + if ($payments) { |
|
| 107 | 107 | |
| 108 | - foreach ( $payments as $payment ) { |
|
| 109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
| 110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
| 111 | - $total = give_get_payment_amount( $payment->ID ); |
|
| 112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 108 | + foreach ($payments as $payment) { |
|
| 109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
| 110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
| 111 | + $total = give_get_payment_amount($payment->ID); |
|
| 112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 113 | 113 | $products = ''; |
| 114 | 114 | $skus = ''; |
| 115 | 115 | |
| 116 | - if ( $downloads ) { |
|
| 117 | - foreach ( $downloads as $key => $download ) { |
|
| 116 | + if ($downloads) { |
|
| 117 | + foreach ($downloads as $key => $download) { |
|
| 118 | 118 | |
| 119 | 119 | // Form ID |
| 120 | - $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; |
|
| 121 | - $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; |
|
| 120 | + $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; |
|
| 121 | + $qty = isset($download['quantity']) ? $download['quantity'] : 1; |
|
| 122 | 122 | |
| 123 | - if ( isset( $download['price'] ) ) { |
|
| 123 | + if (isset($download['price'])) { |
|
| 124 | 124 | $price = $download['price']; |
| 125 | 125 | } else { |
| 126 | 126 | // If the download has variable prices, override the default price |
| 127 | - $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; |
|
| 128 | - $price = give_get_download_final_price( $id, $user_info, $price_override ); |
|
| 127 | + $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; |
|
| 128 | + $price = give_get_download_final_price($id, $user_info, $price_override); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | // Display the Downoad Name |
| 133 | - $products .= html_entity_decode( get_the_title( $id ) ); |
|
| 133 | + $products .= html_entity_decode(get_the_title($id)); |
|
| 134 | 134 | |
| 135 | - if ( $qty > 1 ) { |
|
| 136 | - $products .= html_entity_decode( ' (' . $qty . ')' ); |
|
| 135 | + if ($qty > 1) { |
|
| 136 | + $products .= html_entity_decode(' ('.$qty.')'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $products .= ' - '; |
| 140 | 140 | |
| 141 | - if ( give_use_skus() ) { |
|
| 142 | - $sku = give_get_download_sku( $id ); |
|
| 141 | + if (give_use_skus()) { |
|
| 142 | + $sku = give_get_download_sku($id); |
|
| 143 | 143 | |
| 144 | - if ( ! empty( $sku ) ) { |
|
| 144 | + if ( ! empty($sku)) { |
|
| 145 | 145 | $skus .= $sku; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { |
|
| 150 | - $price_options = $downloads[ $key ]['item_number']['options']; |
|
| 149 | + if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { |
|
| 150 | + $price_options = $downloads[$key]['item_number']['options']; |
|
| 151 | 151 | |
| 152 | - if ( isset( $price_options['price_id'] ) ) { |
|
| 153 | - $products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; |
|
| 152 | + if (isset($price_options['price_id'])) { |
|
| 153 | + $products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - '; |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) ); |
|
| 157 | + $products .= html_entity_decode(give_currency_filter(give_format_amount($price))); |
|
| 158 | 158 | |
| 159 | - if ( $key != ( count( $downloads ) - 1 ) ) { |
|
| 159 | + if ($key != (count($downloads) - 1)) { |
|
| 160 | 160 | $products .= ' / '; |
| 161 | 161 | |
| 162 | - if ( give_use_skus() ) { |
|
| 162 | + if (give_use_skus()) { |
|
| 163 | 163 | $skus .= ' / '; |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if ( is_numeric( $user_id ) ) { |
|
| 170 | - $user = get_userdata( $user_id ); |
|
| 169 | + if (is_numeric($user_id)) { |
|
| 170 | + $user = get_userdata($user_id); |
|
| 171 | 171 | } else { |
| 172 | 172 | $user = false; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $data[] = array( |
| 176 | 176 | 'id' => $payment->ID, |
| 177 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
| 177 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
| 178 | 178 | 'email' => $payment_meta['email'], |
| 179 | 179 | 'first' => $user_info['first_name'], |
| 180 | 180 | 'last' => $user_info['last_name'], |
| 181 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
| 182 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
| 183 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
| 184 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
| 185 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
| 186 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
| 181 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
| 182 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
| 183 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
| 184 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
| 185 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
| 186 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
| 187 | 187 | 'products' => $products, |
| 188 | 188 | 'skus' => $skus, |
| 189 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
| 190 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
| 191 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
| 189 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
| 190 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
| 191 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
| 192 | 192 | 'key' => $payment_meta['key'], |
| 193 | 193 | 'date' => $payment->post_date, |
| 194 | - 'user' => $user ? $user->display_name : esc_html( 'guest', 'give' ), |
|
| 195 | - 'status' => give_get_payment_status( $payment, true ) |
|
| 194 | + 'user' => $user ? $user->display_name : esc_html('guest', 'give'), |
|
| 195 | + 'status' => give_get_payment_status($payment, true) |
|
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 201 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 200 | + $data = apply_filters('give_export_get_data', $data); |
|
| 201 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 202 | 202 | |
| 203 | 203 | return $data; |
| 204 | 204 | |
@@ -218,27 +218,27 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $status = $this->status; |
| 220 | 220 | $args = array( |
| 221 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
| 222 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
| 221 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
| 222 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | - if ( 'any' == $status ) { |
|
| 225 | + if ('any' == $status) { |
|
| 226 | 226 | |
| 227 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
| 227 | + $total = array_sum((array) give_count_payments($args)); |
|
| 228 | 228 | |
| 229 | 229 | } else { |
| 230 | 230 | |
| 231 | - $total = give_count_payments( $args )->$status; |
|
| 231 | + $total = give_count_payments($args)->$status; |
|
| 232 | 232 | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $percentage = 100; |
| 236 | 236 | |
| 237 | - if ( $total > 0 ) { |
|
| 238 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 237 | + if ($total > 0) { |
|
| 238 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( $percentage > 100 ) { |
|
| 241 | + if ($percentage > 100) { |
|
| 242 | 242 | $percentage = 100; |
| 243 | 243 | } |
| 244 | 244 | |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @param array $request The Form Data passed into the batch processing |
| 254 | 254 | */ |
| 255 | - public function set_properties( $request ) { |
|
| 256 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
| 257 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
| 258 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
| 255 | + public function set_properties($request) { |
|
| 256 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
| 257 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
| 258 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
| 259 | 259 | } |
| 260 | 260 | } |