@@ -253,7 +253,7 @@ |
||
| 253 | 253 | * |
| 254 | 254 | * @access public |
| 255 | 255 | * @since 1.0 |
| 256 | - * @return mixed string If search is present, false otherwise. |
|
| 256 | + * @return string|false string If search is present, false otherwise. |
|
| 257 | 257 | */ |
| 258 | 258 | public function get_search() { |
| 259 | 259 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -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 | /** |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | public function __construct() { |
| 62 | 62 | |
| 63 | 63 | // Set parent defaults |
| 64 | - parent::__construct( array( |
|
| 65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
| 66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
| 64 | + parent::__construct(array( |
|
| 65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
| 66 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
| 67 | 67 | 'ajax' => false // Does this table support ajax? |
| 68 | - ) ); |
|
| 68 | + )); |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
@@ -80,20 +80,20 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | - public function search_box( $text, $input_id ) { |
|
| 84 | - $input_id = $input_id . '-search-input'; |
|
| 83 | + public function search_box($text, $input_id) { |
|
| 84 | + $input_id = $input_id.'-search-input'; |
|
| 85 | 85 | |
| 86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 87 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 88 | 88 | } |
| 89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 89 | + if ( ! empty($_REQUEST['order'])) { |
|
| 90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 91 | 91 | } |
| 92 | 92 | ?> |
| 93 | 93 | <p class="search-box" role="search"> |
| 94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 97 | 97 | </p> |
| 98 | 98 | <?php |
| 99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string Column Name. |
| 111 | 111 | */ |
| 112 | - public function column_default( $item, $column_name ) { |
|
| 113 | - switch ( $column_name ) { |
|
| 112 | + public function column_default($item, $column_name) { |
|
| 113 | + switch ($column_name) { |
|
| 114 | 114 | |
| 115 | 115 | case 'num_purchases' : |
| 116 | - $value = '<a href="' . |
|
| 117 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 118 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
| 116 | + $value = '<a href="'. |
|
| 117 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
| 118 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
| 119 | 119 | break; |
| 120 | 120 | |
| 121 | 121 | case 'amount_spent' : |
| 122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
| 123 | 123 | break; |
| 124 | 124 | |
| 125 | 125 | case 'date_created' : |
| 126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
| 126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
| 127 | 127 | break; |
| 128 | 128 | |
| 129 | 129 | default: |
| 130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 131 | 131 | break; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
| 134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return string |
| 144 | 144 | */ |
| 145 | - public function column_name( $item ) { |
|
| 146 | - $name = '#' . $item['id'] . ' '; |
|
| 147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 149 | - $actions = $this->get_row_actions( $item ); |
|
| 145 | + public function column_name($item) { |
|
| 146 | + $name = '#'.$item['id'].' '; |
|
| 147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
| 148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 149 | + $actions = $this->get_row_actions($item); |
|
| 150 | 150 | |
| 151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
| 151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function get_columns() { |
| 162 | 162 | $columns = array( |
| 163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
| 164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
| 165 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
| 166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
| 167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
| 163 | + 'name' => esc_html__('Name', 'give'), |
|
| 164 | + 'email' => esc_html__('Email', 'give'), |
|
| 165 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
| 166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
| 167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
| 170 | + return apply_filters('give_report_customer_columns', $columns); |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function get_sortable_columns() { |
| 182 | 182 | return array( |
| 183 | - 'date_created' => array( 'date_created', true ), |
|
| 184 | - 'name' => array( 'name', true ), |
|
| 185 | - 'num_purchases' => array( 'purchase_count', false ), |
|
| 186 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 183 | + 'date_created' => array('date_created', true), |
|
| 184 | + 'name' => array('name', true), |
|
| 185 | + 'num_purchases' => array('purchase_count', false), |
|
| 186 | + 'amount_spent' => array('purchase_value', false), |
|
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -195,34 +195,34 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return array An array of action links. |
| 197 | 197 | */ |
| 198 | - public function get_row_actions( $item ) { |
|
| 198 | + public function get_row_actions($item) { |
|
| 199 | 199 | |
| 200 | 200 | $actions = array( |
| 201 | 201 | |
| 202 | 202 | 'view' => sprintf( |
| 203 | 203 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 204 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
| 205 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
| 206 | - esc_html__( 'View Donor', 'give' ) |
|
| 204 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
| 205 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
| 206 | + esc_html__('View Donor', 'give') |
|
| 207 | 207 | ), |
| 208 | 208 | |
| 209 | 209 | 'notes' => sprintf( |
| 210 | 210 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 211 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
| 212 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
| 213 | - esc_html__( 'Notes', 'give' ) |
|
| 211 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
| 212 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
| 213 | + esc_html__('Notes', 'give') |
|
| 214 | 214 | ), |
| 215 | 215 | |
| 216 | 216 | 'delete' => sprintf( |
| 217 | 217 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 218 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
| 219 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
| 220 | - esc_html__( 'Delete', 'give' ) |
|
| 218 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
| 219 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
| 220 | + esc_html__('Delete', 'give') |
|
| 221 | 221 | ) |
| 222 | 222 | |
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
| 225 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
| 226 | 226 | |
| 227 | 227 | } |
| 228 | 228 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @since 1.0 |
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | - public function bulk_actions( $which = '' ) { |
|
| 236 | + public function bulk_actions($which = '') { |
|
| 237 | 237 | // These aren't really bulk actions but this outputs the markup in the right place. |
| 238 | 238 | } |
| 239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @return int Current page number. |
| 246 | 246 | */ |
| 247 | 247 | public function get_paged() { |
| 248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @return mixed string If search is present, false otherwise. |
| 257 | 257 | */ |
| 258 | 258 | public function get_search() { |
| 259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Get donor query. |
| 277 | 277 | $args = $this->get_donor_query(); |
| 278 | - $customers = Give()->customers->get_customers( $args ); |
|
| 278 | + $customers = Give()->customers->get_customers($args); |
|
| 279 | 279 | |
| 280 | - if ( $customers ) { |
|
| 280 | + if ($customers) { |
|
| 281 | 281 | |
| 282 | - foreach ( $customers as $customer ) { |
|
| 282 | + foreach ($customers as $customer) { |
|
| 283 | 283 | |
| 284 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
| 284 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
| 285 | 285 | |
| 286 | 286 | $data[] = array( |
| 287 | 287 | 'id' => $customer->id, |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | $_donor_query = $this->get_donor_query(); |
| 310 | 310 | |
| 311 | 311 | $_donor_query['number'] = -1; |
| 312 | - $donors = Give()->customers->get_customers( $_donor_query ); |
|
| 312 | + $donors = Give()->customers->get_customers($_donor_query); |
|
| 313 | 313 | |
| 314 | - return count( $donors ); |
|
| 314 | + return count($donors); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public function get_donor_query() { |
| 325 | 325 | $paged = $this->get_paged(); |
| 326 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 326 | + $offset = $this->per_page * ($paged - 1); |
|
| 327 | 327 | $search = $this->get_search(); |
| 328 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 329 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 328 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 329 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 330 | 330 | |
| 331 | 331 | $args = array( |
| 332 | 332 | 'number' => $this->per_page, |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | 'orderby' => $orderby, |
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | - if( $search ) { |
|
| 339 | - if ( is_email( $search ) ) { |
|
| 338 | + if ($search) { |
|
| 339 | + if (is_email($search)) { |
|
| 340 | 340 | $args['email'] = $search; |
| 341 | - } elseif ( is_numeric( $search ) ) { |
|
| 341 | + } elseif (is_numeric($search)) { |
|
| 342 | 342 | $args['id'] = $search; |
| 343 | 343 | } else { |
| 344 | 344 | $args['name'] = $search; |
@@ -365,16 +365,16 @@ discard block |
||
| 365 | 365 | $hidden = array(); // No hidden columns |
| 366 | 366 | $sortable = $this->get_sortable_columns(); |
| 367 | 367 | |
| 368 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 368 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 369 | 369 | |
| 370 | 370 | $this->items = $this->reports_data(); |
| 371 | 371 | |
| 372 | 372 | $this->total = $this->get_donor_count(); |
| 373 | 373 | |
| 374 | - $this->set_pagination_args( array( |
|
| 374 | + $this->set_pagination_args(array( |
|
| 375 | 375 | 'total_items' => $this->total, |
| 376 | 376 | 'per_page' => $this->per_page, |
| 377 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
| 378 | - ) ); |
|
| 377 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
| 378 | + )); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | \ No newline at end of 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 | /** |
@@ -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' => esc_html__( 'Name', 'give' ), |
|
| 214 | - 'email' => esc_html__( 'Email', 'give' ), |
|
| 215 | - 'num_donations' => esc_html__( 'Donations', 'give' ), |
|
| 216 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
| 213 | + 'name' => esc_html__('Name', 'give'), |
|
| 214 | + 'email' => esc_html__('Email', 'give'), |
|
| 215 | + 'num_donations' => esc_html__('Donations', 'give'), |
|
| 216 | + 'amount_spent' => esc_html__('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()->customers->get_customers( $args ); |
|
| 288 | + $donors = Give()->customers->get_customers($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, |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | $_donor_query = $this->get_donor_query(); |
| 321 | 321 | |
| 322 | 322 | $_donor_query['number'] = -1; |
| 323 | - $donors = Give()->customers->get_customers( $_donor_query ); |
|
| 323 | + $donors = Give()->customers->get_customers($_donor_query); |
|
| 324 | 324 | |
| 325 | - return count( $donors ); |
|
| 325 | + return count($donors); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function get_donor_query() { |
| 336 | 336 | $paged = $this->get_paged(); |
| 337 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 337 | + $offset = $this->per_page * ($paged - 1); |
|
| 338 | 338 | $search = $this->get_search(); |
| 339 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 340 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 339 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 340 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 341 | 341 | |
| 342 | 342 | $args = array( |
| 343 | 343 | 'number' => $this->per_page, |
@@ -346,10 +346,10 @@ discard block |
||
| 346 | 346 | 'orderby' => $orderby, |
| 347 | 347 | ); |
| 348 | 348 | |
| 349 | - if( $search ) { |
|
| 350 | - if ( is_email( $search ) ) { |
|
| 349 | + if ($search) { |
|
| 350 | + if (is_email($search)) { |
|
| 351 | 351 | $args['email'] = $search; |
| 352 | - } elseif ( is_numeric( $search ) ) { |
|
| 352 | + } elseif (is_numeric($search)) { |
|
| 353 | 353 | $args['id'] = $search; |
| 354 | 354 | } else { |
| 355 | 355 | $args['name'] = $search; |
@@ -376,16 +376,16 @@ discard block |
||
| 376 | 376 | $hidden = array(); // No hidden columns |
| 377 | 377 | $sortable = $this->get_sortable_columns(); |
| 378 | 378 | |
| 379 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 379 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 380 | 380 | |
| 381 | 381 | $this->items = $this->reports_data(); |
| 382 | 382 | |
| 383 | 383 | $this->total = $this->get_donor_count(); |
| 384 | 384 | |
| 385 | - $this->set_pagination_args( array( |
|
| 385 | + $this->set_pagination_args(array( |
|
| 386 | 386 | 'total_items' => $this->total, |
| 387 | 387 | 'per_page' => $this->per_page, |
| 388 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
| 389 | - ) ); |
|
| 388 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
| 389 | + )); |
|
| 390 | 390 | } |
| 391 | 391 | } |