@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param $args |
67 | 67 | */ |
68 | - public function __construct( $args ) { |
|
68 | + public function __construct($args) { |
|
69 | 69 | |
70 | 70 | // Only for admins. |
71 | - if ( ! is_admin() ) { |
|
71 | + if ( ! is_admin()) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | 75 | // This plugin is en_US native. |
76 | 76 | $this->locale = get_locale(); |
77 | - if ( 'en_US' === $this->locale ) { |
|
77 | + if ('en_US' === $this->locale) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $this->init( $args ); |
|
81 | + $this->init($args); |
|
82 | 82 | |
83 | - if ( ! $this->hide_promo() ) { |
|
84 | - add_action( $this->hook, array( $this, 'promo' ) ); |
|
83 | + if ( ! $this->hide_promo()) { |
|
84 | + add_action($this->hook, array($this, 'promo')); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param array $args |
94 | 94 | */ |
95 | - private function init( $args ) { |
|
96 | - foreach ( $args as $key => $arg ) { |
|
95 | + private function init($args) { |
|
96 | + foreach ($args as $key => $arg) { |
|
97 | 97 | $this->$key = $arg; |
98 | 98 | } |
99 | 99 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | * @return bool |
108 | 108 | */ |
109 | 109 | private function hide_promo() { |
110 | - $hide_promo = Give_Cache::get( 'give_i18n_give_promo_hide', true ); |
|
111 | - if ( ! $hide_promo ) { |
|
112 | - if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) { |
|
110 | + $hide_promo = Give_Cache::get('give_i18n_give_promo_hide', true); |
|
111 | + if ( ! $hide_promo) { |
|
112 | + if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) { |
|
113 | 113 | // No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc. |
114 | - Give_Cache::set( 'give_i18n_give_promo_hide', true, null, true ); |
|
114 | + Give_Cache::set('give_i18n_give_promo_hide', true, null, true); |
|
115 | 115 | $hide_promo = true; |
116 | 116 | } |
117 | 117 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | $message = false; |
131 | 131 | |
132 | 132 | // Using a translation less than 90% complete. |
133 | - if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) { |
|
134 | - $message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' ); |
|
135 | - } elseif ( ! $this->translation_loaded && $this->translation_exists ) { |
|
136 | - $message = __( 'You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' ); |
|
137 | - } elseif ( ! $this->translation_exists ) { |
|
138 | - $message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' ); |
|
133 | + if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) { |
|
134 | + $message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give'); |
|
135 | + } elseif ( ! $this->translation_loaded && $this->translation_exists) { |
|
136 | + $message = __('You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give'); |
|
137 | + } elseif ( ! $this->translation_exists) { |
|
138 | + $message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // Links. |
142 | - $registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) ); |
|
143 | - $translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) ); |
|
142 | + $registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give')); |
|
143 | + $translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give')); |
|
144 | 144 | |
145 | 145 | // Message. |
146 | - $message = sprintf( $message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link ); |
|
146 | + $message = sprintf($message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link); |
|
147 | 147 | |
148 | 148 | return $message; |
149 | 149 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $this->translation_details(); |
158 | 158 | $message = $this->promo_message(); |
159 | 159 | |
160 | - if ( $message ) { ?> |
|
160 | + if ($message) { ?> |
|
161 | 161 | |
162 | 162 | <style> |
163 | 163 | /* Banner specific styles */ |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | <a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a> |
221 | 221 | |
222 | 222 | <div class="give-i18n-notice-content"> |
223 | - <a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
223 | + <a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
224 | 224 | |
225 | - <h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2> |
|
225 | + <h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2> |
|
226 | 226 | <p><?php echo $message; ?></p> |
227 | 227 | <p> |
228 | - <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now »', 'give' ); ?></a> |
|
228 | + <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now »', 'give'); ?></a> |
|
229 | 229 | </p> |
230 | 230 | </div> |
231 | 231 | </div> |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | */ |
243 | 243 | private function find_or_initialize_translation_details() { |
244 | 244 | |
245 | - $set = Give_Cache::get( "give_i18n_give_{$this->locale}", true ); |
|
245 | + $set = Give_Cache::get("give_i18n_give_{$this->locale}", true); |
|
246 | 246 | |
247 | - if ( ! $set ) { |
|
247 | + if ( ! $set) { |
|
248 | 248 | $set = $this->retrieve_translation_details(); |
249 | - Give_Cache::set( "give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true ); |
|
249 | + Give_Cache::set("give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $set; |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | private function translation_details() { |
261 | 261 | $set = $this->find_or_initialize_translation_details(); |
262 | 262 | |
263 | - $this->translation_exists = ! is_null( $set ); |
|
264 | - $this->translation_loaded = is_textdomain_loaded( 'give' ); |
|
263 | + $this->translation_exists = ! is_null($set); |
|
264 | + $this->translation_loaded = is_textdomain_loaded('give'); |
|
265 | 265 | |
266 | - $this->parse_translation_set( $set ); |
|
266 | + $this->parse_translation_set($set); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -275,26 +275,26 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function retrieve_translation_details() { |
277 | 277 | |
278 | - $api_url = trailingslashit( $this->glotpress_url ); |
|
278 | + $api_url = trailingslashit($this->glotpress_url); |
|
279 | 279 | |
280 | - $resp = wp_remote_get( $api_url ); |
|
280 | + $resp = wp_remote_get($api_url); |
|
281 | 281 | |
282 | - if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) { |
|
282 | + if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') { |
|
283 | 283 | return null; |
284 | 284 | } |
285 | 285 | |
286 | - $body = wp_remote_retrieve_body( $resp ); |
|
287 | - unset( $resp ); |
|
286 | + $body = wp_remote_retrieve_body($resp); |
|
287 | + unset($resp); |
|
288 | 288 | |
289 | - if ( $body ) { |
|
290 | - $body = json_decode( $body ); |
|
289 | + if ($body) { |
|
290 | + $body = json_decode($body); |
|
291 | 291 | |
292 | - foreach ( $body->translation_sets as $set ) { |
|
293 | - if ( ! property_exists( $set, 'wp_locale' ) ) { |
|
292 | + foreach ($body->translation_sets as $set) { |
|
293 | + if ( ! property_exists($set, 'wp_locale')) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | - if ( $this->locale == $set->wp_locale ) { |
|
297 | + if ($this->locale == $set->wp_locale) { |
|
298 | 298 | return $set; |
299 | 299 | } |
300 | 300 | } |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @access private |
312 | 312 | */ |
313 | - private function parse_translation_set( $set ) { |
|
314 | - if ( $this->translation_exists && is_object( $set ) ) { |
|
313 | + private function parse_translation_set($set) { |
|
314 | + if ($this->translation_exists && is_object($set)) { |
|
315 | 315 | $this->locale_name = $set->name; |
316 | 316 | $this->percent_translated = $set->percent_translated; |
317 | 317 | } else { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | public function get_data() { |
56 | 56 | global $wpdb; |
57 | 57 | |
58 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
58 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
59 | 59 | |
60 | - if ( ! is_array( $items ) ) { |
|
60 | + if ( ! is_array($items)) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
64 | + $offset = ($this->step - 1) * $this->per_step; |
|
65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
66 | 66 | |
67 | - if ( $step_items ) { |
|
67 | + if ($step_items) { |
|
68 | 68 | |
69 | 69 | $step_ids = array( |
70 | 70 | 'other' => array(), |
71 | 71 | ); |
72 | 72 | |
73 | - foreach ( $step_items as $item ) { |
|
73 | + foreach ($step_items as $item) { |
|
74 | 74 | |
75 | 75 | $step_ids['other'][] = $item['id']; |
76 | 76 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | |
79 | 79 | $sql = array(); |
80 | 80 | |
81 | - foreach ( $step_ids as $type => $ids ) { |
|
81 | + foreach ($step_ids as $type => $ids) { |
|
82 | 82 | |
83 | - if ( empty( $ids ) ) { |
|
83 | + if (empty($ids)) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
87 | - $ids = implode( ',', $ids ); |
|
87 | + $ids = implode(',', $ids); |
|
88 | 88 | |
89 | - switch ( $type ) { |
|
89 | + switch ($type) { |
|
90 | 90 | case 'other': |
91 | 91 | $sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)"; |
92 | 92 | $sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)"; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - if ( ! empty( $sql ) ) { |
|
101 | - foreach ( $sql as $query ) { |
|
102 | - $wpdb->query( $query ); |
|
100 | + if ( ! empty($sql)) { |
|
101 | + foreach ($sql as $query) { |
|
102 | + $wpdb->query($query); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function get_percentage_complete() { |
121 | 121 | |
122 | - $items = $this->get_stored_data( 'give_temp_reset_ids', false ); |
|
123 | - $total = count( $items ); |
|
122 | + $items = $this->get_stored_data('give_temp_reset_ids', false); |
|
123 | + $total = count($items); |
|
124 | 124 | |
125 | 125 | $percentage = 100; |
126 | 126 | |
127 | - if ( $total > 0 ) { |
|
128 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
127 | + if ($total > 0) { |
|
128 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
129 | 129 | } |
130 | 130 | |
131 | - if ( $percentage > 100 ) { |
|
131 | + if ($percentage > 100) { |
|
132 | 132 | $percentage = 100; |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param array $request The Form Data passed into the batch processing |
144 | 144 | */ |
145 | - public function set_properties( $request ) { |
|
145 | + public function set_properties($request) { |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,29 +153,29 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function process_step() { |
155 | 155 | |
156 | - if ( ! $this->can_export() ) { |
|
157 | - wp_die( esc_html__( 'You do not have permission to delete test transactions.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
156 | + if ( ! $this->can_export()) { |
|
157 | + wp_die(esc_html__('You do not have permission to delete test transactions.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $had_data = $this->get_data(); |
161 | 161 | |
162 | - if ( $had_data ) { |
|
162 | + if ($had_data) { |
|
163 | 163 | $this->done = false; |
164 | 164 | |
165 | 165 | return true; |
166 | 166 | } else { |
167 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
168 | - Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) ); |
|
167 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
168 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
169 | 169 | |
170 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
170 | + $this->delete_data('give_temp_reset_ids'); |
|
171 | 171 | |
172 | 172 | // Reset the sequential order numbers |
173 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
174 | - delete_option( 'give_last_payment_number' ); |
|
173 | + if (give_get_option('enable_sequential')) { |
|
174 | + delete_option('give_last_payment_number'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $this->done = true; |
178 | - $this->message = esc_html__( 'Test transactions successfully deleted.', 'give' ); |
|
178 | + $this->message = esc_html__('Test transactions successfully deleted.', 'give'); |
|
179 | 179 | |
180 | 180 | return false; |
181 | 181 | } |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | * Headers |
186 | 186 | */ |
187 | 187 | public function headers() { |
188 | - ignore_user_abort( true ); |
|
188 | + ignore_user_abort(true); |
|
189 | 189 | |
190 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
191 | - set_time_limit( 0 ); |
|
190 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
191 | + set_time_limit(0); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -212,26 +212,26 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function pre_fetch() { |
214 | 214 | |
215 | - if ( $this->step == 1 ) { |
|
216 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
215 | + if ($this->step == 1) { |
|
216 | + $this->delete_data('give_temp_reset_ids'); |
|
217 | 217 | } |
218 | 218 | |
219 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
219 | + $items = get_option('give_temp_reset_ids', false); |
|
220 | 220 | |
221 | - if ( false === $items ) { |
|
221 | + if (false === $items) { |
|
222 | 222 | $items = array(); |
223 | 223 | |
224 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
224 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
225 | 225 | 'post_type' => 'give_payment', |
226 | 226 | 'post_status' => 'any', |
227 | - 'posts_per_page' => - 1, |
|
227 | + 'posts_per_page' => -1, |
|
228 | 228 | //ONLY TEST MODE TRANSACTIONS!!! |
229 | 229 | 'meta_key' => '_give_payment_mode', |
230 | 230 | 'meta_value' => 'test' |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | |
233 | - $posts = get_posts( $args ); |
|
234 | - foreach ( $posts as $post ) { |
|
233 | + $posts = get_posts($args); |
|
234 | + foreach ($posts as $post) { |
|
235 | 235 | $items[] = array( |
236 | 236 | 'id' => (int) $post->ID, |
237 | 237 | 'type' => $post->post_type, |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | |
241 | 241 | // Allow filtering of items to remove with an unassociative array for each item. |
242 | 242 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
243 | - $items = apply_filters( 'give_reset_items', $items ); |
|
243 | + $items = apply_filters('give_reset_items', $items); |
|
244 | 244 | |
245 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
245 | + $this->store_data('give_temp_reset_ids', $items); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return mixed Returns the data from the database |
258 | 258 | */ |
259 | - private function get_stored_data( $key ) { |
|
259 | + private function get_stored_data($key) { |
|
260 | 260 | global $wpdb; |
261 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
261 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
262 | 262 | |
263 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
263 | + return empty($value) ? false : maybe_unserialize($value); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - private function store_data( $key, $value ) { |
|
276 | + private function store_data($key, $value) { |
|
277 | 277 | global $wpdb; |
278 | 278 | |
279 | - $value = maybe_serialize( $value ); |
|
279 | + $value = maybe_serialize($value); |
|
280 | 280 | |
281 | 281 | $data = array( |
282 | 282 | 'option_name' => $key, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | '%s', |
291 | 291 | ); |
292 | 292 | |
293 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
293 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return void |
304 | 304 | */ |
305 | - private function delete_data( $key ) { |
|
305 | + private function delete_data($key) { |
|
306 | 306 | global $wpdb; |
307 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
307 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | public function get_data() { |
59 | 59 | global $wpdb; |
60 | 60 | |
61 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
61 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
62 | 62 | |
63 | - if ( ! is_array( $items ) ) { |
|
63 | + if ( ! is_array($items)) { |
|
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
67 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
68 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
67 | + $offset = ($this->step - 1) * $this->per_step; |
|
68 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
69 | 69 | |
70 | - if ( $step_items ) { |
|
70 | + if ($step_items) { |
|
71 | 71 | |
72 | 72 | $step_ids = array( |
73 | 73 | 'customers' => array(), |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | 'other' => array(), |
76 | 76 | ); |
77 | 77 | |
78 | - foreach ( $step_items as $item ) { |
|
78 | + foreach ($step_items as $item) { |
|
79 | 79 | |
80 | - switch ( $item['type'] ) { |
|
80 | + switch ($item['type']) { |
|
81 | 81 | case 'customer': |
82 | 82 | $step_ids['customers'][] = $item['id']; |
83 | 83 | break; |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | $step_ids['give_forms'][] = $item['id']; |
86 | 86 | break; |
87 | 87 | default: |
88 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
89 | - $step_ids[ $item_type ][] = $item['id']; |
|
88 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
89 | + $step_ids[$item_type][] = $item['id']; |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | $sql = array(); |
95 | 95 | |
96 | - foreach ( $step_ids as $type => $ids ) { |
|
96 | + foreach ($step_ids as $type => $ids) { |
|
97 | 97 | |
98 | - if ( empty( $ids ) ) { |
|
98 | + if (empty($ids)) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | - $ids = implode( ',', $ids ); |
|
102 | + $ids = implode(',', $ids); |
|
103 | 103 | |
104 | - switch ( $type ) { |
|
104 | + switch ($type) { |
|
105 | 105 | case 'customers': |
106 | - $table_name = $wpdb->prefix . 'give_customers'; |
|
106 | + $table_name = $wpdb->prefix.'give_customers'; |
|
107 | 107 | $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; |
108 | 108 | break; |
109 | 109 | case 'forms': |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | break; |
119 | 119 | } |
120 | 120 | |
121 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
121 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
122 | 122 | // Allows other types of custom post types to filter on their own post_type |
123 | 123 | // and add items to the query list, for the IDs found in their post type. |
124 | - $sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids ); |
|
124 | + $sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - if ( ! empty( $sql ) ) { |
|
129 | - foreach ( $sql as $query ) { |
|
130 | - $wpdb->query( $query ); |
|
128 | + if ( ! empty($sql)) { |
|
129 | + foreach ($sql as $query) { |
|
130 | + $wpdb->query($query); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function get_percentage_complete() { |
149 | 149 | |
150 | - $items = $this->get_stored_data( 'give_temp_reset_ids', false ); |
|
151 | - $total = count( $items ); |
|
150 | + $items = $this->get_stored_data('give_temp_reset_ids', false); |
|
151 | + $total = count($items); |
|
152 | 152 | |
153 | 153 | $percentage = 100; |
154 | 154 | |
155 | - if ( $total > 0 ) { |
|
156 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
155 | + if ($total > 0) { |
|
156 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $percentage > 100 ) { |
|
159 | + if ($percentage > 100) { |
|
160 | 160 | $percentage = 100; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param array $request The Form Data passed into the batch processing |
172 | 172 | */ |
173 | - public function set_properties( $request ) { |
|
173 | + public function set_properties($request) { |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -181,29 +181,29 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function process_step() { |
183 | 183 | |
184 | - if ( ! $this->can_export() ) { |
|
185 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
184 | + if ( ! $this->can_export()) { |
|
185 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $had_data = $this->get_data(); |
189 | 189 | |
190 | - if ( $had_data ) { |
|
190 | + if ($had_data) { |
|
191 | 191 | $this->done = false; |
192 | 192 | |
193 | 193 | return true; |
194 | 194 | } else { |
195 | - update_option( 'give_earnings_total', 0 ); |
|
196 | - Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) ); |
|
195 | + update_option('give_earnings_total', 0); |
|
196 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
197 | 197 | |
198 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
198 | + $this->delete_data('give_temp_reset_ids'); |
|
199 | 199 | |
200 | 200 | // Reset the sequential order numbers |
201 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
202 | - delete_option( 'give_last_payment_number' ); |
|
201 | + if (give_get_option('enable_sequential')) { |
|
202 | + delete_option('give_last_payment_number'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $this->done = true; |
206 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
206 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
207 | 207 | |
208 | 208 | return false; |
209 | 209 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * Headers |
214 | 214 | */ |
215 | 215 | public function headers() { |
216 | - ignore_user_abort( true ); |
|
216 | + ignore_user_abort(true); |
|
217 | 217 | |
218 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
219 | - set_time_limit( 0 ); |
|
218 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
219 | + set_time_limit(0); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -240,35 +240,35 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function pre_fetch() { |
242 | 242 | |
243 | - if ( $this->step == 1 ) { |
|
244 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
243 | + if ($this->step == 1) { |
|
244 | + $this->delete_data('give_temp_reset_ids'); |
|
245 | 245 | } |
246 | 246 | |
247 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
247 | + $items = get_option('give_temp_reset_ids', false); |
|
248 | 248 | |
249 | - if ( false === $items ) { |
|
249 | + if (false === $items) { |
|
250 | 250 | $items = array(); |
251 | 251 | |
252 | - $give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' ); |
|
253 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
252 | + $give_types_for_reset = array('give_forms', 'give_log', 'give_payment'); |
|
253 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
254 | 254 | |
255 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
255 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
256 | 256 | 'post_type' => $give_types_for_reset, |
257 | 257 | 'post_status' => 'any', |
258 | - 'posts_per_page' => - 1, |
|
259 | - ) ); |
|
258 | + 'posts_per_page' => -1, |
|
259 | + )); |
|
260 | 260 | |
261 | - $posts = get_posts( $args ); |
|
262 | - foreach ( $posts as $post ) { |
|
261 | + $posts = get_posts($args); |
|
262 | + foreach ($posts as $post) { |
|
263 | 263 | $items[] = array( |
264 | 264 | 'id' => (int) $post->ID, |
265 | 265 | 'type' => $post->post_type, |
266 | 266 | ); |
267 | 267 | } |
268 | 268 | |
269 | - $customer_args = array( 'number' => - 1 ); |
|
270 | - $customers = Give()->customers->get_customers( $customer_args ); |
|
271 | - foreach ( $customers as $customer ) { |
|
269 | + $customer_args = array('number' => -1); |
|
270 | + $customers = Give()->customers->get_customers($customer_args); |
|
271 | + foreach ($customers as $customer) { |
|
272 | 272 | $items[] = array( |
273 | 273 | 'id' => (int) $customer->id, |
274 | 274 | 'type' => 'customer', |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | |
278 | 278 | // Allow filtering of items to remove with an unassociative array for each item |
279 | 279 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
280 | - $items = apply_filters( 'give_reset_items', $items ); |
|
280 | + $items = apply_filters('give_reset_items', $items); |
|
281 | 281 | |
282 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
282 | + $this->store_data('give_temp_reset_ids', $items); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | } |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return mixed Returns the data from the database. |
295 | 295 | */ |
296 | - private function get_stored_data( $key ) { |
|
296 | + private function get_stored_data($key) { |
|
297 | 297 | global $wpdb; |
298 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
298 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
299 | 299 | |
300 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
300 | + return empty($value) ? false : maybe_unserialize($value); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @return void |
312 | 312 | */ |
313 | - private function store_data( $key, $value ) { |
|
313 | + private function store_data($key, $value) { |
|
314 | 314 | global $wpdb; |
315 | 315 | |
316 | - $value = maybe_serialize( $value ); |
|
316 | + $value = maybe_serialize($value); |
|
317 | 317 | |
318 | 318 | $data = array( |
319 | 319 | 'option_name' => $key, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | '%s', |
328 | 328 | ); |
329 | 329 | |
330 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
330 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - private function delete_data( $key ) { |
|
342 | + private function delete_data($key) { |
|
343 | 343 | global $wpdb; |
344 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
344 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,49 +53,49 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - if ( $this->step == 1 ) { |
|
57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
56 | + if ($this->step == 1) { |
|
57 | + $this->delete_data('give_temp_recount_earnings'); |
|
58 | 58 | } |
59 | 59 | |
60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
60 | + $total = get_option('give_temp_recount_earnings', false); |
|
61 | 61 | |
62 | - if ( false === $total ) { |
|
62 | + if (false === $total) { |
|
63 | 63 | $total = (float) 0; |
64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
65 | 65 | } |
66 | 66 | |
67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
68 | 68 | |
69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
70 | 70 | 'number' => $this->per_step, |
71 | 71 | 'page' => $this->step, |
72 | 72 | 'status' => $accepted_statuses, |
73 | 73 | 'fields' => 'ids' |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $payments = give_get_payments( $args ); |
|
76 | + $payments = give_get_payments($args); |
|
77 | 77 | |
78 | - if ( ! empty( $payments ) ) { |
|
78 | + if ( ! empty($payments)) { |
|
79 | 79 | |
80 | - foreach ( $payments as $payment ) { |
|
80 | + foreach ($payments as $payment) { |
|
81 | 81 | |
82 | - $total += give_get_payment_amount( $payment ); |
|
82 | + $total += give_get_payment_amount($payment); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - if ( $total < 0 ) { |
|
86 | + if ($total < 0) { |
|
87 | 87 | $totals = 0; |
88 | 88 | } |
89 | 89 | |
90 | - $total = round( $total, give_currency_decimal_filter() ); |
|
90 | + $total = round($total, give_currency_decimal_filter()); |
|
91 | 91 | |
92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
93 | 93 | |
94 | 94 | return true; |
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - update_option( 'give_earnings_total', $total ); |
|
98 | + update_option('give_earnings_total', $total); |
|
99 | 99 | |
100 | 100 | return false; |
101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_percentage_complete() { |
111 | 111 | |
112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
113 | 113 | |
114 | - if ( false === $total ) { |
|
115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
114 | + if (false === $total) { |
|
115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
116 | 116 | |
117 | - $counts = give_count_payments( $args ); |
|
118 | - $total = absint( $counts->publish ); |
|
119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
117 | + $counts = give_count_payments($args); |
|
118 | + $total = absint($counts->publish); |
|
119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
120 | 120 | |
121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
121 | + $this->store_data('give_recount_earnings_total', $total); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $percentage = 100; |
125 | 125 | |
126 | - if ( $total > 0 ) { |
|
127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
126 | + if ($total > 0) { |
|
127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $percentage > 100 ) { |
|
130 | + if ($percentage > 100) { |
|
131 | 131 | $percentage = 100; |
132 | 132 | } |
133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param array $request The Form Data passed into the batch processing |
143 | 143 | */ |
144 | - public function set_properties( $request ) { |
|
144 | + public function set_properties($request) { |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -152,31 +152,31 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function process_step() { |
154 | 154 | |
155 | - if ( ! $this->can_export() ) { |
|
156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
155 | + if ( ! $this->can_export()) { |
|
156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $had_data = $this->get_data(); |
160 | 160 | |
161 | - if ( $had_data ) { |
|
161 | + if ($had_data) { |
|
162 | 162 | $this->done = false; |
163 | 163 | |
164 | 164 | return true; |
165 | 165 | } else { |
166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
166 | + $this->delete_data('give_recount_earnings_total'); |
|
167 | + $this->delete_data('give_temp_recount_earnings'); |
|
168 | 168 | $this->done = true; |
169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
170 | 170 | |
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | 175 | public function headers() { |
176 | - ignore_user_abort( true ); |
|
176 | + ignore_user_abort(true); |
|
177 | 177 | |
178 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
179 | - set_time_limit( 0 ); |
|
178 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
179 | + set_time_limit(0); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return mixed Returns the data from the database |
206 | 206 | */ |
207 | - private function get_stored_data( $key ) { |
|
207 | + private function get_stored_data($key) { |
|
208 | 208 | global $wpdb; |
209 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
209 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
210 | 210 | |
211 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
211 | + return empty($value) ? false : maybe_unserialize($value); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | - private function store_data( $key, $value ) { |
|
224 | + private function store_data($key, $value) { |
|
225 | 225 | global $wpdb; |
226 | 226 | |
227 | - $value = maybe_serialize( $value ); |
|
227 | + $value = maybe_serialize($value); |
|
228 | 228 | |
229 | 229 | $data = array( |
230 | 230 | 'option_name' => $key, |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | '%s', |
239 | 239 | ); |
240 | 240 | |
241 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
241 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return void |
252 | 252 | */ |
253 | - private function delete_data( $key ) { |
|
253 | + private function delete_data($key) { |
|
254 | 254 | global $wpdb; |
255 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
255 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | } |
@@ -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 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | - 'ajax' => false,// Does this table support ajax? |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | + 'ajax' => false, // Does this table support ajax? |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
74 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
75 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . $form_title . '</a>'; |
|
73 | + $form_title = get_the_title($item[$column_name]); |
|
74 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
75 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.$form_title.'</a>'; |
|
76 | 76 | |
77 | 77 | case 'user_id' : |
78 | - return '<a href="' . |
|
79 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
80 | - '">' . $item['user_name'] . '</a>'; |
|
78 | + return '<a href="'. |
|
79 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
80 | + '">'.$item['user_name'].'</a>'; |
|
81 | 81 | |
82 | 82 | case 'amount' : |
83 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
83 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
84 | 84 | |
85 | 85 | case 'status' : |
86 | 86 | |
87 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
87 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
88 | 88 | |
89 | - if ( $payment->mode == 'test' ) { |
|
90 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
89 | + if ($payment->mode == 'test') { |
|
90 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $value; |
94 | 94 | |
95 | 95 | case 'payment_id' : |
96 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
96 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
97 | 97 | |
98 | 98 | default: |
99 | - return $item[ $column_name ]; |
|
99 | + return $item[$column_name]; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_columns() { |
111 | 111 | $columns = array( |
112 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
113 | - 'user_id' => esc_html__( 'Donor', 'give' ), |
|
114 | - 'form' => esc_html__( 'Form', 'give' ), |
|
115 | - 'amount' => esc_html__( 'Donation Amount', 'give' ), |
|
116 | - 'status' => esc_html__( 'Status', 'give' ), |
|
117 | - 'payment_id' => esc_html__( 'Transaction ID', 'give' ), |
|
118 | - 'date' => esc_html__( 'Date', 'give' ), |
|
112 | + 'ID' => esc_html__('Log ID', 'give'), |
|
113 | + 'user_id' => esc_html__('Donor', 'give'), |
|
114 | + 'form' => esc_html__('Form', 'give'), |
|
115 | + 'amount' => esc_html__('Donation Amount', 'give'), |
|
116 | + 'status' => esc_html__('Status', 'give'), |
|
117 | + 'payment_id' => esc_html__('Transaction ID', 'give'), |
|
118 | + 'date' => esc_html__('Date', 'give'), |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | return $columns; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return int Current page number |
130 | 130 | */ |
131 | 131 | public function get_paged() { |
132 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
132 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return mixed int If User ID, string If Email/Login |
141 | 141 | */ |
142 | 142 | public function get_filtered_user() { |
143 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
143 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Download ID |
152 | 152 | */ |
153 | 153 | public function get_filtered_give_form() { |
154 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
154 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return string|bool string If search is present, false otherwise |
163 | 163 | */ |
164 | 164 | public function get_search() { |
165 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
165 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param string $which |
180 | 180 | */ |
181 | - protected function display_tablenav( $which ) { |
|
181 | + protected function display_tablenav($which) { |
|
182 | 182 | |
183 | - if ( 'top' === $which ) { |
|
184 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
183 | + if ('top' === $which) { |
|
184 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
185 | 185 | } |
186 | 186 | ?> |
187 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
187 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
188 | 188 | |
189 | 189 | <div class="alignleft actions bulkactions"> |
190 | - <?php $this->bulk_actions( $which ); ?> |
|
190 | + <?php $this->bulk_actions($which); ?> |
|
191 | 191 | </div> |
192 | 192 | <?php |
193 | - $this->extra_tablenav( $which ); |
|
194 | - $this->pagination( $which ); |
|
193 | + $this->extra_tablenav($which); |
|
194 | + $this->pagination($which); |
|
195 | 195 | ?> |
196 | 196 | |
197 | 197 | <br class="clear"/> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $meta_query = array(); |
216 | 216 | |
217 | - if ( $user ) { |
|
217 | + if ($user) { |
|
218 | 218 | // Show only logs from a specific user |
219 | 219 | $meta_query[] = array( |
220 | 220 | 'key' => '_give_log_user_id', |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | $search = $this->get_search(); |
226 | - if ( $search ) { |
|
227 | - if ( is_email( $search ) ) { |
|
226 | + if ($search) { |
|
227 | + if (is_email($search)) { |
|
228 | 228 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
229 | 229 | $key = '_give_log_user_info'; |
230 | 230 | $compare = 'LIKE'; |
@@ -233,32 +233,32 @@ discard block |
||
233 | 233 | $key = '_give_log_user_id'; |
234 | 234 | $compare = 'LIKE'; |
235 | 235 | |
236 | - if ( ! is_numeric( $search ) ) { |
|
236 | + if ( ! is_numeric($search)) { |
|
237 | 237 | // Searching for user by username |
238 | - $user = get_user_by( 'login', $search ); |
|
238 | + $user = get_user_by('login', $search); |
|
239 | 239 | |
240 | - if ( $user ) { |
|
240 | + if ($user) { |
|
241 | 241 | // Found one, set meta value to user's ID |
242 | 242 | $search = $user->ID; |
243 | 243 | } else { |
244 | 244 | // No user found so let's do a real search query |
245 | - $users = new WP_User_Query( array( |
|
245 | + $users = new WP_User_Query(array( |
|
246 | 246 | 'search' => $search, |
247 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
247 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
248 | 248 | 'number' => 1, |
249 | 249 | 'fields' => 'ids', |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | |
252 | 252 | $found_user = $users->get_results(); |
253 | 253 | |
254 | - if ( $found_user ) { |
|
254 | + if ($found_user) { |
|
255 | 255 | $search = $found_user[0]; |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - if ( ! $this->file_search ) { |
|
261 | + if ( ! $this->file_search) { |
|
262 | 262 | // Meta query only works for non file name searche |
263 | 263 | $meta_query[] = array( |
264 | 264 | 'key' => $key, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - function bulk_actions( $which = '' ) { |
|
282 | + function bulk_actions($which = '') { |
|
283 | 283 | give_log_views(); |
284 | 284 | } |
285 | 285 | |
@@ -291,24 +291,24 @@ discard block |
||
291 | 291 | * @return void |
292 | 292 | */ |
293 | 293 | public function give_forms_filter() { |
294 | - $give_forms = get_posts( array( |
|
294 | + $give_forms = get_posts(array( |
|
295 | 295 | 'post_type' => 'give_forms', |
296 | 296 | 'post_status' => 'any', |
297 | - 'posts_per_page' => - 1, |
|
297 | + 'posts_per_page' => -1, |
|
298 | 298 | 'orderby' => 'title', |
299 | 299 | 'order' => 'ASC', |
300 | 300 | 'fields' => 'ids', |
301 | 301 | 'update_post_meta_cache' => false, |
302 | 302 | 'update_post_term_cache' => false, |
303 | - ) ); |
|
303 | + )); |
|
304 | 304 | |
305 | - if ( $give_forms ) { |
|
305 | + if ($give_forms) { |
|
306 | 306 | echo '<select name="form" id="give-log-form-filter">'; |
307 | - echo '<option value="0">' . esc_html__( 'All', 'give' ) . '</option>'; |
|
308 | - foreach ( $give_forms as $form ) { |
|
309 | - $form_title = get_the_title( $form ); |
|
310 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form ) : $form_title; |
|
311 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( $form_title ) . '</option>'; |
|
307 | + echo '<option value="0">'.esc_html__('All', 'give').'</option>'; |
|
308 | + foreach ($give_forms as $form) { |
|
309 | + $form_title = get_the_title($form); |
|
310 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $form) : $form_title; |
|
311 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html($form_title).'</option>'; |
|
312 | 312 | } |
313 | 313 | echo '</select>'; |
314 | 314 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | $logs_data = array(); |
330 | 330 | $paged = $this->get_paged(); |
331 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
331 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
332 | 332 | $user = $this->get_filtered_user(); |
333 | 333 | |
334 | 334 | $log_query = array( |
@@ -338,38 +338,38 @@ discard block |
||
338 | 338 | 'meta_query' => $this->get_meta_query(), |
339 | 339 | ); |
340 | 340 | |
341 | - $cache_key = Give_Cache::get_key( 'get_logs', $log_query ); |
|
341 | + $cache_key = Give_Cache::get_key('get_logs', $log_query); |
|
342 | 342 | |
343 | 343 | // Return result from cache if exist. |
344 | - if ( ! ( $logs_data = Give_Cache::get( $cache_key ) ) ) { |
|
345 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
344 | + if ( ! ($logs_data = Give_Cache::get($cache_key))) { |
|
345 | + $logs = $give_logs->get_connected_logs($log_query); |
|
346 | 346 | |
347 | - if ( $logs ) { |
|
348 | - foreach ( $logs as $log ) { |
|
349 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
347 | + if ($logs) { |
|
348 | + foreach ($logs as $log) { |
|
349 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
350 | 350 | |
351 | 351 | // Make sure this payment hasn't been deleted |
352 | - if ( get_post( $payment_id ) ) : |
|
353 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
354 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
355 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
352 | + if (get_post($payment_id)) : |
|
353 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
354 | + $payment_meta = give_get_payment_meta($payment_id); |
|
355 | + $payment_amount = give_get_payment_amount($payment_id); |
|
356 | 356 | |
357 | 357 | $logs_data[] = array( |
358 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
358 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
359 | 359 | 'payment_id' => $payment_id, |
360 | 360 | 'form' => $log->post_parent, |
361 | 361 | 'amount' => $payment_amount, |
362 | 362 | 'user_id' => $user_info['id'], |
363 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
364 | - 'date' => get_post_field( 'post_date', $payment_id ), |
|
363 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
364 | + 'date' => get_post_field('post_date', $payment_id), |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | endif; |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Cache results. |
371 | - if ( ! empty( $logs_data ) ) { |
|
372 | - Give_Cache::set( $cache_key, $logs_data ); |
|
371 | + if ( ! empty($logs_data)) { |
|
372 | + Give_Cache::set($cache_key, $logs_data); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | $columns = $this->get_columns(); |
398 | 398 | $hidden = array(); |
399 | 399 | $sortable = $this->get_sortable_columns(); |
400 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
400 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
401 | 401 | $current_page = $this->get_pagenum(); |
402 | 402 | $this->items = $this->get_logs(); |
403 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
403 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
404 | 404 | |
405 | - $this->set_pagination_args( array( |
|
405 | + $this->set_pagination_args(array( |
|
406 | 406 | 'total_items' => $total_items, |
407 | 407 | 'per_page' => $this->per_page, |
408 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
408 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
409 | 409 | ) |
410 | 410 | ); |
411 | 411 | } |
@@ -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 | } |
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 |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | <div class="inside"> |
192 | 192 | <?php give_reports_graph_controls(); ?> |
193 | 193 | <?php |
194 | - $graph = new Give_Graph( $data ); |
|
195 | - $graph->set( 'x_mode', 'time' ); |
|
196 | - $graph->set( 'multiple_y_axes', true ); |
|
194 | + $graph = new Give_Graph($data); |
|
195 | + $graph->set('x_mode', 'time'); |
|
196 | + $graph->set('multiple_y_axes', true); |
|
197 | 197 | $graph->display(); |
198 | 198 | |
199 | - if ( 'this_month' == $dates['range'] ) { |
|
199 | + if ('this_month' == $dates['range']) { |
|
200 | 200 | $estimated = give_estimated_monthly_stats(); |
201 | 201 | } |
202 | 202 | ?> |
@@ -205,21 +205,21 @@ discard block |
||
205 | 205 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
209 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
208 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
209 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
210 | 210 | </tr> |
211 | 211 | <tr class="alternate"> |
212 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th> |
|
212 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th> |
|
213 | 213 | <td><?php echo $sales_totals; ?></td> |
214 | 214 | </tr> |
215 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
215 | + <?php if ('this_month' == $dates['range']) : ?> |
|
216 | 216 | <tr> |
217 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th> |
|
218 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
217 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th> |
|
218 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
219 | 219 | </tr> |
220 | 220 | <tr class="alternate"> |
221 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th> |
|
222 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
221 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th> |
|
222 | + <td><?php echo floor($estimated['sales']); ?></td> |
|
223 | 223 | </tr> |
224 | 224 | <?php endif; ?> |
225 | 225 | </table> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_reports_graph_additional_stats' ); |
|
235 | + do_action('give_reports_graph_additional_stats'); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | </div> |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @since 1.0 |
252 | 252 | * @return void |
253 | 253 | */ |
254 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
254 | +function give_reports_graph_of_form($form_id = 0) { |
|
255 | 255 | // Retrieve the queried dates |
256 | 256 | $dates = give_get_report_dates(); |
257 | 257 | |
258 | 258 | // Determine graph options |
259 | - switch ( $dates['range'] ) : |
|
259 | + switch ($dates['range']) : |
|
260 | 260 | case 'today' : |
261 | 261 | case 'yesterday' : |
262 | 262 | $day_by_day = true; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $day_by_day = false; |
275 | 275 | break; |
276 | 276 | case 'other' : |
277 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
277 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
278 | 278 | $day_by_day = false; |
279 | 279 | } else { |
280 | 280 | $day_by_day = true; |
@@ -286,75 +286,75 @@ discard block |
||
286 | 286 | endswitch; |
287 | 287 | |
288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
289 | - $sales_totals = 0; // Total sales for time period shown |
|
289 | + $sales_totals = 0; // Total sales for time period shown |
|
290 | 290 | |
291 | 291 | $earnings_data = array(); |
292 | 292 | $sales_data = array(); |
293 | 293 | $stats = new Give_Payment_Stats; |
294 | 294 | |
295 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
295 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
296 | 296 | |
297 | 297 | // Hour by hour |
298 | 298 | $month = $dates['m_start']; |
299 | 299 | $hour = 1; |
300 | 300 | $minute = 0; |
301 | 301 | $second = 0; |
302 | - while ( $hour <= 23 ) : |
|
302 | + while ($hour <= 23) : |
|
303 | 303 | |
304 | - if ( $hour == 23 ) { |
|
304 | + if ($hour == 23) { |
|
305 | 305 | $minute = $second = 59; |
306 | 306 | } |
307 | 307 | |
308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
310 | 310 | |
311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
311 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
312 | 312 | $sales_totals += $sales; |
313 | 313 | |
314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
315 | 315 | $earnings_totals += $earnings; |
316 | 316 | |
317 | - $sales_data[] = array( $date * 1000, $sales ); |
|
318 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
317 | + $sales_data[] = array($date * 1000, $sales); |
|
318 | + $earnings_data[] = array($date * 1000, $earnings); |
|
319 | 319 | |
320 | - $hour ++; |
|
320 | + $hour++; |
|
321 | 321 | endwhile; |
322 | 322 | |
323 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
323 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
324 | 324 | |
325 | 325 | //Day by day |
326 | 326 | $day = $dates['day']; |
327 | 327 | $day_end = $dates['day_end']; |
328 | 328 | $month = $dates['m_start']; |
329 | - while ( $day <= $day_end ) : |
|
329 | + while ($day <= $day_end) : |
|
330 | 330 | |
331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
333 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
334 | 334 | $sales_totals += $sales; |
335 | 335 | |
336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
337 | 337 | $earnings_totals += $earnings; |
338 | 338 | |
339 | - $sales_data[] = array( $date * 1000, $sales ); |
|
340 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
339 | + $sales_data[] = array($date * 1000, $sales); |
|
340 | + $earnings_data[] = array($date * 1000, $earnings); |
|
341 | 341 | |
342 | - $day ++; |
|
342 | + $day++; |
|
343 | 343 | endwhile; |
344 | 344 | |
345 | 345 | } else { |
346 | 346 | |
347 | 347 | $y = $dates['year']; |
348 | 348 | |
349 | - while ( $y <= $dates['year_end'] ) : |
|
349 | + while ($y <= $dates['year_end']) : |
|
350 | 350 | |
351 | 351 | $last_year = false; |
352 | 352 | |
353 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
353 | + if ($dates['year'] == $dates['year_end']) { |
|
354 | 354 | $month_start = $dates['m_start']; |
355 | 355 | $month_end = $dates['m_end']; |
356 | 356 | $last_year = true; |
357 | - } elseif ( $y == $dates['year'] ) { |
|
357 | + } elseif ($y == $dates['year']) { |
|
358 | 358 | $month_start = $dates['m_start']; |
359 | 359 | $month_end = 12; |
360 | 360 | } else { |
@@ -363,76 +363,76 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | $i = $month_start; |
366 | - while ( $i <= $month_end ) : |
|
366 | + while ($i <= $month_end) : |
|
367 | 367 | |
368 | - if ( $day_by_day ) { |
|
368 | + if ($day_by_day) { |
|
369 | 369 | |
370 | - if ( $i == $month_end && $last_year ) { |
|
370 | + if ($i == $month_end && $last_year) { |
|
371 | 371 | |
372 | 372 | $num_of_days = $dates['day_end']; |
373 | 373 | |
374 | 374 | } else { |
375 | 375 | |
376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | 380 | $d = $dates['day']; |
381 | - while ( $d <= $num_of_days ) : |
|
381 | + while ($d <= $num_of_days) : |
|
382 | 382 | |
383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
383 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
385 | 385 | |
386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
386 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
387 | 387 | $sales_totals += $sales; |
388 | 388 | |
389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
390 | 390 | $earnings_totals += $earnings; |
391 | 391 | |
392 | - $sales_data[] = array( $date * 1000, $sales ); |
|
393 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
394 | - $d ++; |
|
392 | + $sales_data[] = array($date * 1000, $sales); |
|
393 | + $earnings_data[] = array($date * 1000, $earnings); |
|
394 | + $d++; |
|
395 | 395 | |
396 | 396 | endwhile; |
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
401 | 401 | |
402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
402 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
404 | 404 | |
405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
405 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
406 | 406 | $sales_totals += $sales; |
407 | 407 | |
408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
409 | 409 | $earnings_totals += $earnings; |
410 | 410 | |
411 | - $sales_data[] = array( $date * 1000, $sales ); |
|
412 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
411 | + $sales_data[] = array($date * 1000, $sales); |
|
412 | + $earnings_data[] = array($date * 1000, $earnings); |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | - $i ++; |
|
416 | + $i++; |
|
417 | 417 | |
418 | 418 | endwhile; |
419 | 419 | |
420 | - $y ++; |
|
420 | + $y++; |
|
421 | 421 | endwhile; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | 425 | $data = array( |
426 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
427 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
426 | + esc_html__('Income', 'give') => $earnings_data, |
|
427 | + esc_html__('Donations', 'give') => $sales_data |
|
428 | 428 | ); |
429 | 429 | |
430 | 430 | ?> |
431 | 431 | <h3><span><?php |
432 | 432 | printf( |
433 | 433 | /* translators: %s: form title */ |
434 | - esc_html__( 'Income Report for %s', 'give' ), |
|
435 | - get_the_title( $form_id ) |
|
434 | + esc_html__('Income Report for %s', 'give'), |
|
435 | + get_the_title($form_id) |
|
436 | 436 | ); |
437 | 437 | ?></span></h3> |
438 | 438 | <div id="give-dashboard-widgets-wrap"> |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | <div class="inside"> |
442 | 442 | <?php give_reports_graph_controls(); ?> |
443 | 443 | <?php |
444 | - $graph = new Give_Graph( $data ); |
|
445 | - $graph->set( 'x_mode', 'time' ); |
|
446 | - $graph->set( 'multiple_y_axes', true ); |
|
444 | + $graph = new Give_Graph($data); |
|
445 | + $graph->set('x_mode', 'time'); |
|
446 | + $graph->set('multiple_y_axes', true); |
|
447 | 447 | $graph->display(); |
448 | 448 | ?> |
449 | 449 | </div> |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
453 | 453 | <tbody> |
454 | 454 | <tr> |
455 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
455 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <tr class="alternate"> |
459 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th> |
|
459 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th> |
|
460 | 460 | <td><?php echo $sales_totals; ?></td> |
461 | 461 | </tr> |
462 | 462 | <tr> |
463 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th> |
|
464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
463 | + <th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th> |
|
464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
465 | 465 | </tr> |
466 | 466 | <tr class="alternate"> |
467 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th> |
|
468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
467 | + <th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th> |
|
468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
469 | 469 | </tr> |
470 | 470 | </tbody> |
471 | 471 | </table> |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | * @return void |
485 | 485 | */ |
486 | 486 | function give_reports_graph_controls() { |
487 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
488 | - 'today' => esc_html__( 'Today', 'give' ), |
|
489 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
490 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
491 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
492 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
493 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
494 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
495 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
496 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
497 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
498 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
499 | - ) ); |
|
487 | + $date_options = apply_filters('give_report_date_options', array( |
|
488 | + 'today' => esc_html__('Today', 'give'), |
|
489 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
490 | + 'this_week' => esc_html__('This Week', 'give'), |
|
491 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
492 | + 'this_month' => esc_html__('This Month', 'give'), |
|
493 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
494 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
495 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
496 | + 'this_year' => esc_html__('This Year', 'give'), |
|
497 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
498 | + 'other' => esc_html__('Custom', 'give') |
|
499 | + )); |
|
500 | 500 | |
501 | 501 | $dates = give_get_report_dates(); |
502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; |
503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
504 | 504 | |
505 | - if ( empty( $dates['day_end'] ) ) { |
|
506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
505 | + if (empty($dates['day_end'])) { |
|
506 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @since 1.0 |
513 | 513 | */ |
514 | - do_action( 'give_report_graph_controls_before' ); |
|
514 | + do_action('give_report_graph_controls_before'); |
|
515 | 515 | ?> |
516 | 516 | <form id="give-graphs-filter" method="get"> |
517 | 517 | <div class="tablenav top"> |
@@ -519,56 +519,56 @@ discard block |
||
519 | 519 | |
520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> |
521 | 521 | <input type="hidden" name="page" value="give-reports" /> |
522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> |
|
522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> |
|
523 | 523 | |
524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
524 | + <?php if (isset($_GET['form-id'])) : ?> |
|
525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
526 | 526 | <?php endif; ?> |
527 | 527 | |
528 | 528 | <div id="give-graphs-date-options-wrap"> |
529 | 529 | <select id="give-graphs-date-options" name="range"> |
530 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
530 | + <?php foreach ($date_options as $key => $option) : ?> |
|
531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
532 | 532 | <?php endforeach; ?> |
533 | 533 | </select> |
534 | 534 | |
535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> |
|
536 | - <span class="screen-reader-text"><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> |
|
536 | + <span class="screen-reader-text"><?php esc_html_e('From', 'give'); ?> </span> |
|
537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> |
538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
540 | 540 | <?php endfor; ?> |
541 | 541 | </select> |
542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> |
543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> |
|
545 | 545 | <?php endfor; ?> |
546 | 546 | </select> |
547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> |
548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
548 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> |
|
550 | 550 | <?php endfor; ?> |
551 | 551 | </select> |
552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
552 | + <span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> |
|
553 | 553 | <span>–</span> |
554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> |
555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
557 | 557 | <?php endfor; ?> |
558 | 558 | </select> |
559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> |
560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> |
|
562 | 562 | <?php endfor; ?> |
563 | 563 | </select> |
564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> |
565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
565 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> |
|
567 | 567 | <?php endfor; ?> |
568 | 568 | </select> |
569 | 569 | </div> |
570 | 570 | |
571 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
571 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
572 | 572 | </div> |
573 | 573 | |
574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @since 1.0 |
583 | 583 | */ |
584 | - do_action( 'give_report_graph_controls_after' ); |
|
584 | + do_action('give_report_graph_controls_after'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,65 +596,65 @@ discard block |
||
596 | 596 | function give_get_report_dates() { |
597 | 597 | $dates = array(); |
598 | 598 | |
599 | - $current_time = current_time( 'timestamp' ); |
|
599 | + $current_time = current_time('timestamp'); |
|
600 | 600 | |
601 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
602 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
603 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
604 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
605 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
606 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
607 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
601 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
602 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
603 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
604 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
605 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
606 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
607 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
608 | 608 | |
609 | 609 | // Modify dates based on predefined ranges |
610 | - switch ( $dates['range'] ) : |
|
610 | + switch ($dates['range']) : |
|
611 | 611 | |
612 | 612 | case 'this_month' : |
613 | - $dates['m_start'] = date( 'n', $current_time ); |
|
614 | - $dates['m_end'] = date( 'n', $current_time ); |
|
613 | + $dates['m_start'] = date('n', $current_time); |
|
614 | + $dates['m_end'] = date('n', $current_time); |
|
615 | 615 | $dates['day'] = 1; |
616 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
617 | - $dates['year'] = date( 'Y' ); |
|
618 | - $dates['year_end'] = date( 'Y' ); |
|
616 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
617 | + $dates['year'] = date('Y'); |
|
618 | + $dates['year_end'] = date('Y'); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'last_month' : |
622 | - if ( date( 'n' ) == 1 ) { |
|
622 | + if (date('n') == 1) { |
|
623 | 623 | $dates['m_start'] = 12; |
624 | 624 | $dates['m_end'] = 12; |
625 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
626 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
625 | + $dates['year'] = date('Y', $current_time) - 1; |
|
626 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
627 | 627 | } else { |
628 | - $dates['m_start'] = date( 'n' ) - 1; |
|
629 | - $dates['m_end'] = date( 'n' ) - 1; |
|
628 | + $dates['m_start'] = date('n') - 1; |
|
629 | + $dates['m_end'] = date('n') - 1; |
|
630 | 630 | $dates['year_end'] = $dates['year']; |
631 | 631 | } |
632 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
632 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'today' : |
636 | - $dates['day'] = date( 'd', $current_time ); |
|
637 | - $dates['m_start'] = date( 'n', $current_time ); |
|
638 | - $dates['m_end'] = date( 'n', $current_time ); |
|
639 | - $dates['year'] = date( 'Y', $current_time ); |
|
636 | + $dates['day'] = date('d', $current_time); |
|
637 | + $dates['m_start'] = date('n', $current_time); |
|
638 | + $dates['m_end'] = date('n', $current_time); |
|
639 | + $dates['year'] = date('Y', $current_time); |
|
640 | 640 | break; |
641 | 641 | |
642 | 642 | case 'yesterday' : |
643 | 643 | |
644 | - $year = date( 'Y', $current_time ); |
|
645 | - $month = date( 'n', $current_time ); |
|
646 | - $day = date( 'd', $current_time ); |
|
644 | + $year = date('Y', $current_time); |
|
645 | + $month = date('n', $current_time); |
|
646 | + $day = date('d', $current_time); |
|
647 | 647 | |
648 | - if ( $month == 1 && $day == 1 ) { |
|
648 | + if ($month == 1 && $day == 1) { |
|
649 | 649 | |
650 | 650 | $year -= 1; |
651 | 651 | $month = 12; |
652 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
652 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
653 | 653 | |
654 | - } elseif ( $month > 1 && $day == 1 ) { |
|
654 | + } elseif ($month > 1 && $day == 1) { |
|
655 | 655 | |
656 | 656 | $month -= 1; |
657 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
657 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
658 | 658 | |
659 | 659 | } else { |
660 | 660 | |
@@ -670,91 +670,91 @@ discard block |
||
670 | 670 | break; |
671 | 671 | |
672 | 672 | case 'this_week' : |
673 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
674 | - $dates['day'] += get_option( 'start_of_week' ); |
|
673 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
674 | + $dates['day'] += get_option('start_of_week'); |
|
675 | 675 | $dates['day_end'] = $dates['day'] + 6; |
676 | - $dates['m_start'] = date( 'n', $current_time ); |
|
677 | - $dates['m_end'] = date( 'n', $current_time ); |
|
678 | - $dates['year'] = date( 'Y', $current_time ); |
|
676 | + $dates['m_start'] = date('n', $current_time); |
|
677 | + $dates['m_end'] = date('n', $current_time); |
|
678 | + $dates['year'] = date('Y', $current_time); |
|
679 | 679 | break; |
680 | 680 | |
681 | 681 | case 'last_week' : |
682 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
683 | - $dates['day'] += get_option( 'start_of_week' ); |
|
682 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
683 | + $dates['day'] += get_option('start_of_week'); |
|
684 | 684 | $dates['day_end'] = $dates['day'] + 6; |
685 | - $dates['year'] = date( 'Y' ); |
|
686 | - |
|
687 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
688 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
689 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
690 | - if ( $dates['m_start'] <= 1 ) { |
|
691 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
692 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
685 | + $dates['year'] = date('Y'); |
|
686 | + |
|
687 | + if (date('j', $current_time) <= 7) { |
|
688 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
689 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
690 | + if ($dates['m_start'] <= 1) { |
|
691 | + $dates['year'] = date('Y', $current_time) - 1; |
|
692 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
693 | 693 | } |
694 | 694 | } else { |
695 | - $dates['m_start'] = date( 'n', $current_time ); |
|
696 | - $dates['m_end'] = date( 'n', $current_time ); |
|
695 | + $dates['m_start'] = date('n', $current_time); |
|
696 | + $dates['m_end'] = date('n', $current_time); |
|
697 | 697 | } |
698 | 698 | break; |
699 | 699 | |
700 | 700 | case 'this_quarter' : |
701 | - $month_now = date( 'n', $current_time ); |
|
701 | + $month_now = date('n', $current_time); |
|
702 | 702 | |
703 | - if ( $month_now <= 3 ) { |
|
703 | + if ($month_now <= 3) { |
|
704 | 704 | |
705 | 705 | $dates['m_start'] = 1; |
706 | 706 | $dates['m_end'] = 4; |
707 | - $dates['year'] = date( 'Y', $current_time ); |
|
707 | + $dates['year'] = date('Y', $current_time); |
|
708 | 708 | |
709 | - } else if ( $month_now <= 6 ) { |
|
709 | + } else if ($month_now <= 6) { |
|
710 | 710 | |
711 | 711 | $dates['m_start'] = 4; |
712 | 712 | $dates['m_end'] = 7; |
713 | - $dates['year'] = date( 'Y', $current_time ); |
|
713 | + $dates['year'] = date('Y', $current_time); |
|
714 | 714 | |
715 | - } else if ( $month_now <= 9 ) { |
|
715 | + } else if ($month_now <= 9) { |
|
716 | 716 | |
717 | 717 | $dates['m_start'] = 7; |
718 | 718 | $dates['m_end'] = 10; |
719 | - $dates['year'] = date( 'Y', $current_time ); |
|
719 | + $dates['year'] = date('Y', $current_time); |
|
720 | 720 | |
721 | 721 | } else { |
722 | 722 | |
723 | 723 | $dates['m_start'] = 10; |
724 | 724 | $dates['m_end'] = 1; |
725 | - $dates['year'] = date( 'Y', $current_time ); |
|
726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
725 | + $dates['year'] = date('Y', $current_time); |
|
726 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'last_quarter' : |
732 | - $month_now = date( 'n' ); |
|
732 | + $month_now = date('n'); |
|
733 | 733 | |
734 | - if ( $month_now <= 3 ) { |
|
734 | + if ($month_now <= 3) { |
|
735 | 735 | |
736 | 736 | $dates['m_start'] = 10; |
737 | 737 | $dates['m_end'] = 12; |
738 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
739 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
738 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
739 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
740 | 740 | |
741 | - } else if ( $month_now <= 6 ) { |
|
741 | + } else if ($month_now <= 6) { |
|
742 | 742 | |
743 | 743 | $dates['m_start'] = 1; |
744 | 744 | $dates['m_end'] = 3; |
745 | - $dates['year'] = date( 'Y', $current_time ); |
|
745 | + $dates['year'] = date('Y', $current_time); |
|
746 | 746 | |
747 | - } else if ( $month_now <= 9 ) { |
|
747 | + } else if ($month_now <= 9) { |
|
748 | 748 | |
749 | 749 | $dates['m_start'] = 4; |
750 | 750 | $dates['m_end'] = 6; |
751 | - $dates['year'] = date( 'Y', $current_time ); |
|
751 | + $dates['year'] = date('Y', $current_time); |
|
752 | 752 | |
753 | 753 | } else { |
754 | 754 | |
755 | 755 | $dates['m_start'] = 7; |
756 | 756 | $dates['m_end'] = 9; |
757 | - $dates['year'] = date( 'Y', $current_time ); |
|
757 | + $dates['year'] = date('Y', $current_time); |
|
758 | 758 | |
759 | 759 | } |
760 | 760 | break; |
@@ -762,19 +762,19 @@ discard block |
||
762 | 762 | case 'this_year' : |
763 | 763 | $dates['m_start'] = 1; |
764 | 764 | $dates['m_end'] = 12; |
765 | - $dates['year'] = date( 'Y', $current_time ); |
|
765 | + $dates['year'] = date('Y', $current_time); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | case 'last_year' : |
769 | 769 | $dates['m_start'] = 1; |
770 | 770 | $dates['m_end'] = 12; |
771 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
772 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
771 | + $dates['year'] = date('Y', $current_time) - 1; |
|
772 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
773 | 773 | break; |
774 | 774 | |
775 | 775 | endswitch; |
776 | 776 | |
777 | - return apply_filters( 'give_report_dates', $dates ); |
|
777 | + return apply_filters('give_report_dates', $dates); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @param $data |
787 | 787 | */ |
788 | -function give_parse_report_dates( $data ) { |
|
788 | +function give_parse_report_dates($data) { |
|
789 | 789 | $dates = give_get_report_dates(); |
790 | 790 | |
791 | 791 | $view = give_get_reporting_view(); |
792 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
793 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
792 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
793 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
794 | 794 | |
795 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
795 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
796 | 796 | give_die(); |
797 | 797 | } |
798 | 798 | |
799 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
799 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
800 | 800 | |
801 | 801 | |
802 | 802 | /** |
@@ -808,22 +808,22 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function give_reports_refresh_button() { |
810 | 810 | |
811 | - $url = wp_nonce_url( add_query_arg( array( |
|
811 | + $url = wp_nonce_url(add_query_arg(array( |
|
812 | 812 | 'give_action' => 'refresh_reports_transients', |
813 | 813 | 'give-message' => 'refreshed-reports' |
814 | - ) ), 'give-refresh-reports' ); |
|
814 | + )), 'give-refresh-reports'); |
|
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
817 | + . esc_url_raw($url) |
|
818 | + . '" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give') |
|
819 | 819 | . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
820 | 820 | . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
821 | + . esc_html__('Refresh Report Data', 'give') |
|
822 | 822 | . '</a>'; |
823 | 823 | |
824 | 824 | } |
825 | 825 | |
826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
827 | 827 | |
828 | 828 | /** |
829 | 829 | * Trigger the refresh of reports transients |
@@ -834,20 +834,20 @@ discard block |
||
834 | 834 | * |
835 | 835 | * @return void |
836 | 836 | */ |
837 | -function give_run_refresh_reports_transients( $data ) { |
|
837 | +function give_run_refresh_reports_transients($data) { |
|
838 | 838 | |
839 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
839 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
840 | 840 | return; |
841 | 841 | } |
842 | 842 | |
843 | 843 | // Monthly stats. |
844 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
844 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
845 | 845 | |
846 | 846 | // Total earning. |
847 | - delete_option( 'give_earnings_total' ); |
|
847 | + delete_option('give_earnings_total'); |
|
848 | 848 | |
849 | 849 | // @todo: Refresh only range related stat cache |
850 | 850 | give_delete_donation_stats(); |
851 | 851 | } |
852 | 852 | |
853 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
854 | 853 | \ No newline at end of file |
854 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
855 | 855 | \ 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 | |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param array $request The Form Data passed into the batch processing |
64 | 64 | */ |
65 | - public function set_properties( $request ) { |
|
65 | + public function set_properties($request) { |
|
66 | 66 | |
67 | 67 | // Set data from form submission |
68 | - if ( isset( $_POST['form'] ) ) { |
|
69 | - parse_str( $_POST['form'], $this->data ); |
|
68 | + if (isset($_POST['form'])) { |
|
69 | + parse_str($_POST['form'], $this->data); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->form = $this->data['forms']; |
73 | 73 | |
74 | 74 | // Setup donor ids cache. |
75 | - if( ! empty( $this->form ) ) { |
|
75 | + if ( ! empty($this->form)) { |
|
76 | 76 | // Cache donor ids to output unique list of donor. |
77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
78 | - if( ! ( $this->donor_ids = Give_Cache::get( $this->query_id, true ) ) ) { |
|
77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
78 | + if ( ! ($this->donor_ids = Give_Cache::get($this->query_id, true))) { |
|
79 | 79 | $this->donor_ids = array(); |
80 | - Give_Cache::set( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true ); |
|
80 | + Give_Cache::set($this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
84 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function csv_cols() { |
96 | 96 | |
97 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
97 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
98 | 98 | |
99 | 99 | // We need columns. |
100 | - if ( empty( $columns ) ) { |
|
100 | + if (empty($columns)) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - $cols = $this->get_cols( $columns ); |
|
104 | + $cols = $this->get_cols($columns); |
|
105 | 105 | |
106 | 106 | return $cols; |
107 | 107 | } |
@@ -113,38 +113,38 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - private function get_cols( $columns ) { |
|
116 | + private function get_cols($columns) { |
|
117 | 117 | |
118 | 118 | $cols = array(); |
119 | 119 | |
120 | - foreach ( $columns as $key => $value ) { |
|
120 | + foreach ($columns as $key => $value) { |
|
121 | 121 | |
122 | - switch ( $key ) { |
|
122 | + switch ($key) { |
|
123 | 123 | case 'full_name' : |
124 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
124 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
125 | 125 | break; |
126 | 126 | case 'email' : |
127 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
127 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
128 | 128 | break; |
129 | 129 | case 'address' : |
130 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
131 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
132 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
133 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
134 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
135 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
130 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
131 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
132 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
133 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
134 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
135 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
136 | 136 | break; |
137 | 137 | case 'userid' : |
138 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
138 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
139 | 139 | break; |
140 | 140 | case 'date_first_donated' : |
141 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
141 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
142 | 142 | break; |
143 | 143 | case 'donations' : |
144 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
144 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
145 | 145 | break; |
146 | 146 | case 'donation_sum' : |
147 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
147 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
148 | 148 | break; |
149 | 149 | } |
150 | 150 | } |
@@ -167,20 +167,20 @@ discard block |
||
167 | 167 | |
168 | 168 | $i = 0; |
169 | 169 | |
170 | - if ( ! empty( $this->form ) ) { |
|
170 | + if ( ! empty($this->form)) { |
|
171 | 171 | |
172 | 172 | // Export donors of a specific product |
173 | 173 | global $give_logs; |
174 | 174 | |
175 | 175 | $args = array( |
176 | - 'post_parent' => absint( $this->form ), |
|
176 | + 'post_parent' => absint($this->form), |
|
177 | 177 | 'log_type' => 'sale', |
178 | 178 | 'posts_per_page' => 30, |
179 | 179 | 'paged' => $this->step, |
180 | 180 | ); |
181 | 181 | |
182 | 182 | // Check for price option |
183 | - if ( null !== $this->price_id ) { |
|
183 | + if (null !== $this->price_id) { |
|
184 | 184 | $args['meta_query'] = array( |
185 | 185 | array( |
186 | 186 | 'key' => '_give_log_price_id', |
@@ -189,44 +189,44 @@ discard block |
||
189 | 189 | ); |
190 | 190 | } |
191 | 191 | |
192 | - $logs = $give_logs->get_connected_logs( $args ); |
|
192 | + $logs = $give_logs->get_connected_logs($args); |
|
193 | 193 | |
194 | - if ( $logs ) { |
|
195 | - foreach ( $logs as $log ) { |
|
196 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
197 | - $payment = new Give_Payment( $payment_id ); |
|
194 | + if ($logs) { |
|
195 | + foreach ($logs as $log) { |
|
196 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
197 | + $payment = new Give_Payment($payment_id); |
|
198 | 198 | |
199 | 199 | // Continue if donor already included. |
200 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
200 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $this->donor_ids[] = $payment->customer_id; |
205 | 205 | |
206 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
207 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
208 | - $i ++; |
|
206 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
207 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
208 | + $i++; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Cache donor ids only if admin export donor for specific form. |
212 | - Give_Cache::set( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS, true ); |
|
212 | + Give_Cache::set($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS, true); |
|
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | |
216 | 216 | // Export all donors. |
217 | - $offset = 30 * ( $this->step - 1 ); |
|
218 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
217 | + $offset = 30 * ($this->step - 1); |
|
218 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
219 | 219 | |
220 | - foreach ( $donors as $donor ) { |
|
220 | + foreach ($donors as $donor) { |
|
221 | 221 | |
222 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
223 | - $i ++; |
|
222 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
223 | + $i++; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
229 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
228 | + $data = apply_filters('give_export_get_data', $data); |
|
229 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
230 | 230 | |
231 | 231 | return $data; |
232 | 232 | } |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | $percentage = 0; |
243 | 243 | |
244 | 244 | // We can't count the number when getting them for a specific form |
245 | - if ( empty( $this->form ) ) { |
|
245 | + if (empty($this->form)) { |
|
246 | 246 | |
247 | 247 | $total = Give()->customers->count(); |
248 | 248 | |
249 | - if ( $total > 0 ) { |
|
249 | + if ($total > 0) { |
|
250 | 250 | |
251 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
251 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - if ( $percentage > 100 ) { |
|
256 | + if ($percentage > 100) { |
|
257 | 257 | $percentage = 100; |
258 | 258 | } |
259 | 259 | |
@@ -269,46 +269,46 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | - private function set_donor_data( $i, $data, $donor ) { |
|
272 | + private function set_donor_data($i, $data, $donor) { |
|
273 | 273 | |
274 | 274 | $columns = $this->csv_cols(); |
275 | 275 | |
276 | 276 | // Set address variable |
277 | 277 | $address = ''; |
278 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
279 | - $address = give_get_donor_address( $donor->user_id ); |
|
278 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
279 | + $address = give_get_donor_address($donor->user_id); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // Set columns |
283 | - if ( ! empty( $columns['full_name'] ) ) { |
|
284 | - $data[ $i ]['full_name'] = $donor->name; |
|
283 | + if ( ! empty($columns['full_name'])) { |
|
284 | + $data[$i]['full_name'] = $donor->name; |
|
285 | 285 | } |
286 | - if ( ! empty( $columns['email'] ) ) { |
|
287 | - $data[ $i ]['email'] = $donor->email; |
|
286 | + if ( ! empty($columns['email'])) { |
|
287 | + $data[$i]['email'] = $donor->email; |
|
288 | 288 | } |
289 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
290 | - |
|
291 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
292 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
293 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
294 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
295 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
296 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
289 | + if ( ! empty($columns['address_line1'])) { |
|
290 | + |
|
291 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
292 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
293 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
294 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
295 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
296 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
297 | 297 | } |
298 | - if ( ! empty( $columns['userid'] ) ) { |
|
299 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
298 | + if ( ! empty($columns['userid'])) { |
|
299 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
300 | 300 | } |
301 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
302 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
301 | + if ( ! empty($columns['date_first_donated'])) { |
|
302 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
303 | 303 | } |
304 | - if ( ! empty( $columns['donations'] ) ) { |
|
305 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
304 | + if ( ! empty($columns['donations'])) { |
|
305 | + $data[$i]['donations'] = $donor->purchase_count; |
|
306 | 306 | } |
307 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
308 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
307 | + if ( ! empty($columns['donation_sum'])) { |
|
308 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
309 | 309 | } |
310 | 310 | |
311 | - return $data[ $i ]; |
|
311 | + return $data[$i]; |
|
312 | 312 | |
313 | 313 | } |
314 | 314 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'donors' => esc_html__('Donors', 'give'), |
|
106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - $views = apply_filters( 'give_report_views', $views ); |
|
109 | + $views = apply_filters('give_report_views', $views); |
|
110 | 110 | |
111 | 111 | return $views; |
112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @since 1.0 |
122 | 122 | * @return string $view Report View |
123 | 123 | */ |
124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
124 | +function give_get_reporting_view($default = 'earnings') { |
|
125 | 125 | |
126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
127 | 127 | $view = $default; |
128 | 128 | } else { |
129 | 129 | $view = $_GET['view']; |
130 | 130 | } |
131 | 131 | |
132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
132 | + return apply_filters('give_get_reporting_view', $view); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $current_view = 'earnings'; |
143 | 143 | $views = give_reports_default_views(); |
144 | 144 | |
145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
146 | 146 | $current_view = $_GET['tab']; |
147 | 147 | } |
148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( "give_reports_view_{$current_view}" ); |
|
154 | + do_action("give_reports_view_{$current_view}"); |
|
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function give_report_views() { |
166 | 166 | $views = give_reports_default_views(); |
167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
168 | 168 | /** |
169 | 169 | * Fires before the report page actions form. |
170 | 170 | * |
171 | 171 | * @since 1.0 |
172 | 172 | */ |
173 | - do_action( 'give_report_view_actions_before' ); |
|
173 | + do_action('give_report_view_actions_before'); |
|
174 | 174 | ?> |
175 | 175 | <form id="give-reports-filter" method="get"> |
176 | 176 | <select id="give-reports-view" name="view"> |
177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
180 | 180 | <?php endforeach; ?> |
181 | 181 | </select> |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_report_view_actions' ); |
|
191 | + do_action('give_report_view_actions'); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
197 | 197 | </form> |
198 | 198 | <?php |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @since 1.0 |
203 | 203 | */ |
204 | - do_action( 'give_report_view_actions_after' ); |
|
204 | + do_action('give_report_view_actions_after'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function give_reports_forms_table() { |
216 | 216 | |
217 | - if ( isset( $_GET['form-id'] ) ) { |
|
217 | + if (isset($_GET['form-id'])) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
222 | 222 | |
223 | 223 | $give_table = new Give_Form_Reports_Table(); |
224 | 224 | $give_table->prepare_items(); |
225 | 225 | $give_table->display(); |
226 | 226 | } |
227 | 227 | |
228 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
228 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Renders the detailed report for a specific give form |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | * @return void |
235 | 235 | */ |
236 | 236 | function give_reports_form_details() { |
237 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
237 | + if ( ! isset($_GET['form-id'])) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | <div class="tablenav top reports-forms-details-wrap"> |
242 | 242 | <div class="actions bulkactions"> |
243 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
243 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
244 | 244 | </div> |
245 | 245 | </div> |
246 | 246 | <?php |
247 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
247 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
248 | 248 | } |
249 | 249 | |
250 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
250 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Renders the Reports Donors Table |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @return void |
259 | 259 | */ |
260 | 260 | function give_reports_donors_table() { |
261 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
261 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
262 | 262 | |
263 | 263 | $give_table = new Give_Donor_Reports_Table(); |
264 | 264 | $give_table->prepare_items(); |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @since 1.0 |
272 | 272 | */ |
273 | - do_action( 'give_logs_donors_table_top' ); |
|
273 | + do_action('give_logs_donors_table_top'); |
|
274 | 274 | ?> |
275 | 275 | <form id="give-donors-filter" method="get"> |
276 | 276 | <?php |
277 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
277 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
278 | 278 | $give_table->display(); |
279 | 279 | ?> |
280 | 280 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @since 1.0 |
289 | 289 | */ |
290 | - do_action( 'give_logs_donors_table_bottom' ); |
|
290 | + do_action('give_logs_donors_table_bottom'); |
|
291 | 291 | ?> |
292 | 292 | </div> |
293 | 293 | <?php |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
296 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | /** |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | * @return void |
306 | 306 | */ |
307 | 307 | function give_reports_gateways_table() { |
308 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
308 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
309 | 309 | |
310 | 310 | $give_table = new Give_Gateawy_Reports_Table(); |
311 | 311 | $give_table->prepare_items(); |
312 | 312 | $give_table->display(); |
313 | 313 | } |
314 | 314 | |
315 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
315 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
316 | 316 | |
317 | 317 | |
318 | 318 | /** |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | function give_reports_earnings() { |
325 | 325 | ?> |
326 | 326 | <div class="tablenav top reports-table-nav"> |
327 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
327 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
328 | 328 | </div> |
329 | 329 | <?php |
330 | 330 | give_reports_graph(); |
331 | 331 | } |
332 | 332 | |
333 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
333 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | /** |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @since 1.0 |
353 | 353 | */ |
354 | - do_action( 'give_reports_tab_export_content_top' ); |
|
354 | + do_action('give_reports_tab_export_content_top'); |
|
355 | 355 | ?> |
356 | 356 | |
357 | 357 | <table class="widefat export-options-table give-table"> |
358 | 358 | <thead> |
359 | 359 | <tr> |
360 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
361 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
360 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
361 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
362 | 362 | </tr> |
363 | 363 | </thead> |
364 | 364 | <tbody> |
@@ -370,42 +370,42 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @since 1.0 |
372 | 372 | */ |
373 | - do_action( 'give_reports_tab_export_table_top' ); |
|
373 | + do_action('give_reports_tab_export_table_top'); |
|
374 | 374 | ?> |
375 | 375 | <tr class="give-export-pdf-sales-earnings"> |
376 | 376 | <td scope="row" class="row-title"> |
377 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
377 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
378 | 378 | </h3> |
379 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
379 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
380 | 380 | </td> |
381 | 381 | <td> |
382 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
382 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
383 | 383 | </td> |
384 | 384 | </tr> |
385 | 385 | <tr class="alternate give-export-sales-earnings"> |
386 | 386 | <td scope="row" class="row-title"> |
387 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
388 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
387 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
388 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
389 | 389 | </td> |
390 | 390 | <td> |
391 | 391 | <form method="post"> |
392 | 392 | <?php |
393 | 393 | printf( |
394 | 394 | /* translators: 1: start date dropdown 2: end date dropdown */ |
395 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
396 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
397 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
395 | + esc_html__('%1$s to %2$s', 'give'), |
|
396 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
397 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
398 | 398 | ); |
399 | 399 | ?> |
400 | 400 | <input type="hidden" name="give-action" value="earnings_export"/> |
401 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
401 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
402 | 402 | </form> |
403 | 403 | </td> |
404 | 404 | </tr> |
405 | 405 | <tr class="give-export-payment-history"> |
406 | 406 | <td scope="row" class="row-title"> |
407 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
408 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
407 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
408 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
409 | 409 | </td> |
410 | 410 | <td> |
411 | 411 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -413,27 +413,27 @@ discard block |
||
413 | 413 | $args = array( |
414 | 414 | 'id' => 'give-payment-export-start', |
415 | 415 | 'name' => 'start', |
416 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
416 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
417 | 417 | ); |
418 | - echo Give()->html->date_field( $args ); ?> |
|
418 | + echo Give()->html->date_field($args); ?> |
|
419 | 419 | <?php |
420 | 420 | $args = array( |
421 | 421 | 'id' => 'give-payment-export-end', |
422 | 422 | 'name' => 'end', |
423 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
423 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
424 | 424 | ); |
425 | - echo Give()->html->date_field( $args ); ?> |
|
425 | + echo Give()->html->date_field($args); ?> |
|
426 | 426 | <select name="status"> |
427 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
427 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
428 | 428 | <?php |
429 | 429 | $statuses = give_get_payment_statuses(); |
430 | - foreach ( $statuses as $status => $label ) { |
|
431 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
430 | + foreach ($statuses as $status => $label) { |
|
431 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
432 | 432 | } |
433 | 433 | ?> |
434 | 434 | </select> |
435 | 435 | <?php |
436 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
436 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
437 | 437 | echo Give()->html->category_dropdown( |
438 | 438 | 'give_forms_categories[]', |
439 | 439 | 0, |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | 'multiple' => true, |
444 | 444 | 'selected' => array(), |
445 | 445 | 'show_option_all' => false, |
446 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
446 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
447 | 447 | ) |
448 | 448 | ); |
449 | 449 | } |
450 | 450 | |
451 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
451 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
452 | 452 | echo Give()->html->tags_dropdown( |
453 | 453 | 'give_forms_tags[]', |
454 | 454 | 0, |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | 'multiple' => true, |
459 | 459 | 'selected' => array(), |
460 | 460 | 'show_option_all' => false, |
461 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
461 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
462 | 462 | ) |
463 | 463 | ); |
464 | 464 | } |
465 | 465 | |
466 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
466 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
467 | 467 | ?> |
468 | 468 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
469 | 469 | <span> |
470 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
470 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
471 | 471 | <span class="spinner"></span> |
472 | 472 | </span> |
473 | 473 | </form> |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | </tr> |
476 | 476 | <tr class="alternate give-export-donors"> |
477 | 477 | <td scope="row" class="row-title"> |
478 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
479 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
478 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
479 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
480 | 480 | </td> |
481 | 481 | <td> |
482 | 482 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -487,46 +487,46 @@ discard block |
||
487 | 487 | 'id' => 'give_customer_export_form', |
488 | 488 | 'chosen' => true, |
489 | 489 | ); |
490 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
490 | + echo Give()->html->forms_dropdown($args); ?> |
|
491 | 491 | |
492 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
492 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
493 | 493 | |
494 | 494 | <div id="export-donor-options-wrap" class="give-clearfix"> |
495 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
495 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
496 | 496 | <ul id="give-export-option-ul"> |
497 | 497 | <li> |
498 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
498 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
499 | 499 | </label> |
500 | 500 | </li> |
501 | 501 | <li> |
502 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
502 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
503 | 503 | </label> |
504 | 504 | </li> |
505 | 505 | <li> |
506 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
506 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
507 | 507 | </label> |
508 | 508 | </li> |
509 | 509 | <li> |
510 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
510 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
511 | 511 | </label> |
512 | 512 | </li> |
513 | 513 | <li> |
514 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
514 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
515 | 515 | </label> |
516 | 516 | </li> |
517 | 517 | <li> |
518 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
518 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
519 | 519 | </label> |
520 | 520 | </li> |
521 | 521 | <li> |
522 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
522 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
523 | 523 | </label> |
524 | 524 | </li> |
525 | 525 | </ul> |
526 | 526 | </div> |
527 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
527 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
528 | 528 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
529 | - <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
|
529 | + <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/> |
|
530 | 530 | </form> |
531 | 531 | </td> |
532 | 532 | </tr> |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @since 1.0 |
540 | 540 | */ |
541 | - do_action( 'give_reports_tab_export_table_bottom' ); |
|
541 | + do_action('give_reports_tab_export_table_bottom'); |
|
542 | 542 | ?> |
543 | 543 | </tbody> |
544 | 544 | </table> |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @since 1.0 |
551 | 551 | */ |
552 | - do_action( 'give_reports_tab_export_content_bottom' ); |
|
552 | + do_action('give_reports_tab_export_content_bottom'); |
|
553 | 553 | ?> |
554 | 554 | |
555 | 555 | </div> |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | <?php |
561 | 561 | } |
562 | 562 | |
563 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
563 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
564 | 564 | |
565 | 565 | /** |
566 | 566 | * Renders the Reports page |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | */ |
571 | 571 | function give_reports_tab_logs() { |
572 | 572 | |
573 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
573 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
574 | 574 | |
575 | 575 | // Get current section. |
576 | 576 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @since 1.0 |
582 | 582 | */ |
583 | - do_action( "give_logs_view_{$current_section}" ); |
|
583 | + do_action("give_logs_view_{$current_section}"); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | */ |
592 | 592 | function give_estimated_monthly_stats() { |
593 | 593 | |
594 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
594 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
595 | 595 | |
596 | - if ( false === $estimated ) { |
|
596 | + if (false === $estimated) { |
|
597 | 597 | |
598 | 598 | $estimated = array( |
599 | 599 | 'earnings' => 0, |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | |
603 | 603 | $stats = new Give_Payment_Stats; |
604 | 604 | |
605 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
606 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
605 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
606 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
607 | 607 | |
608 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
609 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
610 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
611 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
608 | + $current_day = date('d', current_time('timestamp')); |
|
609 | + $current_month = date('n', current_time('timestamp')); |
|
610 | + $current_year = date('Y', current_time('timestamp')); |
|
611 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
612 | 612 | |
613 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
614 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
613 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
614 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
615 | 615 | |
616 | 616 | // Cache for one day |
617 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
617 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
618 | 618 | } |
619 | 619 | |
620 | - return maybe_unserialize( $estimated ); |
|
620 | + return maybe_unserialize($estimated); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | // Badge for welcome page |
109 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
109 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
110 | 110 | |
111 | 111 | ?> |
112 | 112 | <style type="text/css" media="screen"> |
@@ -186,20 +186,20 @@ discard block |
||
186 | 186 | * @return void |
187 | 187 | */ |
188 | 188 | public function tabs() { |
189 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
189 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
190 | 190 | ?> |
191 | 191 | <h2 class="nav-tab-wrapper"> |
192 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
193 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
192 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
193 | + <?php esc_html_e('About Give', 'give'); ?> |
|
194 | 194 | </a> |
195 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
196 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
195 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
196 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
197 | 197 | </a> |
198 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
199 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
198 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
199 | + <?php esc_html_e('Credits', 'give'); ?> |
|
200 | 200 | </a> |
201 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
202 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
201 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
202 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
203 | 203 | </a> |
204 | 204 | </h2> |
205 | 205 | <?php |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return void |
214 | 214 | */ |
215 | 215 | public function about_screen() { |
216 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
216 | + list($display_version) = explode('-', GIVE_VERSION); |
|
217 | 217 | ?> |
218 | 218 | <div class="wrap about-wrap"> |
219 | 219 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | <p class="about-text"><?php |
224 | 224 | printf( |
225 | 225 | /* translators: %s: https://givewp.com/documenation/ */ |
226 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
227 | - esc_url( 'https://givewp.com/documenation/' ) |
|
226 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
227 | + esc_url('https://givewp.com/documenation/') |
|
228 | 228 | ); |
229 | 229 | ?></p> |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | <div class="give-badge"><?php |
234 | 234 | printf( |
235 | 235 | /* translators: %s: Give version */ |
236 | - esc_html__( 'Version %s', 'give' ), |
|
236 | + esc_html__('Version %s', 'give'), |
|
237 | 237 | $display_version |
238 | 238 | ); |
239 | 239 | ?></div> |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | <div class="feature-section clearfix introduction"> |
244 | 244 | |
245 | 245 | <div class="video feature-section-item"> |
246 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
246 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
247 | 247 | </div> |
248 | 248 | |
249 | 249 | <div class="content feature-section-item last-feature"> |
250 | 250 | |
251 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
251 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
252 | 252 | |
253 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
253 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
254 | 254 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
255 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
255 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
256 | 256 | <span class="dashicons dashicons-external"></span> |
257 | 257 | </a> |
258 | 258 | |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | |
266 | 266 | <div class="content feature-section-item"> |
267 | 267 | |
268 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
268 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
269 | 269 | |
270 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
270 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
271 | 271 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary"> |
272 | - <?php esc_html_e( 'View Documentation', 'give' ); ?> |
|
272 | + <?php esc_html_e('View Documentation', 'give'); ?> |
|
273 | 273 | <span class="dashicons dashicons-external"></span> |
274 | 274 | </a> |
275 | 275 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | <div class="content feature-section-item last-feature"> |
279 | 279 | |
280 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
280 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
281 | 281 | |
282 | 282 | </div> |
283 | 283 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return void |
298 | 298 | */ |
299 | 299 | public function changelog_screen() { |
300 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
300 | + list($display_version) = explode('-', GIVE_VERSION); |
|
301 | 301 | ?> |
302 | 302 | <div class="wrap about-wrap"> |
303 | 303 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | <p class="about-text"><?php |
306 | 306 | printf( |
307 | 307 | /* translators: %s: Give version */ |
308 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
308 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
309 | 309 | $display_version |
310 | 310 | ); |
311 | 311 | ?></p> |
312 | 312 | <div class="give-badge"><?php |
313 | 313 | printf( |
314 | 314 | /* translators: %s: Give version */ |
315 | - esc_html__( 'Version %s', 'give' ), |
|
315 | + esc_html__('Version %s', 'give'), |
|
316 | 316 | $display_version |
317 | 317 | ); |
318 | 318 | ?></div> |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | <?php $this->tabs(); ?> |
321 | 321 | |
322 | 322 | <div class="changelog"> |
323 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
323 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
324 | 324 | |
325 | 325 | <div class="feature-section"> |
326 | 326 | <?php echo $this->parse_readme(); ?> |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="return-to-dashboard"> |
331 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
331 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
332 | 332 | 'post_type' => 'give_forms', |
333 | 333 | 'page' => 'give-settings' |
334 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
334 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
335 | 335 | </div> |
336 | 336 | </div> |
337 | 337 | <?php |
@@ -345,37 +345,37 @@ discard block |
||
345 | 345 | * @return void |
346 | 346 | */ |
347 | 347 | public function getting_started_screen() { |
348 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
348 | + list($display_version) = explode('-', GIVE_VERSION); |
|
349 | 349 | ?> |
350 | 350 | <div class="wrap about-wrap get-started"> |
351 | 351 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
352 | 352 | |
353 | 353 | <?php give_social_media_elements() ?> |
354 | 354 | |
355 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
355 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
356 | 356 | |
357 | 357 | <?php give_get_newsletter(); ?> |
358 | 358 | |
359 | 359 | <div class="give-badge"><?php |
360 | 360 | printf( |
361 | 361 | /* translators: %s: Give version */ |
362 | - esc_html__( 'Version %s', 'give' ), |
|
362 | + esc_html__('Version %s', 'give'), |
|
363 | 363 | $display_version |
364 | 364 | ); |
365 | 365 | ?></div> |
366 | 366 | |
367 | 367 | <?php $this->tabs(); ?> |
368 | 368 | |
369 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
369 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
370 | 370 | |
371 | 371 | <div class="feature-section clearfix"> |
372 | 372 | |
373 | 373 | <div class="content feature-section-item"> |
374 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
374 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
375 | 375 | |
376 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
376 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
377 | 377 | |
378 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
378 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
379 | 379 | </div> |
380 | 380 | |
381 | 381 | <div class="content feature-section-item last-feature"> |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | </div> |
393 | 393 | |
394 | 394 | <div class="content feature-section-item last-feature"> |
395 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
395 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
396 | 396 | |
397 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
397 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
398 | 398 | </div> |
399 | 399 | |
400 | 400 | </div> |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | <div class="feature-section clearfix"> |
404 | 404 | |
405 | 405 | <div class="content feature-section-item add-content"> |
406 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
406 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
407 | 407 | |
408 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
408 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
409 | 409 | |
410 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
410 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
411 | 411 | </div> |
412 | 412 | |
413 | 413 | <div class="content feature-section-item last-feature"> |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | </div> |
425 | 425 | |
426 | 426 | <div class="content feature-section-item last-feature"> |
427 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
427 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
428 | 428 | |
429 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
429 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
430 | 430 | </div> |
431 | 431 | |
432 | 432 | |
@@ -446,23 +446,23 @@ discard block |
||
446 | 446 | * @return void |
447 | 447 | */ |
448 | 448 | public function credits_screen() { |
449 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
449 | + list($display_version) = explode('-', GIVE_VERSION); |
|
450 | 450 | ?> |
451 | 451 | <div class="wrap about-wrap"> |
452 | 452 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
453 | 453 | |
454 | 454 | <?php give_social_media_elements() ?> |
455 | 455 | |
456 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
456 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
457 | 457 | |
458 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
458 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
459 | 459 | |
460 | 460 | <?php give_get_newsletter(); ?> |
461 | 461 | |
462 | 462 | <div class="give-badge"><?php |
463 | 463 | printf( |
464 | 464 | /* translators: %s: Give version */ |
465 | - esc_html__( 'Version %s', 'give' ), |
|
465 | + esc_html__('Version %s', 'give'), |
|
466 | 466 | $display_version |
467 | 467 | ); |
468 | 468 | ?></div> |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | <p class="about-description"><?php |
473 | 473 | printf( |
474 | 474 | /* translators: %s: https://github.com/WordImpress/give */ |
475 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
476 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
475 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
476 | + esc_url('https://github.com/WordImpress/give') |
|
477 | 477 | ); |
478 | 478 | ?></p> |
479 | 479 | |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | * @return string $readme HTML formatted readme file |
491 | 491 | */ |
492 | 492 | public function parse_readme() { |
493 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
493 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
494 | 494 | |
495 | - if ( ! $file ) { |
|
496 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
495 | + if ( ! $file) { |
|
496 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
497 | 497 | } else { |
498 | - $readme = file_get_contents( $file ); |
|
499 | - $readme = nl2br( esc_html( $readme ) ); |
|
500 | - $readme = explode( '== Changelog ==', $readme ); |
|
501 | - $readme = end( $readme ); |
|
502 | - |
|
503 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
504 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
505 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
506 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
507 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
498 | + $readme = file_get_contents($file); |
|
499 | + $readme = nl2br(esc_html($readme)); |
|
500 | + $readme = explode('== Changelog ==', $readme); |
|
501 | + $readme = end($readme); |
|
502 | + |
|
503 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
504 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
505 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
506 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
507 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | return $readme; |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | public function contributors() { |
522 | 522 | $contributors = $this->get_contributors(); |
523 | 523 | |
524 | - if ( empty( $contributors ) ) { |
|
524 | + if (empty($contributors)) { |
|
525 | 525 | return ''; |
526 | 526 | } |
527 | 527 | |
528 | 528 | $contributor_list = '<ul class="wp-people-group">'; |
529 | 529 | |
530 | - foreach ( $contributors as $contributor ) { |
|
530 | + foreach ($contributors as $contributor) { |
|
531 | 531 | $contributor_list .= '<li class="wp-person">'; |
532 | 532 | $contributor_list .= sprintf( |
533 | 533 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
534 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
535 | - esc_url( $contributor->avatar_url ), |
|
536 | - esc_attr( $contributor->login ) |
|
534 | + esc_url('https://github.com/'.$contributor->login), |
|
535 | + esc_url($contributor->avatar_url), |
|
536 | + esc_attr($contributor->login) |
|
537 | 537 | ); |
538 | 538 | $contributor_list .= sprintf( |
539 | 539 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
540 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
541 | - esc_html( $contributor->login ) |
|
540 | + esc_url('https://github.com/'.$contributor->login), |
|
541 | + esc_html($contributor->login) |
|
542 | 542 | ); |
543 | 543 | $contributor_list .= '</li>'; |
544 | 544 | } |
@@ -556,25 +556,25 @@ discard block |
||
556 | 556 | * @return array $contributors List of contributors |
557 | 557 | */ |
558 | 558 | public function get_contributors() { |
559 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
559 | + $contributors = Give_Cache::get('give_contributors', true); |
|
560 | 560 | |
561 | - if ( false !== $contributors ) { |
|
561 | + if (false !== $contributors) { |
|
562 | 562 | return $contributors; |
563 | 563 | } |
564 | 564 | |
565 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
565 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
566 | 566 | |
567 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
567 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
568 | 568 | return array(); |
569 | 569 | } |
570 | 570 | |
571 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
571 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
572 | 572 | |
573 | - if ( ! is_array( $contributors ) ) { |
|
573 | + if ( ! is_array($contributors)) { |
|
574 | 574 | return array(); |
575 | 575 | } |
576 | 576 | |
577 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
577 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
578 | 578 | |
579 | 579 | return $contributors; |
580 | 580 | } |
@@ -592,24 +592,24 @@ discard block |
||
592 | 592 | $give_options = give_get_settings(); |
593 | 593 | |
594 | 594 | // Bail if no activation redirect |
595 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) { |
|
595 | + if ( ! Give_Cache::get('_give_activation_redirect', true)) { |
|
596 | 596 | return; |
597 | 597 | } |
598 | 598 | |
599 | 599 | // Delete the redirect transient |
600 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
600 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
601 | 601 | |
602 | 602 | // Bail if activating from network, or bulk |
603 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
603 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
604 | 604 | return; |
605 | 605 | } |
606 | 606 | |
607 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
607 | + $upgrade = get_option('give_version_upgraded_from'); |
|
608 | 608 | |
609 | - if ( ! $upgrade ) { // First time install |
|
610 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
609 | + if ( ! $upgrade) { // First time install |
|
610 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
611 | 611 | exit; |
612 | - } elseif( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
612 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
613 | 613 | |
614 | 614 | } else { // Welcome is NOT disabled in settings |
615 | 615 | wp_safe_redirect(admin_url('index.php?page=give-about')); |