@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Gateways_Report')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Gateways_Report. |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function __construct() { |
| 45 | 45 | $this->id = 'gateways'; |
| 46 | - $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
| 46 | + $this->label = esc_html__('Donation Methods', 'give'); |
|
| 47 | 47 | |
| 48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | - add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
| 48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
| 49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
| 50 | + add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2); |
|
| 51 | 51 | |
| 52 | 52 | // Do not use main form for this tab. |
| 53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
| 54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
| 55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
| 53 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
| 55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param array $pages Lst of pages. |
| 64 | 64 | * @return array |
| 65 | 65 | */ |
| 66 | - public function add_settings_page( $pages ) { |
|
| 67 | - $pages[ $this->id ] = $this->label; |
|
| 66 | + public function add_settings_page($pages) { |
|
| 67 | + $pages[$this->id] = $this->label; |
|
| 68 | 68 | |
| 69 | 69 | return $pages; |
| 70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param array $settings |
| 87 | 87 | */ |
| 88 | 88 | $settings = apply_filters( |
| 89 | - 'give_get_settings_' . $this->id, |
|
| 89 | + 'give_get_settings_'.$this->id, |
|
| 90 | 90 | array( |
| 91 | 91 | array( |
| 92 | 92 | 'id' => 'give_reports_gateways', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ), |
| 96 | 96 | array( |
| 97 | 97 | 'id' => 'gateways', |
| 98 | - 'name' => esc_html__( 'Gateways', 'give' ), |
|
| 98 | + 'name' => esc_html__('Gateways', 'give'), |
|
| 99 | 99 | 'type' => 'report_gateways', |
| 100 | 100 | ), |
| 101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function output() { |
| 120 | 120 | $settings = $this->get_settings(); |
| 121 | 121 | |
| 122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | * @param $field |
| 132 | 132 | * @param $option_value |
| 133 | 133 | */ |
| 134 | - public function render_report_gateways_field( $field, $option_value ) { |
|
| 135 | - do_action( 'give_reports_view_gateways'); |
|
| 134 | + public function render_report_gateways_field($field, $option_value) { |
|
| 135 | + do_action('give_reports_view_gateways'); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -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 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | global $status, $page; |
| 63 | 63 | |
| 64 | 64 | // Set parent defaults |
| 65 | - parent::__construct( array( |
|
| 66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
| 67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
| 68 | - 'ajax' => false,// Does this table support ajax? |
|
| 69 | - ) ); |
|
| 65 | + parent::__construct(array( |
|
| 66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
| 67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
| 68 | + 'ajax' => false, // Does this table support ajax? |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return false |
| 85 | 85 | */ |
| 86 | - public function search_box( $text, $input_id ) { |
|
| 86 | + public function search_box($text, $input_id) { |
|
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - public function give_search_box( $text, $input_id ) { |
|
| 102 | - $input_id = $input_id . '-search-input'; |
|
| 101 | + public function give_search_box($text, $input_id) { |
|
| 102 | + $input_id = $input_id.'-search-input'; |
|
| 103 | 103 | |
| 104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 106 | 106 | } |
| 107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 107 | + if ( ! empty($_REQUEST['order'])) { |
|
| 108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 109 | 109 | } |
| 110 | 110 | ?> |
| 111 | 111 | <p class="search-box donor-search" role="search"> |
| 112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 115 | 115 | </p> |
| 116 | 116 | <?php |
| 117 | 117 | } |
@@ -124,33 +124,33 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @param string $which |
| 126 | 126 | */ |
| 127 | - protected function display_tablenav( $which ) { |
|
| 127 | + protected function display_tablenav($which) { |
|
| 128 | 128 | |
| 129 | - if ( 'top' === $which ) { |
|
| 130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 129 | + if ('top' === $which) { |
|
| 130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 131 | 131 | } |
| 132 | 132 | ?> |
| 133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 134 | 134 | |
| 135 | - <?php if ( 'top' === $which ) { ?> |
|
| 135 | + <?php if ('top' === $which) { ?> |
|
| 136 | 136 | <h3 class="alignleft reports-earnings-title"> |
| 137 | - <span><?php esc_html_e( 'Donors Report', 'give' ); ?></span> |
|
| 137 | + <span><?php esc_html_e('Donors Report', 'give'); ?></span> |
|
| 138 | 138 | </h3> |
| 139 | 139 | <?php } ?> |
| 140 | 140 | |
| 141 | 141 | <div class="alignright tablenav-right"> |
| 142 | 142 | <div class="actions bulkactions"> |
| 143 | 143 | <?php |
| 144 | - if ( 'top' === $which ) { |
|
| 145 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
| 144 | + if ('top' === $which) { |
|
| 145 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->bulk_actions( $which ); ?> |
|
| 148 | + $this->bulk_actions($which); ?> |
|
| 149 | 149 | |
| 150 | 150 | </div> |
| 151 | 151 | <?php |
| 152 | - $this->extra_tablenav( $which ); |
|
| 153 | - $this->pagination( $which ); |
|
| 152 | + $this->extra_tablenav($which); |
|
| 153 | + $this->pagination($which); |
|
| 154 | 154 | ?> |
| 155 | 155 | </div> |
| 156 | 156 | |
@@ -172,33 +172,33 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return string Column Name |
| 174 | 174 | */ |
| 175 | - public function column_default( $item, $column_name ) { |
|
| 175 | + public function column_default($item, $column_name) { |
|
| 176 | 176 | |
| 177 | - switch ( $column_name ) { |
|
| 177 | + switch ($column_name) { |
|
| 178 | 178 | |
| 179 | 179 | case 'name' : |
| 180 | - $name = '#' . $item['id'] . ' '; |
|
| 181 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 182 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 183 | - $value = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>'; |
|
| 180 | + $name = '#'.$item['id'].' '; |
|
| 181 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
| 182 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 183 | + $value = '<a href="'.esc_url($view_url).'">'.$name.'</a>'; |
|
| 184 | 184 | break; |
| 185 | 185 | |
| 186 | 186 | case 'num_donations' : |
| 187 | - $value = '<a href="' . |
|
| 188 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 189 | - ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
| 187 | + $value = '<a href="'. |
|
| 188 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
| 189 | + ).'">'.esc_html($item['num_donations']).'</a>'; |
|
| 190 | 190 | break; |
| 191 | 191 | |
| 192 | 192 | case 'amount_spent' : |
| 193 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 193 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
| 194 | 194 | break; |
| 195 | 195 | |
| 196 | 196 | default: |
| 197 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 197 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 198 | 198 | break; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
| 201 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -210,13 +210,13 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function get_columns() { |
| 212 | 212 | $columns = array( |
| 213 | - 'name' => __( 'Name', 'give' ), |
|
| 214 | - 'email' => __( 'Email', 'give' ), |
|
| 215 | - 'num_donations' => __( 'Donations', 'give' ), |
|
| 216 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
| 213 | + 'name' => __('Name', 'give'), |
|
| 214 | + 'email' => __('Email', 'give'), |
|
| 215 | + 'num_donations' => __('Donations', 'give'), |
|
| 216 | + 'amount_spent' => __('Total Donated', 'give'), |
|
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
| 219 | + return apply_filters('give_report_donor_columns', $columns); |
|
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function get_sortable_columns() { |
| 231 | 231 | return array( |
| 232 | - 'id' => array( 'id', true ), |
|
| 233 | - 'name' => array( 'name', true ), |
|
| 234 | - 'num_donations' => array( 'purchase_count', false ), |
|
| 235 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 232 | + 'id' => array('id', true), |
|
| 233 | + 'name' => array('name', true), |
|
| 234 | + 'num_donations' => array('purchase_count', false), |
|
| 235 | + 'amount_spent' => array('purchase_value', false), |
|
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @since 1.0 |
| 244 | 244 | * @return void |
| 245 | 245 | */ |
| 246 | - public function bulk_actions( $which = '' ) { |
|
| 246 | + public function bulk_actions($which = '') { |
|
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @return int Current page number |
| 256 | 256 | */ |
| 257 | 257 | public function get_paged() { |
| 258 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 258 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * @return mixed string If search is present, false otherwise |
| 267 | 267 | */ |
| 268 | 268 | public function get_search() { |
| 269 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 269 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | // Get donor query. |
| 287 | 287 | $args = $this->get_donor_query(); |
| 288 | - $donors = Give()->donors->get_donors( $args ); |
|
| 288 | + $donors = Give()->donors->get_donors($args); |
|
| 289 | 289 | |
| 290 | - if ( $donors ) { |
|
| 290 | + if ($donors) { |
|
| 291 | 291 | |
| 292 | - $this->count = count( $donors ); |
|
| 292 | + $this->count = count($donors); |
|
| 293 | 293 | |
| 294 | - foreach ( $donors as $donor ) { |
|
| 294 | + foreach ($donors as $donor) { |
|
| 295 | 295 | |
| 296 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
| 296 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
| 297 | 297 | |
| 298 | 298 | $data[] = array( |
| 299 | 299 | 'id' => $donor->id, |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $_donor_query['number'] = -1; |
| 323 | 323 | $_donor_query['offset'] = 0; |
| 324 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
| 324 | + $donors = Give()->donors->get_donors($_donor_query); |
|
| 325 | 325 | |
| 326 | - return count( $donors ); |
|
| 326 | + return count($donors); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function get_donor_query() { |
| 337 | 337 | $paged = $this->get_paged(); |
| 338 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 338 | + $offset = $this->per_page * ($paged - 1); |
|
| 339 | 339 | $search = $this->get_search(); |
| 340 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 341 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 340 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 341 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 342 | 342 | |
| 343 | 343 | $args = array( |
| 344 | 344 | 'number' => $this->per_page, |
@@ -347,10 +347,10 @@ discard block |
||
| 347 | 347 | 'orderby' => $orderby, |
| 348 | 348 | ); |
| 349 | 349 | |
| 350 | - if( $search ) { |
|
| 351 | - if ( is_email( $search ) ) { |
|
| 350 | + if ($search) { |
|
| 351 | + if (is_email($search)) { |
|
| 352 | 352 | $args['email'] = $search; |
| 353 | - } elseif ( is_numeric( $search ) ) { |
|
| 353 | + } elseif (is_numeric($search)) { |
|
| 354 | 354 | $args['id'] = $search; |
| 355 | 355 | } else { |
| 356 | 356 | $args['name'] = $search; |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | $hidden = array(); // No hidden columns |
| 378 | 378 | $sortable = $this->get_sortable_columns(); |
| 379 | 379 | |
| 380 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 380 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 381 | 381 | |
| 382 | 382 | $this->items = $this->reports_data(); |
| 383 | 383 | |
| 384 | 384 | $this->total = $this->get_donor_count(); |
| 385 | 385 | |
| 386 | - $this->set_pagination_args( array( |
|
| 386 | + $this->set_pagination_args(array( |
|
| 387 | 387 | 'total_items' => $this->total, |
| 388 | 388 | 'per_page' => $this->per_page, |
| 389 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
| 390 | - ) ); |
|
| 389 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
| 390 | + )); |
|
| 391 | 391 | } |
| 392 | 392 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Earnings_Report' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Earnings_Report')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Earnings_Report. |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function __construct() { |
| 45 | 45 | $this->id = 'earnings'; |
| 46 | - $this->label = esc_html__( 'Income', 'give' ); |
|
| 46 | + $this->label = esc_html__('Income', 'give'); |
|
| 47 | 47 | |
| 48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
| 48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
| 49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
| 50 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
| 51 | 51 | |
| 52 | 52 | // Do not use main form for this tab. |
| 53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
| 54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
| 55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
| 53 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
| 55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param array $pages Lst of pages. |
| 64 | 64 | * @return array |
| 65 | 65 | */ |
| 66 | - public function add_settings_page( $pages ) { |
|
| 67 | - $pages[ $this->id ] = $this->label; |
|
| 66 | + public function add_settings_page($pages) { |
|
| 67 | + $pages[$this->id] = $this->label; |
|
| 68 | 68 | |
| 69 | 69 | return $pages; |
| 70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param array $settings |
| 87 | 87 | */ |
| 88 | 88 | $settings = apply_filters( |
| 89 | - 'give_get_settings_' . $this->id, |
|
| 89 | + 'give_get_settings_'.$this->id, |
|
| 90 | 90 | array( |
| 91 | 91 | array( |
| 92 | 92 | 'id' => 'give_tools_earnings', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ), |
| 96 | 96 | array( |
| 97 | 97 | 'id' => 'earnings', |
| 98 | - 'name' => esc_html__( 'Income', 'give' ), |
|
| 98 | + 'name' => esc_html__('Income', 'give'), |
|
| 99 | 99 | 'type' => 'report_earnings', |
| 100 | 100 | ), |
| 101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function output() { |
| 120 | 120 | $settings = $this->get_settings(); |
| 121 | 121 | |
| 122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | * @param $field |
| 132 | 132 | * @param $option_value |
| 133 | 133 | */ |
| 134 | - public function render_report_earnings_field( $field, $option_value ) { |
|
| 135 | - do_action( 'give_reports_view_earnings' ); |
|
| 134 | + public function render_report_earnings_field($field, $option_value) { |
|
| 135 | + do_action('give_reports_view_earnings'); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -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 Donated', '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 Donated', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function get_sortable_columns() { |
| 101 | 101 | return array( |
| 102 | - 'total_donations' => array( 'total_donations', false ) |
|
| 102 | + 'total_donations' => array('total_donations', false) |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return int Current page number |
| 113 | 113 | */ |
| 114 | 114 | public function get_paged() { |
| 115 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 115 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @since 1.0 |
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | - public function bulk_actions( $which = '' ) { |
|
| 126 | + public function bulk_actions($which = '') { |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
@@ -135,27 +135,27 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param string $which |
| 137 | 137 | */ |
| 138 | - protected function display_tablenav( $which ) { |
|
| 138 | + protected function display_tablenav($which) { |
|
| 139 | 139 | |
| 140 | - if ( 'top' === $which ) { |
|
| 141 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 140 | + if ('top' === $which) { |
|
| 141 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 142 | 142 | } |
| 143 | 143 | ?> |
| 144 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 144 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 145 | 145 | |
| 146 | - <?php if ( 'top' === $which ) { ?> |
|
| 146 | + <?php if ('top' === $which) { ?> |
|
| 147 | 147 | <h3 class="alignleft reports-earnings-title"> |
| 148 | - <span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span> |
|
| 148 | + <span><?php esc_html_e('Donation Methods Report', 'give'); ?></span> |
|
| 149 | 149 | </h3> |
| 150 | 150 | <?php } ?> |
| 151 | 151 | |
| 152 | 152 | <div class="alignright tablenav-right"> |
| 153 | 153 | <div class="actions bulkactions"> |
| 154 | - <?php $this->bulk_actions( $which ); ?> |
|
| 154 | + <?php $this->bulk_actions($which); ?> |
|
| 155 | 155 | </div> |
| 156 | 156 | <?php |
| 157 | - $this->extra_tablenav( $which ); |
|
| 158 | - $this->pagination( $which ); |
|
| 157 | + $this->extra_tablenav($which); |
|
| 158 | + $this->pagination($which); |
|
| 159 | 159 | ?> |
| 160 | 160 | </div> |
| 161 | 161 | |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return int |
| 179 | 179 | */ |
| 180 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
| 180 | + public function give_sort_total_donations($old_value, $new_value) { |
|
| 181 | 181 | // If no sort, default to label. |
| 182 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
| 182 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
| 183 | 183 | |
| 184 | 184 | //If no order, default to asc. |
| 185 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
| 185 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
| 186 | 186 | |
| 187 | 187 | //Determine sort order. |
| 188 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
| 188 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
| 189 | 189 | |
| 190 | - return ( $order === 'asc' ) ? $result : -$result; |
|
| 190 | + return ($order === 'asc') ? $result : -$result; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -204,18 +204,18 @@ discard block |
||
| 204 | 204 | $gateways = give_get_payment_gateways(); |
| 205 | 205 | $stats = new Give_Payment_Stats(); |
| 206 | 206 | |
| 207 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 207 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 208 | 208 | |
| 209 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 210 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 209 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 210 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 211 | 211 | |
| 212 | 212 | $reports_data[] = array( |
| 213 | 213 | 'ID' => $gateway_id, |
| 214 | 214 | 'label' => $gateway['admin_label'], |
| 215 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
| 216 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
| 217 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
| 218 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ), |
|
| 215 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
| 216 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
| 217 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
| 218 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))), |
|
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | $columns = $this->get_columns(); |
| 237 | 237 | $hidden = array(); // No hidden columns |
| 238 | 238 | $sortable = $this->get_sortable_columns(); |
| 239 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 239 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 240 | 240 | $this->items = $this->reports_data(); |
| 241 | 241 | |
| 242 | 242 | // Sort Array when we are sorting data in array. |
| 243 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
| 243 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
| 244 | 244 | |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Forms_Report' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Forms_Report')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Forms_Report. |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function __construct() { |
| 45 | 45 | $this->id = 'forms'; |
| 46 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
| 46 | + $this->label = esc_html__('Forms', 'give'); |
|
| 47 | 47 | |
| 48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
| 48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
| 49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
| 50 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | * @param array $pages List of pages. |
| 59 | 59 | * @return array |
| 60 | 60 | */ |
| 61 | - public function add_settings_page( $pages ) { |
|
| 62 | - $pages[ $this->id ] = $this->label; |
|
| 61 | + public function add_settings_page($pages) { |
|
| 62 | + $pages[$this->id] = $this->label; |
|
| 63 | 63 | |
| 64 | 64 | return $pages; |
| 65 | 65 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param array $settings |
| 82 | 82 | */ |
| 83 | 83 | $settings = apply_filters( |
| 84 | - 'give_get_settings_' . $this->id, |
|
| 84 | + 'give_get_settings_'.$this->id, |
|
| 85 | 85 | array( |
| 86 | 86 | array( |
| 87 | 87 | 'id' => 'give_reports_forms', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ), |
| 91 | 91 | array( |
| 92 | 92 | 'id' => 'forms', |
| 93 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
| 93 | + 'name' => esc_html__('Forms', 'give'), |
|
| 94 | 94 | 'type' => 'report_forms', |
| 95 | 95 | ), |
| 96 | 96 | array( |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function output() { |
| 115 | 115 | $settings = $this->get_settings(); |
| 116 | 116 | |
| 117 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 117 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @param $field |
| 127 | 127 | * @param $option_value |
| 128 | 128 | */ |
| 129 | - public function render_report_forms_field( $field, $option_value ) { |
|
| 130 | - do_action( 'give_reports_view_forms'); |
|
| 129 | + public function render_report_forms_field($field, $option_value) { |
|
| 130 | + do_action('give_reports_view_forms'); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Donors_Report' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Donors_Report')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Donors_Report. |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function __construct() { |
| 45 | 45 | $this->id = 'donors'; |
| 46 | - $this->label = esc_html__( 'Donors', 'give' ); |
|
| 46 | + $this->label = esc_html__('Donors', 'give'); |
|
| 47 | 47 | |
| 48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | - add_action( 'give_admin_field_report_donors', array( $this, 'render_report_donors_field' ), 10, 2 ); |
|
| 48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
| 49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
| 50 | + add_action('give_admin_field_report_donors', array($this, 'render_report_donors_field'), 10, 2); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | * @param array $pages List of pages. |
| 59 | 59 | * @return array |
| 60 | 60 | */ |
| 61 | - public function add_settings_page( $pages ) { |
|
| 62 | - $pages[ $this->id ] = $this->label; |
|
| 61 | + public function add_settings_page($pages) { |
|
| 62 | + $pages[$this->id] = $this->label; |
|
| 63 | 63 | |
| 64 | 64 | return $pages; |
| 65 | 65 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param array $settings |
| 82 | 82 | */ |
| 83 | 83 | $settings = apply_filters( |
| 84 | - 'give_get_settings_' . $this->id, |
|
| 84 | + 'give_get_settings_'.$this->id, |
|
| 85 | 85 | array( |
| 86 | 86 | array( |
| 87 | 87 | 'id' => 'give_reports_donors', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ), |
| 91 | 91 | array( |
| 92 | 92 | 'id' => 'donors', |
| 93 | - 'name' => esc_html__( 'Donors', 'give' ), |
|
| 93 | + 'name' => esc_html__('Donors', 'give'), |
|
| 94 | 94 | 'type' => 'report_donors', |
| 95 | 95 | ), |
| 96 | 96 | array( |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function output() { |
| 115 | 115 | $settings = $this->get_settings(); |
| 116 | 116 | |
| 117 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 117 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @param $field |
| 127 | 127 | * @param $option_value |
| 128 | 128 | */ |
| 129 | - public function render_report_donors_field( $field, $option_value ) { |
|
| 130 | - do_action( 'give_reports_view_donors'); |
|
| 129 | + public function render_report_donors_field($field, $option_value) { |
|
| 130 | + do_action('give_reports_view_donors'); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -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,8 +29,8 @@ 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'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 34 | 34 | $views = give_reports_default_views(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
| 39 | 39 | |
| 40 | 40 | <h2 class="nav-tab-wrapper"> |
| 41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 41 | + <?php foreach ($views as $tab => $label) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => $tab, |
| 44 | 44 | 'settings-updated' => false, |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 49 | 49 | 'tab' => 'export', |
| 50 | 50 | 'settings-updated' => false, |
| 51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 52 | 52 | <?php } |
| 53 | 53 | /** |
| 54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - do_action( 'give_reports_tabs' ); |
|
| 60 | + do_action('give_reports_tabs'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </h2> |
| 63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.0 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_reports_page_top' ); |
|
| 70 | + do_action('give_reports_page_top'); |
|
| 71 | 71 | |
| 72 | 72 | // Set $active_tab prior to hook firing. |
| 73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
| 73 | + if (in_array($active_tab, array_keys($views))) { |
|
| 74 | 74 | $active_tab = 'reports'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
| 82 | + do_action("give_reports_tab_{$active_tab}"); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Fires after the report page. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_reports_page_bottom' ); |
|
| 89 | + do_action('give_reports_page_bottom'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div><!-- .wrap --> |
| 92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function give_reports_default_views() { |
| 102 | 102 | $views = array( |
| 103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
| 105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
| 106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
| 103 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 104 | + 'forms' => esc_html__('Forms', 'give'), |
|
| 105 | + 'donors' => esc_html__('Donors', 'give'), |
|
| 106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 109 | + $views = apply_filters('give_report_views', $views); |
|
| 110 | 110 | |
| 111 | 111 | return $views; |
| 112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | * @since 1.0 |
| 122 | 122 | * @return string $view Report View |
| 123 | 123 | */ |
| 124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 124 | +function give_get_reporting_view($default = 'earnings') { |
|
| 125 | 125 | |
| 126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 127 | 127 | $view = $default; |
| 128 | 128 | } else { |
| 129 | 129 | $view = $_GET['view']; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 132 | + return apply_filters('give_get_reporting_view', $view); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $current_view = 'earnings'; |
| 143 | 143 | $views = give_reports_default_views(); |
| 144 | 144 | |
| 145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
| 145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
| 146 | 146 | $current_view = $_GET['tab']; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.0 |
| 153 | 153 | */ |
| 154 | - do_action( "give_reports_view_{$current_view}" ); |
|
| 154 | + do_action("give_reports_view_{$current_view}"); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function give_report_views() { |
| 166 | 166 | $views = give_reports_default_views(); |
| 167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 168 | 168 | /** |
| 169 | 169 | * Fires before the report page actions form. |
| 170 | 170 | * |
| 171 | 171 | * @since 1.0 |
| 172 | 172 | */ |
| 173 | - do_action( 'give_report_view_actions_before' ); |
|
| 173 | + do_action('give_report_view_actions_before'); |
|
| 174 | 174 | ?> |
| 175 | 175 | <form id="give-reports-filter" method="get"> |
| 176 | 176 | <select id="give-reports-view" name="view"> |
| 177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 180 | 180 | <?php endforeach; ?> |
| 181 | 181 | </select> |
| 182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @since 1.0 |
| 190 | 190 | */ |
| 191 | - do_action( 'give_report_view_actions' ); |
|
| 191 | + do_action('give_report_view_actions'); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
| 195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
| 196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 197 | 197 | </form> |
| 198 | 198 | <?php |
| 199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @since 1.0 |
| 203 | 203 | */ |
| 204 | - do_action( 'give_report_view_actions_after' ); |
|
| 204 | + do_action('give_report_view_actions_after'); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | function give_reports_forms_table() { |
| 216 | 216 | |
| 217 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 217 | + if (isset($_GET['form-id'])) { |
|
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 222 | 222 | |
| 223 | 223 | $give_table = new Give_Form_Reports_Table(); |
| 224 | 224 | $give_table->prepare_items(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | <?php |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 233 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * Renders the detailed report for a specific give form. |
@@ -239,20 +239,20 @@ discard block |
||
| 239 | 239 | * @return void |
| 240 | 240 | */ |
| 241 | 241 | function give_reports_form_details() { |
| 242 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 242 | + if ( ! isset($_GET['form-id'])) { |
|
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | ?> |
| 246 | 246 | <div class="tablenav top reports-forms-details-wrap"> |
| 247 | 247 | <div class="actions bulkactions"> |
| 248 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 248 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 249 | 249 | </div> |
| 250 | 250 | </div> |
| 251 | 251 | <?php |
| 252 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 252 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 255 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * Renders the Reports Donors Table |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | 265 | function give_reports_donors_table() { |
| 266 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 266 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 267 | 267 | |
| 268 | 268 | $give_table = new Give_Donor_Reports_Table(); |
| 269 | 269 | $give_table->prepare_items(); |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @since 1.0 |
| 277 | 277 | */ |
| 278 | - do_action( 'give_logs_donors_table_top' ); |
|
| 278 | + do_action('give_logs_donors_table_top'); |
|
| 279 | 279 | |
| 280 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
| 280 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
| 281 | 281 | $give_table->display(); |
| 282 | 282 | ?> |
| 283 | 283 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @since 1.0 |
| 292 | 292 | */ |
| 293 | - do_action( 'give_logs_donors_table_bottom' ); |
|
| 293 | + do_action('give_logs_donors_table_bottom'); |
|
| 294 | 294 | ?> |
| 295 | 295 | </div> |
| 296 | 296 | <?php |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 299 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * Renders the Gateways Table |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | * @return void |
| 308 | 308 | */ |
| 309 | 309 | function give_reports_gateways_table() { |
| 310 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 310 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 311 | 311 | |
| 312 | 312 | $give_table = new Give_Gateway_Reports_Table(); |
| 313 | 313 | $give_table->prepare_items(); |
| 314 | 314 | $give_table->display(); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 317 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Renders the Reports Earnings Graphs |
@@ -325,13 +325,13 @@ discard block |
||
| 325 | 325 | function give_reports_earnings() { |
| 326 | 326 | ?> |
| 327 | 327 | <div class="tablenav top reports-table-nav"> |
| 328 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
| 328 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
| 329 | 329 | </div> |
| 330 | 330 | <?php |
| 331 | 331 | give_reports_graph(); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 334 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | function give_estimated_monthly_stats() { |
| 344 | 344 | |
| 345 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
| 345 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
| 346 | 346 | |
| 347 | - if ( false === $estimated ) { |
|
| 347 | + if (false === $estimated) { |
|
| 348 | 348 | |
| 349 | 349 | $estimated = array( |
| 350 | 350 | 'earnings' => 0, |
@@ -353,22 +353,22 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | $stats = new Give_Payment_Stats; |
| 355 | 355 | |
| 356 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 357 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 356 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 357 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 358 | 358 | |
| 359 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 360 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 361 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 362 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 359 | + $current_day = date('d', current_time('timestamp')); |
|
| 360 | + $current_month = date('n', current_time('timestamp')); |
|
| 361 | + $current_year = date('Y', current_time('timestamp')); |
|
| 362 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 363 | 363 | |
| 364 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 365 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 364 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 365 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 366 | 366 | |
| 367 | 367 | // Cache for one day |
| 368 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
| 368 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return maybe_unserialize( $estimated ); |
|
| 371 | + return maybe_unserialize($estimated); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | function give_reports_set_form_method() { |
| 382 | 382 | return 'get'; |
| 383 | 383 | } |
| 384 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
| 385 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
| 384 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
| 385 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
| 386 | 386 | |
| 387 | 387 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -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 | /** |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | global $status, $page; |
| 57 | 57 | |
| 58 | 58 | // Set parent defaults |
| 59 | - parent::__construct( array( |
|
| 60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 59 | + parent::__construct(array( |
|
| 60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 62 | 62 | 'ajax' => false // Does this table support ajax? |
| 63 | - ) ); |
|
| 63 | + )); |
|
| 64 | 64 | |
| 65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
| 65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
| 66 | 66 | $this->query(); |
| 67 | 67 | |
| 68 | 68 | } |
@@ -78,18 +78,18 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return string Column Name |
| 80 | 80 | */ |
| 81 | - public function column_default( $item, $column_name ) { |
|
| 82 | - switch ( $column_name ) { |
|
| 81 | + public function column_default($item, $column_name) { |
|
| 82 | + switch ($column_name) { |
|
| 83 | 83 | case 'earnings' : |
| 84 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 84 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 85 | 85 | case 'average_sales' : |
| 86 | - return round( $item[ $column_name ] ); |
|
| 86 | + return round($item[$column_name]); |
|
| 87 | 87 | case 'average_earnings' : |
| 88 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 88 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
| 89 | 89 | case 'details' : |
| 90 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
| 90 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
| 91 | 91 | default: |
| 92 | - return $item[ $column_name ]; |
|
| 92 | + return $item[$column_name]; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function get_columns() { |
| 105 | 105 | $columns = array( |
| 106 | - 'title' => esc_html__( 'Form', 'give' ), |
|
| 107 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
| 108 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 109 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
| 110 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
| 111 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
| 106 | + 'title' => esc_html__('Form', 'give'), |
|
| 107 | + 'sales' => esc_html__('Donations', 'give'), |
|
| 108 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 109 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
| 110 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
| 111 | + 'details' => esc_html__('Detailed Report', 'give') |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | return $columns; |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function get_sortable_columns() { |
| 126 | 126 | return array( |
| 127 | - 'title' => array( 'title', true ), |
|
| 128 | - 'sales' => array( 'sales', false ), |
|
| 129 | - 'earnings' => array( 'earnings', false ), |
|
| 127 | + 'title' => array('title', true), |
|
| 128 | + 'sales' => array('sales', false), |
|
| 129 | + 'earnings' => array('earnings', false), |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return int Current page number |
| 140 | 140 | */ |
| 141 | 141 | public function get_paged() { |
| 142 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 142 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @return int Category ID |
| 152 | 152 | */ |
| 153 | 153 | public function get_category() { |
| 154 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
| 154 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return void |
| 164 | 164 | */ |
| 165 | - public function bulk_actions( $which = '' ) { |
|
| 165 | + public function bulk_actions($which = '') { |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
@@ -174,27 +174,27 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @param string $which |
| 176 | 176 | */ |
| 177 | - protected function display_tablenav( $which ) { |
|
| 177 | + protected function display_tablenav($which) { |
|
| 178 | 178 | |
| 179 | - if ( 'top' === $which ) { |
|
| 180 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 179 | + if ('top' === $which) { |
|
| 180 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 181 | 181 | } |
| 182 | 182 | ?> |
| 183 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 183 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 184 | 184 | |
| 185 | - <?php if ( 'top' === $which ) { ?> |
|
| 185 | + <?php if ('top' === $which) { ?> |
|
| 186 | 186 | <h3 class="alignleft reports-earnings-title"> |
| 187 | - <span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span> |
|
| 187 | + <span><?php esc_html_e('Donation Forms Report', 'give'); ?></span> |
|
| 188 | 188 | </h3> |
| 189 | 189 | <?php } ?> |
| 190 | 190 | |
| 191 | 191 | <div class="alignright tablenav-right"> |
| 192 | 192 | <div class="actions bulkactions"> |
| 193 | - <?php $this->bulk_actions( $which ); ?> |
|
| 193 | + <?php $this->bulk_actions($which); ?> |
|
| 194 | 194 | </div> |
| 195 | 195 | <?php |
| 196 | - $this->extra_tablenav( $which ); |
|
| 197 | - $this->pagination( $which ); |
|
| 196 | + $this->extra_tablenav($which); |
|
| 197 | + $this->pagination($which); |
|
| 198 | 198 | ?> |
| 199 | 199 | </div> |
| 200 | 200 | |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function category_filter() { |
| 216 | 216 | |
| 217 | - $categories = get_terms( 'form_category' ); |
|
| 218 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
| 219 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
| 217 | + $categories = get_terms('form_category'); |
|
| 218 | + if ($categories && ! is_wp_error($categories)) { |
|
| 219 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function query() { |
| 232 | 232 | |
| 233 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
| 234 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 233 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
| 234 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 235 | 235 | $category = $this->get_category(); |
| 236 | 236 | |
| 237 | 237 | $args = array( |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | 'suppress_filters' => true |
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | - if ( ! empty( $category ) ) { |
|
| 247 | + if ( ! empty($category)) { |
|
| 248 | 248 | $args['tax_query'] = array( |
| 249 | 249 | array( |
| 250 | 250 | 'taxonomy' => 'form_category', |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | ); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - switch ( $orderby ) : |
|
| 256 | + switch ($orderby) : |
|
| 257 | 257 | case 'title' : |
| 258 | 258 | $args['orderby'] = 'title'; |
| 259 | 259 | break; |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | break; |
| 270 | 270 | endswitch; |
| 271 | 271 | |
| 272 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
| 272 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
| 273 | 273 | |
| 274 | - $this->donation_forms = new WP_Query( $args ); |
|
| 274 | + $this->donation_forms = new WP_Query($args); |
|
| 275 | 275 | |
| 276 | 276 | // Store total number of donation forms count. |
| 277 | 277 | $this->count = $this->donation_forms->found_posts; |
@@ -291,15 +291,15 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $give_forms = $this->donation_forms->posts; |
| 293 | 293 | |
| 294 | - if ( $give_forms ) { |
|
| 295 | - foreach ( $give_forms as $form ) { |
|
| 294 | + if ($give_forms) { |
|
| 295 | + foreach ($give_forms as $form) { |
|
| 296 | 296 | $reports_data[] = array( |
| 297 | 297 | 'ID' => $form, |
| 298 | - 'title' => get_the_title( $form ), |
|
| 299 | - 'sales' => give_get_form_sales_stats( $form ), |
|
| 300 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
| 301 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
| 302 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
| 298 | + 'title' => get_the_title($form), |
|
| 299 | + 'sales' => give_get_form_sales_stats($form), |
|
| 300 | + 'earnings' => give_get_form_earnings_stats($form), |
|
| 301 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
| 302 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
| 303 | 303 | ); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -324,14 +324,14 @@ discard block |
||
| 324 | 324 | $columns = $this->get_columns(); |
| 325 | 325 | $hidden = array(); // No hidden columns |
| 326 | 326 | $sortable = $this->get_sortable_columns(); |
| 327 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 327 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 328 | 328 | $this->items = $this->reports_data(); |
| 329 | 329 | $total_items = $this->count; |
| 330 | 330 | |
| 331 | - $this->set_pagination_args( array( |
|
| 331 | + $this->set_pagination_args(array( |
|
| 332 | 332 | 'total_items' => $total_items, |
| 333 | 333 | 'per_page' => $this->per_page, |
| 334 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 334 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 335 | 335 | ) |
| 336 | 336 | ); |
| 337 | 337 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'advanced'; |
| 30 | - $this->label = esc_html__( 'Advanced', 'give' ); |
|
| 30 | + $this->label = esc_html__('Advanced', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'advanced-options'; |
| 33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $current_section = give_get_current_setting_section(); |
| 47 | 47 | |
| 48 | - switch ( $current_section ) { |
|
| 48 | + switch ($current_section) { |
|
| 49 | 49 | case 'advanced-options': |
| 50 | 50 | $settings = array( |
| 51 | 51 | array( |
@@ -53,45 +53,45 @@ discard block |
||
| 53 | 53 | 'type' => 'title' |
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | - 'name' => esc_html__( 'Remove Data on Uninstall', 'give' ), |
|
| 57 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
| 56 | + 'name' => esc_html__('Remove Data on Uninstall', 'give'), |
|
| 57 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
| 58 | 58 | 'id' => 'uninstall_on_delete', |
| 59 | 59 | 'type' => 'radio_inline', |
| 60 | 60 | 'default' => 'disabled', |
| 61 | 61 | 'options' => array( |
| 62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
| 63 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
| 62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
| 63 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
| 64 | 64 | ) |
| 65 | 65 | ), |
| 66 | 66 | array( |
| 67 | 67 | /* translators: %s: the_content */ |
| 68 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
| 68 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
| 69 | 69 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
| 70 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
| 70 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
| 71 | 71 | 'id' => 'the_content_filter', |
| 72 | 72 | 'default' => 'enabled', |
| 73 | 73 | 'type' => 'radio_inline', |
| 74 | 74 | 'options' => array( |
| 75 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 76 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 75 | + 'enabled' => __('Enabled', 'give'), |
|
| 76 | + 'disabled' => __('Disabled', 'give'), |
|
| 77 | 77 | ) |
| 78 | 78 | ), |
| 79 | 79 | array( |
| 80 | - 'name' => esc_html__( 'Script Loading Location', 'give' ), |
|
| 81 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
| 80 | + 'name' => esc_html__('Script Loading Location', 'give'), |
|
| 81 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
| 82 | 82 | 'id' => 'scripts_footer', |
| 83 | 83 | 'type' => 'radio_inline', |
| 84 | 84 | 'default' => 'disabled', |
| 85 | 85 | 'options' => array( |
| 86 | - 'enabled' => __( 'Footer', 'give' ), |
|
| 87 | - 'disabled' => __( 'Head', 'give' ), |
|
| 86 | + 'enabled' => __('Footer', 'give'), |
|
| 87 | + 'disabled' => __('Head', 'give'), |
|
| 88 | 88 | ) |
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
| 91 | + 'name' => esc_html__('Advanced Settings Docs Link', 'give'), |
|
| 92 | 92 | 'id' => 'advanced_settings_docs_link', |
| 93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
| 94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
| 93 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
| 94 | + 'title' => __('Advanced Settings', 'give'), |
|
| 95 | 95 | 'type' => 'give_docs_link', |
| 96 | 96 | ), |
| 97 | 97 | array( |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * Filter the advanced settings. |
| 108 | 108 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 109 | 109 | */ |
| 110 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
| 110 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * Filter the settings. |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @param array $settings |
| 118 | 118 | */ |
| 119 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 119 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 120 | 120 | |
| 121 | 121 | // Output. |
| 122 | 122 | return $settings; |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function get_sections() { |
| 132 | 132 | $sections = array( |
| 133 | - 'advanced-options' => esc_html__( 'Advanced Options', 'give' ) |
|
| 133 | + 'advanced-options' => esc_html__('Advanced Options', 'give') |
|
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 136 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |