@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - public function __construct( $_data ) { |
|
81 | + public function __construct($_data) { |
|
82 | 82 | |
83 | 83 | $this->data = $_data; |
84 | 84 | |
85 | 85 | // Generate unique ID |
86 | - $this->id = md5( rand() ); |
|
86 | + $this->id = md5(rand()); |
|
87 | 87 | |
88 | 88 | // Setup default options; |
89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
89 | + $this->options = apply_filters('give_graph_args', array( |
|
90 | 90 | 'y_mode' => null, |
91 | 91 | 'x_mode' => null, |
92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'bars' => true, |
104 | 104 | 'lines' => false, |
105 | 105 | 'points' => true |
106 | - ) ); |
|
106 | + )); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | - public function set( $key, $value ) { |
|
119 | - $this->options[ $key ] = $value; |
|
118 | + public function set($key, $value) { |
|
119 | + $this->options[$key] = $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - public function get( $key ) { |
|
130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
129 | + public function get($key) { |
|
130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | 138 | public function get_data() { |
139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function load_scripts() { |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
153 | 153 | |
154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
155 | + wp_enqueue_script('jquery-flot-time'); |
|
156 | 156 | |
157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
158 | + wp_enqueue_script('jquery-flot-resize'); |
|
159 | 159 | |
160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
161 | - wp_enqueue_script( 'jquery-flot' ); |
|
160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
161 | + wp_enqueue_script('jquery-flot'); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | [ |
186 | 186 | <?php |
187 | 187 | $order = 0; |
188 | - foreach( $this->get_data() as $label => $data ) : |
|
188 | + foreach ($this->get_data() as $label => $data) : |
|
189 | 189 | ?> |
190 | 190 | { |
191 | - label : "<?php esc_attr_e( $label ); ?>", |
|
192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
191 | + label : "<?php esc_attr_e($label); ?>", |
|
192 | + id : "<?php echo sanitize_key($label); ?>", |
|
193 | 193 | // data format is: [ point on x, value on y ] |
194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
195 | 195 | points: { |
196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | fill : true, |
207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
208 | 208 | }, |
209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | grid: { |
221 | 221 | show : true, |
222 | 222 | aboveData : false, |
223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
223 | + color : "<?php echo $this->options['color']; ?>", |
|
224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
227 | 227 | clickable : false, |
228 | 228 | hoverable : true |
229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
239 | 239 | <?php endif; ?> |
240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | min : 0, |
244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
248 | 248 | <?php endif; ?> |
249 | 249 | } |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @since 1.0 |
307 | 307 | */ |
308 | 308 | public function display() { |
309 | - do_action( 'give_before_graph', $this ); |
|
309 | + do_action('give_before_graph', $this); |
|
310 | 310 | echo $this->build_graph(); |
311 | - do_action( 'give_after_graph', $this ); |
|
311 | + do_action('give_after_graph', $this); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return string Column Name |
65 | 65 | */ |
66 | - public function column_default( $item, $column_name ) { |
|
67 | - switch ( $column_name ) { |
|
66 | + public function column_default($item, $column_name) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'error' : |
71 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html( 'Payment Error', 'give' ); |
|
71 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html('Payment Error', 'give'); |
|
72 | 72 | default: |
73 | - return $item[ $column_name ]; |
|
73 | + return $item[$column_name]; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return void |
86 | 86 | */ |
87 | - public function column_message( $item ) { |
|
87 | + public function column_message($item) { |
|
88 | 88 | |
89 | 89 | ?> |
90 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Log Message', 'give' ); ?> "><?php esc_html_e( 'View Log Message', 'give' ); ?></a> |
|
90 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Log Message', 'give'); ?> "><?php esc_html_e('View Log Message', 'give'); ?></a> |
|
91 | 91 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
92 | 92 | <?php |
93 | 93 | |
94 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
94 | + $log_message = get_post_field('post_content', $item['ID']); |
|
95 | 95 | |
96 | - $serialized = strpos( $log_message, '{"' ); |
|
96 | + $serialized = strpos($log_message, '{"'); |
|
97 | 97 | |
98 | 98 | // Check to see if the log message contains serialized information |
99 | - if ( $serialized !== false ) { |
|
100 | - $length = strlen( $log_message ) - $serialized; |
|
101 | - $intro = substr( $log_message, 0, - $length ); |
|
102 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
99 | + if ($serialized !== false) { |
|
100 | + $length = strlen($log_message) - $serialized; |
|
101 | + $intro = substr($log_message, 0, - $length); |
|
102 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
103 | 103 | |
104 | - echo wpautop( $intro ); |
|
105 | - echo wpautop( '<strong>' . esc_html( 'Log data:', 'give' ) . '</strong>' ); |
|
106 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
104 | + echo wpautop($intro); |
|
105 | + echo wpautop('<strong>'.esc_html('Log data:', 'give').'</strong>'); |
|
106 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
107 | 107 | } else { |
108 | 108 | // No serialized data found |
109 | - echo wpautop( $log_message ); |
|
109 | + echo wpautop($log_message); |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </div> |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_columns() { |
124 | 124 | $columns = array( |
125 | - 'ID' => esc_html( 'Log ID', 'give' ), |
|
126 | - 'payment_id' => esc_html( 'Payment ID', 'give' ), |
|
127 | - 'error' => esc_html( 'Error', 'give' ), |
|
128 | - 'message' => esc_html( 'Error Message', 'give' ), |
|
129 | - 'gateway' => esc_html( 'Gateway', 'give' ), |
|
130 | - 'date' => esc_html( 'Date', 'give' ) |
|
125 | + 'ID' => esc_html('Log ID', 'give'), |
|
126 | + 'payment_id' => esc_html('Payment ID', 'give'), |
|
127 | + 'error' => esc_html('Error', 'give'), |
|
128 | + 'message' => esc_html('Error Message', 'give'), |
|
129 | + 'gateway' => esc_html('Gateway', 'give'), |
|
130 | + 'date' => esc_html('Date', 'give') |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | return $columns; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return int Current page number |
142 | 142 | */ |
143 | 143 | public function get_paged() { |
144 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
144 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @since 1.0 |
152 | 152 | * @return void |
153 | 153 | */ |
154 | - public function bulk_actions( $which = '' ) { |
|
154 | + public function bulk_actions($which = '') { |
|
155 | 155 | give_log_views(); |
156 | 156 | } |
157 | 157 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | global $give_logs; |
168 | 168 | |
169 | 169 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
170 | - wp_suspend_cache_addition( true ); |
|
170 | + wp_suspend_cache_addition(true); |
|
171 | 171 | |
172 | 172 | $logs_data = array(); |
173 | 173 | $paged = $this->get_paged(); |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | 'paged' => $paged |
177 | 177 | ); |
178 | 178 | |
179 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
179 | + $logs = $give_logs->get_connected_logs($log_query); |
|
180 | 180 | |
181 | - if ( $logs ) { |
|
182 | - foreach ( $logs as $log ) { |
|
181 | + if ($logs) { |
|
182 | + foreach ($logs as $log) { |
|
183 | 183 | |
184 | 184 | $logs_data[] = array( |
185 | 185 | 'ID' => $log->ID, |
186 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
186 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
187 | 187 | 'payment_id' => $log->post_parent, |
188 | 188 | 'error' => 'error', |
189 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
189 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
190 | 190 | 'date' => $log->post_date |
191 | 191 | ); |
192 | 192 | } |
@@ -207,19 +207,19 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param string $which |
209 | 209 | */ |
210 | - protected function display_tablenav( $which ) { |
|
211 | - if ( 'top' === $which ) { |
|
212 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
210 | + protected function display_tablenav($which) { |
|
211 | + if ('top' === $which) { |
|
212 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
213 | 213 | } |
214 | 214 | ?> |
215 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
215 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
216 | 216 | |
217 | 217 | <div class="alignleft actions bulkactions"> |
218 | - <?php $this->bulk_actions( $which ); ?> |
|
218 | + <?php $this->bulk_actions($which); ?> |
|
219 | 219 | </div> |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | $columns = $this->get_columns(); |
247 | 247 | $hidden = array(); // No hidden columns |
248 | 248 | $sortable = $this->get_sortable_columns(); |
249 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
249 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
250 | 250 | $current_page = $this->get_pagenum(); |
251 | 251 | $this->items = $this->get_logs(); |
252 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
252 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
253 | 253 | |
254 | - $this->set_pagination_args( array( |
|
254 | + $this->set_pagination_args(array( |
|
255 | 255 | 'total_items' => $total_items, |
256 | 256 | 'per_page' => $this->per_page, |
257 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
257 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) : |
|
117 | + if ($day_by_day) : |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | else : |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | endif; |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - esc_html( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html('Income', 'give') => $earnings_data, |
|
181 | + esc_html('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | <div class="postbox"> |
191 | 191 | <div class="inside"> |
192 | 192 | <?php |
193 | - $graph = new Give_Graph( $data ); |
|
194 | - $graph->set( 'x_mode', 'time' ); |
|
195 | - $graph->set( 'multiple_y_axes', true ); |
|
193 | + $graph = new Give_Graph($data); |
|
194 | + $graph->set('x_mode', 'time'); |
|
195 | + $graph->set('multiple_y_axes', true); |
|
196 | 196 | $graph->display(); |
197 | 197 | |
198 | - if ( 'this_month' == $dates['range'] ) { |
|
198 | + if ('this_month' == $dates['range']) { |
|
199 | 199 | $estimated = give_estimated_monthly_stats(); |
200 | 200 | } |
201 | 201 | ?> |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | 208 | <td class="row-title"> |
209 | - <label for="tablecell"><?php esc_html_e( 'Total income for period: ', 'give' ); ?></label></td> |
|
210 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
209 | + <label for="tablecell"><?php esc_html_e('Total income for period: ', 'give'); ?></label></td> |
|
210 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
211 | 211 | </tr> |
212 | 212 | <tr class="alternate"> |
213 | 213 | <td class="row-title"> |
214 | - <label for="tablecell"><?php esc_html_e( 'Total donations for period shown: ', 'give' ); ?></label> |
|
214 | + <label for="tablecell"><?php esc_html_e('Total donations for period shown: ', 'give'); ?></label> |
|
215 | 215 | </td> |
216 | - <td><?php echo give_format_amount( $sales_totals, false ); ?></td> |
|
216 | + <td><?php echo give_format_amount($sales_totals, false); ?></td> |
|
217 | 217 | </tr> |
218 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
218 | + <?php if ('this_month' == $dates['range']) : ?> |
|
219 | 219 | <tr> |
220 | 220 | <td class="row-title"> |
221 | - <label for="tablecell"><?php esc_html_e( 'Estimated monthly income: ', 'give' ); ?></label> |
|
221 | + <label for="tablecell"><?php esc_html_e('Estimated monthly income: ', 'give'); ?></label> |
|
222 | 222 | </td> |
223 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
223 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
224 | 224 | </tr> |
225 | 225 | <tr class="alternate"> |
226 | 226 | <td class="row-title"> |
227 | - <label for="tablecell"><?php esc_html_e( 'Estimated monthly donations: ', 'give' ); ?></label> |
|
227 | + <label for="tablecell"><?php esc_html_e('Estimated monthly donations: ', 'give'); ?></label> |
|
228 | 228 | </td> |
229 | - <td><?php echo give_format_amount( $estimated['sales'], false ); ?></td> |
|
229 | + <td><?php echo give_format_amount($estimated['sales'], false); ?></td> |
|
230 | 230 | </tr> |
231 | 231 | <?php endif; ?> |
232 | 232 | </table> |
233 | 233 | |
234 | - <?php do_action( 'give_reports_graph_additional_stats' ); ?> |
|
234 | + <?php do_action('give_reports_graph_additional_stats'); ?> |
|
235 | 235 | |
236 | 236 | </div> |
237 | 237 | </div> |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | * @since 1.0 |
250 | 250 | * @return void |
251 | 251 | */ |
252 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
252 | +function give_reports_graph_of_form($form_id = 0) { |
|
253 | 253 | // Retrieve the queried dates |
254 | 254 | $dates = give_get_report_dates(); |
255 | 255 | |
256 | 256 | // Determine graph options |
257 | - switch ( $dates['range'] ) : |
|
257 | + switch ($dates['range']) : |
|
258 | 258 | case 'today' : |
259 | 259 | case 'yesterday' : |
260 | 260 | $day_by_day = true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $day_by_day = false; |
273 | 273 | break; |
274 | 274 | case 'other' : |
275 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
275 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
276 | 276 | $day_by_day = false; |
277 | 277 | } else { |
278 | 278 | $day_by_day = true; |
@@ -284,75 +284,75 @@ discard block |
||
284 | 284 | endswitch; |
285 | 285 | |
286 | 286 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
287 | - $sales_totals = 0; // Total sales for time period shown |
|
287 | + $sales_totals = 0; // Total sales for time period shown |
|
288 | 288 | |
289 | 289 | $earnings_data = array(); |
290 | 290 | $sales_data = array(); |
291 | 291 | $stats = new Give_Payment_Stats; |
292 | 292 | |
293 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
293 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
294 | 294 | |
295 | 295 | // Hour by hour |
296 | 296 | $month = $dates['m_start']; |
297 | 297 | $hour = 1; |
298 | 298 | $minute = 0; |
299 | 299 | $second = 0; |
300 | - while ( $hour <= 23 ) : |
|
300 | + while ($hour <= 23) : |
|
301 | 301 | |
302 | - if ( $hour == 23 ) { |
|
302 | + if ($hour == 23) { |
|
303 | 303 | $minute = $second = 59; |
304 | 304 | } |
305 | 305 | |
306 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
307 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
306 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
307 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
308 | 308 | |
309 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
309 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
310 | 310 | $sales_totals += $sales; |
311 | 311 | |
312 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
312 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
313 | 313 | $earnings_totals += $earnings; |
314 | 314 | |
315 | - $sales_data[] = array( $date * 1000, $sales ); |
|
316 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
315 | + $sales_data[] = array($date * 1000, $sales); |
|
316 | + $earnings_data[] = array($date * 1000, $earnings); |
|
317 | 317 | |
318 | - $hour ++; |
|
318 | + $hour++; |
|
319 | 319 | endwhile; |
320 | 320 | |
321 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
321 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
322 | 322 | |
323 | 323 | //Day by day |
324 | 324 | $day = $dates['day']; |
325 | 325 | $day_end = $dates['day_end']; |
326 | 326 | $month = $dates['m_start']; |
327 | - while ( $day <= $day_end ) : |
|
327 | + while ($day <= $day_end) : |
|
328 | 328 | |
329 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
330 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
331 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
329 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
330 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
331 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
332 | 332 | $sales_totals += $sales; |
333 | 333 | |
334 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
334 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
335 | 335 | $earnings_totals += $earnings; |
336 | 336 | |
337 | - $sales_data[] = array( $date * 1000, $sales ); |
|
338 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
337 | + $sales_data[] = array($date * 1000, $sales); |
|
338 | + $earnings_data[] = array($date * 1000, $earnings); |
|
339 | 339 | |
340 | - $day ++; |
|
340 | + $day++; |
|
341 | 341 | endwhile; |
342 | 342 | |
343 | 343 | } else { |
344 | 344 | |
345 | 345 | $y = $dates['year']; |
346 | 346 | |
347 | - while ( $y <= $dates['year_end'] ) : |
|
347 | + while ($y <= $dates['year_end']) : |
|
348 | 348 | |
349 | 349 | $last_year = false; |
350 | 350 | |
351 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
351 | + if ($dates['year'] == $dates['year_end']) { |
|
352 | 352 | $month_start = $dates['m_start']; |
353 | 353 | $month_end = $dates['m_end']; |
354 | 354 | $last_year = true; |
355 | - } elseif ( $y == $dates['year'] ) { |
|
355 | + } elseif ($y == $dates['year']) { |
|
356 | 356 | $month_start = $dates['m_start']; |
357 | 357 | $month_end = 12; |
358 | 358 | } else { |
@@ -361,75 +361,75 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | $i = $month_start; |
364 | - while ( $i <= $month_end ) : |
|
364 | + while ($i <= $month_end) : |
|
365 | 365 | |
366 | - if ( $day_by_day ) : |
|
366 | + if ($day_by_day) : |
|
367 | 367 | |
368 | - if ( $i == $month_end && $last_year ) { |
|
368 | + if ($i == $month_end && $last_year) { |
|
369 | 369 | |
370 | 370 | $num_of_days = $dates['day_end']; |
371 | 371 | |
372 | 372 | } else { |
373 | 373 | |
374 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
374 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
378 | 378 | $d = $dates['day']; |
379 | - while ( $d <= $num_of_days ) : |
|
379 | + while ($d <= $num_of_days) : |
|
380 | 380 | |
381 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
382 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
381 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
382 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
383 | 383 | |
384 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
384 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
385 | 385 | $sales_totals += $sales; |
386 | 386 | |
387 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
387 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
388 | 388 | $earnings_totals += $earnings; |
389 | 389 | |
390 | - $sales_data[] = array( $date * 1000, $sales ); |
|
391 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
392 | - $d ++; |
|
390 | + $sales_data[] = array($date * 1000, $sales); |
|
391 | + $earnings_data[] = array($date * 1000, $earnings); |
|
392 | + $d++; |
|
393 | 393 | |
394 | 394 | endwhile; |
395 | 395 | |
396 | 396 | else : |
397 | 397 | |
398 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
398 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
399 | 399 | |
400 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
401 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
400 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
401 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
402 | 402 | |
403 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
403 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
404 | 404 | $sales_totals += $sales; |
405 | 405 | |
406 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
406 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
407 | 407 | $earnings_totals += $earnings; |
408 | 408 | |
409 | - $sales_data[] = array( $date * 1000, $sales ); |
|
410 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
409 | + $sales_data[] = array($date * 1000, $sales); |
|
410 | + $earnings_data[] = array($date * 1000, $earnings); |
|
411 | 411 | endif; |
412 | 412 | |
413 | - $i ++; |
|
413 | + $i++; |
|
414 | 414 | |
415 | 415 | endwhile; |
416 | 416 | |
417 | - $y ++; |
|
417 | + $y++; |
|
418 | 418 | endwhile; |
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | 422 | $data = array( |
423 | - esc_html( 'Income', 'give' ) => $earnings_data, |
|
424 | - esc_html( 'Donations', 'give' ) => $sales_data |
|
423 | + esc_html('Income', 'give') => $earnings_data, |
|
424 | + esc_html('Donations', 'give') => $sales_data |
|
425 | 425 | ); |
426 | 426 | |
427 | 427 | ?> |
428 | 428 | <h3><span><?php |
429 | 429 | printf( |
430 | 430 | /* translators: %s: form title */ |
431 | - esc_html( 'Income Over Time for %s', 'give' ), |
|
432 | - get_the_title( $form_id ) |
|
431 | + esc_html('Income Over Time for %s', 'give'), |
|
432 | + get_the_title($form_id) |
|
433 | 433 | ); |
434 | 434 | ?></span></h3> |
435 | 435 | |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | <div class="postbox"> |
438 | 438 | <div class="inside"> |
439 | 439 | <?php |
440 | - $graph = new Give_Graph( $data ); |
|
441 | - $graph->set( 'x_mode', 'time' ); |
|
442 | - $graph->set( 'multiple_y_axes', true ); |
|
440 | + $graph = new Give_Graph($data); |
|
441 | + $graph->set('x_mode', 'time'); |
|
442 | + $graph->set('multiple_y_axes', true); |
|
443 | 443 | $graph->display(); |
444 | 444 | ?> |
445 | 445 | </div> |
@@ -449,26 +449,26 @@ discard block |
||
449 | 449 | <tbody> |
450 | 450 | <tr> |
451 | 451 | <td class="row-title"> |
452 | - <label for="tablecell"><?php esc_html_e( 'Total income for period: ', 'give' ); ?></label></td> |
|
453 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
452 | + <label for="tablecell"><?php esc_html_e('Total income for period: ', 'give'); ?></label></td> |
|
453 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
454 | 454 | </tr> |
455 | 455 | <tr class="alternate"> |
456 | 456 | <td class="row-title"> |
457 | - <label for="tablecell"><?php esc_html_e( 'Total donations for period: ', 'give' ); ?></label> |
|
457 | + <label for="tablecell"><?php esc_html_e('Total donations for period: ', 'give'); ?></label> |
|
458 | 458 | </td> |
459 | 459 | <td><?php echo $sales_totals; ?></td> |
460 | 460 | </tr> |
461 | 461 | <tr> |
462 | 462 | <td class="row-title"> |
463 | - <label for="tablecell"><?php esc_html_e( 'Average monthly income: %s', 'give' ); ?></label> |
|
463 | + <label for="tablecell"><?php esc_html_e('Average monthly income: %s', 'give'); ?></label> |
|
464 | 464 | </td> |
465 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
465 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
466 | 466 | </tr> |
467 | 467 | <tr class="alternate"> |
468 | 468 | <td class="row-title"> |
469 | - <label for="tablecell"><?php esc_html_e( 'Average monthly donations: %s', 'give' ); ?></label> |
|
469 | + <label for="tablecell"><?php esc_html_e('Average monthly donations: %s', 'give'); ?></label> |
|
470 | 470 | </td> |
471 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
471 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
472 | 472 | </tr> |
473 | 473 | </tbody> |
474 | 474 | </table> |
@@ -485,29 +485,29 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | function give_reports_graph_controls() { |
488 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
489 | - 'today' => esc_html( 'Today', 'give' ), |
|
490 | - 'yesterday' => esc_html( 'Yesterday', 'give' ), |
|
491 | - 'this_week' => esc_html( 'This Week', 'give' ), |
|
492 | - 'last_week' => esc_html( 'Last Week', 'give' ), |
|
493 | - 'this_month' => esc_html( 'This Month', 'give' ), |
|
494 | - 'last_month' => esc_html( 'Last Month', 'give' ), |
|
495 | - 'this_quarter' => esc_html( 'This Quarter', 'give' ), |
|
496 | - 'last_quarter' => esc_html( 'Last Quarter', 'give' ), |
|
497 | - 'this_year' => esc_html( 'This Year', 'give' ), |
|
498 | - 'last_year' => esc_html( 'Last Year', 'give' ), |
|
499 | - 'other' => esc_html( 'Custom', 'give' ) |
|
500 | - ) ); |
|
488 | + $date_options = apply_filters('give_report_date_options', array( |
|
489 | + 'today' => esc_html('Today', 'give'), |
|
490 | + 'yesterday' => esc_html('Yesterday', 'give'), |
|
491 | + 'this_week' => esc_html('This Week', 'give'), |
|
492 | + 'last_week' => esc_html('Last Week', 'give'), |
|
493 | + 'this_month' => esc_html('This Month', 'give'), |
|
494 | + 'last_month' => esc_html('Last Month', 'give'), |
|
495 | + 'this_quarter' => esc_html('This Quarter', 'give'), |
|
496 | + 'last_quarter' => esc_html('Last Quarter', 'give'), |
|
497 | + 'this_year' => esc_html('This Year', 'give'), |
|
498 | + 'last_year' => esc_html('Last Year', 'give'), |
|
499 | + 'other' => esc_html('Custom', 'give') |
|
500 | + )); |
|
501 | 501 | |
502 | 502 | $dates = give_get_report_dates(); |
503 | 503 | $display = $dates['range'] == 'other' ? '' : 'style="display:none;"'; |
504 | 504 | $view = give_get_reporting_view(); |
505 | 505 | |
506 | - if ( empty( $dates['day_end'] ) ) { |
|
507 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
506 | + if (empty($dates['day_end'])) { |
|
507 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
508 | 508 | } |
509 | 509 | |
510 | - do_action( 'give_report_graph_controls_before' ); |
|
510 | + do_action('give_report_graph_controls_before'); |
|
511 | 511 | ?> |
512 | 512 | <form id="give-graphs-filter" method="get" class="alignright"> |
513 | 513 | <div class="tablenav top alignright"> |
@@ -515,53 +515,53 @@ discard block |
||
515 | 515 | |
516 | 516 | <input type="hidden" name="post_type" value="give_forms" /> |
517 | 517 | <input type="hidden" name="page" value="give-reports" /> |
518 | - <input type="hidden" name="view" value="<?php esc_attr_e( $view ); ?>" /> |
|
518 | + <input type="hidden" name="view" value="<?php esc_attr_e($view); ?>" /> |
|
519 | 519 | |
520 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
521 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
520 | + <?php if (isset($_GET['form-id'])) : ?> |
|
521 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
522 | 522 | <?php endif; ?> |
523 | 523 | |
524 | 524 | <div id="give-graphs-date-options-wrap" class="alignright"> |
525 | 525 | <select id="give-graphs-date-options" name="range"> |
526 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
527 | - <option value="<?php esc_attr_e( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php esc_html_e( $option ); ?></option> |
|
526 | + <?php foreach ($date_options as $key => $option) : ?> |
|
527 | + <option value="<?php esc_attr_e($key); ?>"<?php selected($key, $dates['range']); ?>><?php esc_html_e($option); ?></option> |
|
528 | 528 | <?php endforeach; ?> |
529 | 529 | </select> |
530 | 530 | |
531 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
531 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
532 | 532 | </div> |
533 | 533 | |
534 | 534 | <div id="give-date-range-options" <?php echo $display; ?>> |
535 | - <span><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <span><?php esc_html_e('From', 'give'); ?> </span> |
|
536 | 536 | <select id="give-graphs-month-start" name="m_start"> |
537 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
538 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
537 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
538 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
539 | 539 | <?php endfor; ?> |
540 | 540 | </select> |
541 | 541 | <select id="give-graphs-day-start" name="day"> |
542 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
543 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option> |
|
542 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
543 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option> |
|
544 | 544 | <?php endfor; ?> |
545 | 545 | </select> |
546 | 546 | <select id="give-graphs-year-start" name="year"> |
547 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
548 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option> |
|
547 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
548 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option> |
|
549 | 549 | <?php endfor; ?> |
550 | 550 | </select> |
551 | - <span><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
551 | + <span><?php esc_html_e('To', 'give'); ?> </span> |
|
552 | 552 | <select id="give-graphs-month-end" name="m_end"> |
553 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
554 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option> |
|
553 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
554 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option> |
|
555 | 555 | <?php endfor; ?> |
556 | 556 | </select> |
557 | 557 | <select id="give-graphs-day-end" name="day_end"> |
558 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
559 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option> |
|
558 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
559 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option> |
|
560 | 560 | <?php endfor; ?> |
561 | 561 | </select> |
562 | 562 | <select id="give-graphs-year-end" name="year_end"> |
563 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
564 | - <option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option> |
|
563 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
564 | + <option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option> |
|
565 | 565 | <?php endfor; ?> |
566 | 566 | </select> |
567 | 567 | </div> |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | </div> |
572 | 572 | </form> |
573 | 573 | <?php |
574 | - do_action( 'give_report_graph_controls_after' ); |
|
574 | + do_action('give_report_graph_controls_after'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -586,65 +586,65 @@ discard block |
||
586 | 586 | function give_get_report_dates() { |
587 | 587 | $dates = array(); |
588 | 588 | |
589 | - $current_time = current_time( 'timestamp' ); |
|
589 | + $current_time = current_time('timestamp'); |
|
590 | 590 | |
591 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
592 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
593 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
594 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
595 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
596 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
597 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
591 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
592 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
593 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
594 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
595 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
596 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
597 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
598 | 598 | |
599 | 599 | // Modify dates based on predefined ranges |
600 | - switch ( $dates['range'] ) : |
|
600 | + switch ($dates['range']) : |
|
601 | 601 | |
602 | 602 | case 'this_month' : |
603 | - $dates['m_start'] = date( 'n', $current_time ); |
|
604 | - $dates['m_end'] = date( 'n', $current_time ); |
|
603 | + $dates['m_start'] = date('n', $current_time); |
|
604 | + $dates['m_end'] = date('n', $current_time); |
|
605 | 605 | $dates['day'] = 1; |
606 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
607 | - $dates['year'] = date( 'Y' ); |
|
608 | - $dates['year_end'] = date( 'Y' ); |
|
606 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
607 | + $dates['year'] = date('Y'); |
|
608 | + $dates['year_end'] = date('Y'); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | case 'last_month' : |
612 | - if ( date( 'n' ) == 1 ) { |
|
612 | + if (date('n') == 1) { |
|
613 | 613 | $dates['m_start'] = 12; |
614 | 614 | $dates['m_end'] = 12; |
615 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
616 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
615 | + $dates['year'] = date('Y', $current_time) - 1; |
|
616 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
617 | 617 | } else { |
618 | - $dates['m_start'] = date( 'n' ) - 1; |
|
619 | - $dates['m_end'] = date( 'n' ) - 1; |
|
618 | + $dates['m_start'] = date('n') - 1; |
|
619 | + $dates['m_end'] = date('n') - 1; |
|
620 | 620 | $dates['year_end'] = $dates['year']; |
621 | 621 | } |
622 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
622 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
623 | 623 | break; |
624 | 624 | |
625 | 625 | case 'today' : |
626 | - $dates['day'] = date( 'd', $current_time ); |
|
627 | - $dates['m_start'] = date( 'n', $current_time ); |
|
628 | - $dates['m_end'] = date( 'n', $current_time ); |
|
629 | - $dates['year'] = date( 'Y', $current_time ); |
|
626 | + $dates['day'] = date('d', $current_time); |
|
627 | + $dates['m_start'] = date('n', $current_time); |
|
628 | + $dates['m_end'] = date('n', $current_time); |
|
629 | + $dates['year'] = date('Y', $current_time); |
|
630 | 630 | break; |
631 | 631 | |
632 | 632 | case 'yesterday' : |
633 | 633 | |
634 | - $year = date( 'Y', $current_time ); |
|
635 | - $month = date( 'n', $current_time ); |
|
636 | - $day = date( 'd', $current_time ); |
|
634 | + $year = date('Y', $current_time); |
|
635 | + $month = date('n', $current_time); |
|
636 | + $day = date('d', $current_time); |
|
637 | 637 | |
638 | - if ( $month == 1 && $day == 1 ) { |
|
638 | + if ($month == 1 && $day == 1) { |
|
639 | 639 | |
640 | 640 | $year -= 1; |
641 | 641 | $month = 12; |
642 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
642 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
643 | 643 | |
644 | - } elseif ( $month > 1 && $day == 1 ) { |
|
644 | + } elseif ($month > 1 && $day == 1) { |
|
645 | 645 | |
646 | 646 | $month -= 1; |
647 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
647 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
648 | 648 | |
649 | 649 | } else { |
650 | 650 | |
@@ -660,91 +660,91 @@ discard block |
||
660 | 660 | break; |
661 | 661 | |
662 | 662 | case 'this_week' : |
663 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
664 | - $dates['day'] += get_option( 'start_of_week' ); |
|
663 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
664 | + $dates['day'] += get_option('start_of_week'); |
|
665 | 665 | $dates['day_end'] = $dates['day'] + 6; |
666 | - $dates['m_start'] = date( 'n', $current_time ); |
|
667 | - $dates['m_end'] = date( 'n', $current_time ); |
|
668 | - $dates['year'] = date( 'Y', $current_time ); |
|
666 | + $dates['m_start'] = date('n', $current_time); |
|
667 | + $dates['m_end'] = date('n', $current_time); |
|
668 | + $dates['year'] = date('Y', $current_time); |
|
669 | 669 | break; |
670 | 670 | |
671 | 671 | case 'last_week' : |
672 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
673 | - $dates['day'] += get_option( 'start_of_week' ); |
|
672 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
673 | + $dates['day'] += get_option('start_of_week'); |
|
674 | 674 | $dates['day_end'] = $dates['day'] + 6; |
675 | - $dates['year'] = date( 'Y' ); |
|
676 | - |
|
677 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
678 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
679 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
680 | - if ( $dates['m_start'] <= 1 ) { |
|
681 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
682 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
675 | + $dates['year'] = date('Y'); |
|
676 | + |
|
677 | + if (date('j', $current_time) <= 7) { |
|
678 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
679 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
680 | + if ($dates['m_start'] <= 1) { |
|
681 | + $dates['year'] = date('Y', $current_time) - 1; |
|
682 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
683 | 683 | } |
684 | 684 | } else { |
685 | - $dates['m_start'] = date( 'n', $current_time ); |
|
686 | - $dates['m_end'] = date( 'n', $current_time ); |
|
685 | + $dates['m_start'] = date('n', $current_time); |
|
686 | + $dates['m_end'] = date('n', $current_time); |
|
687 | 687 | } |
688 | 688 | break; |
689 | 689 | |
690 | 690 | case 'this_quarter' : |
691 | - $month_now = date( 'n', $current_time ); |
|
691 | + $month_now = date('n', $current_time); |
|
692 | 692 | |
693 | - if ( $month_now <= 3 ) { |
|
693 | + if ($month_now <= 3) { |
|
694 | 694 | |
695 | 695 | $dates['m_start'] = 1; |
696 | 696 | $dates['m_end'] = 4; |
697 | - $dates['year'] = date( 'Y', $current_time ); |
|
697 | + $dates['year'] = date('Y', $current_time); |
|
698 | 698 | |
699 | - } else if ( $month_now <= 6 ) { |
|
699 | + } else if ($month_now <= 6) { |
|
700 | 700 | |
701 | 701 | $dates['m_start'] = 4; |
702 | 702 | $dates['m_end'] = 7; |
703 | - $dates['year'] = date( 'Y', $current_time ); |
|
703 | + $dates['year'] = date('Y', $current_time); |
|
704 | 704 | |
705 | - } else if ( $month_now <= 9 ) { |
|
705 | + } else if ($month_now <= 9) { |
|
706 | 706 | |
707 | 707 | $dates['m_start'] = 7; |
708 | 708 | $dates['m_end'] = 10; |
709 | - $dates['year'] = date( 'Y', $current_time ); |
|
709 | + $dates['year'] = date('Y', $current_time); |
|
710 | 710 | |
711 | 711 | } else { |
712 | 712 | |
713 | 713 | $dates['m_start'] = 10; |
714 | 714 | $dates['m_end'] = 1; |
715 | - $dates['year'] = date( 'Y', $current_time ); |
|
716 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
715 | + $dates['year'] = date('Y', $current_time); |
|
716 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | break; |
720 | 720 | |
721 | 721 | case 'last_quarter' : |
722 | - $month_now = date( 'n' ); |
|
722 | + $month_now = date('n'); |
|
723 | 723 | |
724 | - if ( $month_now <= 3 ) { |
|
724 | + if ($month_now <= 3) { |
|
725 | 725 | |
726 | 726 | $dates['m_start'] = 10; |
727 | 727 | $dates['m_end'] = 12; |
728 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
729 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
728 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
729 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
730 | 730 | |
731 | - } else if ( $month_now <= 6 ) { |
|
731 | + } else if ($month_now <= 6) { |
|
732 | 732 | |
733 | 733 | $dates['m_start'] = 1; |
734 | 734 | $dates['m_end'] = 3; |
735 | - $dates['year'] = date( 'Y', $current_time ); |
|
735 | + $dates['year'] = date('Y', $current_time); |
|
736 | 736 | |
737 | - } else if ( $month_now <= 9 ) { |
|
737 | + } else if ($month_now <= 9) { |
|
738 | 738 | |
739 | 739 | $dates['m_start'] = 4; |
740 | 740 | $dates['m_end'] = 6; |
741 | - $dates['year'] = date( 'Y', $current_time ); |
|
741 | + $dates['year'] = date('Y', $current_time); |
|
742 | 742 | |
743 | 743 | } else { |
744 | 744 | |
745 | 745 | $dates['m_start'] = 7; |
746 | 746 | $dates['m_end'] = 9; |
747 | - $dates['year'] = date( 'Y', $current_time ); |
|
747 | + $dates['year'] = date('Y', $current_time); |
|
748 | 748 | |
749 | 749 | } |
750 | 750 | break; |
@@ -752,19 +752,19 @@ discard block |
||
752 | 752 | case 'this_year' : |
753 | 753 | $dates['m_start'] = 1; |
754 | 754 | $dates['m_end'] = 12; |
755 | - $dates['year'] = date( 'Y', $current_time ); |
|
755 | + $dates['year'] = date('Y', $current_time); |
|
756 | 756 | break; |
757 | 757 | |
758 | 758 | case 'last_year' : |
759 | 759 | $dates['m_start'] = 1; |
760 | 760 | $dates['m_end'] = 12; |
761 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
762 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
761 | + $dates['year'] = date('Y', $current_time) - 1; |
|
762 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
763 | 763 | break; |
764 | 764 | |
765 | 765 | endswitch; |
766 | 766 | |
767 | - return apply_filters( 'give_report_dates', $dates ); |
|
767 | + return apply_filters('give_report_dates', $dates); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | /** |
@@ -774,17 +774,17 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @param $data |
776 | 776 | */ |
777 | -function give_parse_report_dates( $data ) { |
|
777 | +function give_parse_report_dates($data) { |
|
778 | 778 | $dates = give_get_report_dates(); |
779 | 779 | |
780 | 780 | $view = give_get_reporting_view(); |
781 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
781 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
782 | 782 | |
783 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
783 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
784 | 784 | give_die(); |
785 | 785 | } |
786 | 786 | |
787 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
787 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
@@ -794,16 +794,16 @@ discard block |
||
794 | 794 | */ |
795 | 795 | function give_reports_refresh_button() { |
796 | 796 | |
797 | - $url = wp_nonce_url( add_query_arg( array( |
|
797 | + $url = wp_nonce_url(add_query_arg(array( |
|
798 | 798 | 'give_action' => 'refresh_reports_transients', |
799 | 799 | 'give-message' => 'refreshed-reports' |
800 | - ) ), 'give-refresh-reports' ); |
|
800 | + )), 'give-refresh-reports'); |
|
801 | 801 | |
802 | - echo '<a href="' . $url . '" data-tooltip="' . esc_attr( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . esc_html( 'Refresh Reports', 'give' ) . '</a>'; |
|
802 | + echo '<a href="'.$url.'" data-tooltip="'.esc_attr('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.esc_html('Refresh Reports', 'give').'</a>'; |
|
803 | 803 | |
804 | 804 | } |
805 | 805 | |
806 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
806 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * Trigger the refresh of reports transients |
@@ -814,18 +814,18 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return void |
816 | 816 | */ |
817 | -function give_run_refresh_reports_transients( $data ) { |
|
817 | +function give_run_refresh_reports_transients($data) { |
|
818 | 818 | |
819 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
819 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
823 | 823 | //Delete transients |
824 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
825 | - delete_transient( 'give_earnings_total' ); |
|
826 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
827 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
824 | + delete_transient('give_estimated_monthly_stats'); |
|
825 | + delete_transient('give_earnings_total'); |
|
826 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
827 | + delete_transient(md5('give_earnings_todaytoday')); |
|
828 | 828 | |
829 | 829 | } |
830 | 830 | |
831 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
832 | 831 | \ No newline at end of file |
832 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
833 | 833 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => esc_html( 'ID', 'give' ), |
|
73 | - 'date' => esc_html( 'Date', 'give' ) |
|
72 | + 'id' => esc_html('ID', 'give'), |
|
73 | + 'date' => esc_html('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( esc_html( 'You do not have permission to export data.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(esc_html('You do not have permission to export data.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => esc_html( 'Date', 'give' ), |
|
65 | - 'donations' => esc_html( 'Donations', 'give' ), |
|
64 | + 'date' => esc_html('Date', 'give'), |
|
65 | + 'donations' => esc_html('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( esc_html( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) ) |
|
67 | + 'earnings' => sprintf(esc_html('Income (%s)', 'give'), html_entity_decode(give_currency_filter(''))) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
15 | +if ( ! defined('ABSPATH')) exit; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Give_Batch_Export Class |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | * @param $_step int The step to process |
105 | 105 | * @since 1.5 |
106 | 106 | */ |
107 | - public function __construct( $_step = 1 ) { |
|
107 | + public function __construct($_step = 1) { |
|
108 | 108 | |
109 | 109 | $upload_dir = wp_upload_dir(); |
110 | 110 | $this->filetype = '.csv'; |
111 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
112 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
111 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
112 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
113 | 113 | |
114 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
114 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
115 | 115 | $this->is_writable = false; |
116 | 116 | } |
117 | 117 | |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function process_step() { |
129 | 129 | |
130 | - if ( ! $this->can_export() ) { |
|
131 | - wp_die( esc_html( 'You do not have permission to export data.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
130 | + if ( ! $this->can_export()) { |
|
131 | + wp_die(esc_html('You do not have permission to export data.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
132 | 132 | } |
133 | 133 | |
134 | - if( $this->step < 2 ) { |
|
134 | + if ($this->step < 2) { |
|
135 | 135 | |
136 | 136 | // Make sure we start with a fresh file on step 1 |
137 | - @unlink( $this->file ); |
|
137 | + @unlink($this->file); |
|
138 | 138 | $this->print_csv_cols(); |
139 | 139 | } |
140 | 140 | |
141 | 141 | $rows = $this->print_csv_rows(); |
142 | 142 | |
143 | - if( $rows ) { |
|
143 | + if ($rows) { |
|
144 | 144 | return true; |
145 | 145 | } else { |
146 | 146 | return false; |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $col_data = ''; |
161 | 161 | $cols = $this->get_csv_cols(); |
162 | 162 | $i = 1; |
163 | - foreach( $cols as $col_id => $column ) { |
|
164 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
165 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
163 | + foreach ($cols as $col_id => $column) { |
|
164 | + $col_data .= '"'.addslashes($column).'"'; |
|
165 | + $col_data .= $i == count($cols) ? '' : ','; |
|
166 | 166 | $i++; |
167 | 167 | } |
168 | 168 | $col_data .= "\r\n"; |
169 | 169 | |
170 | - $this->stash_step_data( $col_data ); |
|
170 | + $this->stash_step_data($col_data); |
|
171 | 171 | |
172 | 172 | return $col_data; |
173 | 173 | |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | $data = $this->get_data(); |
187 | 187 | $cols = $this->get_csv_cols(); |
188 | 188 | |
189 | - if( $data ) { |
|
189 | + if ($data) { |
|
190 | 190 | |
191 | 191 | // Output each row |
192 | - foreach ( $data as $row ) { |
|
192 | + foreach ($data as $row) { |
|
193 | 193 | $i = 1; |
194 | - foreach ( $row as $col_id => $column ) { |
|
194 | + foreach ($row as $col_id => $column) { |
|
195 | 195 | // Make sure the column is valid |
196 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
197 | - $row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"'; |
|
198 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
196 | + if (array_key_exists($col_id, $cols)) { |
|
197 | + $row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"'; |
|
198 | + $row_data .= $i == count($cols) ? '' : ','; |
|
199 | 199 | $i++; |
200 | 200 | } |
201 | 201 | } |
202 | 202 | $row_data .= "\r\n"; |
203 | 203 | } |
204 | 204 | |
205 | - $this->stash_step_data( $row_data ); |
|
205 | + $this->stash_step_data($row_data); |
|
206 | 206 | |
207 | 207 | return $row_data; |
208 | 208 | } |
@@ -230,18 +230,18 @@ discard block |
||
230 | 230 | |
231 | 231 | $file = ''; |
232 | 232 | |
233 | - if ( @file_exists( $this->file ) ) { |
|
233 | + if (@file_exists($this->file)) { |
|
234 | 234 | |
235 | - if ( ! is_writeable( $this->file ) ) { |
|
235 | + if ( ! is_writeable($this->file)) { |
|
236 | 236 | $this->is_writable = false; |
237 | 237 | } |
238 | 238 | |
239 | - $file = @file_get_contents( $this->file ); |
|
239 | + $file = @file_get_contents($this->file); |
|
240 | 240 | |
241 | 241 | } else { |
242 | 242 | |
243 | - @file_put_contents( $this->file, '' ); |
|
244 | - @chmod( $this->file, 0664 ); |
|
243 | + @file_put_contents($this->file, ''); |
|
244 | + @chmod($this->file, 0664); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | * @param $data string The data to add to the file |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - protected function stash_step_data( $data = '' ) { |
|
258 | + protected function stash_step_data($data = '') { |
|
259 | 259 | |
260 | 260 | $file = $this->get_file(); |
261 | 261 | $file .= $data; |
262 | - @file_put_contents( $this->file, $file ); |
|
262 | + @file_put_contents($this->file, $file); |
|
263 | 263 | |
264 | 264 | // If we have no rows after this step, mark it as an empty export |
265 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES); |
|
265 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
266 | 266 | $default_cols = $this->get_csv_cols(); |
267 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
267 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
268 | 268 | |
269 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
269 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $file = $this->get_file(); |
286 | 286 | |
287 | - @unlink( $this->file ); |
|
287 | + @unlink($this->file); |
|
288 | 288 | |
289 | 289 | echo $file; |
290 | 290 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @since 1.5 |
298 | 298 | * @param array $request The Form Data passed into the batch processing |
299 | 299 | */ |
300 | - public function set_properties( $request ) {} |
|
300 | + public function set_properties($request) {} |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Allow for prefetching of data for the remainder of the exporter |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param array $request The Form Data passed into the batch processing |
48 | 48 | */ |
49 | - public function set_properties( $request ) { |
|
49 | + public function set_properties($request) { |
|
50 | 50 | |
51 | 51 | //Set data from form submission |
52 | - if ( isset( $_POST['form'] ) ) { |
|
53 | - parse_str( $_POST['form'], $this->data ); |
|
52 | + if (isset($_POST['form'])) { |
|
53 | + parse_str($_POST['form'], $this->data); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $this->form = $this->data['forms']; |
57 | 57 | |
58 | - $this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
58 | + $this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
@@ -70,36 +70,36 @@ discard block |
||
70 | 70 | |
71 | 71 | $cols = array(); |
72 | 72 | |
73 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
73 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
74 | 74 | |
75 | - if ( empty( $columns ) ) { |
|
75 | + if (empty($columns)) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | - if ( ! empty( $columns['full_name'] ) ) { |
|
79 | - $cols['full_name'] = esc_html( 'Full Name', 'give' ); |
|
78 | + if ( ! empty($columns['full_name'])) { |
|
79 | + $cols['full_name'] = esc_html('Full Name', 'give'); |
|
80 | 80 | } |
81 | - if ( ! empty( $columns['email'] ) ) { |
|
82 | - $cols['email'] = esc_html( 'Email Address', 'give' ); |
|
81 | + if ( ! empty($columns['email'])) { |
|
82 | + $cols['email'] = esc_html('Email Address', 'give'); |
|
83 | 83 | } |
84 | - if ( ! empty( $columns['address'] ) ) { |
|
85 | - $cols['address_line1'] = esc_html( 'Address', 'give' ); |
|
86 | - $cols['address_line2'] = esc_html( 'Address (Line 2)', 'give' ); |
|
87 | - $cols['address_city'] = esc_html( 'City', 'give' ); |
|
88 | - $cols['address_state'] = esc_html( 'State', 'give' ); |
|
89 | - $cols['address_zip'] = esc_html( 'Zip', 'give' ); |
|
90 | - $cols['address_country'] = esc_html( 'Country', 'give' ); |
|
84 | + if ( ! empty($columns['address'])) { |
|
85 | + $cols['address_line1'] = esc_html('Address', 'give'); |
|
86 | + $cols['address_line2'] = esc_html('Address (Line 2)', 'give'); |
|
87 | + $cols['address_city'] = esc_html('City', 'give'); |
|
88 | + $cols['address_state'] = esc_html('State', 'give'); |
|
89 | + $cols['address_zip'] = esc_html('Zip', 'give'); |
|
90 | + $cols['address_country'] = esc_html('Country', 'give'); |
|
91 | 91 | } |
92 | - if ( ! empty( $columns['userid'] ) ) { |
|
93 | - $cols['userid'] = esc_html( 'User ID', 'give' ); |
|
92 | + if ( ! empty($columns['userid'])) { |
|
93 | + $cols['userid'] = esc_html('User ID', 'give'); |
|
94 | 94 | } |
95 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
96 | - $cols['date_first_donated'] = esc_html( 'First Donation Date', 'give' ); |
|
95 | + if ( ! empty($columns['date_first_donated'])) { |
|
96 | + $cols['date_first_donated'] = esc_html('First Donation Date', 'give'); |
|
97 | 97 | } |
98 | - if ( ! empty( $columns['donations'] ) ) { |
|
99 | - $cols['donations'] = esc_html( 'Number of Donations', 'give' ); |
|
98 | + if ( ! empty($columns['donations'])) { |
|
99 | + $cols['donations'] = esc_html('Number of Donations', 'give'); |
|
100 | 100 | } |
101 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
102 | - $cols['donation_sum'] = esc_html( 'Sum of Donations', 'give' ); |
|
101 | + if ( ! empty($columns['donation_sum'])) { |
|
102 | + $cols['donation_sum'] = esc_html('Sum of Donations', 'give'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $cols; |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | |
120 | 120 | $i = 0; |
121 | 121 | |
122 | - if ( ! empty( $this->form ) ) { |
|
122 | + if ( ! empty($this->form)) { |
|
123 | 123 | |
124 | 124 | // Export donors of a specific product |
125 | 125 | global $give_logs; |
126 | 126 | |
127 | 127 | $args = array( |
128 | - 'post_parent' => absint( $this->form ), |
|
128 | + 'post_parent' => absint($this->form), |
|
129 | 129 | 'log_type' => 'sale', |
130 | 130 | 'posts_per_page' => 30, |
131 | 131 | 'paged' => $this->step |
132 | 132 | ); |
133 | 133 | |
134 | 134 | //Check for price option |
135 | - if ( null !== $this->price_id ) { |
|
135 | + if (null !== $this->price_id) { |
|
136 | 136 | $args['meta_query'] = array( |
137 | 137 | array( |
138 | 138 | 'key' => '_give_log_price_id', |
@@ -141,33 +141,33 @@ discard block |
||
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - $logs = $give_logs->get_connected_logs( $args ); |
|
144 | + $logs = $give_logs->get_connected_logs($args); |
|
145 | 145 | |
146 | - if ( $logs ) { |
|
147 | - foreach ( $logs as $log ) { |
|
148 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
149 | - $payment = new Give_Payment( $payment_id ); |
|
150 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
151 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
152 | - $i ++; |
|
146 | + if ($logs) { |
|
147 | + foreach ($logs as $log) { |
|
148 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
149 | + $payment = new Give_Payment($payment_id); |
|
150 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
151 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
152 | + $i++; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | } else { |
157 | 157 | |
158 | 158 | // Export all customers |
159 | - $offset = 30 * ( $this->step - 1 ); |
|
160 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
159 | + $offset = 30 * ($this->step - 1); |
|
160 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
161 | 161 | |
162 | - foreach ( $donors as $donor ) { |
|
162 | + foreach ($donors as $donor) { |
|
163 | 163 | |
164 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
165 | - $i ++; |
|
164 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
165 | + $i++; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
170 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
169 | + $data = apply_filters('give_export_get_data', $data); |
|
170 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
171 | 171 | |
172 | 172 | return $data; |
173 | 173 | } |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | $percentage = 0; |
184 | 184 | |
185 | 185 | // We can't count the number when getting them for a specific form |
186 | - if ( empty( $this->form ) ) { |
|
186 | + if (empty($this->form)) { |
|
187 | 187 | |
188 | 188 | $total = Give()->customers->count(); |
189 | 189 | |
190 | - if ( $total > 0 ) { |
|
190 | + if ($total > 0) { |
|
191 | 191 | |
192 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
192 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | 196 | } |
197 | 197 | |
198 | - if ( $percentage > 100 ) { |
|
198 | + if ($percentage > 100) { |
|
199 | 199 | $percentage = 100; |
200 | 200 | } |
201 | 201 | |
@@ -207,46 +207,46 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param $donor |
209 | 209 | */ |
210 | - private function set_donor_data( $i, $data, $donor ) { |
|
210 | + private function set_donor_data($i, $data, $donor) { |
|
211 | 211 | |
212 | 212 | $columns = $this->csv_cols(); |
213 | 213 | |
214 | 214 | //Set address variable |
215 | 215 | $address = ''; |
216 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
217 | - $address = give_get_donor_address( $donor->user_id ); |
|
216 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
217 | + $address = give_get_donor_address($donor->user_id); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | //Set columns |
221 | - if ( ! empty( $columns['full_name'] ) ) { |
|
222 | - $data[ $i ]['full_name'] = $donor->name; |
|
221 | + if ( ! empty($columns['full_name'])) { |
|
222 | + $data[$i]['full_name'] = $donor->name; |
|
223 | 223 | } |
224 | - if ( ! empty( $columns['email'] ) ) { |
|
225 | - $data[ $i ]['email'] = $donor->email; |
|
224 | + if ( ! empty($columns['email'])) { |
|
225 | + $data[$i]['email'] = $donor->email; |
|
226 | 226 | } |
227 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
227 | + if ( ! empty($columns['address_line1'])) { |
|
228 | 228 | |
229 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
230 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
231 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
232 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
233 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
234 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
229 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
230 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
231 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
232 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
233 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
234 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
235 | 235 | } |
236 | - if ( ! empty( $columns['userid'] ) ) { |
|
237 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
236 | + if ( ! empty($columns['userid'])) { |
|
237 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
238 | 238 | } |
239 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
240 | - $data[ $i ]['date_first_donated'] = date_i18n( get_option( 'date_format' ), strtotime( $donor->date_created ) ); |
|
239 | + if ( ! empty($columns['date_first_donated'])) { |
|
240 | + $data[$i]['date_first_donated'] = date_i18n(get_option('date_format'), strtotime($donor->date_created)); |
|
241 | 241 | } |
242 | - if ( ! empty( $columns['donations'] ) ) { |
|
243 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
242 | + if ( ! empty($columns['donations'])) { |
|
243 | + $data[$i]['donations'] = $donor->purchase_count; |
|
244 | 244 | } |
245 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
246 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
245 | + if ( ! empty($columns['donation_sum'])) { |
|
246 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
247 | 247 | } |
248 | 248 | |
249 | - return $data[ $i ]; |
|
249 | + return $data[$i]; |
|
250 | 250 | |
251 | 251 | } |
252 | 252 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => esc_html( 'ID', 'give' ), // unaltered payment ID (use for querying) |
|
43 | - 'seq_id' => esc_html( 'Payment Number', 'give' ), // sequential payment ID |
|
44 | - 'email' => esc_html( 'Email', 'give' ), |
|
45 | - 'first' => esc_html( 'First Name', 'give' ), |
|
46 | - 'last' => esc_html( 'Last Name', 'give' ), |
|
47 | - 'address1' => esc_html( 'Address', 'give' ), |
|
48 | - 'address2' => esc_html( 'Address (Line 2)', 'give' ), |
|
49 | - 'city' => esc_html( 'City', 'give' ), |
|
50 | - 'state' => esc_html( 'State', 'give' ), |
|
51 | - 'country' => esc_html( 'Country', 'give' ), |
|
52 | - 'zip' => esc_html( 'Zip / Postal Code', 'give' ), |
|
53 | - 'products' => esc_html( 'Products', 'give' ), |
|
54 | - 'amount' => esc_html( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
55 | - 'gateway' => esc_html( 'Payment Method', 'give' ), |
|
56 | - 'trans_id' => esc_html( 'Transaction ID', 'give' ), |
|
57 | - 'key' => esc_html( 'Purchase Key', 'give' ), |
|
58 | - 'date' => esc_html( 'Date', 'give' ), |
|
59 | - 'user' => esc_html( 'User', 'give' ), |
|
60 | - 'status' => esc_html( 'Status', 'give' ) |
|
42 | + 'id' => esc_html('ID', 'give'), // unaltered payment ID (use for querying) |
|
43 | + 'seq_id' => esc_html('Payment Number', 'give'), // sequential payment ID |
|
44 | + 'email' => esc_html('Email', 'give'), |
|
45 | + 'first' => esc_html('First Name', 'give'), |
|
46 | + 'last' => esc_html('Last Name', 'give'), |
|
47 | + 'address1' => esc_html('Address', 'give'), |
|
48 | + 'address2' => esc_html('Address (Line 2)', 'give'), |
|
49 | + 'city' => esc_html('City', 'give'), |
|
50 | + 'state' => esc_html('State', 'give'), |
|
51 | + 'country' => esc_html('Country', 'give'), |
|
52 | + 'zip' => esc_html('Zip / Postal Code', 'give'), |
|
53 | + 'products' => esc_html('Products', 'give'), |
|
54 | + 'amount' => esc_html('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
55 | + 'gateway' => esc_html('Payment Method', 'give'), |
|
56 | + 'trans_id' => esc_html('Transaction ID', 'give'), |
|
57 | + 'key' => esc_html('Purchase Key', 'give'), |
|
58 | + 'date' => esc_html('Date', 'give'), |
|
59 | + 'user' => esc_html('User', 'give'), |
|
60 | + 'status' => esc_html('Status', 'give') |
|
61 | 61 | ); |
62 | 62 | |
63 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
64 | - unset( $cols['seq_id'] ); |
|
63 | + if ( ! give_get_option('enable_sequential')) { |
|
64 | + unset($cols['seq_id']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -101,104 +101,104 @@ discard block |
||
101 | 101 | |
102 | 102 | //echo json_encode($args ); exit; |
103 | 103 | |
104 | - $payments = give_get_payments( $args ); |
|
104 | + $payments = give_get_payments($args); |
|
105 | 105 | |
106 | - if ( $payments ) { |
|
106 | + if ($payments) { |
|
107 | 107 | |
108 | - foreach ( $payments as $payment ) { |
|
109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
111 | - $total = give_get_payment_amount( $payment->ID ); |
|
112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
108 | + foreach ($payments as $payment) { |
|
109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
111 | + $total = give_get_payment_amount($payment->ID); |
|
112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
113 | 113 | $products = ''; |
114 | 114 | $skus = ''; |
115 | 115 | |
116 | - if ( $downloads ) { |
|
117 | - foreach ( $downloads as $key => $download ) { |
|
116 | + if ($downloads) { |
|
117 | + foreach ($downloads as $key => $download) { |
|
118 | 118 | |
119 | 119 | // Form ID |
120 | - $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; |
|
121 | - $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; |
|
120 | + $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; |
|
121 | + $qty = isset($download['quantity']) ? $download['quantity'] : 1; |
|
122 | 122 | |
123 | - if ( isset( $download['price'] ) ) { |
|
123 | + if (isset($download['price'])) { |
|
124 | 124 | $price = $download['price']; |
125 | 125 | } else { |
126 | 126 | // If the download has variable prices, override the default price |
127 | - $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; |
|
128 | - $price = give_get_download_final_price( $id, $user_info, $price_override ); |
|
127 | + $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; |
|
128 | + $price = give_get_download_final_price($id, $user_info, $price_override); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | // Display the Downoad Name |
133 | - $products .= html_entity_decode( get_the_title( $id ) ); |
|
133 | + $products .= html_entity_decode(get_the_title($id)); |
|
134 | 134 | |
135 | - if ( $qty > 1 ) { |
|
136 | - $products .= html_entity_decode( ' (' . $qty . ')' ); |
|
135 | + if ($qty > 1) { |
|
136 | + $products .= html_entity_decode(' ('.$qty.')'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $products .= ' - '; |
140 | 140 | |
141 | - if ( give_use_skus() ) { |
|
142 | - $sku = give_get_download_sku( $id ); |
|
141 | + if (give_use_skus()) { |
|
142 | + $sku = give_get_download_sku($id); |
|
143 | 143 | |
144 | - if ( ! empty( $sku ) ) { |
|
144 | + if ( ! empty($sku)) { |
|
145 | 145 | $skus .= $sku; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { |
|
150 | - $price_options = $downloads[ $key ]['item_number']['options']; |
|
149 | + if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { |
|
150 | + $price_options = $downloads[$key]['item_number']['options']; |
|
151 | 151 | |
152 | - if ( isset( $price_options['price_id'] ) ) { |
|
153 | - $products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; |
|
152 | + if (isset($price_options['price_id'])) { |
|
153 | + $products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - '; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - $products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) ); |
|
157 | + $products .= html_entity_decode(give_currency_filter(give_format_amount($price))); |
|
158 | 158 | |
159 | - if ( $key != ( count( $downloads ) - 1 ) ) { |
|
159 | + if ($key != (count($downloads) - 1)) { |
|
160 | 160 | $products .= ' / '; |
161 | 161 | |
162 | - if ( give_use_skus() ) { |
|
162 | + if (give_use_skus()) { |
|
163 | 163 | $skus .= ' / '; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( is_numeric( $user_id ) ) { |
|
170 | - $user = get_userdata( $user_id ); |
|
169 | + if (is_numeric($user_id)) { |
|
170 | + $user = get_userdata($user_id); |
|
171 | 171 | } else { |
172 | 172 | $user = false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $data[] = array( |
176 | 176 | 'id' => $payment->ID, |
177 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
177 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
178 | 178 | 'email' => $payment_meta['email'], |
179 | 179 | 'first' => $user_info['first_name'], |
180 | 180 | 'last' => $user_info['last_name'], |
181 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
182 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
183 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
184 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
185 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
186 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
181 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
182 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
183 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
184 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
185 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
186 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
187 | 187 | 'products' => $products, |
188 | 188 | 'skus' => $skus, |
189 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
190 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
191 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
189 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
190 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
191 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
192 | 192 | 'key' => $payment_meta['key'], |
193 | 193 | 'date' => $payment->post_date, |
194 | - 'user' => $user ? $user->display_name : esc_html( 'guest', 'give' ), |
|
195 | - 'status' => give_get_payment_status( $payment, true ) |
|
194 | + 'user' => $user ? $user->display_name : esc_html('guest', 'give'), |
|
195 | + 'status' => give_get_payment_status($payment, true) |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
201 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
200 | + $data = apply_filters('give_export_get_data', $data); |
|
201 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
202 | 202 | |
203 | 203 | return $data; |
204 | 204 | |
@@ -218,27 +218,27 @@ discard block |
||
218 | 218 | |
219 | 219 | $status = $this->status; |
220 | 220 | $args = array( |
221 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
222 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
221 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
222 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
223 | 223 | ); |
224 | 224 | |
225 | - if ( 'any' == $status ) { |
|
225 | + if ('any' == $status) { |
|
226 | 226 | |
227 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
227 | + $total = array_sum((array) give_count_payments($args)); |
|
228 | 228 | |
229 | 229 | } else { |
230 | 230 | |
231 | - $total = give_count_payments( $args )->$status; |
|
231 | + $total = give_count_payments($args)->$status; |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
235 | 235 | $percentage = 100; |
236 | 236 | |
237 | - if ( $total > 0 ) { |
|
238 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
237 | + if ($total > 0) { |
|
238 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $percentage > 100 ) { |
|
241 | + if ($percentage > 100) { |
|
242 | 242 | $percentage = 100; |
243 | 243 | } |
244 | 244 | |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $request The Form Data passed into the batch processing |
254 | 254 | */ |
255 | - public function set_properties( $request ) { |
|
256 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
257 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
258 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
255 | + public function set_properties($request) { |
|
256 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
257 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
258 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
259 | 259 | } |
260 | 260 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html( 'Nonce verification failed.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html('Nonce verification failed.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Donors_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_register_batch_exporters() { |
85 | - if ( is_admin() ) { |
|
86 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + if (is_admin()) { |
|
86 | + do_action('give_register_batch_exporter'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
90 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Register the payments batch exporter |
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @since 1.5.2 |
122 | 122 | */ |
123 | 123 | function give_register_customers_batch_export() { |
124 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
124 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
127 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Loads the customers batch process if needed |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_include_customers_batch_processor( $class ) { |
|
138 | +function give_include_customers_batch_processor($class) { |
|
139 | 139 | |
140 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
141 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
140 | + if ('Give_Batch_Customers_Export' === $class) { |
|
141 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | * @since 1.5 |
150 | 150 | */ |
151 | 151 | function give_register_forms_batch_export() { |
152 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
152 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
153 | 153 | } |
154 | 154 | |
155 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
155 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Loads the file downloads batch process if needed |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return void |
165 | 165 | */ |
166 | -function give_include_forms_batch_processor( $class ) { |
|
166 | +function give_include_forms_batch_processor($class) { |
|
167 | 167 | |
168 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
169 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
168 | + if ('Give_Batch_Forms_Export' === $class) { |
|
169 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | \ No newline at end of file |